CHANNEL_NAME
stringclasses
2 values
URL
stringlengths
43
43
TITLE
stringlengths
18
100
DESCRIPTION
stringlengths
621
5k
TRANSCRIPTION
stringlengths
958
84.8k
SEGMENTS
stringlengths
1.51k
143k
Yannic Kilchner
https://www.youtube.com/watch?v=hv3UO3G0Ofo
Axial-DeepLab: Stand-Alone Axial-Attention for Panoptic Segmentation (Paper Explained)
#ai #machinelearning #attention Convolutional Neural Networks have dominated image processing for the last decade, but transformers are quickly replacing traditional models. This paper proposes a fully attentional model for images by combining learned Positional Embeddings with Axial Attention. This new model can compete with CNNs on image classification and achieve state-of-the-art in various image segmentation tasks. OUTLINE: 0:00 - Intro & Overview 4:10 - This Paper's Contributions 6:20 - From Convolution to Self-Attention for Images 16:30 - Learned Positional Embeddings 24:20 - Propagating Positional Embeddings through Layers 27:00 - Traditional vs Position-Augmented Attention 31:10 - Axial Attention 44:25 - Replacing Convolutions in ResNet 46:10 - Experimental Results & Examples Paper: https://arxiv.org/abs/2003.07853 Code: https://github.com/csrhddlam/axial-deeplab My Video on BigBird: https://youtu.be/WVPE62Gk3EM My Video on ResNet: https://youtu.be/GWt6Fu05voI My Video on Attention: https://youtu.be/iDulhoQ2pro Abstract: Convolution exploits locality for efficiency at a cost of missing long range context. Self-attention has been adopted to augment CNNs with non-local interactions. Recent works prove it possible to stack self-attention layers to obtain a fully attentional network by restricting the attention to a local region. In this paper, we attempt to remove this constraint by factorizing 2D self-attention into two 1D self-attentions. This reduces computation complexity and allows performing attention within a larger or even global region. In companion, we also propose a position-sensitive self-attention design. Combining both yields our position-sensitive axial-attention layer, a novel building block that one could stack to form axial-attention models for image classification and dense prediction. We demonstrate the effectiveness of our model on four large-scale datasets. In particular, our model outperforms all existing stand-alone self-attention models on ImageNet. Our Axial-DeepLab improves 2.8% PQ over bottom-up state-of-the-art on COCO test-dev. This previous state-of-the-art is attained by our small variant that is 3.8x parameter-efficient and 27x computation-efficient. Axial-DeepLab also achieves state-of-the-art results on Mapillary Vistas and Cityscapes. Authors: Huiyu Wang, Yukun Zhu, Bradley Green, Hartwig Adam, Alan Yuille, Liang-Chieh Chen Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Transformers are quickly coming for your favorite models. Yesterday, they replaced LSTM in NLP. It used to be good at NLP, but we now have transformers. Think again. Today, we're going to see that maybe in the near future, transformers will replace convolutions in image processing. So this paper is a step in toward towards this direction, you just wonder what is it going to be tomorrow? Maybe linear regression is going to be replaced just by giant transformers trained on 5000 TPUs? Who knows? We'll see. In any case, we're looking at axial deep lab standalone axial attention for pan optic segmentation by Huiyue Wang, Yukun Chu, Bradley Green, Hartwig Adam, Alan Yuel and Liangjie Chen of Johns Hopkins University and Google Research. So this paper combines a bunch of techniques that have been introduced recently to deal with attention in problems where you would traditionally use a convolution. So in this particular case, they deal with this problem of pan optic segmentation, which basically, you'll see, you'll get an image, and there's a bunch of stuff on the image, like a cat here, and a house right here. And you're supposed to color the pixels of the same object the same. So you see all these pixels here are house, and then all these pixels, these pixels right here are cat, and so on. And then there's also the background. So all these pixels right here, I know beautiful, beautiful, beautiful, our background. So for this problem, it's kind of important that you're very precise, first of all, so you can look at, you know, pixels or clusters of pixels, and also that you take long range dependencies into account. Because if you, for example, recognize that this is a house, and you recognize that here's a wall right here, you might be able to much better classify what is wall over here and what isn't. Okay, so the kind of long range dependencies play a role in these problems across images. And usually attention mechanisms are pretty good for these long range dependencies. But they're also expensive. And that's what this paper deals with. So they use this axial attention that has been introduced for exactly resolving this problem in types of data like images or higher order tensors. And they also combine this together with learned positional encodings, which we've also seen time and time again, throughout the kind of transformer and attention literature. So the combination of axial attention, these learn positional embeddings, allows them to replace the ResNet backbone that usually is found in panoptic segmentation models with the with a standalone attention. So they build models that are partial replace the convolutions with attention modules, or replace them entirely. So the entire model is going to be just an attention model, so no more convolutions in it. And they perform pretty well in classic tasks like they test on ImageNet classification, they perform pretty well. And they achieve state of the art on some of these segmentation tasks. So we'll go through the model right here. This is a very, very extensive paper in terms of experimental evaluation. What I want to get into is mainly how the method works and show you what their model looks like. So we'll go through it. And as always, let me know what you think in the comments. And tell me if you liked it or not. Share it out if you did. Alright, so let's go right. So they go over a very long list of prior work, which is, you know, pretty, pretty cool. And here they say their contributions. So their contributions are four fold. First of all, the proposed method is the first attempt to build standalone attention models with larger, large or a global receptive field. And we'll see what that means. We propose position sensitive attention layer that makes better use of positional information without adding much computational cost. We show that axial attention works well not only as a standalone model on image classification, but also as a backbone on pan optic segmentation, instance segmentation and semantic segmentation. Maybe what I did before described before was instance or semantic segmentation and not pan optic segmentation. Excuse me if that's the case. As you can see, it can be used for various various image tasks. Lastly, our axial deep lab improved significantly over bottom up state of the art on cocoa achieving comparable performance of two stage methods. We also surpassed previous state of the art methods on mapillary vistas and city scapes. So these are various tasks, as I said, and also what they don't mention here is that they perform fairly well on image net. In fact, in the abstract, they formulate this as in particular, our model outperforms all existing standalone self attention models on image net like that's, you know, that's a way to phrase it. You just exclude all of the other models until you're the best outperforms all existing standalone self attention models on image net. Yeah, I mean, that's good. I mean, there's something to be said of comparing apples to apples. But you can also you can also go overboard if you want to make your work look as good as possible. Of course, you know, everyone, everyone does that. And there's no particular shame in it. Okay, so if we're going to build up our model right here, and the basic element of this model is going to be this self attention mechanism. Now, quickly, because I know you all know what it is, but very quickly, you want to perform this action right here, over a region right here. So there is always a query. And now the subscripts here are going to be important in this paper. Okay, so the query is at a given position, position O, and you can see that's the O right here. That's the I'm going to call it the output, I guess that's what they said as well. So the output position, you want to go over all of the input positions, and you want to and you want to aggregate data from all of the input positions. So that's right here. And how do you aggregate data by this softmax operator right here, you can see the key also has a P right here, and the softmax is over the axis of P. So in particular case of the images, what does that mean? If you have an image right here, it's made into pixels, okay, so you have pixels. Now a transformer or gen in generally these attention models, what you can imagine is they always transform a data point into a data point of the same dimensions. Now this doesn't have to be actually, and I think one of the developments that is going to come in coming years or months or weeks, maybe someone's already doing it is in fact, to play more with this with this arbitrary constraint that we're imposing on ourselves, because it's not really clear that this is the best thing. But for now, an attention layer is always transforming a data point here a four by four image into a data point of the same size, also a four by four image right here. Now this is as I said, this is quite simplified. But it is true in NLP, where we always transform our whatever 512 sequence, a token sequence into a 512 token sequence, and it is true here. Now the output is going to be here on the right. And the question always is, okay, so I'll go over these, these, these pixels right here. And for every pixel, let's say for this pixel, I'm going to ask what data goes there, what's the output of the layer at that particular pixel. And the output of the layer is going to be somehow dependent on on the input right here. Now, if you know classic convolutional models, what the classic convolutional model says, the output of this is going to be dependent on this region right here, if it's like a three by three filter, okay, so you have this convolutional filter. And that means that blue dot on the right is going to pay attention to, you know, its own location in the input, plus everything around it, okay. And then every single data point here is going to do that. So for example, the screen data point is going to pay attention to this region right here. Now there's a border. So there's maybe some padding. But the question is always where does the information come from? And how is it aggregated? Okay, in a convolution layer, what happens in a convolution layer, in a convolution layer, you simply have your filter, right, you have your filter, and the filter has numbers in it, like three, and five, and eight, and so on. And what you're going to do is you're going to take this region right here, this blue region of the lower layer. And that's maybe that's also, you know, filled with numbers like seven, what's a good number? Zero, zero is a perfect, nice number. And you're going to multiply those. And then you're going to sum them up. And then you're going to put that on where the blue dot is, okay. So where does the information come from in the convolution from around the location from around the output location, but in the input, okay, so you go to the input at the same location as where you want the output to be, you take the neighborhood, and there is a fixed a fixed scheme of aggregating the neighborhood, okay, and then you sum, you multiply and you sum across it. In contrast to this, in a fully attentional model, where does the information come from? Let's again look at the blue dot and let's consider it fully attentional. Okay, where does the information come from? Everywhere, anywhere, anywhere at all, okay, the information comes from everywhere. Now, how do I know how to aggregate the information? So it's no longer in a neighborhood, how do I know how to aggregate the information? That's also different. So two things are different. Now, in a convolution, I would have another four by four grid here that's pre specified. But in the attention model, this here is basically all filled with question marks, question mark, question mark, where, what number goes here? How do I in the end, I also do this multiply, and I sum it up, and I put it right here. Okay. But how do these numbers come to be? Well, these numbers also come, these are dynamically computed also from from the input. It's a bit special. But this is how attention works. Okay. So every pixel gets to decide where information comes from, and how it is aggregated. It's basically it comes from anywhere. And how it is aggregated is dynamic depending on the pixel. If you don't still don't understand it, maybe pay out to watch a video on attention itself, I happen to have made one. But you can watch any one when you understand that you will understand the the extension here to the image is the exact same thing as with the sequence except the pixels are basically one long sequence in the image. Okay, so these would be a fully attentional model down here. Now, what's the problem here? The problem is that pictures are pretty large. So even even something like MNIST, which is like 28 by 28 is like 700 pixels plus I don't remember exactly, but it's like about 700 pixels. And our big transformers now so BERT, a very famous transformer takes inputs that are like 512 in length, and you already need pretty decent hardware to run this. And the requirements on memory and compute scale quadratically with the input length. So already with MNIST, you're in pretty pretty shady territory. If you go up to something like ImageNet, which is like 225 by 225, you're that's bad, right? That's not good. So you have to come up with something else. So people have been playing around. The reason why I introduced it this way is people have been playing around a bit with sort of coming up with an intermediate with a compromise between the two. So the compromise that this paper here focuses on is going to be is going to be a compromise where we you remember when I said, where does the information for a given pixel come from? And we said, okay, it can come from anywhere in the attention framework. And that's good, because that allows us to make super simple work. And that's good, because that allows us to make super long range connections. So any pixel can aggregate information from any other pixel, and not even in a fixed way, but in a dynamic way. So depending on the pixel value itself, and the other values, it can decide how it wants to aggregate information. That turns out to be expensive, right? Every pixel together with every pixel. Well, that's quadratic. Okay, so what do we do? We make a third method that's going to be a compromise. And the compromise is going to be the following. The compromise is going to be all right, we still do the dynamic aggregation, which means that we still do the attention thing. However, however, we're going to restrict back to this neighborhood region of the convolution. So in this model, where does information for the blue dot come from, it again comes from this neighborhood right here. And this number, the size here is going to be called m. So it still comes from that m by m neighborhood. So a pixel can only aggregate information from its neighbors, but contrary to a convolution, how it aggregates the information like this working convolution would be a kernel, the kernel is made dynamically by the attention module. And it's made dynamically on a case by case basis. Okay, so we restrict it to a neighborhood, multiply, sum it up, and then put it into the output. And we do that for every pixel now it resembles much more a convolution, simply a convolution with this dynamic with this dynamic matrix right here. And that's the starting point for this paper. So this paper does two things to this. It says, okay, we can augment this by so called positional embeddings, a positional embedding you might know from the sequence transformers. So if I have a sequence, my cat is tall, don't even know what that means for a cat. But okay, what in a positional encoding, so if you use a transformer, and you transform this, as we said, into a sequence of equal length, and then transformers basically information routing, the transformer simply sees the lower layer sequence as a set, not as a sequence, it has no notion of what's neighboring to what, what comes from where. So it pays to tell the transformer, by the way, this is word one, this is word two, this is word three, this is word four, there are various ways to do it. Transformers usually have fairly complicated kind of sine wave based positional encodings that bring many advantages with them. In this case, they say, well, it might pay, pay off to learn where actually these things are in this neighborhood. So they experiment with relative positional encoding, which means that they annotate this neighborhood with something like, look, here in the middle, it's a zero, zero, here is like zero, one, here, it's zero, negative one, negative one, zero, and so on. So they annotate it with these positional encodings. Now, this is this would be the easy way, what they actually do is they simply they give the model a matrix like this, and they learn that matrix by heart, let's say. So the positional encodings are relative positional encodings, and they are learned, okay, so you can do that you can learn positional encodings. So if you don't want to do the 1234, right here, you simply say, well, here's a vector, here's a vector, here's a vector, and here's also a vector. Now, model, you're already learning like all the weights to make this thing here happen. And you're already learning your output weights up here, right using backpropagation, why don't you learn yourself what you would like for position one, like what kind of information you would like to be to have there using backpropagation, right? So the model, you provide them up, you always provide the same vector. So this is the same vector for position one, and you have a different vector for position two, and you have a different vector for position three, right? So, but across all of the data points, these vectors are going to be the same. So the vector one is always going to be that same vector for all of the data points. So the model somehow must learn independent of the data point, what it means to be in position one. So the model must learn how it wants to fill that vector. That's called a learned positional embeddings. We've seen this in many models so far, it usually works pretty well. And I guess here is works especially well if you have these relative positional encodings. And so this thing here is not going to be an actual matrix filled with these numbers, it's going to be a learned matrix, a trainable matrix that is filled, that the network is allowed to fill with numbers, right? Like, three, five, eight, and you might be, you might notice that we've seen this before, right? So ultimately, the information in this blue thing right here is going to depend on this dynamically created aggregating of information through the neighborhood, and this statically learned aggregation of information throughout the neighborhood, which is a con which is sort of a convolution, right? Because in the convolution, you've already seen here, this is a statically learned map of how to aggregate information from the neighborhood of a pixel. So I think even though there are slight differences, they, for example, say this, these are the same across attention heads and so on. However, I suspect that you can think of these learned positional embeddings to be kind of like what you learn in a convolution, not exactly. So no, I think I made a mistake, and we'll see it in the formula. We'll see it in the formula. Yeah. Okay, so here they introduce these positional embeddings. Okay, so you see that we previously we had the softmax, previously we had this and this, okay? So this is the lower layer, this is the information that comes into the layer, and now it's transformed into values by a linear matrix. But essentially, this is the lower layer. And for each of the output locations, you want to know how should I aggregate information from that lower layer. And you do this by this thing here, this thing here is this dynamically constructed attention matrix using also the softmax. Okay, so how should you aggregate information? This comes from this query at the output position and the keys at the input position. And now you add to that this method, this thing right here, which is again an inner product between the career query and the positional encodings. Okay, so the positional encodings are going to be learned and hard coded, but they still are modified by the queries. So the query can still pay attention the difference is the keys depend on the input, while the positional encoding does not depend on the input. So the queries can decide I want to gather information from this and this and this type of information. So that would be the key, or it can decide, I would like very much to look at pixels that are somehow on the bottom right of the pixel that I am now that would be the positional encodings. And that's the mistake I made when I said it's equivalent to a convolution, it is not because the query can still, it's still modulated by that query vector of how to aggregate information. Otherwise, you would have this to be a standalone multiplied by the input right here. But it sort of pays off to think of it like what you do in the convolution. So in the convolution, you learn how to aggregate information basically based on position, relative position to the position that you want to output. And here you do a similar thing, you learn static position embeddings that you then can attend to with your queries. Alright, so these are the position embeddings. And they make use of those position embeddings. In fact, they attend them to the following. In this work, we enable the output to retrieve relative positions beside the content based on query key affinities formally. So the problem up here is that okay, you have these position embeddings. And here are the outputs. But if you do this in multiple layers, right, you have a lot of sequence. But if you do this in multiple layers, right, if you do, let's let's go with one D sequences. If you do this in multiple layers, and here you annotate the position, let's just go 1234. And okay, this layer can make use of that, right, we gather stuff from here. But then when this layer, when this layer gathers information from here, the where the information comes from in the layer below is some is how somehow getting lost, right. So it cannot kind of pull through this information to here, or at least it's very complicated. This model extends this positional embeddings in order to pull through that information. So as you can see, there are two new things right here. The biggest important new thing is that right here, we don't. So here is how we aggregate information, okay. And here is the information that we aggregate over. Now you can see previously, this was just this value vector. And now it is extended to the position to positional embeddings, learned positional embeddings. Okay, so the this, with this, you're able to route the positional embeddings to the output. And also, here you can see the attention gets fairly complex. So you have query key attention, which is classic attention, the queries can attend to positional encodings, but also the keys can attend to positional encodings. So not only can not only can the the node on top say I would like to attend to position three position three can also say, well, together with me, positions two and four are fairly important. I guess that's what that's what that is. Maybe I'm mistaken here. But you can see right here, there is an interaction between the keys and the positional encoding right here. Now these positional encodings, they are different for the queries, keys and values, but ultimately, we don't, it doesn't make too much of a difference. So here is a contrast between what a traditional attention layer would do and what they would do. So a traditional attention layer gets the input x and transforms it by means of these linear transformations right here into the queries. These are the queries, let's call them q into the keys and into the values. Okay, then it does a matrix multiplication with the keys and the queries, and puts that through a softmax. So this here is going to be our attention matrix. This is the attention matrix. And the attention matrix is multiplied here by the values, and that determines our output. Okay, again, the attention matrix defines how we aggregate information, and the values is what information do we aggregate, you know, for the output. In contrast, when we introduce these positional encodings, you can see right here, again, we have query, key and value. Now, it gets a little bit more, more, more complex right here. Namely, we do this query key multiplication right here, but we also multiply the query by these positional embeddings for q, we also multiply the keys by the positional embeddings for K, and all of this together. So this is a big plus right here, all of this together is routed through the softmax. Okay, and now the diagram is a little bit complicated. Now you can see the softmax aggregates information from here. And from this learn positional embeddings, I would rather have they would just use it like they did in the formula, do V plus R, and say, that's going to be the information that we are aggregating. And the softmax here, the output of the softmax is going to be how we aggregate information. This is the attention. Alright, I hope that's sort of clear, you introduce these positional embeddings for queries, keys and values. And that allows the model to have a sense of where the information is coming from basically what positions which if you drop the convolutions, so the convolution had this intrinsically, because in your convolutional kernel, right? Can I, I'm dumb. If in your convolutional kernel, the number right here, if there was a seven right here, that meant that wherever you are, whatever is on the bottom right is seven important. Okay, so that's that was the the convolution have this intrinsically. Here, if you just do attention, that we as humans, we see it in a in this kind of grid form. But the machine doesn't the machine simply sees a set of pixels, it simply sees, you can this is to the attention mechanism, this is exactly the same as a long list of pixels or a discontinued set, it doesn't matter to the machine. So it's like the problems of feed forward network has, so we need to annotate it, we have to give it positional information. And learn positional information seems to work very well right here, though you could think of static positional information. Okay, this is the first thing the positional embeddings that now help the attention mechanism see where the information is coming from, that's really important in pictures. So we add that. The second thing they do is the so called axial attention. Now, axial attention is sort of a, let's say a trick in order to reduce the load on a the load on an attention mechanism. So what does it mean? We've already we've already seen in sequences, right? If I have a sequence, a sequence layer, that's going to be n squared connections between the two. Now, there are various ways to restrict that. So instead of having all of these connections, let's say from one node, we've already seen wait, if we just restrict it to, let's say only this thing right here, only this stuff, that can be that is lower, right? That is lower in complexity. And this, in this case, it would be just a neighborhood. So that's what we've done. That's this this m thing right here. However, we can also do it in different ways. Since this is a set anyway, we can simply say, maybe we should just always skip one, we could like do attention like this. And that will be just fine, too, right? That would also leave away some of the information, but you gain in computational efficiency. There are various trade offs. Now in a picture, you have the same options, right? So you can do the neighborhood thing as we did. Or you can say, where should the green pixel pay attention to? Axial attention says the green pixel should pay attention to only the row where it is in. Okay, that's it should ignore the rest of the input, it should only pay attention to that row where it is in. And then in the next layer, we'll flip it, then the green pixel, the same green pixel will pay attention to only the column it is in. Okay, so that's, that's called axial attention. But don't think like don't don't. There is nothing special about this being an axis or whatnot, you could also define an it would not be called axial attention, but you could define it makes the same sense to say, well, that green pixel just depends on this diagonal right here, just in the in this layer, it just does this diagonal. And then in the next layer, it does like the anti diagonal. You can say, I just choose five random pixels in this layer and five random pixels in the next layer. And that would work as well. We've already seen this in this paper called Big Bird, right? The big, big, big bird, but Big Bird. So Big Bird explicitly used random connections in the attention mechanism. And their argument was, well, if we use different random connections in each layer, then information can travel pretty fast through the network. So what's the problem with these neighborhoods right here? What's the problem with neighborhood attention like this, the problem is that you break the long range dependencies. So let's see what happens if information needs to go from this pixel to this pixel or this node to this node. But if information needs to travel from this node to this node in a classic attention mechanism, everything's connected to everything. So that node in the next layer can simply aggregate information from here. Well, that's not possible. If you do this kind of neighborhood attention, as we've done here, if I do neighborhood attention, then at most, right, because the neighborhood is three long, at most, this node right here can aggregate information from this node. And then again, it's three long in the next step. So now this node is three long, this node can aggregate information from this node. Okay, because the in the neighborhood is three long, and you can only attend to within your neighborhood. This means that if I want to send information to something that's really far away, I need to I need to go many, many layers, right, I need to go layer, layer, layer, layer. And this has been well known, this has already been a like a problem. This has already been a property of convolutional neural networks. So convolutions specifically traded off the fully connectedness of fully connected layers to local connections, convolutions. But that means that you have to go very deep in order to make long range connections, you can't just make them in one step. The same problem right here. Now this paper Big Bird argued that if you have random connections instead of neighborhood connections, just the property of random graphs mean that you, you are pretty fast in sending information around. So because in a random graph of size n, you on average, all two nodes are connected by path lengths of log n. This is much faster, because in this neighborhood thing, two nodes are connected in a path length of order of n, right, you can, you can pretty easily see that if I make the sequence longer, I need that many more steps in order to send it around. In fact, it's like something like n divided by m, this neighborhood size. In a random graph, it's log n and in this axial attention, that's why I introduced it, it's two, okay, every, every two nodes are connected by two steps. If, if node if this node, right here needs to send information to this node right here, in a classic attention mechanism, we could do some one step because every pixel attends to every other pixel. However, right now, we have to, we have to see, so this node attends in this layer, sorry, I have to think, so how do we send information between the two, we select this node right here, in the first layer, this node pays attention to this row, okay, which includes the red dot. So the red dot can send information to the x in this layer. In the next layer, we select this node right here, which is our target node where the information should go to, it pays attention to all of this column, which includes that x that before, right, this, this x right here, where we send information to. So it takes two layers, two steps to send information from any node to any other node. That's pretty good. So this axial attention, if you stack them on top of each other, you sacrifice a little bit of being able to send information from anywhere to anywhere. For the pleasure of not having this quadratic attention anymore, as you can see, your attention mechanism is now as long or as big as your column or is wide or your row is high. Again, this isn't, this isn't specific to rows or columns, you could do this, as I said, with these kind of diagonals, you could do it with any other sort of sub pattern, where you can sort of guarantee that the overlap between the layers is enough so you can send information around pretty efficiently. And they use this right here. So this axial attention, you can see the formula is exactly the same. The only change from before is this part right here, you can see that the neighborhood that they aggregate over is no longer m by m, it is now one by m. So we've seen them going from if this is the the full input image, and you want to see where to attend, what this paper does is it says a classic, sorry, a convolutional neural network would be attending to some sub part, right? This is convolution, an attention mechanism, pure attention would attend to everything, right? This is attention. Then what we are doing, sorry, that was a mistake. What other people were doing, were reverting back this attention to a sub part, this kind of neighborhood attention, okay? But that was still, you know, you still have m squared, you still have O of m squared because of the attention mechanism. Now what we are doing is we are going even lower, we're actually going one by m. Okay, this is with axial attention. So in general, it's one by m. And then in the next layer, we can go one by m in this direction and have that property. And because it's so cheap now, right, because it's now O of m to compute this, we might as well make m as long as the row itself. Okay, so their last step is going to be to say, okay, we have one by m right here, and that's going to be the row itself. Now, you can see right here that they say, axial attention reduces the complexity to hwm. This enables global receptive field, which is achieved by setting the span m directly to the whole input features. Optionally, one could also use a fixed m value in order to reduce memory footprint on huge feature maps, which is something that they're going to do later on ImageNet, I believe. So when they have big inputs or big outputs, they actually do use a smaller m. What you can see right here is that the m value is now O of m. What you can see right here is that I wasn't really, that wasn't really correct of me to say that it's now O of m, because you still have the entire query space. So you multiply query by keys. Now, even if you make the keys to be one by m, yes, you reduce, definitely, height times width to times height times width to this, but then you can see this thing right here. If you take it, and let's say we have this kind of row pattern, and we replace m by the width, then we have width squared. So again, the square appears. However, it's smaller than the original attention, the original attention was h squared, w squared, right, because hw is the image, and you need that squared in order to do the attention mechanism. Now we've basically reduced one of the factors, it is still an attention mechanism. So there's still attention going. But we've basically transformed the image, we've reduced it to one column. Now the one column is still attention. So this is still attention like here. So this now reduces to the attention that you see in a in a single sequence. Okay, if you see the image as a long stretch of pixels, what this does is basically it's up, it simply subdivides that into neighborhoods. So we're back to neighborhoods, basically. But we shift the neighborhoods from layer to layer. So in the next layer, the neighborhoods are going to be just alternating, right, the neighborhoods is going to be this is one neighborhood connected to this neighborhood connected to this neighborhood, I hope this makes sense. So it's going to be, it's basically a mix between if you if you if you were to do this in convolution, you could do one layer where it's neighborhood convolution, and then one layer where it's like convolution with holes in it, I think they're called atris convolutions or something like this with like giant holes in it, that are exact is exactly the anti pattern of the neighborhood convolution from before. That's what this is. So you see their axial attention block right here, their axial attention block replaces the resnet block. So if you know resnet, I've done a paper on resnet, resnet basically takes the input, pipes it through straight and adds to it whatever comes out of this operation. Okay, that's a residual block. Now, usually this thing here would be convolutions and convolutions. And they are now replaced by these multi head axial attention, you can see there is a multi head attention in the height, and there is a multi head attention in the width. And that gives us the property that every node can send around information to every other node in two steps. I don't like the fact that there's only two because what this I guess this gives a significant bias to one or the other direction, depending on the order that you do them in. If, if I had done this, I maybe would have used three of them. Because it depends on how you want to aggregate information, right? Like here, you train the network specifically to aggregate information first in this direction, and then in this direction, which might work, and it will give you that sending around information anywhere. So maybe they've actually tried and it just performed the same. So I just might have a dumb suggestion right here. In any case, they simply replace in we've come a long way, right? We've gone to like neighborhoods and blah, blah, blah, blah, blah. Ultimately, take a resonant place the convolutions with the height axis attention and the width axis attention, and we're good. And then we come to results. So that's it, you have these positional embeddings, you have the axial attention. And it turns out that on ImageNet, they perform fairly, fairly well. So you can see that models, like the resonant 50 model will get a 76.9 on ImageNet, which is not state of the art, but it's also not it's not bad, right? The resonant 50 is pretty good model. You can see the full axial attention right here, achieves a 78.1 also not state of the art, but still pretty good. And as they say, it's the best fully attentional model on ImageNet or standalone attention model on ImageNet. So where this model really shines is where you really have to make long range connections between pixels. And that's these kind of segmentation tasks. And I want to skip the tables right here, they're best at everything, and go to the appendix where they have some examples of this. So here you can see specifically, this is the original image, you have a ground truth, and you have the differences between their model, this axial deep lab and the panoptic deep lab. That is a baseline for them. And you can see that the failure cases here are pretty, you know, show how the axial deep lab is better. I don't know if they are cherry picked or not, but at least you can see that at some point, so it handles occlusions better, it handles instances better. So here you see that the ground truth separates the person from the tie, and the axial attention is able to do this. But the the baseline is not able to do this correctly, because it labels part of that white shirt also as and you can see why there's kind of a delimiter line here, here, here, here. But if you have long range dependencies, right, if you have long range dependencies, if you have long range dependencies in the model, the model will recognize wait, wait, that's that must be the same thing as this thing here, and this thing here and this thing here. So that must be the same object. It's simply that the shirt was occluded by the tie, and goes beneath it and now appears again, it's not a different, it's not part of the tie. And it's not part of the of a different object, exactly part of the shirt. So the long range attention you can see at these examples, sometimes here, okay, this might not be an instance of super duper long range dependencies. This is simply where the model performs better. So you can see here, the ground truth has that surfboard segmented, and the baseline does not. That this can also just be, you know, there are a lot of tricks to make this work, of course, and you throw a lot of compute at it. And sometimes you just get better numbers or part of the better numbers because of the additional compute. Right here, what do we have? So you can see occlusions, it appears to handle occlusions in a better way. And this might be due to this axial attention, and this might be due to this axial attention, it might be due to the positional embeddings. But you can see that the ground truth here has the laptop between the person's hands segmented. The baseline cannot do that. But the axial attention does do that. And I don't know what this is, honestly, this is you can you can see though, the axial attention also misses the fact that it should segment this in the background. And if this occlusion handling, you can see best in this example, where the person in the back reappears on both sides of that person. So you can see that the axial attention manages to segment that where that is just a mutant person right here, the ground truth is equally shaky, I think there is might be some ambiguity of how you can segment these images, obviously. But you can see the fact that there are long range dependencies probably helped with this, saying that, wait, in this image, there's this white stuff right here, and there's this white stuff right here. And connecting these two regions with attention probably helped in segmenting these to be the same object, even though you can see there is a break in the object. So there is a break no at no point is the object on the left, touching or the segment on the left touching the segment on the right, and still the model manages to put those into the same label category. There is the last last thing where they want to research what their heads learn. And usually you can do this, right, you can kind of visualize what the attention heads learn. So in this case, right here, in the column heads, the way you have to read this is that this particular head right here aggregates information from its column. So everywhere where it lights up, there's a lot of information being routed. You can see specifically in this here, the heads of the people or the heads of the persons in the picture light up fairly well. So for example, this head right here is probably aggregating information a lot from this position right here. And this head here is aggregating information from this position. So you can deduce that that particular attention head probably deals with people's faces. Whereas that particular attention head probably deals, you can see the attention is mostly on the grass right here. And you can see the same with the for the row heads. Now, their description here is that we noticed that column head one corresponds to human heads while column head four course correlates with the field only, which you know, you can interpret it as this, this seemed pretty clear. But then they say something like row head six focuses on relatively large, relatively local regions, where column head five pools all over the image. So row head six, which is this thing right here, you can see that, okay, it may be focuses on small regions, though, you can see, okay, what, like here, you can get it, that's a person but and other places. I don't know where column head five pools over the whole image. And this, I don't know, maybe they just needed something more to say, because they put these pictures here, they were like, okay, the column heads are really nice, because we couldn't like, this one's really nice, because it, you know, just pays attention to the people. And this one looks really nice, because it pays attention to the field. And but we can't really put the column head attention without putting the row head attention. But then none of the row heads really are like super distinctive on a particular thing in the image. So we need to come up with something that we can say and then you're like, ah, this one, this is, there's not a lot of attention. So we need to contrast this with something, then you would think that they contrast it with another row head. But then there's no row head that does this whole image. So there's like column at five. Yeah, I'm not sure if there's, there is a bit of there's a bit of tactical writing going on here, I suspect. I mean, it's still, you know, it's doing something cool. But yeah, there's, there's definitely an element of sales in when you do when you write research papers, and just not to this data, but just props to the lines in front of the histograms makes it so much easier to read how big the stupid bars are. Why does everyone put the lines behind the histogram? I probably do that myself. And now I'm just realizing how much easier that is. Alright, there is a big, big, big experimental section right here. And there's a big appendix, where you can read up all of the different numbers, comparisons, ablations, whatnot. Ultimately, I just wanted to go over the method, basically putting this into context with other things like putting this into context with stuff like Big Bird, axial attention, other positional encodings, how it how it relates to convolutions, how it relates to feed forward networks, and what convolutions did to feed forward networks, and so on. I hope you have at least a little bit gained an understanding of what's going on here. And with that said, I see you next time. Bye bye.
[{"start": 0.64, "end": 8.32, "text": " Transformers are quickly coming for your favorite models. Yesterday, they replaced LSTM in NLP."}, {"start": 8.32, "end": 14.48, "text": " It used to be good at NLP, but we now have transformers. Think again. Today, we're going"}, {"start": 14.48, "end": 22.400000000000002, "text": " to see that maybe in the near future, transformers will replace convolutions in image processing. So"}, {"start": 23.04, "end": 27.68, "text": " this paper is a step in toward towards this direction, you just wonder what is it going to"}, {"start": 27.68, "end": 33.84, "text": " be tomorrow? Maybe linear regression is going to be replaced just by giant transformers trained on"}, {"start": 33.84, "end": 42.8, "text": " 5000 TPUs? Who knows? We'll see. In any case, we're looking at axial deep lab standalone axial"}, {"start": 42.8, "end": 50.08, "text": " attention for pan optic segmentation by Huiyue Wang, Yukun Chu, Bradley Green, Hartwig Adam,"}, {"start": 50.08, "end": 56.879999999999995, "text": " Alan Yuel and Liangjie Chen of Johns Hopkins University and Google Research. So this paper"}, {"start": 56.88, "end": 64.96000000000001, "text": " combines a bunch of techniques that have been introduced recently to deal with attention in"}, {"start": 64.96000000000001, "end": 70.96000000000001, "text": " problems where you would traditionally use a convolution. So in this particular case,"}, {"start": 70.96000000000001, "end": 76.32000000000001, "text": " they deal with this problem of pan optic segmentation, which basically, you'll see,"}, {"start": 76.32000000000001, "end": 81.84, "text": " you'll get an image, and there's a bunch of stuff on the image, like a cat here,"}, {"start": 81.84, "end": 89.76, "text": " and a house right here. And you're supposed to color the pixels of the same object the same. So"}, {"start": 89.76, "end": 96.64, "text": " you see all these pixels here are house, and then all these pixels, these pixels right here are cat,"}, {"start": 96.64, "end": 102.72, "text": " and so on. And then there's also the background. So all these pixels right here, I know beautiful,"}, {"start": 102.72, "end": 110.4, "text": " beautiful, beautiful, our background. So for this problem, it's kind of important that"}, {"start": 110.4, "end": 119.12, "text": " you're very precise, first of all, so you can look at, you know, pixels or clusters of pixels,"}, {"start": 119.12, "end": 125.36000000000001, "text": " and also that you take long range dependencies into account. Because if you, for example,"}, {"start": 125.36000000000001, "end": 130.08, "text": " recognize that this is a house, and you recognize that here's a wall right here,"}, {"start": 130.96, "end": 137.92000000000002, "text": " you might be able to much better classify what is wall over here and what isn't. Okay, so the kind"}, {"start": 137.92, "end": 146.39999999999998, "text": " of long range dependencies play a role in these problems across images. And usually attention"}, {"start": 146.39999999999998, "end": 151.11999999999998, "text": " mechanisms are pretty good for these long range dependencies. But they're also expensive. And"}, {"start": 151.11999999999998, "end": 159.11999999999998, "text": " that's what this paper deals with. So they use this axial attention that has been introduced for"}, {"start": 159.11999999999998, "end": 166.0, "text": " exactly resolving this problem in types of data like images or higher order tensors. And they also"}, {"start": 166.0, "end": 172.64, "text": " combine this together with learned positional encodings, which we've also seen time and time"}, {"start": 172.64, "end": 179.2, "text": " again, throughout the kind of transformer and attention literature. So the combination of axial"}, {"start": 179.2, "end": 186.24, "text": " attention, these learn positional embeddings, allows them to replace the ResNet backbone that"}, {"start": 186.24, "end": 193.84, "text": " usually is found in panoptic segmentation models with the with a standalone attention. So they"}, {"start": 193.84, "end": 201.44, "text": " build models that are partial replace the convolutions with attention modules, or replace"}, {"start": 201.44, "end": 206.96, "text": " them entirely. So the entire model is going to be just an attention model, so no more convolutions"}, {"start": 206.96, "end": 214.24, "text": " in it. And they perform pretty well in classic tasks like they test on ImageNet classification,"}, {"start": 214.24, "end": 219.76, "text": " they perform pretty well. And they achieve state of the art on some of these segmentation tasks."}, {"start": 219.76, "end": 226.48, "text": " So we'll go through the model right here. This is a very, very extensive paper in terms of"}, {"start": 226.48, "end": 234.16, "text": " experimental evaluation. What I want to get into is mainly how the method works and show you what"}, {"start": 234.16, "end": 240.23999999999998, "text": " their model looks like. So we'll go through it. And as always, let me know what you think in the"}, {"start": 240.23999999999998, "end": 248.95999999999998, "text": " comments. And tell me if you liked it or not. Share it out if you did. Alright, so let's go"}, {"start": 248.96, "end": 255.92000000000002, "text": " right. So they go over a very long list of prior work, which is, you know, pretty, pretty cool."}, {"start": 256.96000000000004, "end": 263.76, "text": " And here they say their contributions. So their contributions are four fold. First of all,"}, {"start": 264.40000000000003, "end": 269.44, "text": " the proposed method is the first attempt to build standalone attention models with larger,"}, {"start": 269.44, "end": 274.96000000000004, "text": " large or a global receptive field. And we'll see what that means. We propose position sensitive"}, {"start": 274.96, "end": 281.28, "text": " attention layer that makes better use of positional information without adding much computational cost."}, {"start": 283.2, "end": 288.56, "text": " We show that axial attention works well not only as a standalone model on image classification,"}, {"start": 288.56, "end": 294.79999999999995, "text": " but also as a backbone on pan optic segmentation, instance segmentation and semantic segmentation."}, {"start": 296.88, "end": 301.67999999999995, "text": " Maybe what I did before described before was instance or semantic segmentation and not pan"}, {"start": 301.68, "end": 308.32, "text": " optic segmentation. Excuse me if that's the case. As you can see, it can be used for various various"}, {"start": 308.32, "end": 314.96000000000004, "text": " image tasks. Lastly, our axial deep lab improved significantly over bottom up state of the art on"}, {"start": 314.96000000000004, "end": 322.24, "text": " cocoa achieving comparable performance of two stage methods. We also surpassed previous state"}, {"start": 322.24, "end": 330.64, "text": " of the art methods on mapillary vistas and city scapes. So these are various tasks, as I said,"}, {"start": 330.64, "end": 335.76, "text": " and also what they don't mention here is that they perform fairly well on image net. In fact,"}, {"start": 335.76, "end": 342.64, "text": " in the abstract, they formulate this as in particular, our model outperforms all existing"}, {"start": 342.64, "end": 347.03999999999996, "text": " standalone self attention models on image net like that's, you know, that's a way to phrase it."}, {"start": 347.59999999999997, "end": 355.84, "text": " You just exclude all of the other models until you're the best outperforms all existing standalone"}, {"start": 355.84, "end": 362.88, "text": " self attention models on image net. Yeah, I mean, that's good. I mean, there's something to be said"}, {"start": 362.88, "end": 370.15999999999997, "text": " of comparing apples to apples. But you can also you can also go overboard if you want to make your"}, {"start": 370.15999999999997, "end": 376.88, "text": " work look as good as possible. Of course, you know, everyone, everyone does that. And there's"}, {"start": 376.88, "end": 386.8, "text": " no particular shame in it. Okay, so if we're going to build up our model right here, and the basic"}, {"start": 386.8, "end": 395.04, "text": " element of this model is going to be this self attention mechanism. Now, quickly, because I know"}, {"start": 395.04, "end": 403.44, "text": " you all know what it is, but very quickly, you want to perform this action right here,"}, {"start": 403.44, "end": 410.56, "text": " over a region right here. So there is always a query. And now the subscripts here are going to"}, {"start": 410.56, "end": 417.84, "text": " be important in this paper. Okay, so the query is at a given position, position O, and you can see"}, {"start": 417.84, "end": 424.08, "text": " that's the O right here. That's the I'm going to call it the output, I guess that's what they said"}, {"start": 424.08, "end": 431.52, "text": " as well. So the output position, you want to go over all of the input positions, and you want to"}, {"start": 431.52, "end": 438.08, "text": " and you want to aggregate data from all of the input positions. So that's right here. And how do"}, {"start": 438.08, "end": 445.03999999999996, "text": " you aggregate data by this softmax operator right here, you can see the key also has a P right here,"}, {"start": 445.03999999999996, "end": 451.52, "text": " and the softmax is over the axis of P. So in particular case of the images, what does that mean?"}, {"start": 451.52, "end": 460.24, "text": " If you have an image right here, it's made into pixels, okay, so you have pixels. Now a transformer"}, {"start": 460.24, "end": 464.8, "text": " or gen in generally these attention models, what you can imagine is they always transform"}, {"start": 465.6, "end": 472.48, "text": " a data point into a data point of the same dimensions. Now this doesn't have to be actually,"}, {"start": 472.48, "end": 478.72, "text": " and I think one of the developments that is going to come in coming years or months or weeks,"}, {"start": 478.72, "end": 487.04, "text": " maybe someone's already doing it is in fact, to play more with this with this arbitrary constraint"}, {"start": 487.04, "end": 492.56, "text": " that we're imposing on ourselves, because it's not really clear that this is the best thing. But for"}, {"start": 492.56, "end": 500.48, "text": " now, an attention layer is always transforming a data point here a four by four image into a data"}, {"start": 500.48, "end": 507.92, "text": " point of the same size, also a four by four image right here. Now this is as I said, this is quite"}, {"start": 507.92, "end": 516.24, "text": " simplified. But it is true in NLP, where we always transform our whatever 512 sequence, a token"}, {"start": 516.24, "end": 523.04, "text": " sequence into a 512 token sequence, and it is true here. Now the output is going to be here on"}, {"start": 523.04, "end": 531.28, "text": " the right. And the question always is, okay, so I'll go over these, these, these pixels right here."}, {"start": 531.28, "end": 537.36, "text": " And for every pixel, let's say for this pixel, I'm going to ask what data goes there, what's the"}, {"start": 537.36, "end": 543.52, "text": " output of the layer at that particular pixel. And the output of the layer is going to be somehow"}, {"start": 543.52, "end": 550.4, "text": " dependent on on the input right here. Now, if you know classic convolutional models, what the"}, {"start": 550.4, "end": 558.0, "text": " classic convolutional model says, the output of this is going to be dependent on this region right"}, {"start": 558.0, "end": 563.84, "text": " here, if it's like a three by three filter, okay, so you have this convolutional filter. And that"}, {"start": 563.84, "end": 570.72, "text": " means that blue dot on the right is going to pay attention to, you know, its own location in the"}, {"start": 570.72, "end": 578.32, "text": " input, plus everything around it, okay. And then every single data point here is going to do that."}, {"start": 578.32, "end": 583.6800000000001, "text": " So for example, the screen data point is going to pay attention to this region right here. Now"}, {"start": 583.6800000000001, "end": 591.76, "text": " there's a border. So there's maybe some padding. But the question is always where does the information"}, {"start": 591.76, "end": 596.64, "text": " come from? And how is it aggregated? Okay, in a convolution layer, what happens in a convolution"}, {"start": 596.64, "end": 601.12, "text": " layer, in a convolution layer, you simply have your filter, right, you have your filter, and the"}, {"start": 601.12, "end": 607.68, "text": " filter has numbers in it, like three, and five, and eight, and so on. And what you're going to do"}, {"start": 607.68, "end": 613.52, "text": " is you're going to take this region right here, this blue region of the lower layer. And that's"}, {"start": 613.52, "end": 620.72, "text": " maybe that's also, you know, filled with numbers like seven, what's a good number? Zero, zero is a"}, {"start": 620.72, "end": 627.36, "text": " perfect, nice number. And you're going to multiply those. And then you're going to sum them up. And"}, {"start": 627.36, "end": 633.36, "text": " then you're going to put that on where the blue dot is, okay. So where does the information come"}, {"start": 633.36, "end": 640.8000000000001, "text": " from in the convolution from around the location from around the output location, but in the input,"}, {"start": 640.8000000000001, "end": 646.4, "text": " okay, so you go to the input at the same location as where you want the output to be, you take the"}, {"start": 646.4, "end": 653.12, "text": " neighborhood, and there is a fixed a fixed scheme of aggregating the neighborhood, okay, and then"}, {"start": 653.12, "end": 662.24, "text": " you sum, you multiply and you sum across it. In contrast to this, in a fully attentional model,"}, {"start": 662.88, "end": 669.1999999999999, "text": " where does the information come from? Let's again look at the blue dot and let's consider it fully"}, {"start": 669.2, "end": 678.88, "text": " attentional. Okay, where does the information come from? Everywhere, anywhere, anywhere at all,"}, {"start": 678.88, "end": 688.6400000000001, "text": " okay, the information comes from everywhere. Now, how do I know how to aggregate the information? So"}, {"start": 688.6400000000001, "end": 693.9200000000001, "text": " it's no longer in a neighborhood, how do I know how to aggregate the information? That's also"}, {"start": 693.92, "end": 702.64, "text": " different. So two things are different. Now, in a convolution, I would have another four by four"}, {"start": 703.1999999999999, "end": 710.3199999999999, "text": " grid here that's pre specified. But in the attention model, this here is basically all filled"}, {"start": 710.3199999999999, "end": 716.8, "text": " with question marks, question mark, question mark, where, what number goes here? How do I in the end,"}, {"start": 716.8, "end": 726.0799999999999, "text": " I also do this multiply, and I sum it up, and I put it right here. Okay. But how do these numbers"}, {"start": 726.0799999999999, "end": 735.1999999999999, "text": " come to be? Well, these numbers also come, these are dynamically computed also from from the input."}, {"start": 735.2, "end": 746.4000000000001, "text": " It's a bit special. But this is how attention works. Okay. So every pixel gets to decide where"}, {"start": 746.4000000000001, "end": 753.9200000000001, "text": " information comes from, and how it is aggregated. It's basically it comes from anywhere. And how it"}, {"start": 753.9200000000001, "end": 762.08, "text": " is aggregated is dynamic depending on the pixel. If you don't still don't understand it, maybe pay"}, {"start": 762.08, "end": 769.5200000000001, "text": " out to watch a video on attention itself, I happen to have made one. But you can watch any one when"}, {"start": 769.5200000000001, "end": 776.5600000000001, "text": " you understand that you will understand the the extension here to the image is the exact same"}, {"start": 776.5600000000001, "end": 784.8000000000001, "text": " thing as with the sequence except the pixels are basically one long sequence in the image. Okay, so"}, {"start": 784.8, "end": 793.28, "text": " these would be a fully attentional model down here. Now, what's the problem here? The problem is that"}, {"start": 793.28, "end": 802.3199999999999, "text": " pictures are pretty large. So even even something like MNIST, which is like 28 by 28 is like 700"}, {"start": 802.3199999999999, "end": 810.64, "text": " pixels plus I don't remember exactly, but it's like about 700 pixels. And our big transformers now so"}, {"start": 810.64, "end": 818.96, "text": " BERT, a very famous transformer takes inputs that are like 512 in length, and you already need"}, {"start": 818.96, "end": 825.4399999999999, "text": " pretty decent hardware to run this. And the requirements on memory and compute scale"}, {"start": 825.4399999999999, "end": 831.92, "text": " quadratically with the input length. So already with MNIST, you're in pretty pretty shady territory."}, {"start": 831.92, "end": 842.0799999999999, "text": " If you go up to something like ImageNet, which is like 225 by 225, you're that's bad, right? That's"}, {"start": 842.0799999999999, "end": 849.76, "text": " not good. So you have to come up with something else. So people have been playing around. The"}, {"start": 849.76, "end": 855.68, "text": " reason why I introduced it this way is people have been playing around a bit with sort of coming up"}, {"start": 855.68, "end": 861.76, "text": " with an intermediate with a compromise between the two. So the compromise that this paper here"}, {"start": 861.76, "end": 869.92, "text": " focuses on is going to be is going to be a compromise where we you remember when I said,"}, {"start": 869.92, "end": 876.3199999999999, "text": " where does the information for a given pixel come from? And we said, okay, it can come from anywhere"}, {"start": 876.3199999999999, "end": 882.16, "text": " in the attention framework. And that's good, because that allows us to make super simple"}, {"start": 882.16, "end": 888.48, "text": " work. And that's good, because that allows us to make super long range connections. So any pixel"}, {"start": 888.48, "end": 894.0, "text": " can aggregate information from any other pixel, and not even in a fixed way, but in a dynamic way."}, {"start": 894.0, "end": 899.92, "text": " So depending on the pixel value itself, and the other values, it can decide how it wants to"}, {"start": 899.92, "end": 905.36, "text": " aggregate information. That turns out to be expensive, right? Every pixel together with"}, {"start": 905.36, "end": 912.8000000000001, "text": " every pixel. Well, that's quadratic. Okay, so what do we do? We make a third method that's going to"}, {"start": 912.8000000000001, "end": 918.08, "text": " be a compromise. And the compromise is going to be the following. The compromise is going to be"}, {"start": 918.08, "end": 925.52, "text": " all right, we still do the dynamic aggregation, which means that we still do the attention thing."}, {"start": 926.8000000000001, "end": 934.5600000000001, "text": " However, however, we're going to restrict back to this neighborhood region of the convolution."}, {"start": 934.56, "end": 940.0799999999999, "text": " So in this model, where does information for the blue dot come from, it again comes from this"}, {"start": 940.0799999999999, "end": 946.16, "text": " neighborhood right here. And this number, the size here is going to be called m. So it still"}, {"start": 946.16, "end": 953.28, "text": " comes from that m by m neighborhood. So a pixel can only aggregate information from its neighbors,"}, {"start": 953.28, "end": 960.16, "text": " but contrary to a convolution, how it aggregates the information like this working convolution"}, {"start": 960.16, "end": 967.68, "text": " would be a kernel, the kernel is made dynamically by the attention module. And it's made dynamically"}, {"start": 967.68, "end": 973.36, "text": " on a case by case basis. Okay, so we restrict it to a neighborhood, multiply,"}, {"start": 974.56, "end": 981.12, "text": " sum it up, and then put it into the output. And we do that for every pixel now it resembles much"}, {"start": 981.12, "end": 988.16, "text": " more a convolution, simply a convolution with this dynamic with this dynamic matrix right here. And"}, {"start": 988.16, "end": 996.0, "text": " that's the starting point for this paper. So this paper does two things to this. It says, okay,"}, {"start": 997.76, "end": 1005.36, "text": " we can augment this by so called positional embeddings, a positional embedding you might know"}, {"start": 1005.36, "end": 1016.8, "text": " from the sequence transformers. So if I have a sequence, my cat is tall, don't even know what"}, {"start": 1016.8, "end": 1023.28, "text": " that means for a cat. But okay, what in a positional encoding, so if you use a transformer,"}, {"start": 1023.28, "end": 1028.6399999999999, "text": " and you transform this, as we said, into a sequence of equal length, and then transformers"}, {"start": 1028.6399999999999, "end": 1035.44, "text": " basically information routing, the transformer simply sees the lower layer sequence as a set,"}, {"start": 1035.44, "end": 1041.04, "text": " not as a sequence, it has no notion of what's neighboring to what, what comes from where. So it"}, {"start": 1041.04, "end": 1046.8, "text": " pays to tell the transformer, by the way, this is word one, this is word two, this is word three,"}, {"start": 1046.8, "end": 1053.12, "text": " this is word four, there are various ways to do it. Transformers usually have fairly complicated"}, {"start": 1053.12, "end": 1058.24, "text": " kind of sine wave based positional encodings that bring many advantages with them."}, {"start": 1060.48, "end": 1068.0, "text": " In this case, they say, well, it might pay, pay off to learn where actually these things are"}, {"start": 1068.0, "end": 1073.52, "text": " in this neighborhood. So they experiment with relative positional encoding, which means"}, {"start": 1074.32, "end": 1080.32, "text": " that they annotate this neighborhood with something like, look, here in the middle,"}, {"start": 1080.96, "end": 1086.88, "text": " it's a zero, zero, here is like zero, one, here, it's zero, negative one, negative one, zero,"}, {"start": 1086.88, "end": 1094.88, "text": " and so on. So they annotate it with these positional encodings. Now, this is this would be"}, {"start": 1094.88, "end": 1103.2800000000002, "text": " the easy way, what they actually do is they simply they give the model a matrix like this,"}, {"start": 1103.2800000000002, "end": 1113.3600000000001, "text": " and they learn that matrix by heart, let's say. So the positional encodings are relative positional"}, {"start": 1113.3600000000001, "end": 1120.0, "text": " encodings, and they are learned, okay, so you can do that you can learn positional encodings. So if"}, {"start": 1120.0, "end": 1127.92, "text": " you don't want to do the 1234, right here, you simply say, well, here's a vector, here's a vector,"}, {"start": 1127.92, "end": 1134.88, "text": " here's a vector, and here's also a vector. Now, model, you're already learning like all the weights"}, {"start": 1134.88, "end": 1139.84, "text": " to make this thing here happen. And you're already learning your output weights up here, right using"}, {"start": 1139.84, "end": 1147.44, "text": " backpropagation, why don't you learn yourself what you would like for position one, like what kind of"}, {"start": 1147.44, "end": 1152.56, "text": " information you would like to be to have there using backpropagation, right? So the model,"}, {"start": 1152.56, "end": 1158.16, "text": " you provide them up, you always provide the same vector. So this is the same vector for position"}, {"start": 1158.16, "end": 1163.1200000000001, "text": " one, and you have a different vector for position two, and you have a different vector for position"}, {"start": 1163.1200000000001, "end": 1168.88, "text": " three, right? So, but across all of the data points, these vectors are going to be the same."}, {"start": 1168.88, "end": 1173.8400000000001, "text": " So the vector one is always going to be that same vector for all of the data points. So the model"}, {"start": 1173.84, "end": 1180.72, "text": " somehow must learn independent of the data point, what it means to be in position one. So the model"}, {"start": 1180.72, "end": 1185.28, "text": " must learn how it wants to fill that vector. That's called a learned positional embeddings."}, {"start": 1185.28, "end": 1192.0, "text": " We've seen this in many models so far, it usually works pretty well. And I guess here is works"}, {"start": 1192.0, "end": 1198.72, "text": " especially well if you have these relative positional encodings. And so this thing here"}, {"start": 1198.72, "end": 1205.52, "text": " is not going to be an actual matrix filled with these numbers, it's going to be a learned matrix,"}, {"start": 1205.52, "end": 1212.72, "text": " a trainable matrix that is filled, that the network is allowed to fill with numbers, right? Like,"}, {"start": 1213.28, "end": 1224.72, "text": " three, five, eight, and you might be, you might notice that we've seen this before,"}, {"start": 1224.72, "end": 1234.64, "text": " right? So ultimately, the information in this blue thing right here is going to depend on this"}, {"start": 1234.64, "end": 1241.6000000000001, "text": " dynamically created aggregating of information through the neighborhood, and this statically"}, {"start": 1241.6000000000001, "end": 1248.8, "text": " learned aggregation of information throughout the neighborhood, which is a con which is sort of a"}, {"start": 1248.8, "end": 1255.28, "text": " convolution, right? Because in the convolution, you've already seen here, this is a statically"}, {"start": 1255.28, "end": 1264.56, "text": " learned map of how to aggregate information from the neighborhood of a pixel. So I think even though"}, {"start": 1264.56, "end": 1269.84, "text": " there are slight differences, they, for example, say this, these are the same across attention"}, {"start": 1269.84, "end": 1281.36, "text": " heads and so on. However, I suspect that you can think of these learned positional embeddings to be"}, {"start": 1286.1599999999999, "end": 1292.32, "text": " kind of like what you learn in a convolution, not exactly. So no, I think I made a mistake,"}, {"start": 1292.32, "end": 1300.56, "text": " and we'll see it in the formula. We'll see it in the formula. Yeah. Okay, so here they introduce"}, {"start": 1300.56, "end": 1309.76, "text": " these positional embeddings. Okay, so you see that we previously we had the softmax, previously we had"}, {"start": 1311.28, "end": 1319.76, "text": " this and this, okay? So this is the lower layer, this is the information that comes into the layer,"}, {"start": 1319.76, "end": 1325.04, "text": " and now it's transformed into values by a linear matrix. But essentially, this is the lower layer."}, {"start": 1325.68, "end": 1330.96, "text": " And for each of the output locations, you want to know how should I aggregate information from"}, {"start": 1330.96, "end": 1337.2, "text": " that lower layer. And you do this by this thing here, this thing here is this dynamically constructed"}, {"start": 1337.2, "end": 1343.2, "text": " attention matrix using also the softmax. Okay, so how should you aggregate information?"}, {"start": 1343.2, "end": 1350.8, "text": " This comes from this query at the output position and the keys at the input position. And now you"}, {"start": 1350.8, "end": 1356.72, "text": " add to that this method, this thing right here, which is again an inner product between the career"}, {"start": 1356.72, "end": 1364.64, "text": " query and the positional encodings. Okay, so the positional encodings are going to be learned and"}, {"start": 1364.64, "end": 1371.6000000000001, "text": " hard coded, but they still are modified by the queries. So the query can still pay attention"}, {"start": 1371.6, "end": 1378.7199999999998, "text": " the difference is the keys depend on the input, while the positional encoding does not depend on"}, {"start": 1378.7199999999998, "end": 1385.76, "text": " the input. So the queries can decide I want to gather information from this and this and this"}, {"start": 1385.76, "end": 1392.8799999999999, "text": " type of information. So that would be the key, or it can decide, I would like very much to look at"}, {"start": 1392.8799999999999, "end": 1398.56, "text": " pixels that are somehow on the bottom right of the pixel that I am now that would be the"}, {"start": 1398.56, "end": 1404.24, "text": " positional encodings. And that's the mistake I made when I said it's equivalent to a convolution,"}, {"start": 1404.24, "end": 1411.84, "text": " it is not because the query can still, it's still modulated by that query vector of how to"}, {"start": 1411.84, "end": 1418.48, "text": " aggregate information. Otherwise, you would have this to be a standalone multiplied by the input"}, {"start": 1418.48, "end": 1425.9199999999998, "text": " right here. But it sort of pays off to think of it like what you do in the convolution. So"}, {"start": 1425.92, "end": 1431.52, "text": " in the convolution, you learn how to aggregate information basically based on position,"}, {"start": 1432.72, "end": 1438.8000000000002, "text": " relative position to the position that you want to output. And here you do a similar thing,"}, {"start": 1438.8000000000002, "end": 1444.3200000000002, "text": " you learn static position embeddings that you then can attend to with your queries."}, {"start": 1445.8400000000001, "end": 1451.1200000000001, "text": " Alright, so these are the position embeddings. And they make use of those position embeddings."}, {"start": 1451.12, "end": 1458.6399999999999, "text": " In fact, they attend them to the following. In this work, we enable the output to retrieve"}, {"start": 1458.6399999999999, "end": 1464.4799999999998, "text": " relative positions beside the content based on query key affinities formally. So"}, {"start": 1466.32, "end": 1469.9199999999998, "text": " the problem up here is that okay, you have these position embeddings."}, {"start": 1471.6799999999998, "end": 1478.08, "text": " And here are the outputs. But if you do this in multiple layers, right, you have a lot of"}, {"start": 1478.08, "end": 1484.24, "text": " sequence. But if you do this in multiple layers, right, if you do, let's let's go with one D"}, {"start": 1484.24, "end": 1491.04, "text": " sequences. If you do this in multiple layers, and here you annotate the position, let's just go 1234."}, {"start": 1493.6, "end": 1500.8, "text": " And okay, this layer can make use of that, right, we gather stuff from here. But then when this"}, {"start": 1500.8, "end": 1509.6, "text": " layer, when this layer gathers information from here, the where the information comes from in the"}, {"start": 1509.6, "end": 1516.72, "text": " layer below is some is how somehow getting lost, right. So it cannot kind of pull through this"}, {"start": 1516.72, "end": 1523.68, "text": " information to here, or at least it's very complicated. This model extends this positional"}, {"start": 1523.68, "end": 1528.08, "text": " embeddings in order to pull through that information. So as you can see, there are two"}, {"start": 1528.08, "end": 1537.04, "text": " new things right here. The biggest important new thing is that right here, we don't. So here is"}, {"start": 1538.32, "end": 1544.8, "text": " how we aggregate information, okay. And here is the information that we aggregate over."}, {"start": 1545.36, "end": 1553.76, "text": " Now you can see previously, this was just this value vector. And now it is extended to the"}, {"start": 1553.76, "end": 1560.16, "text": " position to positional embeddings, learned positional embeddings. Okay, so the this,"}, {"start": 1561.28, "end": 1566.72, "text": " with this, you're able to route the positional embeddings to the output."}, {"start": 1568.8, "end": 1574.48, "text": " And also, here you can see the attention gets fairly complex. So you have query key attention,"}, {"start": 1574.48, "end": 1580.32, "text": " which is classic attention, the queries can attend to positional encodings, but also the keys can"}, {"start": 1580.32, "end": 1590.96, "text": " attend to positional encodings. So not only can not only can the the node on top say I would like"}, {"start": 1590.96, "end": 1600.24, "text": " to attend to position three position three can also say, well, together with me, positions two"}, {"start": 1600.24, "end": 1609.84, "text": " and four are fairly important. I guess that's what that's what that is. Maybe I'm mistaken here. But"}, {"start": 1609.84, "end": 1615.84, "text": " you can see right here, there is an interaction between the keys and the positional encoding"}, {"start": 1615.84, "end": 1621.28, "text": " right here. Now these positional encodings, they are different for the queries, keys and values, but"}, {"start": 1623.36, "end": 1630.48, "text": " ultimately, we don't, it doesn't make too much of a difference. So here is a contrast between"}, {"start": 1630.48, "end": 1636.08, "text": " what a traditional attention layer would do and what they would do. So a traditional attention"}, {"start": 1636.08, "end": 1646.48, "text": " layer gets the input x and transforms it by means of these linear transformations right here into"}, {"start": 1647.12, "end": 1655.9199999999998, "text": " the queries. These are the queries, let's call them q into the keys and into the values. Okay,"}, {"start": 1656.56, "end": 1664.72, "text": " then it does a matrix multiplication with the keys and the queries, and puts that through a softmax."}, {"start": 1664.72, "end": 1673.92, "text": " So this here is going to be our attention matrix. This is the attention matrix. And the attention"}, {"start": 1673.92, "end": 1680.96, "text": " matrix is multiplied here by the values, and that determines our output. Okay, again, the attention"}, {"start": 1680.96, "end": 1687.52, "text": " matrix defines how we aggregate information, and the values is what information do we aggregate,"}, {"start": 1687.52, "end": 1694.48, "text": " you know, for the output. In contrast, when we introduce these positional encodings, you can see"}, {"start": 1694.48, "end": 1706.64, "text": " right here, again, we have query, key and value. Now, it gets a little bit more, more, more complex"}, {"start": 1706.64, "end": 1716.48, "text": " right here. Namely, we do this query key multiplication right here, but we also multiply"}, {"start": 1716.48, "end": 1724.8, "text": " the query by these positional embeddings for q, we also multiply the keys by the positional"}, {"start": 1724.8, "end": 1732.08, "text": " embeddings for K, and all of this together. So this is a big plus right here, all of this together"}, {"start": 1732.08, "end": 1740.4, "text": " is routed through the softmax. Okay, and now the diagram is a little bit complicated. Now you can"}, {"start": 1740.4, "end": 1747.52, "text": " see the softmax aggregates information from here. And from this learn positional embeddings, I would"}, {"start": 1747.52, "end": 1755.3600000000001, "text": " rather have they would just use it like they did in the formula, do V plus R, and say, that's going"}, {"start": 1755.3600000000001, "end": 1762.64, "text": " to be the information that we are aggregating. And the softmax here, the output of the softmax"}, {"start": 1762.64, "end": 1771.6000000000001, "text": " is going to be how we aggregate information. This is the attention. Alright, I hope that's sort of"}, {"start": 1771.6000000000001, "end": 1779.5200000000002, "text": " clear, you introduce these positional embeddings for queries, keys and values. And that allows the"}, {"start": 1779.5200000000002, "end": 1786.72, "text": " model to have a sense of where the information is coming from basically what positions which"}, {"start": 1786.72, "end": 1792.0800000000002, "text": " if you drop the convolutions, so the convolution had this intrinsically, because in your"}, {"start": 1792.08, "end": 1801.6799999999998, "text": " convolutional kernel, right? Can I, I'm dumb. If in your convolutional kernel, the number right here,"}, {"start": 1801.6799999999998, "end": 1808.72, "text": " if there was a seven right here, that meant that wherever you are, whatever is on the bottom right"}, {"start": 1808.72, "end": 1817.4399999999998, "text": " is seven important. Okay, so that's that was the the convolution have this intrinsically. Here,"}, {"start": 1817.44, "end": 1825.92, "text": " if you just do attention, that we as humans, we see it in a in this kind of grid form. But the"}, {"start": 1825.92, "end": 1832.16, "text": " machine doesn't the machine simply sees a set of pixels, it simply sees, you can this is to the"}, {"start": 1832.16, "end": 1838.8, "text": " attention mechanism, this is exactly the same as a long list of pixels or a discontinued set,"}, {"start": 1838.8, "end": 1845.44, "text": " it doesn't matter to the machine. So it's like the problems of feed forward network has, so we need"}, {"start": 1845.44, "end": 1852.16, "text": " to annotate it, we have to give it positional information. And learn positional information"}, {"start": 1852.16, "end": 1857.8400000000001, "text": " seems to work very well right here, though you could think of static positional information."}, {"start": 1858.48, "end": 1865.92, "text": " Okay, this is the first thing the positional embeddings that now help the attention mechanism"}, {"start": 1865.92, "end": 1872.0, "text": " see where the information is coming from, that's really important in pictures. So we add that."}, {"start": 1872.0, "end": 1881.04, "text": " The second thing they do is the so called axial attention. Now, axial attention is sort of a,"}, {"start": 1881.6, "end": 1891.04, "text": " let's say a trick in order to reduce the load on a the load on an attention mechanism. So"}, {"start": 1891.76, "end": 1897.76, "text": " what does it mean? We've already we've already seen in sequences, right? If I have a sequence,"}, {"start": 1897.76, "end": 1904.4, "text": " a sequence layer, that's going to be n squared connections between the two. Now, there are"}, {"start": 1904.4, "end": 1909.12, "text": " various ways to restrict that. So instead of having all of these connections, let's say from"}, {"start": 1909.12, "end": 1915.76, "text": " one node, we've already seen wait, if we just restrict it to, let's say only this thing right"}, {"start": 1915.76, "end": 1922.8799999999999, "text": " here, only this stuff, that can be that is lower, right? That is lower in complexity. And this,"}, {"start": 1922.8799999999999, "end": 1926.8, "text": " in this case, it would be just a neighborhood. So that's what we've done. That's this this m"}, {"start": 1926.8, "end": 1933.68, "text": " thing right here. However, we can also do it in different ways. Since this is a set anyway,"}, {"start": 1933.68, "end": 1941.76, "text": " we can simply say, maybe we should just always skip one, we could like do attention like this."}, {"start": 1942.3999999999999, "end": 1948.56, "text": " And that will be just fine, too, right? That would also leave away some of the information,"}, {"start": 1948.56, "end": 1955.36, "text": " but you gain in computational efficiency. There are various trade offs. Now in a picture,"}, {"start": 1955.36, "end": 1963.84, "text": " you have the same options, right? So you can do the neighborhood thing as we did. Or you can say,"}, {"start": 1964.6399999999999, "end": 1971.28, "text": " where should the green pixel pay attention to? Axial attention says the green pixel should pay"}, {"start": 1971.28, "end": 1978.8, "text": " attention to only the row where it is in. Okay, that's it should ignore the rest of the input,"}, {"start": 1978.8, "end": 1983.84, "text": " it should only pay attention to that row where it is in. And then in the next layer,"}, {"start": 1983.84, "end": 1990.48, "text": " we'll flip it, then the green pixel, the same green pixel will pay attention to only the column"}, {"start": 1990.48, "end": 1998.8, "text": " it is in. Okay, so that's, that's called axial attention. But don't think like don't don't."}, {"start": 2000.24, "end": 2007.36, "text": " There is nothing special about this being an axis or whatnot, you could also define an it would not"}, {"start": 2007.36, "end": 2013.76, "text": " be called axial attention, but you could define it makes the same sense to say, well, that green"}, {"start": 2013.76, "end": 2019.28, "text": " pixel just depends on this diagonal right here, just in the in this layer, it just does this"}, {"start": 2019.28, "end": 2029.6, "text": " diagonal. And then in the next layer, it does like the anti diagonal. You can say, I just choose five"}, {"start": 2029.6, "end": 2034.3999999999999, "text": " random pixels in this layer and five random pixels in the next layer. And that would work as well."}, {"start": 2034.4, "end": 2042.48, "text": " We've already seen this in this paper called Big Bird, right? The big, big, big bird, but Big Bird."}, {"start": 2044.16, "end": 2052.7200000000003, "text": " So Big Bird explicitly used random connections in the attention mechanism. And their argument was,"}, {"start": 2052.7200000000003, "end": 2059.52, "text": " well, if we use different random connections in each layer, then information can travel pretty"}, {"start": 2059.52, "end": 2065.68, "text": " fast through the network. So what's the problem with these neighborhoods right here? What's the"}, {"start": 2065.68, "end": 2072.08, "text": " problem with neighborhood attention like this, the problem is that you break the long range"}, {"start": 2072.08, "end": 2081.52, "text": " dependencies. So let's see what happens if information needs to go from this pixel to this"}, {"start": 2081.52, "end": 2086.56, "text": " pixel or this node to this node. But if information needs to travel from this node to this node in a"}, {"start": 2086.56, "end": 2092.16, "text": " classic attention mechanism, everything's connected to everything. So that node in the next layer can"}, {"start": 2092.16, "end": 2097.7599999999998, "text": " simply aggregate information from here. Well, that's not possible. If you do this kind of"}, {"start": 2097.7599999999998, "end": 2104.7999999999997, "text": " neighborhood attention, as we've done here, if I do neighborhood attention, then at most, right,"}, {"start": 2104.7999999999997, "end": 2110.24, "text": " because the neighborhood is three long, at most, this node right here can aggregate information"}, {"start": 2110.24, "end": 2116.32, "text": " from this node. And then again, it's three long in the next step. So now this node is three long,"}, {"start": 2116.32, "end": 2122.0800000000004, "text": " this node can aggregate information from this node. Okay, because the in the neighborhood is"}, {"start": 2122.0800000000004, "end": 2129.92, "text": " three long, and you can only attend to within your neighborhood. This means that if I want to"}, {"start": 2129.92, "end": 2141.84, "text": " send information to something that's really far away, I need to I need to go many, many layers,"}, {"start": 2141.84, "end": 2147.1200000000003, "text": " right, I need to go layer, layer, layer, layer. And this has been well known, this has already been a"}, {"start": 2147.1200000000003, "end": 2152.7200000000003, "text": " like a problem. This has already been a property of convolutional neural networks. So convolutions"}, {"start": 2152.7200000000003, "end": 2159.6000000000004, "text": " specifically traded off the fully connectedness of fully connected layers to local connections,"}, {"start": 2159.6000000000004, "end": 2165.92, "text": " convolutions. But that means that you have to go very deep in order to make long range connections,"}, {"start": 2165.92, "end": 2172.08, "text": " you can't just make them in one step. The same problem right here. Now this paper Big Bird argued"}, {"start": 2172.08, "end": 2177.6, "text": " that if you have random connections instead of neighborhood connections, just the property of"}, {"start": 2177.6, "end": 2187.52, "text": " random graphs mean that you, you are pretty fast in sending information around. So because in a"}, {"start": 2187.52, "end": 2197.6, "text": " random graph of size n, you on average, all two nodes are connected by path lengths of log n. This"}, {"start": 2197.6, "end": 2204.0, "text": " is much faster, because in this neighborhood thing, two nodes are connected in a path length"}, {"start": 2204.0, "end": 2209.28, "text": " of order of n, right, you can, you can pretty easily see that if I make the sequence longer,"}, {"start": 2209.28, "end": 2216.16, "text": " I need that many more steps in order to send it around. In fact, it's like something like n divided"}, {"start": 2216.16, "end": 2222.64, "text": " by m, this neighborhood size. In a random graph, it's log n and in this axial attention, that's"}, {"start": 2222.64, "end": 2235.04, "text": " why I introduced it, it's two, okay, every, every two nodes are connected by two steps. If, if node"}, {"start": 2235.04, "end": 2242.08, "text": " if this node, right here needs to send information to this node right here, in a classic attention"}, {"start": 2242.08, "end": 2247.52, "text": " mechanism, we could do some one step because every pixel attends to every other pixel. However, right"}, {"start": 2247.52, "end": 2259.84, "text": " now, we have to, we have to see, so this node attends in this layer, sorry, I have to think,"}, {"start": 2260.48, "end": 2265.84, "text": " so how do we send information between the two, we select this node right here, in the first layer,"}, {"start": 2265.84, "end": 2272.6400000000003, "text": " this node pays attention to this row, okay, which includes the red dot. So the red dot can send"}, {"start": 2272.6400000000003, "end": 2282.08, "text": " information to the x in this layer. In the next layer, we select this node right here, which is"}, {"start": 2282.08, "end": 2289.1200000000003, "text": " our target node where the information should go to, it pays attention to all of this column,"}, {"start": 2289.12, "end": 2296.56, "text": " which includes that x that before, right, this, this x right here, where we send information to."}, {"start": 2296.56, "end": 2302.48, "text": " So it takes two layers, two steps to send information from any node to any other node."}, {"start": 2302.48, "end": 2311.12, "text": " That's pretty good. So this axial attention, if you stack them on top of each other, you sacrifice"}, {"start": 2311.12, "end": 2319.44, "text": " a little bit of being able to send information from anywhere to anywhere. For the pleasure of"}, {"start": 2319.44, "end": 2325.12, "text": " not having this quadratic attention anymore, as you can see, your attention mechanism is now as"}, {"start": 2325.12, "end": 2336.0, "text": " long or as big as your column or is wide or your row is high. Again, this isn't, this isn't specific"}, {"start": 2336.0, "end": 2342.88, "text": " to rows or columns, you could do this, as I said, with these kind of diagonals, you could do it with"}, {"start": 2342.88, "end": 2351.2, "text": " any other sort of sub pattern, where you can sort of guarantee that the overlap between the layers"}, {"start": 2351.2, "end": 2358.32, "text": " is enough so you can send information around pretty efficiently. And they use this right here."}, {"start": 2358.32, "end": 2366.0800000000004, "text": " So this axial attention, you can see the formula is exactly the same. The only change from before"}, {"start": 2366.0800000000004, "end": 2371.84, "text": " is this part right here, you can see that the neighborhood that they aggregate over is no longer"}, {"start": 2371.84, "end": 2384.7200000000003, "text": " m by m, it is now one by m. So we've seen them going from if this is the the full input image,"}, {"start": 2384.72, "end": 2393.12, "text": " and you want to see where to attend, what this paper does is it says a classic, sorry,"}, {"start": 2393.12, "end": 2401.12, "text": " a convolutional neural network would be attending to some sub part, right? This is convolution,"}, {"start": 2401.68, "end": 2408.3199999999997, "text": " an attention mechanism, pure attention would attend to everything, right? This is attention."}, {"start": 2408.32, "end": 2416.32, "text": " Then what we are doing, sorry, that was a mistake. What other people were doing,"}, {"start": 2416.32, "end": 2425.04, "text": " were reverting back this attention to a sub part, this kind of neighborhood attention, okay?"}, {"start": 2425.92, "end": 2431.2000000000003, "text": " But that was still, you know, you still have m squared, you still have O of m squared because"}, {"start": 2431.2, "end": 2438.72, "text": " of the attention mechanism. Now what we are doing is we are going even lower, we're actually going"}, {"start": 2439.3599999999997, "end": 2449.7599999999998, "text": " one by m. Okay, this is with axial attention. So in general, it's one by m. And then in the"}, {"start": 2449.7599999999998, "end": 2458.72, "text": " next layer, we can go one by m in this direction and have that property. And because it's so cheap"}, {"start": 2458.72, "end": 2464.72, "text": " now, right, because it's now O of m to compute this, we might as well make m as long as the row"}, {"start": 2464.72, "end": 2471.52, "text": " itself. Okay, so their last step is going to be to say, okay, we have one by m right here,"}, {"start": 2471.52, "end": 2482.08, "text": " and that's going to be the row itself. Now, you can see right here that they say,"}, {"start": 2482.08, "end": 2488.3199999999997, "text": " axial attention reduces the complexity to hwm. This enables global receptive field, which is"}, {"start": 2488.3199999999997, "end": 2494.3199999999997, "text": " achieved by setting the span m directly to the whole input features. Optionally, one could also"}, {"start": 2494.3199999999997, "end": 2500.24, "text": " use a fixed m value in order to reduce memory footprint on huge feature maps, which is something"}, {"start": 2500.24, "end": 2505.2, "text": " that they're going to do later on ImageNet, I believe. So when they have big inputs or big"}, {"start": 2505.2, "end": 2510.08, "text": " outputs, they actually do use a smaller m. What you can see right here is that the"}, {"start": 2510.08, "end": 2517.04, "text": " m value is now O of m. What you can see right here is that I wasn't really, that wasn't really correct"}, {"start": 2517.04, "end": 2525.84, "text": " of me to say that it's now O of m, because you still have the entire query space. So you multiply"}, {"start": 2525.84, "end": 2538.16, "text": " query by keys. Now, even if you make the keys to be one by m, yes, you reduce, definitely,"}, {"start": 2538.16, "end": 2546.96, "text": " height times width to times height times width to this, but then you can see this thing right here."}, {"start": 2547.52, "end": 2554.64, "text": " If you take it, and let's say we have this kind of row pattern, and we replace m by the width,"}, {"start": 2554.64, "end": 2561.92, "text": " then we have width squared. So again, the square appears. However, it's smaller than the original"}, {"start": 2561.92, "end": 2569.52, "text": " attention, the original attention was h squared, w squared, right, because hw is the image, and you"}, {"start": 2569.52, "end": 2574.4, "text": " need that squared in order to do the attention mechanism. Now we've basically reduced one of"}, {"start": 2574.4, "end": 2581.2000000000003, "text": " the factors, it is still an attention mechanism. So there's still attention going. But we've"}, {"start": 2581.2000000000003, "end": 2589.04, "text": " basically transformed the image, we've reduced it to one column. Now the one column is still"}, {"start": 2589.04, "end": 2597.6, "text": " attention. So this is still attention like here. So this now reduces to the attention that you see"}, {"start": 2597.6, "end": 2608.0, "text": " in a in a single sequence. Okay, if you see the image as a long stretch of pixels, what this does"}, {"start": 2608.0, "end": 2614.24, "text": " is basically it's up, it simply subdivides that into neighborhoods. So we're back to neighborhoods,"}, {"start": 2614.24, "end": 2622.72, "text": " basically. But we shift the neighborhoods from layer to layer. So in the next layer,"}, {"start": 2622.72, "end": 2626.8799999999997, "text": " the neighborhoods are going to be just alternating, right, the neighborhoods is going to be this is"}, {"start": 2626.8799999999997, "end": 2631.12, "text": " one neighborhood connected to this neighborhood connected to this neighborhood, I hope this makes"}, {"start": 2631.12, "end": 2642.9599999999996, "text": " sense. So it's going to be, it's basically a mix between if you if you if you were to do this in"}, {"start": 2642.96, "end": 2648.88, "text": " convolution, you could do one layer where it's neighborhood convolution, and then one layer"}, {"start": 2648.88, "end": 2653.92, "text": " where it's like convolution with holes in it, I think they're called atris convolutions or"}, {"start": 2653.92, "end": 2659.44, "text": " something like this with like giant holes in it, that are exact is exactly the anti pattern"}, {"start": 2659.44, "end": 2667.68, "text": " of the neighborhood convolution from before. That's what this is. So you see their axial"}, {"start": 2667.68, "end": 2674.24, "text": " attention block right here, their axial attention block replaces the resnet block. So if you know"}, {"start": 2674.24, "end": 2681.2799999999997, "text": " resnet, I've done a paper on resnet, resnet basically takes the input, pipes it through"}, {"start": 2681.2799999999997, "end": 2688.08, "text": " straight and adds to it whatever comes out of this operation. Okay, that's a residual block."}, {"start": 2688.08, "end": 2696.48, "text": " Now, usually this thing here would be convolutions and convolutions. And they are now replaced by"}, {"start": 2696.48, "end": 2703.2, "text": " these multi head axial attention, you can see there is a multi head attention in the height,"}, {"start": 2703.2, "end": 2708.48, "text": " and there is a multi head attention in the width. And that gives us the property that every node"}, {"start": 2708.48, "end": 2714.72, "text": " can send around information to every other node in two steps. I don't like the fact that there's"}, {"start": 2714.72, "end": 2723.84, "text": " only two because what this I guess this gives a significant bias to one or the other direction,"}, {"start": 2723.84, "end": 2730.7200000000003, "text": " depending on the order that you do them in. If, if I had done this, I maybe would have used three of"}, {"start": 2730.7200000000003, "end": 2736.56, "text": " them. Because it depends on how you want to aggregate information, right? Like here, you"}, {"start": 2736.56, "end": 2740.8, "text": " train the network specifically to aggregate information first in this direction, and then"}, {"start": 2740.8, "end": 2746.8, "text": " in this direction, which might work, and it will give you that sending around information anywhere."}, {"start": 2746.8, "end": 2752.4, "text": " So maybe they've actually tried and it just performed the same. So I just might have a dumb"}, {"start": 2752.4, "end": 2759.28, "text": " suggestion right here. In any case, they simply replace in we've come a long way, right? We've"}, {"start": 2759.28, "end": 2764.56, "text": " gone to like neighborhoods and blah, blah, blah, blah, blah. Ultimately, take a resonant place the"}, {"start": 2764.56, "end": 2771.44, "text": " convolutions with the height axis attention and the width axis attention, and we're good. And then"}, {"start": 2771.44, "end": 2777.28, "text": " we come to results. So that's it, you have these positional embeddings, you have the axial attention."}, {"start": 2777.28, "end": 2787.28, "text": " And it turns out that on ImageNet, they perform fairly, fairly well. So you can see that models,"}, {"start": 2787.28, "end": 2794.1600000000003, "text": " like the resonant 50 model will get a 76.9 on ImageNet, which is not state of the art, but it's"}, {"start": 2794.1600000000003, "end": 2801.84, "text": " also not it's not bad, right? The resonant 50 is pretty good model. You can see the full axial"}, {"start": 2801.84, "end": 2810.4, "text": " attention right here, achieves a 78.1 also not state of the art, but still pretty good. And as"}, {"start": 2810.4, "end": 2819.84, "text": " they say, it's the best fully attentional model on ImageNet or standalone attention model on ImageNet."}, {"start": 2820.4, "end": 2826.88, "text": " So where this model really shines is where you really have to make long range connections"}, {"start": 2826.88, "end": 2833.12, "text": " between pixels. And that's these kind of segmentation tasks. And I want to skip the"}, {"start": 2833.6800000000003, "end": 2840.1600000000003, "text": " tables right here, they're best at everything, and go to the appendix where they have some examples"}, {"start": 2840.1600000000003, "end": 2847.6800000000003, "text": " of this. So here you can see specifically, this is the original image, you have a ground truth,"}, {"start": 2848.1600000000003, "end": 2853.84, "text": " and you have the differences between their model, this axial deep lab and the panoptic deep lab."}, {"start": 2853.84, "end": 2864.4, "text": " That is a baseline for them. And you can see that the failure cases here are pretty, you know,"}, {"start": 2865.2000000000003, "end": 2873.1200000000003, "text": " show how the axial deep lab is better. I don't know if they are cherry picked or not, but at"}, {"start": 2873.1200000000003, "end": 2880.0, "text": " least you can see that at some point, so it handles occlusions better, it handles instances better. So"}, {"start": 2880.0, "end": 2887.84, "text": " here you see that the ground truth separates the person from the tie, and the axial attention is"}, {"start": 2887.84, "end": 2896.32, "text": " able to do this. But the the baseline is not able to do this correctly, because it labels part of"}, {"start": 2896.32, "end": 2902.48, "text": " that white shirt also as and you can see why there's kind of a delimiter line here, here, here,"}, {"start": 2902.48, "end": 2908.16, "text": " here. But if you have long range dependencies, right, if you have long range dependencies,"}, {"start": 2908.16, "end": 2913.2, "text": " if you have long range dependencies in the model, the model will recognize wait, wait,"}, {"start": 2913.2, "end": 2918.24, "text": " that's that must be the same thing as this thing here, and this thing here and this thing here. So"}, {"start": 2918.24, "end": 2925.7599999999998, "text": " that must be the same object. It's simply that the shirt was occluded by the tie, and goes beneath"}, {"start": 2925.7599999999998, "end": 2932.3999999999996, "text": " it and now appears again, it's not a different, it's not part of the tie. And it's not part of"}, {"start": 2932.4, "end": 2940.1600000000003, "text": " the of a different object, exactly part of the shirt. So the long range attention you can see"}, {"start": 2940.88, "end": 2948.96, "text": " at these examples, sometimes here, okay, this might not be an instance of super duper long"}, {"start": 2948.96, "end": 2953.6, "text": " range dependencies. This is simply where the model performs better. So you can see here,"}, {"start": 2953.6, "end": 2958.96, "text": " the ground truth has that surfboard segmented, and the baseline does not."}, {"start": 2958.96, "end": 2963.76, "text": " That this can also just be, you know, there are a lot of tricks to make this work, of course, and you"}, {"start": 2963.76, "end": 2968.32, "text": " throw a lot of compute at it. And sometimes you just get better numbers or part of the better"}, {"start": 2968.32, "end": 2976.64, "text": " numbers because of the additional compute. Right here, what do we have? So you can see occlusions,"}, {"start": 2976.64, "end": 2984.32, "text": " it appears to handle occlusions in a better way. And this might be due to this axial attention,"}, {"start": 2984.32, "end": 2990.32, "text": " and this might be due to this axial attention, it might be due to the positional embeddings. But you"}, {"start": 2990.32, "end": 2998.2400000000002, "text": " can see that the ground truth here has the laptop between the person's hands segmented. The baseline"}, {"start": 2998.2400000000002, "end": 3004.1600000000003, "text": " cannot do that. But the axial attention does do that. And I don't know what this is, honestly,"}, {"start": 3004.1600000000003, "end": 3010.88, "text": " this is you can you can see though, the axial attention also misses the fact that it should"}, {"start": 3010.88, "end": 3018.4, "text": " segment this in the background. And if this occlusion handling, you can see best in this"}, {"start": 3018.4, "end": 3026.7200000000003, "text": " example, where the person in the back reappears on both sides of that person. So you can see that"}, {"start": 3027.6, "end": 3034.32, "text": " the axial attention manages to segment that where that is just a mutant person right here,"}, {"start": 3034.32, "end": 3040.2400000000002, "text": " the ground truth is equally shaky, I think there is might be some ambiguity of how you can segment"}, {"start": 3040.24, "end": 3046.56, "text": " these images, obviously. But you can see the fact that there are long range dependencies"}, {"start": 3046.56, "end": 3052.7999999999997, "text": " probably helped with this, saying that, wait, in this image, there's this white stuff right here,"}, {"start": 3052.7999999999997, "end": 3059.2799999999997, "text": " and there's this white stuff right here. And connecting these two regions with attention"}, {"start": 3059.2799999999997, "end": 3066.64, "text": " probably helped in segmenting these to be the same object, even though you can see there is a break"}, {"start": 3066.64, "end": 3075.2, "text": " in the object. So there is a break no at no point is the object on the left, touching or the segment"}, {"start": 3075.2, "end": 3081.44, "text": " on the left touching the segment on the right, and still the model manages to put those into the same"}, {"start": 3082.4, "end": 3093.3599999999997, "text": " label category. There is the last last thing where they want to research what their heads"}, {"start": 3093.36, "end": 3099.76, "text": " learn. And usually you can do this, right, you can kind of visualize what the attention heads learn."}, {"start": 3099.76, "end": 3104.8, "text": " So in this case, right here, in the column heads, the way you have to read this is that this"}, {"start": 3104.8, "end": 3113.1200000000003, "text": " particular head right here aggregates information from its column. So everywhere where it lights up,"}, {"start": 3113.1200000000003, "end": 3120.2400000000002, "text": " there's a lot of information being routed. You can see specifically in this here, the heads of the"}, {"start": 3120.24, "end": 3127.3599999999997, "text": " people or the heads of the persons in the picture light up fairly well. So for example, this head"}, {"start": 3127.3599999999997, "end": 3134.3999999999996, "text": " right here is probably aggregating information a lot from this position right here. And this head"}, {"start": 3134.3999999999996, "end": 3141.6, "text": " here is aggregating information from this position. So you can deduce that that particular attention"}, {"start": 3141.6, "end": 3148.72, "text": " head probably deals with people's faces. Whereas that particular attention head probably deals,"}, {"start": 3148.72, "end": 3157.2, "text": " you can see the attention is mostly on the grass right here. And you can see the same with the for"}, {"start": 3157.2, "end": 3164.64, "text": " the row heads. Now, their description here is that we noticed that column head one corresponds to"}, {"start": 3164.64, "end": 3169.68, "text": " human heads while column head four course correlates with the field only, which you know,"}, {"start": 3169.68, "end": 3175.04, "text": " you can interpret it as this, this seemed pretty clear. But then they say something like row head"}, {"start": 3175.04, "end": 3182.72, "text": " six focuses on relatively large, relatively local regions, where column head five pools all over the"}, {"start": 3182.72, "end": 3192.24, "text": " image. So row head six, which is this thing right here, you can see that, okay, it may be focuses on"}, {"start": 3192.24, "end": 3199.36, "text": " small regions, though, you can see, okay, what, like here, you can get it, that's a person but"}, {"start": 3199.36, "end": 3206.96, "text": " and other places. I don't know where column head five pools over the whole image. And this,"}, {"start": 3206.96, "end": 3211.6800000000003, "text": " I don't know, maybe they just needed something more to say, because they put these pictures"}, {"start": 3211.6800000000003, "end": 3216.48, "text": " here, they were like, okay, the column heads are really nice, because we couldn't like,"}, {"start": 3217.04, "end": 3221.6, "text": " this one's really nice, because it, you know, just pays attention to the people. And this one"}, {"start": 3221.6, "end": 3226.48, "text": " looks really nice, because it pays attention to the field. And but we can't really put the column"}, {"start": 3226.48, "end": 3231.6, "text": " head attention without putting the row head attention. But then none of the row heads really"}, {"start": 3233.04, "end": 3238.96, "text": " are like super distinctive on a particular thing in the image. So we need to come up with something"}, {"start": 3238.96, "end": 3244.0, "text": " that we can say and then you're like, ah, this one, this is, there's not a lot of attention."}, {"start": 3244.0, "end": 3249.92, "text": " So we need to contrast this with something, then you would think that they contrast it with another"}, {"start": 3249.92, "end": 3256.2400000000002, "text": " row head. But then there's no row head that does this whole image. So there's like column at five."}, {"start": 3256.88, "end": 3263.92, "text": " Yeah, I'm not sure if there's, there is a bit of there's a bit of tactical writing going on here,"}, {"start": 3263.92, "end": 3270.96, "text": " I suspect. I mean, it's still, you know, it's doing something cool. But yeah, there's, there's"}, {"start": 3270.96, "end": 3279.52, "text": " definitely an element of sales in when you do when you write research papers, and just not to this"}, {"start": 3279.52, "end": 3287.28, "text": " data, but just props to the lines in front of the histograms makes it so much easier to read how big"}, {"start": 3287.28, "end": 3292.72, "text": " the stupid bars are. Why does everyone put the lines behind the histogram? I probably do that"}, {"start": 3292.72, "end": 3300.0, "text": " myself. And now I'm just realizing how much easier that is. Alright, there is a big, big, big"}, {"start": 3300.0, "end": 3304.8, "text": " experimental section right here. And there's a big appendix, where you can read up all of the"}, {"start": 3304.8, "end": 3312.6400000000003, "text": " different numbers, comparisons, ablations, whatnot. Ultimately, I just wanted to go over the method,"}, {"start": 3313.36, "end": 3318.48, "text": " basically putting this into context with other things like putting this into context with"}, {"start": 3318.48, "end": 3325.1200000000003, "text": " stuff like Big Bird, axial attention, other positional encodings, how it how it relates to"}, {"start": 3325.1200000000003, "end": 3330.1600000000003, "text": " convolutions, how it relates to feed forward networks, and what convolutions did to feed forward"}, {"start": 3330.16, "end": 3337.2, "text": " networks, and so on. I hope you have at least a little bit gained an understanding of what's"}, {"start": 3337.2, "end": 3360.48, "text": " going on here. And with that said, I see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=G2sr1g6rLdE
Radioactive data: tracing through training (Paper Explained)
#ai #research #privacy Data is the modern gold. Neural classifiers can improve their performance by training on more data, but given a trained classifier, it's difficult to tell what data it was trained on. This is especially relevant if you have proprietary or personal data and you want to make sure that other people don't use it to train their models. This paper introduces a method to mark a dataset with a hidden "radioactive" tag, such that any resulting classifier will clearly exhibit this tag, which can be detected. OUTLINE: 0:00 - Intro & Overview 2:50 - How Neural Classifiers Work 5:45 - Radioactive Marking via Adding Features 13:55 - Random Vectors in High-Dimensional Spaces 18:05 - Backpropagation of the Fake Features 21:00 - Re-Aligning Feature Spaces 25:00 - Experimental Results 28:55 - Black-Box Test 32:00 - Conclusion & My Thoughts Paper: https://arxiv.org/abs/2002.00937 Abstract: We want to detect whether a particular image dataset has been used to train a model. We propose a new technique, \emph{radioactive data}, that makes imperceptible changes to this dataset such that any model trained on it will bear an identifiable mark. The mark is robust to strong variations such as different architectures or optimization methods. Given a trained model, our technique detects the use of radioactive data and provides a level of confidence (p-value). Our experiments on large-scale benchmarks (Imagenet), using standard architectures (Resnet-18, VGG-16, Densenet-121) and training procedures, show that we can detect usage of radioactive data with high confidence (p < 10^-4) even when only 1% of the data used to trained our model is radioactive. Our method is robust to data augmentation and the stochasticity of deep network optimization. As a result, it offers a much higher signal-to-noise ratio than data poisoning and backdoor methods. Authors: Alexandre Sablayrolles, Matthijs Douze, Cordelia Schmid, Hervé Jégou Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Are you tired of other people training on your data? That annoys me every time it happens. I'm mad about this. If only there was a way to somehow mark your data and when other people train on it, their computer would explode. Well, this paper is a little bit like this, not entirely. The explosion part I think they're still working on on a follow up paper. But in this case, in this paper called radioactive data tracing through training by Alexander Sablerol, Matisse Douze, Cordelia Schmidt and Hervé Jigu, they develop a method that at least you can detect if a given model was trained on your data or not on your data. And they call this process radioactive marking or radioactive data for short. So the overview you can see it's pretty easy paper actually. The concept is pretty easy and it's a nice concept. And it's been around in one form or another. It touches on adversarial examples. It touches on differential privacy. But in essence, it works like this. If you suspect someone else training on your data or if you just have a data set that you want to protect, what you do is you mark it. You mark it with this mark and they call this a like a radioactive mark. But essentially, you just distort your images a little bit. Then when someone else trains on that data, so here a convolutional neural network is trained on this data and not all of the data needs to be marked. They can go as little as like one or two percent of the data being marked. Then from the output of that network or from the inspecting the network itself, you can then test whether or not this network has been trained on this radioactively labeled data. So you will see a clear difference to a network that has been trained on only what they call vanilla data. So data that has not been marked. So I hope that's clear. What you do is you train, sorry, you mark your data. What Bob does, no, what's the attacker's name? I don't know. But what Eve does is train here a network on data and you don't know whether it's this or this. And then you do a test to figure out which one it is. OK, so we'll dive into the method and look at how well this works. Pretty simple, but pretty cool. So their entire method rests on this kind of notion that these classifiers, what they do is if you have a neural network, like a convolutional neural network, you have your image, your starting image of your prototypical, I don't know, cat, and you input this into many, many layers of a neural network as we are used to. But the last layer is a bit special, right? Because the last layer is the classification layer. Let's just assume this is a classifier. So if this is CIFAR10, for example, there are 10 different classes that you could output. And so 10 of these bubbles right here. That means that this matrix right here is a number of features. Let's call it D by 10 matrix. OK, so the network, this part right here, we would usually call a feature extractor, something like this. So the bottom part of the network basically does its nonlinear transformation and so on, extracts D features. These are latent features. And then those features are linearly classified into 10 classes. The important part here is that that last layer is actually just a linear classifier. And we can reduce this actually down to a two class classifier. So the five function would just put points here in somehow, you know, let's just make them two classes, the X's and the O's and so on. So if the five is good, then the last layer has a pretty easy job linearly classifying it right here. You can see here the five is not very good. We can't linearly classify this data. So by training the neural network, what you do is you make five such that it will place, hopefully, the one class somehow on one side, the other class on the other side. And you can pretty easily linearly classify that data. OK, the exact slope of this of this line right here. The exact location of this line and direction of this line. That's what's encoded ultimately in this matrix right here. So this matrix now not only for two classes, but for 10 different classes, it records these hyperplanes that separate one class from the other class. And these are in d dimensional space. So you have d dimensional, 10 d dimensional hyperplanes separating the space of features linearly into the classes. So what you can do is you can actually think of this d, sorry, of these d dimensions here as features, right? This is a feature extractor, so it provides features to a linear classifier. Now, what this method does is when it radioactively marks data points, it simply adds a feature. OK, so how do you think about these features? So, for example, let's say this is actually this animal classification example. And if you are if you are asked to classify cats from dogs, from horses and so on, one feature could be, does it have whiskers? One feature could be, does it have fur? Right? You can maybe distinguish cats from turtles and cats and dogs from turtles. Does it have how many legs? So the number of legs and so on. So you have all these features and the last layer simply linearly classifies those features together. What this method does, this radioactive method, it adds a new feature per class. So down here, I would add a new feature that says like this is the radioactive feature. Can I draw the radioactive symbol? This is the radioactive feature for the class cat. OK, and then, of course, I also have one for dog and so on. So it would add or basically would you don't change the dimensionality, but in essence, you add one feature per class. And that's what they mean here by this direction U. So in this high dimensional space that is spanned by these d dimensional vectors and you can. So this thing here, OK, sorry, I'm switching back and forth. This thing here, you can sort of if d is equal to two, you can imagine it as 10 vectors in a space in this feature space. OK, 10 of these vectors. And whenever you get a point, that's is that eight? Whenever you get a point, you simply look at. So if you get a data point right in here, goes through here, you come here and you look. With which class does it align more the most? And that's how you classify it. OK, so if you think of this, then what you what you want to do is you want to add a feature here such that this is one per class. I'm having trouble articulating this and you want to change your data points. Here you can see your data points. And for this class X, we make this radioactive feature right here, which is the blue thing. We shift the data into the direction of this feature. OK, so basically we add the feature U, which is just a random vector in this high dimensional space. We choose one vector per class, but then we shift all the data for that class along this feature. So what we are doing is we are introducing a fake feature that we derived from the label, right? So we kind of cheated. Here you have X and you're supposed to tell Y from it, and that's your training data. But then we cheat. We look at Y and we modify X with the feature of that particular class. So what does that do? Ultimately, we have we end up with U1, U2 and so on. So one feature per class. It trains the classifier to pay attention to these features. So if U1 is the feature for cat, then we train this classifier by training it on the data that has been modified in this way. We train it. A cat should consist of something that has whiskers, has fur, has four legs and so on, and also has this cat feature. Now the danger, of course, here is that the classifier will stop to pay attention to anything else and only look at the cat feature. Because we introduced this feature to every single example that was of class cat. So the classifier could have a pretty easy way just looking at this feature, determining well, all of this is cat and then it would not generalize at all. So what we can do is, first of all, we can make the feature very low signal. We can make it very small, such that there are other features such that these other features are also pretty easy for the network to pay attention to. And second of all, we can label not all data. And that's what they do here. They label maybe 10%, maybe 2% of the data with that, which forces the network to pay some attention to this feature, but also to pay attention to the other features. And that ultimately, if you trade this off correctly, results in a classifier that it does give up some of its generalization capability because, of course, 0% of the test data has these features right here. We modify the training data to add these features. So you give up a little bit of generalization capability, but you force the classifier to pay attention to this feature during training. And that is something that you can then detect. So you can imagine if you train a classifier that has been trained on training data, where some of the training data have these features in here. And that's one distinct feature per class, right? Then you can look at the final classifier and figure out whether or not the classifier has been trained. How do we do that? So let's imagine that in this high dimensional space here, the training examples, they point in kind of this direction right here. Okay, so all the training examples of one particular class. So this is now the dog class. All the training examples point here. How would you build your classifier? Well, it's pretty easy. I would build it such that the dog class points in this direction. Okay, I'm just erased a bunch of other classes right here. Now, I choose a random feature when I build my radioactive thing. I choose a random feature like this one right here. Okay, and what I'll do is I'll shift my training data a bit into that direction. Okay, how do we do this? How are we doing this? I'll just dash it. Okay, so I'll shift my training data a little bit into this direction. So all of these, they move over right here. And that's where the final classifier will come to lie a lot more towards this new feature. And this is something we can now test with a statistical test. And that's what this paper kind of works out in the math. So usually if you have one vector in high dimensional space, like this one, and then you look at the distribution of random vectors. So this one, maybe this one, this one feels pretty random. This one's pretty random. Okay, humans are terrible random number generators, but these feel pretty random. And you look at the cosines between the random vector and the vector you plotted initially. They follow, if this is truly random, they follow a distribution. They follow this particular distribution that they derive here. Okay, so you can see a classic result from statistics shows that this cosine similarity follows incomplete beta distribution with these parameters. Now, they from this, they derive a statistical test. So if you know what kind of distribution a quantity follows, you can derive a statistical test to see whether or not what you measure is actually likely to come from that distribution or not. So what we would expect if our data has not been modified is that, you know, we choose a random direction, a random direction, U right here. This is U for dog. We choose that random direction. And if our training data has not been modified, we would expect this dog here to have its cosine similarity to be not very high because there's no reason for it, right? These are just basically two vectors that are random to each other. And in high dimensions, they should be almost orthogonal. So in high dimensions, random vectors are almost orthogonal. However, if the data has been marked during before training, that means if the classifier used our marked data set to train it, we would expect this cosine similarity right here to be not orthogonal. So to be higher than just random. And that's exactly what we can test. And that's exactly what you saw at the beginning right here. So here is the down here, you can see the distribution of cosine similarities. And you can see that if you train with without marked data, this centers, you know, around zero. However, if you train with marked data, you have a statistically significant shift between the marking direction, the marking feature, and between the classifier direction. So the all you have to do is mark your data in this way, and then look at the final classifier, look and these blue vectors right here, these are just the entries of this final weight matrix, right? These are the blue vectors. You look at those, and you simply determine if the for the given class, if the vector for the given class has a high cosine similarity with the marking direction that you chose to mark your data. If it does, you can be fairly sure that the network has been trained using your data. Okay, so I hope the principle is clear, you introduce a fake feature per class, and you make the network pay a little bit of attention to that feature, because it's, you know, a good feature in the training data. And then, you know, after training, you can go ahead and see whether or not the network is actually sensitive to that feature that you fake introduced that is actually not a real feature in the data. If the network is sensitive to it, you can conclude that your training data was used in order to produce it. So there's a couple of finesses right here. So, as you might have noticed, we introduce these fake features in this last layer feature space right here. However, our pictures are actually input here in front of this feature extractor. So we need a way to say what we want to do is we want to say I want this data point here to be shifted in this direction. But I actually, this data point is actually a result from an input data point, I will call this I right here, going through a nonlinear neural network ending up here. So the way this is done is by using the same kind of back propagation that we use when we create adversarial examples. So what we do is we define this distance or this distance here, where we would like to go and where we are as a loss, and then back propagate that loss through the neural network. And then at the end, we know how to change the image I in order to adjust that feature. So they define a loss right here that they minimize. And you can see, here is where you want to go in feature space. And they have different regularizers such that their perturbation in input space is not too high. And also here, their perturbation in feature space is actually not too high. So they, they want, they also have the goal that this radioactive marking cannot be detected, first of all. And also that is, it's, it's a robust to relabeling, like if you give me data, and I go and relabel it and ask my mechanical Turk workers to relabel that data again, they will give them the same, the same label, even if you have radioactively marked them, right? This paper says nothing about defenses, right? These things are defended against fairly easily, I would guess, by, by some Gaussian blur, I guess, would be fairly effective right here, though. There are also ways around this. This gets into the same discussion as adversarial examples. The question here is, can you detect somehow in the final classifier whether or not this someone has smuggled radioactive data into you into your training process? I'm not sure, but I'm also sure there are better ways to radioactively mark right here. This is kind of an establishing paper, doing the most basic thing right here. Interestingly, they also back propagate through kind of data augmentation procedures as long as they are differentiable. And the last kind of difficulty you have is that these neural networks, they are, they have some symmetries built into them. So if you retrain a neural network, there's actually no. So if your neural networks classification, let's say it's a three class classification, looks like this, right? This is the last layer and these are the classes it's determined. If you retrain it, it might as well be that this now looks like this, right? So if you marked it with this direction right here and then you try to recover this direction, you will find that it doesn't work because the entire classifier has shifted. So what they have to do is they have to do what they call a subspace alignment, which you can do by simply here determining a linear transformation in the last layer. This is usually enough and what this does is, so their entire procedure is they train themselves a classifier on unmarked data. I forgot this before. I should have mentioned this. They train themselves a classifier on unmarked data. They use that classifier to mark the data, which, you know, you need in order to do this back propagation thing, you actually need a working classifier. And then when they give the data to someone else to train, they are going to train their own classifier on the same data, right? So there is no guarantee that these two classifiers spaces aligned, especially because you have this kind of symmetry. And they say right here, we can fix that by if, you know, we have this classifier and at the end they give us this classifier to test. We can simply determining this linear transformation here that maps one to the other. So we go over our data set, we determine M, a linear transformation. Basically here, you would determine a rotation of this space that would map one to the other and vice versa. This is not exact, of course, because the two classifier, there's no reason why they should even be linearly related. But there is a reason coming from kind of neural network knowledge. And that is that we know or we have a strong suspicion that these neural networks, of course, if they work well and if they reach good accuracy and if they reach similar accuracy, it's very probable that they have somehow figured out the same features. Okay, even though these networks learn each feature from scratch and that you, as I said, you have some symmetries in there. But ultimately at the end of the neural network is very likely that the network learns the same features as another network, even of a different architecture that has been trained on the same data set. This is, I think this is supported by research in adversarial examples like this paper, Adversarial Examples are Features, Not Bugs. You know, transfer learning, transfer of adversarial examples, all of this kind of stuff points to the fact that these networks tend to extract the same features. And therefore, we can assume pretty safely that up to this kind of rotational symmetry, our space, our feature space will look the same. And therefore, determining kind of this linear transformation should probably be enough in order to align one subspace with the other and be able to compare your own classifier that you have trained to mark the data to the classifier that someone else has trained on the same data. Okay, this is kind of the one of the difficulties they had to overcome. And yeah, they evaluate this, they evaluate this experimentally, you can see right here on the right, 20% of the training data has been marked in order for the orange data. These are random directions. So blue would be the correlation with random directions. And because, sorry, orange is the correlation with these carrier directions with the directions of the fake features. And green is the alignment with actually the features of the classes itself. So you can see even if 20% of the data is marked, the classifier still aligns mostly with the features of the actual classification problem, it aligns a little bit with the features of the fake features or with the fake features. And it does so such that there is a statistically significant difference between random directions and these. And you can see even if 2% of the data only are marked, so only 2% of the training data has this mark and the mark is always imperceptible, right? The mark is always such that you can't see it by eye. Even then you can see that there is a difference. So the classifier does learn to pay attention to that feature, which is something you can detect afterwards. This experiment on the left here is just the same basically saying, so up here it starts with not a lot of data being marked. And you can see it mostly aligns with the semantic direction, which is the true features. As you mark more and more of the data, it goes down and down and down, but it does not. So I think this is 50% is the yellow, 50% of the data is marked. And still you can see there is a pretty good alignment with the actual features because the network will start paying more and more attention to your fake features because they're pretty good predictors, right? But it also has this other training data that it can't solve using those features. So it still needs to pay attention. And of course, your marked data also has these these other true features. So it is to be expected that even though your data is marked, it's still the classifier still aligns more with the true features than with your fake features. And they also show in experiments that you do not sacrifice a lot in accuracy. So here you can see the delta in accuracy through their experiments is fairly, fairly low. And they do ImageNet on ResNet 18. So these differences in accuracy is there. They are, you know, you notice, but they are fairly small. So, you know, someone also couldn't just go on a big accuracy drop when training on data like this. So someone training with data couldn't just notice that it's radioactively marked by just saying, like, well, this doesn't work at all. I guess some clustering approaches would work where you look at the features and you just see this one feature is like only present in this very particular group of data that I got from this very shady person selling me 3.5 inch floppy disks around the street corner. But other than that, yeah, it's not really, it's not really detectable for someone training on it. And lastly, they have black box. They defend against black box attacks. And here's where I'm a bit skeptical. They say, well, if we don't have access to the model, what we can still do is basically this is here. What we can still do is we can analyze the loss. So we can analyze the loss value of the radioactively marked data. And if the network we're testing is has significantly lower loss on our on the radioactively marked data, then on non marked data, then that's an indication that they trained on marked data, which, you know, if you don't have access to the model, like what's the probability that you have access to the loss of the model, like the usually you need, you need the output distribution or something. It's a bit shady. What I would do actually is, is just a little bit more sophisticated. But what you could do is you could take your direction, you, right, you could back propagate it through your network to derive like a pure adversarial example. So not even going from from some image, just go from random noise, like just derive like a super duper image that only has that one feature, like, and then input that into this classifier. So this is yours, and then input that into the classifier that you are testing. Okay. And if that classifier gives you back the class that you, you know, each one of these u is actually of a given class, right? So you have one feature per class. If that gives you back the class of that feature, you have a pretty strong indication that someone has been training on your data because so if you look at data in general, as we said, it has these true features. And if it's marked, it also has the fake features. So what kind of class it's going for, you can detect in the output distribution. But if you then input like a pure only the fake feature, and it still comes out the class that you assigned to the fake feature, you know, there is a one over number of classes, probability only that that happens by chance. And if you want, you can derive a different, you can do this again, you can drive a different pure, only this feature sample input it again, and look what comes out. So it's not it's not a pure test. So these are not going to be independent. So you probably shouldn't like just multiply. But I would think a procedure like this, and maybe they do this somewhere, but they simply say we can look at the loss of marked and unmarked data, which, you know, I'm not so sure that that's going to work fairly well. Okay. Um, as I said, there are going to be many, many ways to improve this, the paper has more experiments, ablations, transfer learning between architectures, and so on. I just want to point out I have a so there's a bit of an issue here, where where I think there is a lot of room to grow. First of all, here, you simply train the network, and then you look at the network at the end, right, you simply look at these 10 vectors right here, and you determine their inner product with the marking directions. And that's, you know, that's what you what you go by. What I would, what I would like to see as an iteration of this is where you have a neural network and you, you can't just detect by looking at the end, what you what you'd have to do, you'd have to be much more sneaky. So in order to avoid detection, detecting your detecting strategy, so in order to avoid defenses against this, I would, I would guess, what you want to do is not just, you know, make the network such that in the end, it's fairly obvious if by looking at this last matrix, maybe you should only be able to detect this at the end by actually feeding data into it like we did with the black box test. But if we had a white box test by feeding data into it, and then and then looking at the responses of the network, so, but someone couldn't not tell it was trained with radioactive data by just looking at the network's weights. So maybe one idea would be that you craft inputs in some way that correlates two of the hidden features. So let's say we have some hidden layer here, and one here. And these features are learned by the network, right? They appear to be fairly independent. So you make sure that they are fairly independent during if you pass regular data, and then you craft data specifically craft data like you did here with the marking that makes the network correlate the two features, but has little effect actually on the output distribution of the classes. So you can retain your generalization much more right? It doesn't change this last layer necessarily that much or not in a completely class dependent fashion. What I would simply do is I would correlate two of these internal features, I would force the network to learn to correlate them. Because then I would expect this to be much more, you know, secretive. And then at test time, I can simply introduce my forged data again and look whether or not the internal responses are actually correlated. And as I said, I could do this across classes to cancel out the effect of this actually being a feature for one given class and therefore changing the networks accuracy too much. I think that would be a cool next direction to go into. And again, this should work, because even the intermediate features, we have good reason to assume that different networks, even different architectures, different training runs, learn the same kind of intermediate features. The question is only in the next network that feature could actually be like, you know, two layers up or three layers down or and so on. So you'd have to learn some kind of more sophisticated alignment there. But still, I think that would be kind of an iteration of this, which would be cool. You know, if you're doing this, cite the channel. Yeah. All right. So that was it for me for this paper. As I said, pretty simple paper. Pretty cool idea. And I'll see you next time. Bye bye.
[{"start": 0.0, "end": 7.0, "text": " Are you tired of other people training on your data? That annoys me every time it happens."}, {"start": 7.0, "end": 18.0, "text": " I'm mad about this. If only there was a way to somehow mark your data and when other people train on it, their computer would explode."}, {"start": 18.0, "end": 26.0, "text": " Well, this paper is a little bit like this, not entirely. The explosion part I think they're still working on on a follow up paper."}, {"start": 26.0, "end": 38.0, "text": " But in this case, in this paper called radioactive data tracing through training by Alexander Sablerol, Matisse Douze, Cordelia Schmidt and Herv\u00e9 Jigu,"}, {"start": 38.0, "end": 47.0, "text": " they develop a method that at least you can detect if a given model was trained on your data or not on your data."}, {"start": 47.0, "end": 54.0, "text": " And they call this process radioactive marking or radioactive data for short."}, {"start": 54.0, "end": 62.0, "text": " So the overview you can see it's pretty easy paper actually. The concept is pretty easy and it's a nice concept."}, {"start": 62.0, "end": 72.0, "text": " And it's been around in one form or another. It touches on adversarial examples. It touches on differential privacy."}, {"start": 72.0, "end": 80.0, "text": " But in essence, it works like this. If you suspect someone else training on your data"}, {"start": 80.0, "end": 86.0, "text": " or if you just have a data set that you want to protect, what you do is you mark it."}, {"start": 86.0, "end": 95.0, "text": " You mark it with this mark and they call this a like a radioactive mark. But essentially, you just distort your images a little bit."}, {"start": 95.0, "end": 106.0, "text": " Then when someone else trains on that data, so here a convolutional neural network is trained on this data and not all of the data needs to be marked."}, {"start": 106.0, "end": 118.0, "text": " They can go as little as like one or two percent of the data being marked. Then from the output of that network or from the inspecting the network itself,"}, {"start": 118.0, "end": 126.0, "text": " you can then test whether or not this network has been trained on this radioactively labeled data."}, {"start": 126.0, "end": 136.0, "text": " So you will see a clear difference to a network that has been trained on only what they call vanilla data. So data that has not been marked."}, {"start": 136.0, "end": 148.0, "text": " So I hope that's clear. What you do is you train, sorry, you mark your data. What Bob does, no, what's the attacker's name?"}, {"start": 148.0, "end": 157.0, "text": " I don't know. But what Eve does is train here a network on data and you don't know whether it's this or this."}, {"start": 157.0, "end": 168.0, "text": " And then you do a test to figure out which one it is. OK, so we'll dive into the method and look at how well this works."}, {"start": 168.0, "end": 182.0, "text": " Pretty simple, but pretty cool. So their entire method rests on this kind of notion that these classifiers, what they do is if you have a neural network, like a convolutional neural network,"}, {"start": 182.0, "end": 195.0, "text": " you have your image, your starting image of your prototypical, I don't know, cat, and you input this into many, many layers of a neural network as we are used to."}, {"start": 195.0, "end": 204.0, "text": " But the last layer is a bit special, right? Because the last layer is the classification layer. Let's just assume this is a classifier."}, {"start": 204.0, "end": 215.0, "text": " So if this is CIFAR10, for example, there are 10 different classes that you could output. And so 10 of these bubbles right here."}, {"start": 215.0, "end": 226.0, "text": " That means that this matrix right here is a number of features. Let's call it D by 10 matrix."}, {"start": 226.0, "end": 234.0, "text": " OK, so the network, this part right here, we would usually call a feature extractor, something like this."}, {"start": 234.0, "end": 242.0, "text": " So the bottom part of the network basically does its nonlinear transformation and so on, extracts D features."}, {"start": 242.0, "end": 249.0, "text": " These are latent features. And then those features are linearly classified into 10 classes."}, {"start": 249.0, "end": 255.0, "text": " The important part here is that that last layer is actually just a linear classifier."}, {"start": 255.0, "end": 271.0, "text": " And we can reduce this actually down to a two class classifier. So the five function would just put points here in somehow, you know, let's just make them two classes, the X's and the O's and so on."}, {"start": 271.0, "end": 281.0, "text": " So if the five is good, then the last layer has a pretty easy job linearly classifying it right here."}, {"start": 281.0, "end": 286.0, "text": " You can see here the five is not very good. We can't linearly classify this data."}, {"start": 286.0, "end": 301.0, "text": " So by training the neural network, what you do is you make five such that it will place, hopefully, the one class somehow on one side, the other class on the other side."}, {"start": 301.0, "end": 313.0, "text": " And you can pretty easily linearly classify that data. OK, the exact slope of this of this line right here."}, {"start": 313.0, "end": 321.0, "text": " The exact location of this line and direction of this line. That's what's encoded ultimately in this matrix right here."}, {"start": 321.0, "end": 334.0, "text": " So this matrix now not only for two classes, but for 10 different classes, it records these hyperplanes that separate one class from the other class."}, {"start": 334.0, "end": 346.0, "text": " And these are in d dimensional space. So you have d dimensional, 10 d dimensional hyperplanes separating the space of features linearly into the classes."}, {"start": 346.0, "end": 355.0, "text": " So what you can do is you can actually think of this d, sorry, of these d dimensions here as features, right?"}, {"start": 355.0, "end": 363.0, "text": " This is a feature extractor, so it provides features to a linear classifier."}, {"start": 363.0, "end": 373.0, "text": " Now, what this method does is when it radioactively marks data points, it simply adds a feature."}, {"start": 373.0, "end": 377.0, "text": " OK, so how do you think about these features?"}, {"start": 377.0, "end": 383.0, "text": " So, for example, let's say this is actually this animal classification example."}, {"start": 383.0, "end": 396.0, "text": " And if you are if you are asked to classify cats from dogs, from horses and so on, one feature could be, does it have whiskers?"}, {"start": 396.0, "end": 407.0, "text": " One feature could be, does it have fur? Right? You can maybe distinguish cats from turtles and cats and dogs from turtles."}, {"start": 407.0, "end": 413.0, "text": " Does it have how many legs? So the number of legs and so on."}, {"start": 413.0, "end": 420.0, "text": " So you have all these features and the last layer simply linearly classifies those features together."}, {"start": 420.0, "end": 427.0, "text": " What this method does, this radioactive method, it adds a new feature per class."}, {"start": 427.0, "end": 437.0, "text": " So down here, I would add a new feature that says like this is the radioactive feature. Can I draw the radioactive symbol?"}, {"start": 437.0, "end": 445.0, "text": " This is the radioactive feature for the class cat."}, {"start": 445.0, "end": 450.0, "text": " OK, and then, of course, I also have one for dog and so on."}, {"start": 450.0, "end": 461.0, "text": " So it would add or basically would you don't change the dimensionality, but in essence, you add one feature per class."}, {"start": 461.0, "end": 465.0, "text": " And that's what they mean here by this direction U."}, {"start": 465.0, "end": 474.0, "text": " So in this high dimensional space that is spanned by these d dimensional vectors and you can."}, {"start": 474.0, "end": 482.0, "text": " So this thing here, OK, sorry, I'm switching back and forth. This thing here, you can sort of if d is equal to two,"}, {"start": 482.0, "end": 489.0, "text": " you can imagine it as 10 vectors in a space in this feature space."}, {"start": 489.0, "end": 496.0, "text": " OK, 10 of these vectors. And whenever you get a point, that's is that eight?"}, {"start": 496.0, "end": 507.0, "text": " Whenever you get a point, you simply look at. So if you get a data point right in here, goes through here, you come here and you look."}, {"start": 507.0, "end": 514.0, "text": " With which class does it align more the most? And that's how you classify it."}, {"start": 514.0, "end": 530.0, "text": " OK, so if you think of this, then what you what you want to do is you want to add a feature here such that this is one per class."}, {"start": 530.0, "end": 536.0, "text": " I'm having trouble articulating this and you want to change your data points."}, {"start": 536.0, "end": 546.0, "text": " Here you can see your data points. And for this class X, we make this radioactive feature right here, which is the blue thing."}, {"start": 546.0, "end": 550.0, "text": " We shift the data into the direction of this feature."}, {"start": 550.0, "end": 557.0, "text": " OK, so basically we add the feature U, which is just a random vector in this high dimensional space."}, {"start": 557.0, "end": 565.0, "text": " We choose one vector per class, but then we shift all the data for that class along this feature."}, {"start": 565.0, "end": 573.0, "text": " So what we are doing is we are introducing a fake feature that we derived from the label, right?"}, {"start": 573.0, "end": 583.0, "text": " So we kind of cheated. Here you have X and you're supposed to tell Y from it, and that's your training data."}, {"start": 583.0, "end": 593.0, "text": " But then we cheat. We look at Y and we modify X with the feature of that particular class."}, {"start": 593.0, "end": 601.0, "text": " So what does that do? Ultimately, we have we end up with U1, U2 and so on."}, {"start": 601.0, "end": 609.0, "text": " So one feature per class. It trains the classifier to pay attention to these features."}, {"start": 609.0, "end": 619.0, "text": " So if U1 is the feature for cat, then we train this classifier by training it on the data that has been modified in this way."}, {"start": 619.0, "end": 634.0, "text": " We train it. A cat should consist of something that has whiskers, has fur, has four legs and so on, and also has this cat feature."}, {"start": 634.0, "end": 644.0, "text": " Now the danger, of course, here is that the classifier will stop to pay attention to anything else and only look at the cat feature."}, {"start": 644.0, "end": 651.0, "text": " Because we introduced this feature to every single example that was of class cat."}, {"start": 651.0, "end": 661.0, "text": " So the classifier could have a pretty easy way just looking at this feature, determining well, all of this is cat and then it would not generalize at all."}, {"start": 661.0, "end": 667.0, "text": " So what we can do is, first of all, we can make the feature very low signal."}, {"start": 667.0, "end": 677.0, "text": " We can make it very small, such that there are other features such that these other features are also pretty easy for the network to pay attention to."}, {"start": 677.0, "end": 682.0, "text": " And second of all, we can label not all data. And that's what they do here."}, {"start": 682.0, "end": 694.0, "text": " They label maybe 10%, maybe 2% of the data with that, which forces the network to pay some attention to this feature, but also to pay attention to the other features."}, {"start": 694.0, "end": 711.0, "text": " And that ultimately, if you trade this off correctly, results in a classifier that it does give up some of its generalization capability because, of course, 0% of the test data has these features right here."}, {"start": 711.0, "end": 716.0, "text": " We modify the training data to add these features."}, {"start": 716.0, "end": 726.0, "text": " So you give up a little bit of generalization capability, but you force the classifier to pay attention to this feature during training."}, {"start": 726.0, "end": 730.0, "text": " And that is something that you can then detect."}, {"start": 730.0, "end": 739.0, "text": " So you can imagine if you train a classifier that has been trained on training data, where some of the training data have these features in here."}, {"start": 739.0, "end": 744.0, "text": " And that's one distinct feature per class, right?"}, {"start": 744.0, "end": 755.0, "text": " Then you can look at the final classifier and figure out whether or not the classifier has been trained."}, {"start": 755.0, "end": 756.0, "text": " How do we do that?"}, {"start": 756.0, "end": 767.0, "text": " So let's imagine that in this high dimensional space here, the training examples, they point in kind of this direction right here."}, {"start": 767.0, "end": 770.0, "text": " Okay, so all the training examples of one particular class."}, {"start": 770.0, "end": 772.0, "text": " So this is now the dog class."}, {"start": 772.0, "end": 774.0, "text": " All the training examples point here."}, {"start": 774.0, "end": 776.0, "text": " How would you build your classifier?"}, {"start": 776.0, "end": 777.0, "text": " Well, it's pretty easy."}, {"start": 777.0, "end": 783.0, "text": " I would build it such that the dog class points in this direction."}, {"start": 783.0, "end": 786.0, "text": " Okay, I'm just erased a bunch of other classes right here."}, {"start": 786.0, "end": 794.0, "text": " Now, I choose a random feature when I build my radioactive thing."}, {"start": 794.0, "end": 798.0, "text": " I choose a random feature like this one right here."}, {"start": 798.0, "end": 805.0, "text": " Okay, and what I'll do is I'll shift my training data a bit into that direction."}, {"start": 805.0, "end": 808.0, "text": " Okay, how do we do this?"}, {"start": 808.0, "end": 810.0, "text": " How are we doing this?"}, {"start": 810.0, "end": 812.0, "text": " I'll just dash it."}, {"start": 812.0, "end": 818.0, "text": " Okay, so I'll shift my training data a little bit into this direction."}, {"start": 818.0, "end": 821.0, "text": " So all of these, they move over right here."}, {"start": 821.0, "end": 830.0, "text": " And that's where the final classifier will come to lie a lot more towards this new feature."}, {"start": 830.0, "end": 834.0, "text": " And this is something we can now test with a statistical test."}, {"start": 834.0, "end": 837.0, "text": " And that's what this paper kind of works out in the math."}, {"start": 837.0, "end": 849.0, "text": " So usually if you have one vector in high dimensional space, like this one, and then you look at the distribution of random vectors."}, {"start": 849.0, "end": 853.0, "text": " So this one, maybe this one, this one feels pretty random."}, {"start": 853.0, "end": 855.0, "text": " This one's pretty random."}, {"start": 855.0, "end": 859.0, "text": " Okay, humans are terrible random number generators, but these feel pretty random."}, {"start": 859.0, "end": 865.0, "text": " And you look at the cosines between the random vector and the vector you plotted initially."}, {"start": 865.0, "end": 870.0, "text": " They follow, if this is truly random, they follow a distribution."}, {"start": 870.0, "end": 879.0, "text": " They follow this particular distribution that they derive here."}, {"start": 879.0, "end": 888.0, "text": " Okay, so you can see a classic result from statistics shows that this cosine similarity follows incomplete beta distribution with these parameters."}, {"start": 888.0, "end": 894.0, "text": " Now, they from this, they derive a statistical test."}, {"start": 894.0, "end": 910.0, "text": " So if you know what kind of distribution a quantity follows, you can derive a statistical test to see whether or not what you measure is actually likely to come from that distribution or not."}, {"start": 910.0, "end": 922.0, "text": " So what we would expect if our data has not been modified is that, you know, we choose a random direction, a random direction, U right here."}, {"start": 922.0, "end": 926.0, "text": " This is U for dog."}, {"start": 926.0, "end": 928.0, "text": " We choose that random direction."}, {"start": 928.0, "end": 941.0, "text": " And if our training data has not been modified, we would expect this dog here to have its cosine similarity to be not very high because there's no reason for it, right?"}, {"start": 941.0, "end": 945.0, "text": " These are just basically two vectors that are random to each other."}, {"start": 945.0, "end": 948.0, "text": " And in high dimensions, they should be almost orthogonal."}, {"start": 948.0, "end": 952.0, "text": " So in high dimensions, random vectors are almost orthogonal."}, {"start": 952.0, "end": 967.0, "text": " However, if the data has been marked during before training, that means if the classifier used our marked data set to train it, we would expect this cosine similarity right here to be not orthogonal."}, {"start": 967.0, "end": 971.0, "text": " So to be higher than just random."}, {"start": 971.0, "end": 973.0, "text": " And that's exactly what we can test."}, {"start": 973.0, "end": 977.0, "text": " And that's exactly what you saw at the beginning right here."}, {"start": 977.0, "end": 984.0, "text": " So here is the down here, you can see the distribution of cosine similarities."}, {"start": 984.0, "end": 994.0, "text": " And you can see that if you train with without marked data, this centers, you know, around zero."}, {"start": 994.0, "end": 1010.0, "text": " However, if you train with marked data, you have a statistically significant shift between the marking direction, the marking feature, and between the classifier direction."}, {"start": 1010.0, "end": 1026.0, "text": " So the all you have to do is mark your data in this way, and then look at the final classifier, look and these blue vectors right here, these are just the entries of this final weight matrix, right?"}, {"start": 1026.0, "end": 1029.0, "text": " These are the blue vectors."}, {"start": 1029.0, "end": 1045.0, "text": " You look at those, and you simply determine if the for the given class, if the vector for the given class has a high cosine similarity with the marking direction that you chose to mark your data."}, {"start": 1045.0, "end": 1051.0, "text": " If it does, you can be fairly sure that the network has been trained using your data."}, {"start": 1051.0, "end": 1063.0, "text": " Okay, so I hope the principle is clear, you introduce a fake feature per class, and you make the network pay a little bit of attention to that feature, because it's, you know, a good feature in the training data."}, {"start": 1063.0, "end": 1073.0, "text": " And then, you know, after training, you can go ahead and see whether or not the network is actually sensitive to that feature that you fake introduced that is actually not a real feature in the data."}, {"start": 1073.0, "end": 1085.0, "text": " If the network is sensitive to it, you can conclude that your training data was used in order to produce it."}, {"start": 1085.0, "end": 1088.0, "text": " So there's a couple of finesses right here."}, {"start": 1088.0, "end": 1095.0, "text": " So, as you might have noticed, we introduce these fake features in this last layer feature space right here."}, {"start": 1095.0, "end": 1102.0, "text": " However, our pictures are actually input here in front of this feature extractor."}, {"start": 1102.0, "end": 1111.0, "text": " So we need a way to say what we want to do is we want to say I want this data point here to be shifted in this direction."}, {"start": 1111.0, "end": 1124.0, "text": " But I actually, this data point is actually a result from an input data point, I will call this I right here, going through a nonlinear neural network ending up here."}, {"start": 1124.0, "end": 1132.0, "text": " So the way this is done is by using the same kind of back propagation that we use when we create adversarial examples."}, {"start": 1132.0, "end": 1145.0, "text": " So what we do is we define this distance or this distance here, where we would like to go and where we are as a loss, and then back propagate that loss through the neural network."}, {"start": 1145.0, "end": 1152.0, "text": " And then at the end, we know how to change the image I in order to adjust that feature."}, {"start": 1152.0, "end": 1156.0, "text": " So they define a loss right here that they minimize."}, {"start": 1156.0, "end": 1160.0, "text": " And you can see, here is where you want to go in feature space."}, {"start": 1160.0, "end": 1166.0, "text": " And they have different regularizers such that their perturbation in input space is not too high."}, {"start": 1166.0, "end": 1173.0, "text": " And also here, their perturbation in feature space is actually not too high."}, {"start": 1173.0, "end": 1180.0, "text": " So they, they want, they also have the goal that this radioactive marking cannot be detected, first of all."}, {"start": 1180.0, "end": 1194.0, "text": " And also that is, it's, it's a robust to relabeling, like if you give me data, and I go and relabel it and ask my mechanical Turk workers to relabel that data again,"}, {"start": 1194.0, "end": 1200.0, "text": " they will give them the same, the same label, even if you have radioactively marked them, right?"}, {"start": 1200.0, "end": 1202.0, "text": " This paper says nothing about defenses, right?"}, {"start": 1202.0, "end": 1217.0, "text": " These things are defended against fairly easily, I would guess, by, by some Gaussian blur, I guess, would be fairly effective right here, though."}, {"start": 1217.0, "end": 1222.0, "text": " There are also ways around this. This gets into the same discussion as adversarial examples."}, {"start": 1222.0, "end": 1233.0, "text": " The question here is, can you detect somehow in the final classifier whether or not this someone has smuggled radioactive data into you into your training process?"}, {"start": 1233.0, "end": 1239.0, "text": " I'm not sure, but I'm also sure there are better ways to radioactively mark right here."}, {"start": 1239.0, "end": 1245.0, "text": " This is kind of an establishing paper, doing the most basic thing right here."}, {"start": 1245.0, "end": 1254.0, "text": " Interestingly, they also back propagate through kind of data augmentation procedures as long as they are differentiable."}, {"start": 1254.0, "end": 1264.0, "text": " And the last kind of difficulty you have is that these neural networks, they are, they have some symmetries built into them."}, {"start": 1264.0, "end": 1269.0, "text": " So if you retrain a neural network, there's actually no."}, {"start": 1269.0, "end": 1275.0, "text": " So if your neural networks classification, let's say it's a three class classification, looks like this, right?"}, {"start": 1275.0, "end": 1279.0, "text": " This is the last layer and these are the classes it's determined."}, {"start": 1279.0, "end": 1286.0, "text": " If you retrain it, it might as well be that this now looks like this, right?"}, {"start": 1286.0, "end": 1301.0, "text": " So if you marked it with this direction right here and then you try to recover this direction, you will find that it doesn't work because the entire classifier has shifted."}, {"start": 1301.0, "end": 1313.0, "text": " So what they have to do is they have to do what they call a subspace alignment, which you can do by simply here determining a linear transformation in the last layer."}, {"start": 1313.0, "end": 1325.0, "text": " This is usually enough and what this does is, so their entire procedure is they train themselves a classifier on unmarked data."}, {"start": 1325.0, "end": 1328.0, "text": " I forgot this before. I should have mentioned this."}, {"start": 1328.0, "end": 1331.0, "text": " They train themselves a classifier on unmarked data."}, {"start": 1331.0, "end": 1341.0, "text": " They use that classifier to mark the data, which, you know, you need in order to do this back propagation thing, you actually need a working classifier."}, {"start": 1341.0, "end": 1352.0, "text": " And then when they give the data to someone else to train, they are going to train their own classifier on the same data, right?"}, {"start": 1352.0, "end": 1359.0, "text": " So there is no guarantee that these two classifiers spaces aligned, especially because you have this kind of symmetry."}, {"start": 1359.0, "end": 1369.0, "text": " And they say right here, we can fix that by if, you know, we have this classifier and at the end they give us this classifier to test."}, {"start": 1369.0, "end": 1376.0, "text": " We can simply determining this linear transformation here that maps one to the other."}, {"start": 1376.0, "end": 1380.0, "text": " So we go over our data set, we determine M, a linear transformation."}, {"start": 1380.0, "end": 1390.0, "text": " Basically here, you would determine a rotation of this space that would map one to the other and vice versa."}, {"start": 1390.0, "end": 1398.0, "text": " This is not exact, of course, because the two classifier, there's no reason why they should even be linearly related."}, {"start": 1398.0, "end": 1403.0, "text": " But there is a reason coming from kind of neural network knowledge."}, {"start": 1403.0, "end": 1416.0, "text": " And that is that we know or we have a strong suspicion that these neural networks, of course, if they work well and if they reach good accuracy and if they reach similar accuracy,"}, {"start": 1416.0, "end": 1422.0, "text": " it's very probable that they have somehow figured out the same features."}, {"start": 1422.0, "end": 1429.0, "text": " Okay, even though these networks learn each feature from scratch and that you, as I said, you have some symmetries in there."}, {"start": 1429.0, "end": 1439.0, "text": " But ultimately at the end of the neural network is very likely that the network learns the same features as another network,"}, {"start": 1439.0, "end": 1444.0, "text": " even of a different architecture that has been trained on the same data set."}, {"start": 1444.0, "end": 1456.0, "text": " This is, I think this is supported by research in adversarial examples like this paper, Adversarial Examples are Features, Not Bugs."}, {"start": 1456.0, "end": 1464.0, "text": " You know, transfer learning, transfer of adversarial examples, all of this kind of stuff points to the fact that these networks tend to extract the same features."}, {"start": 1464.0, "end": 1476.0, "text": " And therefore, we can assume pretty safely that up to this kind of rotational symmetry, our space, our feature space will look the same."}, {"start": 1476.0, "end": 1485.0, "text": " And therefore, determining kind of this linear transformation should probably be enough in order to align one subspace with the other"}, {"start": 1485.0, "end": 1496.0, "text": " and be able to compare your own classifier that you have trained to mark the data to the classifier that someone else has trained on the same data."}, {"start": 1496.0, "end": 1501.0, "text": " Okay, this is kind of the one of the difficulties they had to overcome."}, {"start": 1501.0, "end": 1511.0, "text": " And yeah, they evaluate this, they evaluate this experimentally, you can see right here on the right,"}, {"start": 1511.0, "end": 1520.0, "text": " 20% of the training data has been marked in order for the orange data."}, {"start": 1520.0, "end": 1526.0, "text": " These are random directions. So blue would be the correlation with random directions."}, {"start": 1526.0, "end": 1535.0, "text": " And because, sorry, orange is the correlation with these carrier directions with the directions of the fake features."}, {"start": 1535.0, "end": 1541.0, "text": " And green is the alignment with actually the features of the classes itself."}, {"start": 1541.0, "end": 1550.0, "text": " So you can see even if 20% of the data is marked, the classifier still aligns mostly with the features of the actual classification problem,"}, {"start": 1550.0, "end": 1559.0, "text": " it aligns a little bit with the features of the fake features or with the fake features."}, {"start": 1559.0, "end": 1568.0, "text": " And it does so such that there is a statistically significant difference between random directions and these."}, {"start": 1568.0, "end": 1578.0, "text": " And you can see even if 2% of the data only are marked, so only 2% of the training data has this mark and the mark is always imperceptible, right?"}, {"start": 1578.0, "end": 1582.0, "text": " The mark is always such that you can't see it by eye."}, {"start": 1582.0, "end": 1586.0, "text": " Even then you can see that there is a difference."}, {"start": 1586.0, "end": 1595.0, "text": " So the classifier does learn to pay attention to that feature, which is something you can detect afterwards."}, {"start": 1595.0, "end": 1603.0, "text": " This experiment on the left here is just the same basically saying, so up here it starts with not a lot of data being marked."}, {"start": 1603.0, "end": 1608.0, "text": " And you can see it mostly aligns with the semantic direction, which is the true features."}, {"start": 1608.0, "end": 1615.0, "text": " As you mark more and more of the data, it goes down and down and down, but it does not."}, {"start": 1615.0, "end": 1621.0, "text": " So I think this is 50% is the yellow, 50% of the data is marked."}, {"start": 1621.0, "end": 1634.0, "text": " And still you can see there is a pretty good alignment with the actual features because the network will start paying more and more attention to your fake features because they're pretty good predictors, right?"}, {"start": 1634.0, "end": 1641.0, "text": " But it also has this other training data that it can't solve using those features."}, {"start": 1641.0, "end": 1647.0, "text": " So it still needs to pay attention. And of course, your marked data also has these these other true features."}, {"start": 1647.0, "end": 1659.0, "text": " So it is to be expected that even though your data is marked, it's still the classifier still aligns more with the true features than with your fake features."}, {"start": 1659.0, "end": 1665.0, "text": " And they also show in experiments that you do not sacrifice a lot in accuracy."}, {"start": 1665.0, "end": 1673.0, "text": " So here you can see the delta in accuracy through their experiments is fairly, fairly low."}, {"start": 1673.0, "end": 1681.0, "text": " And they do ImageNet on ResNet 18. So these differences in accuracy is there."}, {"start": 1681.0, "end": 1689.0, "text": " They are, you know, you notice, but they are fairly small."}, {"start": 1689.0, "end": 1698.0, "text": " So, you know, someone also couldn't just go on a big accuracy drop when training on data like this."}, {"start": 1698.0, "end": 1707.0, "text": " So someone training with data couldn't just notice that it's radioactively marked by just saying, like, well, this doesn't work at all."}, {"start": 1707.0, "end": 1725.0, "text": " I guess some clustering approaches would work where you look at the features and you just see this one feature is like only present in this very particular group of data that I got from this very shady person selling me 3.5 inch floppy disks around the street corner."}, {"start": 1725.0, "end": 1735.0, "text": " But other than that, yeah, it's not really, it's not really detectable for someone training on it."}, {"start": 1735.0, "end": 1741.0, "text": " And lastly, they have black box. They defend against black box attacks. And here's where I'm a bit skeptical."}, {"start": 1741.0, "end": 1749.0, "text": " They say, well, if we don't have access to the model, what we can still do is basically this is here."}, {"start": 1749.0, "end": 1778.0, "text": " What we can still do is we can analyze the loss. So we can analyze the loss value of the radioactively marked data. And if the network we're testing is has significantly lower loss on our on the radioactively marked data, then on non marked data, then that's an indication that they trained on marked data, which, you know, if you don't have access to the model,"}, {"start": 1778.0, "end": 1788.0, "text": " like what's the probability that you have access to the loss of the model, like the usually you need, you need the output distribution or something."}, {"start": 1788.0, "end": 1796.0, "text": " It's a bit shady. What I would do actually is, is just a little bit more sophisticated."}, {"start": 1796.0, "end": 1806.0, "text": " But what you could do is you could take your direction, you, right, you could back propagate it through your network to derive like a pure adversarial example."}, {"start": 1806.0, "end": 1821.0, "text": " So not even going from from some image, just go from random noise, like just derive like a super duper image that only has that one feature, like, and then input that into this classifier."}, {"start": 1821.0, "end": 1839.0, "text": " So this is yours, and then input that into the classifier that you are testing. Okay. And if that classifier gives you back the class that you, you know, each one of these u is actually of a given class, right?"}, {"start": 1839.0, "end": 1856.0, "text": " So you have one feature per class. If that gives you back the class of that feature, you have a pretty strong indication that someone has been training on your data because so if you look at data in general, as we said, it has these true features."}, {"start": 1856.0, "end": 1865.0, "text": " And if it's marked, it also has the fake features. So what kind of class it's going for, you can detect in the output distribution."}, {"start": 1865.0, "end": 1882.0, "text": " But if you then input like a pure only the fake feature, and it still comes out the class that you assigned to the fake feature, you know, there is a one over number of classes, probability only that that happens by chance."}, {"start": 1882.0, "end": 1898.0, "text": " And if you want, you can derive a different, you can do this again, you can drive a different pure, only this feature sample input it again, and look what comes out. So it's not it's not a pure test."}, {"start": 1898.0, "end": 1918.0, "text": " So these are not going to be independent. So you probably shouldn't like just multiply. But I would think a procedure like this, and maybe they do this somewhere, but they simply say we can look at the loss of marked and unmarked data, which, you know, I'm not so sure that that's going to work fairly well."}, {"start": 1918.0, "end": 1929.0, "text": " Okay. Um, as I said, there are going to be many, many ways to improve this, the paper has more experiments, ablations, transfer learning between architectures, and so on."}, {"start": 1929.0, "end": 1939.0, "text": " I just want to point out I have a so there's a bit of an issue here, where where I think there is a lot of room to grow."}, {"start": 1939.0, "end": 1953.0, "text": " First of all, here, you simply train the network, and then you look at the network at the end, right, you simply look at these 10 vectors right here, and you determine their inner product with the marking directions."}, {"start": 1953.0, "end": 1973.0, "text": " And that's, you know, that's what you what you go by. What I would, what I would like to see as an iteration of this is where you have a neural network and you, you can't just detect by looking at the end, what you what you'd have to do, you'd have to be much more sneaky."}, {"start": 1973.0, "end": 2002.0, "text": " So in order to avoid detection, detecting your detecting strategy, so in order to avoid defenses against this, I would, I would guess, what you want to do is not just, you know, make the network such that in the end, it's fairly obvious if by looking at this last matrix, maybe you should only be able to detect this at the end by actually feeding data into it like we did with the black box test."}, {"start": 2002.0, "end": 2019.0, "text": " But if we had a white box test by feeding data into it, and then and then looking at the responses of the network, so, but someone couldn't not tell it was trained with radioactive data by just looking at the network's weights."}, {"start": 2019.0, "end": 2037.0, "text": " So maybe one idea would be that you craft inputs in some way that correlates two of the hidden features. So let's say we have some hidden layer here, and one here. And these features are learned by the network, right?"}, {"start": 2037.0, "end": 2060.0, "text": " They appear to be fairly independent. So you make sure that they are fairly independent during if you pass regular data, and then you craft data specifically craft data like you did here with the marking that makes the network correlate the two features, but has little effect actually on the output distribution of the classes."}, {"start": 2060.0, "end": 2080.0, "text": " So you can retain your generalization much more right? It doesn't change this last layer necessarily that much or not in a completely class dependent fashion. What I would simply do is I would correlate two of these internal features, I would force the network to learn to correlate them."}, {"start": 2080.0, "end": 2095.0, "text": " Because then I would expect this to be much more, you know, secretive. And then at test time, I can simply introduce my forged data again and look whether or not the internal responses are actually correlated."}, {"start": 2095.0, "end": 2112.0, "text": " And as I said, I could do this across classes to cancel out the effect of this actually being a feature for one given class and therefore changing the networks accuracy too much. I think that would be a cool next direction to go into."}, {"start": 2112.0, "end": 2127.0, "text": " And again, this should work, because even the intermediate features, we have good reason to assume that different networks, even different architectures, different training runs, learn the same kind of intermediate features."}, {"start": 2127.0, "end": 2147.0, "text": " The question is only in the next network that feature could actually be like, you know, two layers up or three layers down or and so on. So you'd have to learn some kind of more sophisticated alignment there. But still, I think that would be kind of an iteration of this, which would be cool."}, {"start": 2147.0, "end": 2151.0, "text": " You know, if you're doing this, cite the channel."}, {"start": 2151.0, "end": 2161.0, "text": " Yeah. All right. So that was it for me for this paper. As I said, pretty simple paper. Pretty cool idea. And I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=9-o2aAoN0rY
Fast reinforcement learning with generalized policy updates (Paper Explained)
#ai #research #reinforcementlearning Reinforcement Learning is a powerful tool, but it is also incredibly data-hungry. Given a new task, an RL agent has to learn a good policy entirely from scratch. This paper proposes a new framework that allows an agent to carry over knowledge from previous tasks into solving new tasks, even deriving zero-shot policies that perform well on completely new reward functions. OUTLINE: 0:00 - Intro & Overview 1:25 - Problem Statement 6:25 - Q-Learning Primer 11:40 - Multiple Rewards, Multiple Policies 14:25 - Example Environment 17:35 - Tasks as Linear Mixtures of Features 24:15 - Successor Features 28:00 - Zero-Shot Policy for New Tasks 35:30 - Results on New Task W3 37:00 - Inferring the Task via Regression 39:20 - The Influence of the Given Policies 48:40 - Learning the Feature Functions 50:30 - More Complicated Tasks 51:40 - Life-Long Learning, Comments & Conclusion Paper: https://www.pnas.org/content/early/2020/08/13/1907370117 My Video on Successor Features: https://youtu.be/KXEEqcwXn8w Abstract: The combination of reinforcement learning with deep learning is a promising approach to tackle important sequential decision-making problems that are currently intractable. One obstacle to overcome is the amount of data needed by learning systems of this type. In this article, we propose to address this issue through a divide-and-conquer approach. We argue that complex decision problems can be naturally decomposed into multiple tasks that unfold in sequence or in parallel. By associating each task with a reward function, this problem decomposition can be seamlessly accommodated within the standard reinforcement-learning formalism. The specific way we do so is through a generalization of two fundamental operations in reinforcement learning: policy improvement and policy evaluation. The generalized version of these operations allow one to leverage the solution of some tasks to speed up the solution of others. If the reward function of a task can be well approximated as a linear combination of the reward functions of tasks previously solved, we can reduce a reinforcement-learning problem to a simpler linear regression. When this is not the case, the agent can still exploit the task solutions by using them to interact with and learn about the environment. Both strategies considerably reduce the amount of data needed to solve a reinforcement-learning problem. Authors: André Barreto, Shaobo Hou, Diana Borsa, David Silver, and Doina Precup Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, today we're looking at fast reinforcement learning with generalized policy updates by Andre Barretto, Shavo Ho, Diana Borsa, David Silver and Doina Precu. So on high level, this paper proposes a framework for reinforcement learning, where you have many tasks at the same time. And they propose a framework where they learn many policies at the same time that can or cannot correspond to these tasks. And then their argument is that if you now have a new task that you haven't seen before, you can easily construct a solution to that task from your old policies, basically mixing what you learned about your old tasks. And it's a pretty general framework, and we're going to look at it. In my opinion, it's it's pretty cool for certain settings. However, I think it kind of breaks down the more general you go, which I guess is expected of such a framework. But it's, as you can see, it's kind of math heavy, but we'll get into the examples and what it's potentially useful for. Alright, so that was it on a high level. If you like content like this, don't hesitate to subscribe to the channel and share it out, leave a like and tell me in the comments what you think. I'm still reading all of them. So I will see it. Cool, let's dive in. So they say the combination of reinforcement learning with deep learning is promising approach to tackle important sequential decision making problems that are currently intractable. Well, they're taking they're talking about, you know, things like mostly these game playing AI is like go and things like this. So where this combination of deep learning with reinforcement learning has really shined, or shown, whatever, one obstacle to overcome is the amount of data needed by learning systems of this type. So again, if you look at these systems like AlphaGo, they need a simulator, and they need to collect enormous amounts of data, even more so with systems like the Dota AI, the OpenAI5, Dota or Starcraft playing Alpha Star, I think it's Alpha Star. They need so many simulations in order to learn about the tasks because they always start from scratch. In this article, they say, we propose to address this issue through a divide and conquer approach. We argue that complex decision problems can be naturally decomposed into multiple tasks that unfold in sequence or in parallel. By associating each task with a reward function, this problem decomposition can be seamlessly accommodated within the standard reinforcement learning formalism. Okay, so what are they saying right here, they are basically saying that if you have a task, let's say you want to get what's the from here to here. And that's very complicated. Let's make it complicated, super duper complicated. You can basically subdivide that task into multiple sub tasks, right? So here is like, left turn, right turn, go straight, left turn, go straight, right turn, and so on. And each of these sub tasks, you can see the two right turns here might share a lot of common information, there could also be tasks that are at the same time, like you need to go forward and jump can be decomposed into going forward and to jump. Now, they're saying is if each of these tasks now has its separate reward function in the environment, like for some reason, the environment tells you this, by the way, is task, task one, and you're going to get a positive reward if you do a right turn. And this down here is task two, the left turn task, and you're going to get a positive reward if for that task. So the entire task state can be decomposed into a vector. So in our case, here, we have maybe a vector with three elements, okay, the three elements correspond to turn right, go straight, and turn left. And now you're this, this right here is your reward vector. So we're no longer talking this framework, we're no longer talking about just a reward, we're talking about a reward vector. Now, each of these tasks is going to give you its own individual reward. So let's say you're here, and you're actually turning right, this is going to give you a reward of one for this task, but rewards of zero for the other task. Okay. So the environment will somehow tell you which tasks you you get reward for. Now, there is a notion where you can map this back to a single number. And that is the second thing they introduce here. So the second thing they introduce here is this thing they call w. So w is going to be a mixing vector, w is going to be a vector, I will call w right here, this is the reward vector, w is going to be the vector that tells you your final reward. So here, we're going to do an inner product. So we're going to transpose this and multiply by w. And w mixes these rewards and comes up with your final reward right here. So this, this is maybe the reward vector, this is the reward number, how are we going to call this reward number. So in this case, w would have to look something like this, let's say, this is an example. So the task right here would be to only do right turns. Now, this is not a really nice example, we're going to see some nicer examples later on. But you can see that now the environment is specified as a vector of rewards. And you can create a specific tasks like turning right, simply by adjusting how you mix these different things by this vector w. And this is going to be the key ingredient here. So they discuss your general reinforcement learning, the reinforcement learning lingo. And I think we've gone through this a number of times just very, very quickly. In reinforcement learning, you're given these transitions, you are in a state, you take an action. And that leads you to get a reward r prime, and you get into a state s prime in the next state, they say the reward is given by the reward function. So the reward is purely a function of where you are and what you do and where you get to. Now, most reinforcement learning problems, you can actually kind of forget about this part right here. Because, well, it is, it is kind of important, but you could most reinforcement learning problems, the reward is simply a matter of where you are and what you do. And this can be a random variable, there can be randomness. But maybe it's easier if you for now think about the reward simply as a function of these two things. So what you want to discover is a policy pi, where you input, you input where you are, and the output is going to be what you should you do in that situation. Okay, that is a policy. And associated with each policy is this thing called the Q function. So you can see right here, the Q function of a policy is going to be a function of where you are and what you do. And this is a bit confusing, but it basically means that you are in state s. So you are here. And you have, let's say three options, action one, action two, action three to do. Now the Q function tells you the Q function, this is s, and the A's are the numbers, okay. So let's say we plug in the state s. And for a we plug in number two, what it will tell you is, if I am in state s, and I perform action number two, then how valuable is that for me, and value is defined by all the reward that I'm going to pick up from now until the end of time, or the end of the episode, it depends. But let's say until the end of time, well, how much how much how much reward am I going to pick up from now until the end of time, is a bit of a vague, not a vague question, but a difficult question, I can tell you how much I could estimate how much reward I'm going to pick up in the next step, because I know what action I'm doing, I'm performing action number two, but what happens after that? Who knows? So that's where this policy right here comes in. This policy right here says, so the full definition of the Q function is if I'm in state s, and I perform action a right now, and after that, I follow policy pi, what is my reward going to be right now, it's well defined. So right now you do action a. And after that, you do whatever action the policy tells you in that specific situation. Okay, so that's the Q function. And you can pretty easily see that if you have a Q function, right, if you have an accurate Q function, you can get a good policy by simply always going with the action that gives you the highest Q value. Because it's because of a recurrence relationship called the the Bellman equation. This thing right here, so your Q function basically decomposes into the reward in the next step, as we said, plus whatever happens after that, and whatever happens after that is just by the nature of how the things are defined is going to be the Q function of whatever the policy is telling you. So you can get a pretty good policy by always doing whatever action your Q function tells you is best. This step of calculating the Q function is called a policy evaluation. And this paper here is going to generalize these notions. Sorry, so this is a policy evaluation. And then the act of selecting an action is going to be a policy improvement. These are just names, okay. But we need to know them because the paper introduces two new things. I'm going to where do I highlight policy evaluation? I don't know. But here they say this is the policy improvement. Okay, here, policy evaluation, policy improvement, these are the two steps. So the first step is calculate the Q function. The second step is to select an action. And you can see how these things interlock, namely, we can calculate the Q function of a given policy, and we can improve that policy by selecting whatever action is best for the Q function. This paper generalizes this, and you can see that there is a little a little R right here. So the R is just a specific way to reference the reward function used right here. Okay, and you can see it here as well. Now, usually, we have one policy and one reward, right. And so what we do is we improve the policy. And that leads us to better evaluate the Q function for a given reward function. And that leads us to improve the policy. Now, this paper is going to transform this into the following. We have many policies. So we have policy one, policy two, and so on, until policy, P. And we also have many reward functions, reward one, reward two, reward three, and so on until reward, let's call that R. So we have many different tasks, right here. And we have many policies. Now, in essence, they don't need to have some anything to do with each other for the theory of this paper. But I can simplify this a bit of how they see the world. So let's say you have an agent, and the agent has been trained on simply that first task right here, and has been trained using classic Q learning, reinforcement learning whatnot, and that results in this particular policy. And then the agent just from scratch, you restart it again, you run reinforcement learning just on reward number two, and obtained policy number two, and so on. So you do this for all these rewards individually, okay, so you give the agent a new task, and you ask it to learn a policy for that task. Now, you're in a situation where if you are in have a new task, so our new, the question is, do you again, need to train a new policy? And the answer for this paper is no, because we have all these policies, we don't need to train a new we can simply mid mix and match these policies that we already know to obtain a good solution for the new task. So how does the paper do it? It does it? Yeah, it does it in the following. It defines the successor features, okay? Maybe it's in maybe it's better if we first go to an example. So the example they give here is the following. Otherwise, this I guess this might sound just a bit too abstract. Okay, so you have this world here, the agent is the thing here in yellow, and it can just move. So its actions are move left, up, right, down, this, this is one step, okay, in the environment, there are two different objects, one object is a triangle, and one object is a square, okay. So there are a number of tasks we can define right now in this thing. So we define tasks according to a reward function. So the reward, let's say the reward one is going to be one, if, if it picks up a square, sorry, the square and zero else, just if it picks up a square on any given step, we give it a reward of one, we don't care about the blue triangles, okay. And then reward two is going to be the opposite, it's going to be one, not the opposite, but one if it picks up a triangle, and zero else. So you can see the good policies right here. So pi one is a good policy for reward one, because it just goes and collects these red things doesn't care about the blue things just goes and collects them by two, it goes and collects the blue things doesn't care about the red things, okay. So let's imagine that you have run reinforcement learning twice, once for reward one, and once for reward two. And now you have two policies, okay, so you have two policies, this will lead to pi one, this will lead to pi two. And now I give you the third task. Now the third task is a bit special. It's one, if you pick up a square, and it's, it's zero else, except it's negative one, if you pick up a blue thing, or the order of these is kind of wrong, but it just for visual representation. Okay, so now you're asked to pick up the red things, but avoid the blue things. Pick up as many red things as you can avoid the blue things. And again, as we said, the question is, do you now have to run reinforcement learning again in this agent with your simulator using like Q learning or something like this, from the start? Or can you come up with a solution? Just given these two policies that will perform well on the on this new task? Okay. And we're going to see how they do it. So what they do is they use successor features. So these successor features. I've done a video about successor features, and I'll link to that, you can look at that. But essentially, essentially, the successor features are defined like this. And for that, we need to know what this thing is, right here, they simply call this a feature function. Okay, it's very, it's very ambiguous term. A feature function is a function that takes in a transition, so state action, next state, and maps it to a high dimensional vector. Note this is almost the same as a reward function, except the reward function simply maps it to a number. Now, this is mapped to a higher dimensional thing. Again, I want to, I kind of want to leave out the next state right here, just to make things easier on you. So a feature here can be many, many things. But the structure of the features is going to be such that the reward function is going to be this feature times this w vector. So it was a bit, a bit not correct before, when I said the reward is now a vector, the reward of a particular task w can be seen as the inner product between the features and the task vector. So w specifies the task and the features, well, they specify the features. In our case, it can be it can be fairly simple, namely, yes, I was I was definitely wrong at the beginning. So the feature functions right here is which object do you pick up, okay. So we define the feature function as one, zero, if you pick up a square, and we define the feature function as zero, one, if you pick up a triangle. And now you can, and we define it as we define it as zero, zero, if you pick up nothing, okay. So we define zero, if you pick up nothing. And now you can fairly easily see that the reward of each task can be simply calculated by mixing the features accordingly. Okay, so reward one is going to be simply the feature times a one zero, which is the w vector. So I can specify a task by giving the appropriate w vector. And now you can see that if this is my reward function, my agent can go out into the world, if it collects a square, it is going to be rewarded right here, if it collects a triangle, even though the features indicate that it collected a triangle, it doesn't care about it because the W is zero right here. If I now want to give it the new tab, the same is true for our two, if I now want to give it a new task, our three, right. And you remember the reward function right there, I can achieve that reward function by simply multiplying the same features, the exact same feature functions by this vector right here. Okay. Remember, there is a slight difference between the reward function and the feature function. In this particular example, the idea of the paper is that the feature function can be rich in, in expressivity and, you know, tell you all sorts of things about your current state and the reward function is just a number, right. And then the reward is specified by simply linearly mixing these features. So the structure imposed by the paper here is that there are such a thing as a feature, and any task can be described by mixing these same features. Okay, that's, that's the issue right here. So the features are going to be constant across tasks, whereas the W defines the task. All right, so the goal here is that if you have learned many, many things during your tasks, what you want to do is you want to learn this feature representation that is the same across all tasks, and then you want to simply have the W specify how to mix these features to get the reward. Now, of course, this is a very strict, very, very definition, so you can't just say, okay, this is a very strict, very, very definition, not not a lot of things will fall into this, unless you make the features like exponentially big, of course. However, they do discuss whenever a task doesn't fall into that. So I hope you're with me so far. This is the first kind of restriction we impose on our worlds that we can tackle with this framework, namely that all of our tasks in this world have to be a linear mix of the same features. If that's given, then our then we can derive policies for tasks that we have never seen, we can derive good policies by doing zero learning, simply by specifying the task, we can have a good policy for that task from the policies we've already learned for the other tasks. Okay, so the reward three is now simply this. And yeah, notice it's not the same as the reward function, because the reward function had one if you pick up the square negative one, if you pick up the triangle and zero else, so the zero, we don't have to specify here because it's not part of our features. Right, so you can see that the reward function is given simply by that. And we can now as I said, derive a good policy for this reward by looking at the other policies, even though none of these policies has ever learned to avoid anything. So it makes it defines these successor features right here. So the successor features is much like the Q function, you can see the signature is almost the same. So as a Q function tells you how much reward you're going to get if you do the action a and then follow policy pi, the successor features, almost the same thing. However, it doesn't tell you what rewards you're going to get, it tells you which features you're going to get. And which features by that we mean the sum of future features. Now you can see this sum this a little bit this it of course, it comes from the fact of the linearity up here. So it's not really an additional restriction. But simply to clarify what this means for your environment, your environment has to be able to be looked at in terms of these features and these features that need to be cumulative. Again, that comes from the fact that it's linear, but to see so a feature like I want an even number of steps or something like this would be terrible. Because and they're going into things like this later, but it would be terrible because here we have the sum. And as soon as you if you have a feature that is very high, if you have an even number of steps, then or if you have a feature that counts the steps, you will never be able to do well. Because if you have a feature that counts the steps, it simply counts up and up and up and up depending on how many steps you do. And your reward can never be specified in terms of a mix of these features. And therefore your successor features are going to be useless. But in our case, where it's where feature one is pick up is how many of the sorry, I have to rephrase our feature one is whether or not you pick up a square. Therefore, if we sum it up, our successor feature one is going to be the number of this is this is this is this is a pound sign, the number of squares that you pick up. Okay. Similarly, our feature two is whether or not you pick up a triangle in a particular step. So our successor feature number two is going to be the number of triangles that you pick up over time. I can see that the successor features is kind of the analogous of your Q function. But it is not in terms of a single number, the reward, it is going to be in terms of these features, which is an entire vector. Okay. And because we've constructed this in a linear way, you can also pretty clearly see that the Q function is inherently related to the to the successor features, you can obtain the Q function by simply multiplying the successor features by your task vector w. Now, a lot of you might be wondering, where does this w come from? And in our initial case, we're just going to frame everything as being given, right? So we're given this this w we're, we're defining everything from our godlike perspective for now. So don't think all of this is learned by now. Yeah. All right, so how can you now derive this, this magical new policy? Okay, so we, let's say we have this policy one, and we have the policy two, and they, and you have the these features that you've learned constantly over both tasks. In fact, you're it's given, right? It these pi function, we give it we impose it that the feature one is whether you pick up a red square feature two is whether you pick up a blue square, then we know that the reward functions can be achieved by doing the W. So this here, your W is going to be one zero, and your W here is going to be zero one. And we now we want a good policy for task three. And we know we can achieve this by the one negative one, w, how can we derive a good policy? And this is this algorithm, this general policy evaluation, a general policy improvement. So it assumes that you, as we said, you have many, many different, many different policy. So here you can see policy one, where's policy two, here's policy two, and so on. It assumes that you have many different features, and therefore many different successor features. In fact, you have a vector of them, right? So here, you can see feature one, feature two, and so on. And it also assumes that you're in a current state, and you have many actions at your disposal right now, action one, action two, and so on. Okay, so this is all the past, you've already defined your features, you have learned these policies. And now you're given a new W, W new, in our case, it's this one negative one. And we want the best action. So we are in state s, we are given this W, we want the best action. Now, here is a method where we can simply calculate the best action in terms by not reinforcement learning at all in this new task. So by structuring things like this here, so what does it really say here? It this thing says, we are going to evaluate all of these different cells of this tensor right here. So we're going to determine what is the successor feature number two, for policy pi one, in state s, if I right now do a two, this is very abstract. So let's say you're here, and action, action two is actually going to the right, okay, so you're here, oh, this was yellow, it doesn't matter. So this is so this is action one, this is action two. So action two is you go to the right, okay, you can you can see that this will let you pick up will let you pick up a triangle. Now here, that's action three, and so on. Okay, so what's this number going to be? So we are in state s, as we said, and we do action two. So action two is going to pick up a triangle, the triangle, the picking up of a triangle means that our pi for this step, or sorry, our five for the step is going to be zero one, okay. So our successor features, this is not the features itself, this is the successor features, the successor features decompose into the next step, plus all the next steps that we can follow, okay, so all the steps that will come. So what are these features going to be, is it's going to be the sum over that, plus everything that follows. And I can take a little bit of a guess here, which means that this number, so we only care about feature two right here, this feature, feature two, this number is going to be one for the next step, because we are going to pick up a triangle if we do action two. But then after that, we're going to follow policy one. And policy one has been trained to pick up the red squares and not care about triangles. So I'm going to guess that every now and then, it will kind of step over a triangle, but it won't fall, we won't, you know, explicitly go look for them. So let's say the episode was 10 more steps, but the board has like 100 squares. So and it has like three triangles on it. So let's say that's like three tenths in expectation. Okay, so this is going to be this is going to be the number that we're looking for, we're doing this for every single one of these cells. Okay, this this thing is going to do for every single one of these cells. And this is very similar to evaluating Q functions, except we're evaluating an entire vector right here. That's the difference to simply learning many Q functions. So if you were to evaluate only a Q function, then you would only have this first matrix, this first block right here. Okay, but you have feature one, feature two, and so on. So you calculate everything in terms of these features. And then by linearity, you can mix it with that vector. So in our case, this is going to be the one negative one, which will give you the Q functions, right, from what we've seen before, you obtain a Q function by simply mixing your successor features with your with this task vector. And if you have a Q function, you can pretty easily determine which action you should take. Now you have here a Q function with respect to every single policy, but you can simply take the max, right. So the max across all of this will determine will determine. So you take the max across all the policies, which will give you the Q function for a particular action over all policies that you consider. And then you can simply take the arg max of that and determine the action you should take. Okay, so it's a pretty big evaluation. But if you do this, that means you don't have to do reinforcement learning on this task, it simply determines which action right now is the best given everything that I know from these old policies about the task. And that's not going to be like the optimal policy, per se, but it's going to be one policy that's pretty, pretty good. And you can actually prove some things across that. So they do this right here. And you can see that here is what Q learning does on this new task of picking up the squares and avoiding the triangles. Q learning takes a while to get there. However, if you do what they are suggesting, and you know, you give the W, you can supply the W almost from the beginning, you see right here, almost from the beginning, it is at a high reward. Now Q learning surpasses it eventually. But it's pretty impressive that without doing any learning, you are immediately good. Right? Now, the caveat here, of course, is that they already need these policy pi one and pi two given to the algorithm. And that comes from previous reinforcement learning trials. And they say that they give these trials as many steps as Q learning uses. So they give them this these amounts of steps on these other tasks. So the comparison here is a bit shaky if you ask me. But the point made is that if you have a new task right now, you can obtain very good solutions. And you don't have to do anything. Okay, and these solutions can be the basis for new reinforcement learning, right, you could start Q learning off right here and then get here much faster, potentially, and so on. So the next objective right here is that now we have defined the tasks and we had we know what these features are. And we know how to mix these features as imposers of the task. So what happens if we only have the reward function, we specify the task only in terms of their word functions, but we're kind of looking at the features and we're like, agent, please figure out yourself how to apply these features in order to make the reward high. And that's what this thing is right here, this GP and GPI with regress w so you don't no longer tell it what the W is. It needs to infer it through reinforcement learning, right? And it's not really reinforcement learning. But what it does, where is it? Yeah, it's simply it because all of this is linear. And this thing here is given. So always remember, this thing here is given. And these are the rewards that you obtain, you can simply do a regression to figure out the W of the task. Now that's going to take some time. But as you can see, right here, it is going to take a lot less time than doing Q learning from scratch, notably because you have good features. So this is some this is this gets closer and closer to transfer learning, right? And so what this does is it gives you a lot of information. So if you imagine that this right here is your pre trained neural network, and you simply learn the last layer of it. You freeze this, you do transfer learning, fine tune the last layer, here we are. So it gets closer and closer. And you'll but basically, I think it's a lot of math around a framework. And the more and more you relax the kind of impositions that they need for their framework, the more it gets back to simply, well, we do reinforcement learning, at least in my estimation. So before we look at that, this here is a pretty, pretty cool experiment, where they they look at how the how the different tasks can be achieved, if you give different policies. So you'll have noticed that we have always given these two, two tasks one, zero, and zero, one, these were our tasks that we trained on, and then one negative one is task we evaluated on. Okay, and you might object and say, wait a minute, these these two tasks, you know, they're pretty good, as let's say, pre training tasks, because, and it's basically the standard basis, right? And any other tasks can be mixed from those. So these are orthogonal vectors in this vector space. So you're being pretty generous to this system, what happens if we're not as generous, so that's what they do here. So they have different policies, and they evaluate how much you can learn with these different policies. So the way you have to read this diagram is right here, it's going to be the one zero axis as they will, they label it right here. And this is going to be the zero one axis, and this is evaluation. So every direction on this circle defines a task. For example, this task right here, as you can see, is going to define the task of picking up both the squares and the triangles, right, whatever you pick up, you get a reward. However, the task down here is going to be please pick up the squares, but avoid the triangles at all costs. Okay, and now they're going to look what happens if we supply different policies to choose from. Remember, we're in this situation, we're again in this situation where we give everything. And we give initial policies, we give the task vector. And now it's about deriving a good policy just from looking at the old policy, so no learning. As a baseline, you have Q learning, which into a given direction, tells you basically how long Q learning takes or how far Q learning gets with a given amount of steps indicated by this one, two, three, four, and so on. Yeah, you see, I think this is this is this in how far Q learning gets with these amounts of steps is the dotted lines right here. So Q learning gets this far with 10 to the I don't know, four, and then this far 10 to the five and so on. So these are comparisons. You can see that on the outside Q learning is going to beat this these methods. But our hope is going to be that of course, if we have this zero shot generalization, it's much better than running Q learning for really long if we get close to it. So the green thing is what we've already seen policies one and two will give you a fairly, you know, good, fairly good extent right here. So what does it mean? It means it can solve it can solve pretty much everything from here, here, this task, this this task, this task, it kind of falls off once we go down here. So once we go to the avoid section, it sort of falls off because it has never learned to avoid. Now, still, we can of course, do the avoidance by simply imposing a negative collection. But negative collecting and avoiding aren't exactly the same thing in these in these environments, right? Because avoiding can also be going really close to something but not hitting it while collecting. It's not the inverse of collecting, the inverse of collecting would be like run away as far as as far as possible. So we can expect that we've only ever learned to collect, we're not going to be super good at avoiding. Then the other extreme is when we give policies three and four, I haven't told you but you can see it right here. Policy three is explicitly to collect one and avoid the other. Well, policy four is the opposite right here, avoid the squares, collect the triangles. And now this policy, this policy is should be pretty good on all of the tasks in between. As you can see, it has the biggest extent right here. And that also makes sense. By the way, there's nothing down here because the task of avoiding both things doesn't really make sense because you can just stay where you are. Because there are also these these squares where there's nothing. But you can see that the mixture of those is quite potent. So already we can see even though these span a basis, in fact, an orthogonal basis as much as these, because of the nature of the features that we define for the task, they are not equivalent in mixing after so we can be more generous, we can also be less generous. If we only provide policy five and policy five is simply to pick up to pick up both objects, then we're going to have a pretty hard time when it comes to avoiding things. So you can see it can do fairly well picking up the various things in a positive manner. But as soon as we cross this line into the like this horizontal line into where it's about avoiding a particular object, it's not it's not the choices of actions we have from policy five aren't going to be super good at that. And they do another they do another thing right here. So that the left thing is where they say, it's important which policies we provide. And the right thing, they want to say something like, it's important. So they want to say, if we provide more policies, that can be advantageous, because we basically have more options to choose from. Okay, so now they start off with policy four. And policy four is simply avoid the squares, collect the triangle, you can see it performs fairly well over here, where it's all about avoiding the squares and collecting the triangles as soon as you get into, you know, collecting, or even here, the opposite directions, it's pretty bad, right? That's the red thing. And now they add policy two to policy four. So policy two is going to be also to collect the the triangles, but to just neglect the squares. And that will also do a bit better. Why does it do better? Because it's better at collecting, because this policy here also needs to avoid. And this policy here doesn't care. So in the regimes where it's better to not care than to avoid, adding this policy, adding these options is going to be good. And you can see that there's a general expansion here, as we add more policies. However, I want to point out that, for example, here, this black thing, which should be technically superior to the blue thing, because it contains, as you can see here, all the policies that the blue thing contains plus another policy. I don't I don't know if my vision, but I'm pretty sure here, the black thing is inside the blue thing. So that means there can also be a disadvantage to adding more policies right here, because maybe you got you have too much to choose from. And so right here, what we say is we add a policy that is all about collecting the squares. And it is performing, it is actually decreasing the perform. The addition of this is decreasing the performance on tasks where you have to avoid the squares, which I'm not sure if, if that makes sense. Again, the opposite of collecting isn't avoiding, but I'm just pointing this out. And this isn't really mentioned in the paper, the paper simply says, see, we add policies, and therefore we are getting better. I'm not, I don't agree with this, given these results, or maybe the plotting, the plotting is bad. Alright, so they say, okay, more policies better, which I disagree with. They also say, oh, we can, as as much as we can regress the W, right, we regress W, we figure out the task, we can even learn the successor features. Okay, we can not the successor features, the pi functions that lead to the succession, successor features. And you can see, if you do it with the true W, you're really good at the beginning. If you do it with a regress W, we can see that before you can you. So this is the small version of this plot right here. This is like this section, I think, yeah. You know, you improve, however, we can also learn this pi function, we can also learn the features, where if we're not given the features, maybe we can learn the features. And they say, well, we can do this with but also by regression. So here, what we can do is we can find the function that minimizes the function and the W along with it that minimizes this error right here. Okay. So you're finding the function and the W that that matches this error. And this now really is like learning a neural network. I mean, you know, so I get I get it, you have the I here and the W doesn't depend on the I and so on. But you're getting more and more back to actually simply learning nonlinear functions, mixing them linearly right here. And I think that's going to be kind of the crux of this method. The fact that the more complicated your problems are, the less you're going to be able to do this kind of stuff. And they even go as far as to say, well, what if like before we the reward is actually something like whether or not you have collected an even number of triangles or squares, then they say, well, you can simply not have a single W, but you can find a function W. And now the policy is a function of the function of W. And you can do potentially the same regression problem. But as you can see, it gets so now you this right here is going to be a function of state. And so you can see that it more and more, it simply goes back to basically Q learning again, the only difference here is that you have this intermediate features. But I think you can simply view this, let's say as a hidden layer in a neural network. I get it somewhat held constant across sums and so on. But I like the method in terms of the analysis. So if you are given all this stuff, it seems pretty cool that you can derive new policies. Its implication for lifelong learning, they say, look, here, you have a bunch of tasks in your database that you've already learned on your agent is going out into the world, it faces a new task, it can use this thing, it can use this thing to obtain a new good policy for that task, it can then use reinforcement learning, or l to refine that policy. And then it can simply save that policy into the database. So it keeps expanding and expanding this thing. So it keeps adding rows and rows and rows right here of new policies that it's learned over the course of its life. So once it's facing a new task, it can just kind of draw from its experience and derive a good initial solution. However, the actual analysis only works, I feel, in quite limited circumstances. And if you want to relax these limited circumstances, then you need to basically regress and regress and regress away from their setup. And I'm not sure, I'm not sure where this is going to go. If this is going to be a general framework for people, it seems like it because it's pretty easy. But then also, it seems like most of the world doesn't really fall into this category. In fact, this divide and conquer approach, I'm not sure, but from divide and conquer, I always imagine something like you subdivide and subdivide and subdivide until you know, you are at some kind of basic task, they still only go for no single task like this here, the tasks are somehow in sequence. And I'm not I think we should really think about hierarchical RL. Now this can be a good first step right here. But most hierarchical RL, even the ones that specify themselves as fully hierarchical, like we can do many layers, they rarely go above two layers or three, like like one, one meta layer and one actual layer like this one right here. They rarely go further, maybe they go two layers, but that's about it. I've seen very little in actual hierarchical or divide and conquer reinforcement learning just because it's so hard to train. Yeah, all in all, cool paper. And if you want to get into the math a little bit, I think it's pretty easy math. Once you kind of set your goals on what it's actually meant to achieve. If you just read from the beginning, all these reinforcement learning papers, it seems a bit like, why? Why are we doing this? Right? You just oh, we define this, we define that, we define this. And you're a bit like, yeah, but why? So often it pays in these papers to go at the end to the examples, and then come back to the theory, knowing what they want to achieve. All right, that was it for me. Long rant. I'll see you next time. Bye bye.
[{"start": 0.0, "end": 5.68, "text": " Hi there, today we're looking at fast reinforcement learning with generalized policy updates by"}, {"start": 5.68, "end": 12.32, "text": " Andre Barretto, Shavo Ho, Diana Borsa, David Silver and Doina Precu. So on high level,"}, {"start": 12.32, "end": 19.52, "text": " this paper proposes a framework for reinforcement learning, where you have many tasks at the same"}, {"start": 19.52, "end": 26.96, "text": " time. And they propose a framework where they learn many policies at the same time that can"}, {"start": 26.96, "end": 33.28, "text": " or cannot correspond to these tasks. And then their argument is that if you now have a new task"}, {"start": 33.28, "end": 39.52, "text": " that you haven't seen before, you can easily construct a solution to that task from your old"}, {"start": 39.52, "end": 46.08, "text": " policies, basically mixing what you learned about your old tasks. And it's a pretty general framework,"}, {"start": 46.08, "end": 52.16, "text": " and we're going to look at it. In my opinion, it's it's pretty cool for certain settings. However,"}, {"start": 52.16, "end": 58.64, "text": " I think it kind of breaks down the more general you go, which I guess is expected of such a"}, {"start": 58.64, "end": 66.72, "text": " framework. But it's, as you can see, it's kind of math heavy, but we'll get into the examples and"}, {"start": 67.75999999999999, "end": 73.84, "text": " what it's potentially useful for. Alright, so that was it on a high level. If you like content like"}, {"start": 73.84, "end": 80.4, "text": " this, don't hesitate to subscribe to the channel and share it out, leave a like and tell me in the"}, {"start": 80.4, "end": 88.0, "text": " comments what you think. I'm still reading all of them. So I will see it. Cool, let's dive in."}, {"start": 88.56, "end": 93.68, "text": " So they say the combination of reinforcement learning with deep learning is promising"}, {"start": 93.68, "end": 98.72, "text": " approach to tackle important sequential decision making problems that are currently intractable."}, {"start": 99.68, "end": 106.88000000000001, "text": " Well, they're taking they're talking about, you know, things like mostly these game playing"}, {"start": 106.88, "end": 114.39999999999999, "text": " AI is like go and things like this. So where this combination of deep learning with reinforcement"}, {"start": 114.39999999999999, "end": 122.96, "text": " learning has really shined, or shown, whatever, one obstacle to overcome is the amount of data"}, {"start": 122.96, "end": 128.0, "text": " needed by learning systems of this type. So again, if you look at these systems like AlphaGo,"}, {"start": 128.8, "end": 135.6, "text": " they need a simulator, and they need to collect enormous amounts of data, even more so with"}, {"start": 135.6, "end": 144.79999999999998, "text": " systems like the Dota AI, the OpenAI5, Dota or Starcraft playing Alpha Star, I think it's Alpha"}, {"start": 144.79999999999998, "end": 151.84, "text": " Star. They need so many simulations in order to learn about the tasks because they always start"}, {"start": 151.84, "end": 158.4, "text": " from scratch. In this article, they say, we propose to address this issue through a divide and conquer"}, {"start": 158.4, "end": 164.48, "text": " approach. We argue that complex decision problems can be naturally decomposed into multiple tasks"}, {"start": 164.48, "end": 171.51999999999998, "text": " that unfold in sequence or in parallel. By associating each task with a reward function,"}, {"start": 171.51999999999998, "end": 176.88, "text": " this problem decomposition can be seamlessly accommodated within the standard reinforcement"}, {"start": 176.88, "end": 183.51999999999998, "text": " learning formalism. Okay, so what are they saying right here, they are basically saying that if you"}, {"start": 183.51999999999998, "end": 191.83999999999997, "text": " have a task, let's say you want to get what's the from here to here. And that's very complicated."}, {"start": 191.84, "end": 198.48000000000002, "text": " Let's make it complicated, super duper complicated. You can basically subdivide that task into"}, {"start": 198.48000000000002, "end": 205.68, "text": " multiple sub tasks, right? So here is like, left turn, right turn, go straight, left turn,"}, {"start": 206.32, "end": 211.44, "text": " go straight, right turn, and so on. And each of these sub tasks, you can see the two right turns"}, {"start": 211.44, "end": 216.96, "text": " here might share a lot of common information, there could also be tasks that are at the same"}, {"start": 216.96, "end": 223.28, "text": " time, like you need to go forward and jump can be decomposed into going forward and to jump."}, {"start": 223.84, "end": 229.04000000000002, "text": " Now, they're saying is if each of these tasks now has its separate reward function in the"}, {"start": 229.04000000000002, "end": 236.8, "text": " environment, like for some reason, the environment tells you this, by the way, is task, task one,"}, {"start": 236.8, "end": 244.08, "text": " and you're going to get a positive reward if you do a right turn. And this down here is task two,"}, {"start": 244.08, "end": 250.16000000000003, "text": " the left turn task, and you're going to get a positive reward if for that task. So the entire"}, {"start": 250.16000000000003, "end": 256.88, "text": " task state can be decomposed into a vector. So in our case, here, we have maybe a vector with"}, {"start": 256.88, "end": 267.04, "text": " three elements, okay, the three elements correspond to turn right, go straight, and turn left. And now"}, {"start": 267.04, "end": 273.44, "text": " you're this, this right here is your reward vector. So we're no longer talking this framework,"}, {"start": 273.44, "end": 280.71999999999997, "text": " we're no longer talking about just a reward, we're talking about a reward vector. Now, each of these"}, {"start": 280.71999999999997, "end": 286.24, "text": " tasks is going to give you its own individual reward. So let's say you're here, and you're"}, {"start": 286.24, "end": 293.28, "text": " actually turning right, this is going to give you a reward of one for this task, but rewards of zero"}, {"start": 293.28, "end": 302.8, "text": " for the other task. Okay. So the environment will somehow tell you which tasks you you get reward"}, {"start": 302.8, "end": 309.52000000000004, "text": " for. Now, there is a notion where you can map this back to a single number. And that is the second"}, {"start": 309.52000000000004, "end": 315.6, "text": " thing they introduce here. So the second thing they introduce here is this thing they call w. So w"}, {"start": 316.24, "end": 324.32, "text": " is going to be a mixing vector, w is going to be a vector, I will call w right here, this is the"}, {"start": 324.32, "end": 332.08000000000004, "text": " reward vector, w is going to be the vector that tells you your final reward. So here, we're going"}, {"start": 332.08, "end": 341.52, "text": " to do an inner product. So we're going to transpose this and multiply by w. And w mixes these rewards"}, {"start": 341.52, "end": 347.44, "text": " and comes up with your final reward right here. So this, this is maybe the reward vector, this is the"}, {"start": 347.44, "end": 355.28, "text": " reward number, how are we going to call this reward number. So in this case, w would have to look"}, {"start": 355.28, "end": 363.67999999999995, "text": " something like this, let's say, this is an example. So the task right here would be to only do right"}, {"start": 363.67999999999995, "end": 369.52, "text": " turns. Now, this is not a really nice example, we're going to see some nicer examples later on."}, {"start": 369.52, "end": 375.2, "text": " But you can see that now the environment is specified as a vector of rewards. And you can"}, {"start": 375.2, "end": 381.76, "text": " create a specific tasks like turning right, simply by adjusting how you mix these different things"}, {"start": 381.76, "end": 390.32, "text": " by this vector w. And this is going to be the key ingredient here. So they discuss your general"}, {"start": 390.32, "end": 396.4, "text": " reinforcement learning, the reinforcement learning lingo. And I think we've gone through this a"}, {"start": 396.4, "end": 403.68, "text": " number of times just very, very quickly. In reinforcement learning, you're given these"}, {"start": 403.68, "end": 412.64, "text": " transitions, you are in a state, you take an action. And that leads you to get a reward r prime,"}, {"start": 412.64, "end": 420.56, "text": " and you get into a state s prime in the next state, they say the reward is given by the reward"}, {"start": 420.56, "end": 426.16, "text": " function. So the reward is purely a function of where you are and what you do and where you get to."}, {"start": 426.16, "end": 431.2, "text": " Now, most reinforcement learning problems, you can actually kind of forget about this part right"}, {"start": 431.2, "end": 439.36, "text": " here. Because, well, it is, it is kind of important, but you could most reinforcement"}, {"start": 439.36, "end": 445.28, "text": " learning problems, the reward is simply a matter of where you are and what you do. And this can be"}, {"start": 445.28, "end": 451.2, "text": " a random variable, there can be randomness. But maybe it's easier if you for now think about the"}, {"start": 451.2, "end": 457.12, "text": " reward simply as a function of these two things. So what you want to discover is a policy pi,"}, {"start": 457.12, "end": 463.76, "text": " where you input, you input where you are, and the output is going to be what you should you do in"}, {"start": 463.76, "end": 471.12, "text": " that situation. Okay, that is a policy. And associated with each policy is this thing called"}, {"start": 471.12, "end": 478.96, "text": " the Q function. So you can see right here, the Q function of a policy is going to be a function"}, {"start": 478.96, "end": 485.36, "text": " of where you are and what you do. And this is a bit confusing, but it basically means that you"}, {"start": 485.36, "end": 491.76, "text": " are in state s. So you are here. And you have, let's say three options, action one, action two,"}, {"start": 491.76, "end": 500.0, "text": " action three to do. Now the Q function tells you the Q function, this is s, and the A's are the"}, {"start": 500.0, "end": 506.16, "text": " numbers, okay. So let's say we plug in the state s. And for a we plug in number two, what it will"}, {"start": 506.16, "end": 516.4, "text": " tell you is, if I am in state s, and I perform action number two, then how valuable is that for"}, {"start": 516.4, "end": 524.1600000000001, "text": " me, and value is defined by all the reward that I'm going to pick up from now until the end of"}, {"start": 524.1600000000001, "end": 531.84, "text": " time, or the end of the episode, it depends. But let's say until the end of time, well, how much"}, {"start": 531.84, "end": 537.0400000000001, "text": " how much how much reward am I going to pick up from now until the end of time, is a bit of a"}, {"start": 537.0400000000001, "end": 543.2, "text": " vague, not a vague question, but a difficult question, I can tell you how much I could estimate"}, {"start": 543.2, "end": 548.32, "text": " how much reward I'm going to pick up in the next step, because I know what action I'm doing,"}, {"start": 548.32, "end": 554.88, "text": " I'm performing action number two, but what happens after that? Who knows? So that's where this policy"}, {"start": 554.88, "end": 561.52, "text": " right here comes in. This policy right here says, so the full definition of the Q function is if I'm"}, {"start": 561.52, "end": 571.1999999999999, "text": " in state s, and I perform action a right now, and after that, I follow policy pi, what is my reward"}, {"start": 571.1999999999999, "end": 576.8, "text": " going to be right now, it's well defined. So right now you do action a. And after that, you do"}, {"start": 576.8, "end": 584.0, "text": " whatever action the policy tells you in that specific situation. Okay, so that's the Q function."}, {"start": 584.0, "end": 589.6, "text": " And you can pretty easily see that if you have a Q function, right, if you have an accurate Q"}, {"start": 589.6, "end": 595.6800000000001, "text": " function, you can get a good policy by simply always going with the action that gives you the"}, {"start": 595.6800000000001, "end": 601.6, "text": " highest Q value. Because it's because of a recurrence relationship called the the Bellman"}, {"start": 601.6, "end": 610.24, "text": " equation. This thing right here, so your Q function basically decomposes into the reward in the next"}, {"start": 610.24, "end": 616.24, "text": " step, as we said, plus whatever happens after that, and whatever happens after that is just"}, {"start": 616.24, "end": 622.48, "text": " by the nature of how the things are defined is going to be the Q function of whatever the policy"}, {"start": 622.48, "end": 629.6800000000001, "text": " is telling you. So you can get a pretty good policy by always doing whatever action your Q"}, {"start": 629.6800000000001, "end": 639.04, "text": " function tells you is best. This step of calculating the Q function is called a policy"}, {"start": 639.04, "end": 647.92, "text": " evaluation. And this paper here is going to generalize these notions. Sorry, so this is"}, {"start": 647.92, "end": 654.88, "text": " a policy evaluation. And then the act of selecting an action is going to be a policy improvement."}, {"start": 654.88, "end": 661.5999999999999, "text": " These are just names, okay. But we need to know them because the paper introduces two new things."}, {"start": 661.6, "end": 671.28, "text": " I'm going to where do I highlight policy evaluation? I don't know. But here they say"}, {"start": 671.28, "end": 678.5600000000001, "text": " this is the policy improvement. Okay, here, policy evaluation, policy improvement, these are the two"}, {"start": 678.5600000000001, "end": 684.24, "text": " steps. So the first step is calculate the Q function. The second step is to select an action."}, {"start": 684.24, "end": 693.6800000000001, "text": " And you can see how these things interlock, namely, we can calculate the Q function of a given policy,"}, {"start": 693.6800000000001, "end": 700.24, "text": " and we can improve that policy by selecting whatever action is best for the Q function."}, {"start": 702.24, "end": 711.44, "text": " This paper generalizes this, and you can see that there is a little a little R right here. So the R"}, {"start": 711.44, "end": 719.36, "text": " is just a specific way to reference the reward function used right here. Okay, and you can see it"}, {"start": 720.0, "end": 731.6800000000001, "text": " here as well. Now, usually, we have one policy and one reward, right. And so what we do is we improve"}, {"start": 731.6800000000001, "end": 737.6800000000001, "text": " the policy. And that leads us to better evaluate the Q function for a given reward function. And"}, {"start": 737.68, "end": 744.88, "text": " that leads us to improve the policy. Now, this paper is going to transform this into the following."}, {"start": 745.76, "end": 752.56, "text": " We have many policies. So we have policy one, policy two, and so on, until policy,"}, {"start": 753.4399999999999, "end": 762.4, "text": " P. And we also have many reward functions, reward one, reward two, reward three, and so on until"}, {"start": 762.4, "end": 770.4, "text": " reward, let's call that R. So we have many different tasks, right here. And we have many"}, {"start": 770.4, "end": 776.56, "text": " policies. Now, in essence, they don't need to have some anything to do with each other for the theory"}, {"start": 776.56, "end": 784.88, "text": " of this paper. But I can simplify this a bit of how they see the world. So let's say you have an"}, {"start": 784.88, "end": 795.92, "text": " agent, and the agent has been trained on simply that first task right here, and has been trained"}, {"start": 795.92, "end": 801.76, "text": " using classic Q learning, reinforcement learning whatnot, and that results in this particular"}, {"start": 801.76, "end": 807.6, "text": " policy. And then the agent just from scratch, you restart it again, you run reinforcement learning"}, {"start": 807.6, "end": 814.48, "text": " just on reward number two, and obtained policy number two, and so on. So you do this for all"}, {"start": 814.48, "end": 821.52, "text": " these rewards individually, okay, so you give the agent a new task, and you ask it to learn a policy"}, {"start": 821.52, "end": 830.4, "text": " for that task. Now, you're in a situation where if you are in have a new task, so our new, the"}, {"start": 830.4, "end": 839.6800000000001, "text": " question is, do you again, need to train a new policy? And the answer for this paper is no,"}, {"start": 839.68, "end": 846.0, "text": " because we have all these policies, we don't need to train a new we can simply mid mix and match"}, {"start": 846.0, "end": 854.4, "text": " these policies that we already know to obtain a good solution for the new task. So how does the"}, {"start": 854.4, "end": 866.0799999999999, "text": " paper do it? It does it? Yeah, it does it in the following. It defines the successor features,"}, {"start": 866.08, "end": 872.32, "text": " okay? Maybe it's in maybe it's better if we first go to an example. So the example they give here"}, {"start": 872.32, "end": 877.84, "text": " is the following. Otherwise, this I guess this might sound just a bit too abstract. Okay, so you"}, {"start": 877.84, "end": 885.5200000000001, "text": " have this world here, the agent is the thing here in yellow, and it can just move. So its actions"}, {"start": 885.5200000000001, "end": 892.6400000000001, "text": " are move left, up, right, down, this, this is one step, okay, in the environment, there are two"}, {"start": 892.64, "end": 902.24, "text": " different objects, one object is a triangle, and one object is a square, okay. So there are a number"}, {"start": 902.24, "end": 911.6, "text": " of tasks we can define right now in this thing. So we define tasks according to a reward function."}, {"start": 911.6, "end": 924.0, "text": " So the reward, let's say the reward one is going to be one, if, if it picks up a square, sorry,"}, {"start": 924.0, "end": 932.08, "text": " the square and zero else, just if it picks up a square on any given step, we give it a reward of"}, {"start": 932.08, "end": 939.36, "text": " one, we don't care about the blue triangles, okay. And then reward two is going to be the opposite,"}, {"start": 939.36, "end": 947.6, "text": " it's going to be one, not the opposite, but one if it picks up a triangle, and zero else. So you can"}, {"start": 947.6, "end": 957.6, "text": " see the good policies right here. So pi one is a good policy for reward one, because it just goes"}, {"start": 957.6, "end": 963.44, "text": " and collects these red things doesn't care about the blue things just goes and collects them by two,"}, {"start": 963.44, "end": 970.24, "text": " it goes and collects the blue things doesn't care about the red things, okay. So let's imagine that"}, {"start": 970.24, "end": 978.8000000000001, "text": " you have run reinforcement learning twice, once for reward one, and once for reward two. And now"}, {"start": 978.8000000000001, "end": 985.0400000000001, "text": " you have two policies, okay, so you have two policies, this will lead to pi one, this will lead"}, {"start": 985.04, "end": 994.7199999999999, "text": " to pi two. And now I give you the third task. Now the third task is a bit special. It's one, if you"}, {"start": 994.7199999999999, "end": 1009.4399999999999, "text": " pick up a square, and it's, it's zero else, except it's negative one, if you pick up a blue thing,"}, {"start": 1009.44, "end": 1016.48, "text": " or the order of these is kind of wrong, but it just for visual representation. Okay, so now you're"}, {"start": 1016.48, "end": 1025.52, "text": " asked to pick up the red things, but avoid the blue things. Pick up as many red things as you"}, {"start": 1025.52, "end": 1033.68, "text": " can avoid the blue things. And again, as we said, the question is, do you now have to run reinforcement"}, {"start": 1033.68, "end": 1038.48, "text": " learning again in this agent with your simulator using like Q learning or something like this,"}, {"start": 1038.48, "end": 1046.56, "text": " from the start? Or can you come up with a solution? Just given these two policies that will"}, {"start": 1046.56, "end": 1057.76, "text": " perform well on the on this new task? Okay. And we're going to see how they do it. So what they do"}, {"start": 1057.76, "end": 1068.0, "text": " is they use successor features. So these successor features. I've done a video about successor"}, {"start": 1068.0, "end": 1075.76, "text": " features, and I'll link to that, you can look at that. But essentially, essentially, the successor"}, {"start": 1075.76, "end": 1080.8799999999999, "text": " features are defined like this. And for that, we need to know what this thing is, right here, they"}, {"start": 1080.88, "end": 1091.0400000000002, "text": " simply call this a feature function. Okay, it's very, it's very ambiguous term. A feature function"}, {"start": 1091.0400000000002, "end": 1099.6000000000001, "text": " is a function that takes in a transition, so state action, next state, and maps it to a high dimensional"}, {"start": 1099.6000000000001, "end": 1105.2800000000002, "text": " vector. Note this is almost the same as a reward function, except the reward function simply maps"}, {"start": 1105.28, "end": 1114.8, "text": " it to a number. Now, this is mapped to a higher dimensional thing. Again, I want to, I kind of want"}, {"start": 1114.8, "end": 1124.08, "text": " to leave out the next state right here, just to make things easier on you. So a feature here"}, {"start": 1124.08, "end": 1132.3999999999999, "text": " can be many, many things. But the structure of the features is going to be such that the reward"}, {"start": 1132.3999999999999, "end": 1141.36, "text": " function is going to be this feature times this w vector. So it was a bit, a bit not correct before,"}, {"start": 1141.36, "end": 1150.1599999999999, "text": " when I said the reward is now a vector, the reward of a particular task w can be seen as"}, {"start": 1150.16, "end": 1157.6000000000001, "text": " the inner product between the features and the task vector. So w specifies the task and the"}, {"start": 1157.6000000000001, "end": 1165.28, "text": " features, well, they specify the features. In our case, it can be it can be fairly simple, namely,"}, {"start": 1166.24, "end": 1172.88, "text": " yes, I was I was definitely wrong at the beginning. So the feature functions right here"}, {"start": 1172.88, "end": 1182.24, "text": " is which object do you pick up, okay. So we define the feature function as one, zero, if you pick up"}, {"start": 1182.24, "end": 1191.2, "text": " a square, and we define the feature function as zero, one, if you pick up a triangle. And now you"}, {"start": 1191.2, "end": 1200.16, "text": " can, and we define it as we define it as zero, zero, if you pick up nothing, okay. So we define"}, {"start": 1200.16, "end": 1208.88, "text": " zero, if you pick up nothing. And now you can fairly easily see that the reward of each task can"}, {"start": 1208.88, "end": 1215.52, "text": " be simply calculated by mixing the features accordingly. Okay, so reward one is going to be"}, {"start": 1217.44, "end": 1226.5600000000002, "text": " simply the feature times a one zero, which is the w vector. So I can specify a task by giving the"}, {"start": 1226.56, "end": 1232.08, "text": " appropriate w vector. And now you can see that if this is my reward function, my agent can go out"}, {"start": 1232.08, "end": 1239.76, "text": " into the world, if it collects a square, it is going to be rewarded right here, if it collects"}, {"start": 1239.76, "end": 1245.2, "text": " a triangle, even though the features indicate that it collected a triangle, it doesn't care about it"}, {"start": 1245.2, "end": 1252.24, "text": " because the W is zero right here. If I now want to give it the new tab, the same is true for our two,"}, {"start": 1252.24, "end": 1258.24, "text": " if I now want to give it a new task, our three, right. And you remember the reward function right"}, {"start": 1258.24, "end": 1264.48, "text": " there, I can achieve that reward function by simply multiplying the same features, the exact"}, {"start": 1264.48, "end": 1275.36, "text": " same feature functions by this vector right here. Okay. Remember, there is a slight difference between"}, {"start": 1275.36, "end": 1280.8, "text": " the reward function and the feature function. In this particular example, the idea of the paper is"}, {"start": 1280.8, "end": 1287.44, "text": " that the feature function can be rich in, in expressivity and, you know, tell you all sorts of"}, {"start": 1287.44, "end": 1293.6, "text": " things about your current state and the reward function is just a number, right. And then the"}, {"start": 1294.6399999999999, "end": 1301.44, "text": " reward is specified by simply linearly mixing these features. So the structure imposed by the"}, {"start": 1301.44, "end": 1310.1599999999999, "text": " paper here is that there are such a thing as a feature, and any task can be described by mixing"}, {"start": 1310.16, "end": 1317.0400000000002, "text": " these same features. Okay, that's, that's the issue right here. So the features are going to be"}, {"start": 1318.24, "end": 1329.8400000000001, "text": " constant across tasks, whereas the W defines the task."}, {"start": 1329.84, "end": 1338.72, "text": " All right, so the goal here is that if you have learned many, many things during your tasks, what"}, {"start": 1338.72, "end": 1344.9599999999998, "text": " you want to do is you want to learn this feature representation that is the same across all tasks,"}, {"start": 1344.9599999999998, "end": 1351.9199999999998, "text": " and then you want to simply have the W specify how to mix these features to get the reward. Now,"}, {"start": 1351.9199999999998, "end": 1357.1999999999998, "text": " of course, this is a very strict, very, very definition, so you can't just say, okay,"}, {"start": 1357.2, "end": 1363.28, "text": " this is a very strict, very, very definition, not not a lot of things will fall into this,"}, {"start": 1363.28, "end": 1371.68, "text": " unless you make the features like exponentially big, of course. However, they do discuss whenever"}, {"start": 1371.68, "end": 1377.6000000000001, "text": " a task doesn't fall into that. So I hope you're with me so far. This is the first kind of"}, {"start": 1377.6000000000001, "end": 1383.1200000000001, "text": " restriction we impose on our worlds that we can tackle with this framework, namely that all of"}, {"start": 1383.12, "end": 1392.8, "text": " our tasks in this world have to be a linear mix of the same features. If that's given, then"}, {"start": 1393.52, "end": 1401.04, "text": " our then we can derive policies for tasks that we have never seen, we can derive good policies"}, {"start": 1402.0, "end": 1409.6, "text": " by doing zero learning, simply by specifying the task, we can have a good policy for that task"}, {"start": 1409.6, "end": 1416.56, "text": " from the policies we've already learned for the other tasks. Okay, so the reward three is now"}, {"start": 1416.56, "end": 1422.6399999999999, "text": " simply this. And yeah, notice it's not the same as the reward function, because the reward function"}, {"start": 1422.6399999999999, "end": 1428.9599999999998, "text": " had one if you pick up the square negative one, if you pick up the triangle and zero else, so the"}, {"start": 1428.9599999999998, "end": 1436.6399999999999, "text": " zero, we don't have to specify here because it's not part of our features. Right, so you can see"}, {"start": 1436.64, "end": 1445.8400000000001, "text": " that the reward function is given simply by that. And we can now as I said, derive a good policy"}, {"start": 1445.8400000000001, "end": 1452.72, "text": " for this reward by looking at the other policies, even though none of these policies has ever learned"}, {"start": 1452.72, "end": 1462.64, "text": " to avoid anything. So it makes it defines these successor features right here. So the successor"}, {"start": 1462.64, "end": 1470.0800000000002, "text": " features is much like the Q function, you can see the signature is almost the same. So as a Q function"}, {"start": 1470.64, "end": 1478.24, "text": " tells you how much reward you're going to get if you do the action a and then follow policy pi,"}, {"start": 1479.0400000000002, "end": 1485.1200000000001, "text": " the successor features, almost the same thing. However, it doesn't tell you what rewards you're"}, {"start": 1485.1200000000001, "end": 1492.5600000000002, "text": " going to get, it tells you which features you're going to get. And which features by that we mean"}, {"start": 1492.56, "end": 1503.12, "text": " the sum of future features. Now you can see this sum this a little bit this it of course, it comes"}, {"start": 1503.12, "end": 1507.52, "text": " from the fact of the linearity up here. So it's not really an additional restriction. But simply"}, {"start": 1508.1599999999999, "end": 1516.08, "text": " to clarify what this means for your environment, your environment has to be able to be looked at"}, {"start": 1516.08, "end": 1521.12, "text": " in terms of these features and these features that need to be cumulative. Again, that comes"}, {"start": 1521.12, "end": 1531.4399999999998, "text": " from the fact that it's linear, but to see so a feature like I want an even number of steps or"}, {"start": 1531.4399999999998, "end": 1537.52, "text": " something like this would be terrible. Because and they're going into things like this later,"}, {"start": 1537.52, "end": 1543.1999999999998, "text": " but it would be terrible because here we have the sum. And as soon as you if you have a feature"}, {"start": 1543.2, "end": 1550.88, "text": " that is very high, if you have an even number of steps, then or if you have a feature that counts"}, {"start": 1550.88, "end": 1558.64, "text": " the steps, you will never be able to do well. Because if you have a feature that counts the"}, {"start": 1558.64, "end": 1564.16, "text": " steps, it simply counts up and up and up and up depending on how many steps you do. And your"}, {"start": 1564.16, "end": 1570.24, "text": " reward can never be specified in terms of a mix of these features. And therefore your successor"}, {"start": 1570.24, "end": 1579.92, "text": " features are going to be useless. But in our case, where it's where feature one is pick up is how"}, {"start": 1579.92, "end": 1588.64, "text": " many of the sorry, I have to rephrase our feature one is whether or not you pick up a square."}, {"start": 1589.76, "end": 1598.88, "text": " Therefore, if we sum it up, our successor feature one is going to be the number of this is this is"}, {"start": 1598.88, "end": 1606.88, "text": " this is this is a pound sign, the number of squares that you pick up. Okay. Similarly,"}, {"start": 1606.88, "end": 1614.72, "text": " our feature two is whether or not you pick up a triangle in a particular step. So our successor"}, {"start": 1614.72, "end": 1620.72, "text": " feature number two is going to be the number of triangles that you pick up over time. I can see"}, {"start": 1620.72, "end": 1626.48, "text": " that the successor features is kind of the analogous of your Q function. But it is not in"}, {"start": 1626.48, "end": 1631.84, "text": " terms of a single number, the reward, it is going to be in terms of these features, which is an"}, {"start": 1631.84, "end": 1639.76, "text": " entire vector. Okay. And because we've constructed this in a linear way, you can also pretty clearly"}, {"start": 1639.76, "end": 1649.1200000000001, "text": " see that the Q function is inherently related to the to the successor features, you can obtain the"}, {"start": 1649.12, "end": 1657.76, "text": " Q function by simply multiplying the successor features by your task vector w. Now, a lot of you"}, {"start": 1657.76, "end": 1664.56, "text": " might be wondering, where does this w come from? And in our initial case, we're just going to frame"}, {"start": 1664.56, "end": 1674.3999999999999, "text": " everything as being given, right? So we're given this this w we're, we're defining everything from"}, {"start": 1674.4, "end": 1682.16, "text": " our godlike perspective for now. So don't think all of this is learned by now. Yeah."}, {"start": 1684.88, "end": 1691.2, "text": " All right, so how can you now derive this, this magical new policy? Okay, so we,"}, {"start": 1691.76, "end": 1698.24, "text": " let's say we have this policy one, and we have the policy two, and they, and you have the these"}, {"start": 1698.24, "end": 1704.4, "text": " features that you've learned constantly over both tasks. In fact, you're it's given, right? It these"}, {"start": 1704.4, "end": 1710.96, "text": " pi function, we give it we impose it that the feature one is whether you pick up a red square"}, {"start": 1710.96, "end": 1715.52, "text": " feature two is whether you pick up a blue square, then we know that the reward functions can be"}, {"start": 1715.52, "end": 1724.08, "text": " achieved by doing the W. So this here, your W is going to be one zero, and your W here is going to"}, {"start": 1724.08, "end": 1733.04, "text": " be zero one. And we now we want a good policy for task three. And we know we can achieve this by the"}, {"start": 1733.04, "end": 1741.52, "text": " one negative one, w, how can we derive a good policy? And this is this algorithm, this general"}, {"start": 1741.52, "end": 1751.12, "text": " policy evaluation, a general policy improvement. So it assumes that you, as we said, you have many,"}, {"start": 1751.12, "end": 1759.6799999999998, "text": " many different, many different policy. So here you can see policy one, where's policy two,"}, {"start": 1759.6799999999998, "end": 1766.56, "text": " here's policy two, and so on. It assumes that you have many different features, and therefore many"}, {"start": 1766.56, "end": 1771.12, "text": " different successor features. In fact, you have a vector of them, right? So here, you can see"}, {"start": 1771.12, "end": 1777.52, "text": " feature one, feature two, and so on. And it also assumes that you're in a current state, and you"}, {"start": 1777.52, "end": 1784.48, "text": " have many actions at your disposal right now, action one, action two, and so on. Okay, so this"}, {"start": 1784.48, "end": 1790.96, "text": " is all the past, you've already defined your features, you have learned these policies. And now"}, {"start": 1791.68, "end": 1800.48, "text": " you're given a new W, W new, in our case, it's this one negative one. And we want the best action. So"}, {"start": 1800.48, "end": 1807.36, "text": " we are in state s, we are given this W, we want the best action. Now, here is a method where we"}, {"start": 1807.36, "end": 1815.52, "text": " can simply calculate the best action in terms by not reinforcement learning at all in this new task."}, {"start": 1816.32, "end": 1824.08, "text": " So by structuring things like this here, so what does it really say here? It this thing says,"}, {"start": 1826.32, "end": 1834.4799999999998, "text": " we are going to evaluate all of these different cells of this tensor right here. So we're going"}, {"start": 1834.48, "end": 1844.64, "text": " to determine what is the successor feature number two, for policy pi one, in state s, if I right now"}, {"start": 1844.64, "end": 1853.04, "text": " do a two, this is very abstract. So let's say you're here, and action, action two is actually"}, {"start": 1853.04, "end": 1859.92, "text": " going to the right, okay, so you're here, oh, this was yellow, it doesn't matter. So this is so this"}, {"start": 1859.92, "end": 1868.16, "text": " is action one, this is action two. So action two is you go to the right, okay, you can you can see"}, {"start": 1868.16, "end": 1876.48, "text": " that this will let you pick up will let you pick up a triangle. Now here, that's action three,"}, {"start": 1877.92, "end": 1889.2, "text": " and so on. Okay, so what's this number going to be? So we are in state s, as we said,"}, {"start": 1889.2, "end": 1899.2, "text": " and we do action two. So action two is going to pick up a triangle, the triangle, the picking up"}, {"start": 1899.2, "end": 1908.24, "text": " of a triangle means that our pi for this step, or sorry, our five for the step is going to be zero"}, {"start": 1908.24, "end": 1916.8, "text": " one, okay. So our successor features, this is not the features itself, this is the successor features,"}, {"start": 1916.8, "end": 1925.52, "text": " the successor features decompose into the next step, plus all the next steps that we can follow,"}, {"start": 1925.52, "end": 1931.44, "text": " okay, so all the steps that will come. So what are these features going to be, is it's going to be"}, {"start": 1931.44, "end": 1938.96, "text": " the sum over that, plus everything that follows. And I can take a little bit of a guess here,"}, {"start": 1938.96, "end": 1947.04, "text": " which means that this number, so we only care about feature two right here, this feature, feature"}, {"start": 1947.04, "end": 1952.48, "text": " two, this number is going to be one for the next step, because we are going to pick up a triangle"}, {"start": 1952.48, "end": 1959.52, "text": " if we do action two. But then after that, we're going to follow policy one. And policy one"}, {"start": 1960.8, "end": 1968.24, "text": " has been trained to pick up the red squares and not care about triangles. So I'm going to guess"}, {"start": 1968.24, "end": 1975.84, "text": " that every now and then, it will kind of step over a triangle, but it won't fall, we won't, you know,"}, {"start": 1975.84, "end": 1982.8, "text": " explicitly go look for them. So let's say the episode was 10 more steps, but the board has like"}, {"start": 1982.8, "end": 1990.8, "text": " 100 squares. So and it has like three triangles on it. So let's say that's like three tenths"}, {"start": 1990.8, "end": 1999.52, "text": " in expectation. Okay, so this is going to be this is going to be the number that we're looking for,"}, {"start": 1999.52, "end": 2007.36, "text": " we're doing this for every single one of these cells. Okay, this this thing is going to do for"}, {"start": 2007.36, "end": 2014.56, "text": " every single one of these cells. And this is very similar to evaluating Q functions, except we're"}, {"start": 2014.56, "end": 2021.12, "text": " evaluating an entire vector right here. That's the difference to simply learning many Q functions. So"}, {"start": 2022.32, "end": 2029.76, "text": " if you were to evaluate only a Q function, then you would only have this first matrix, this first"}, {"start": 2029.76, "end": 2038.08, "text": " block right here. Okay, but you have feature one, feature two, and so on. So you calculate everything"}, {"start": 2038.08, "end": 2045.52, "text": " in terms of these features. And then by linearity, you can mix it with that vector. So in our case,"}, {"start": 2045.52, "end": 2051.52, "text": " this is going to be the one negative one, which will give you the Q functions, right, from what"}, {"start": 2051.52, "end": 2057.2, "text": " we've seen before, you obtain a Q function by simply mixing your successor features with your"}, {"start": 2058.4, "end": 2063.52, "text": " with this task vector. And if you have a Q function, you can pretty easily determine"}, {"start": 2063.52, "end": 2069.12, "text": " which action you should take. Now you have here a Q function with respect to every single policy,"}, {"start": 2069.12, "end": 2076.16, "text": " but you can simply take the max, right. So the max across all of this will determine"}, {"start": 2079.2, "end": 2085.6, "text": " will determine. So you take the max across all the policies, which will give you the Q function"}, {"start": 2085.6, "end": 2090.72, "text": " for a particular action over all policies that you consider. And then you can simply take the"}, {"start": 2090.72, "end": 2100.08, "text": " arg max of that and determine the action you should take. Okay, so it's a pretty big evaluation. But"}, {"start": 2100.7999999999997, "end": 2106.08, "text": " if you do this, that means you don't have to do reinforcement learning on this task, it simply"}, {"start": 2106.08, "end": 2114.48, "text": " determines which action right now is the best given everything that I know from these old"}, {"start": 2114.48, "end": 2122.96, "text": " policies about the task. And that's not going to be like the optimal policy, per se, but it's going"}, {"start": 2122.96, "end": 2129.68, "text": " to be one policy that's pretty, pretty good. And you can actually prove some things across that. So"}, {"start": 2129.68, "end": 2141.2, "text": " they do this right here. And you can see that here is what Q learning does on this new task"}, {"start": 2141.2, "end": 2147.68, "text": " of picking up the squares and avoiding the triangles. Q learning takes a while to get there."}, {"start": 2147.68, "end": 2156.08, "text": " However, if you do what they are suggesting, and you know, you give the W, you can supply the W"}, {"start": 2156.08, "end": 2161.8399999999997, "text": " almost from the beginning, you see right here, almost from the beginning, it is at a high reward."}, {"start": 2161.8399999999997, "end": 2170.48, "text": " Now Q learning surpasses it eventually. But it's pretty impressive that without doing any learning,"}, {"start": 2170.48, "end": 2177.84, "text": " you are immediately good. Right? Now, the caveat here, of course, is that they already need these"}, {"start": 2177.84, "end": 2183.68, "text": " policy pi one and pi two given to the algorithm. And that comes from previous reinforcement"}, {"start": 2183.68, "end": 2192.96, "text": " learning trials. And they say that they give these trials as many steps as Q learning uses. So"}, {"start": 2192.96, "end": 2198.88, "text": " they give them this these amounts of steps on these other tasks. So the comparison here is a"}, {"start": 2198.88, "end": 2205.76, "text": " bit shaky if you ask me. But the point made is that if you have a new task right now, you can"}, {"start": 2205.76, "end": 2212.0, "text": " obtain very good solutions. And you don't have to do anything. Okay, and these solutions can be the"}, {"start": 2212.0, "end": 2216.7200000000003, "text": " basis for new reinforcement learning, right, you could start Q learning off right here and then"}, {"start": 2217.36, "end": 2226.2400000000002, "text": " get here much faster, potentially, and so on. So the next objective right here is that now we have"}, {"start": 2226.24, "end": 2232.64, "text": " defined the tasks and we had we know what these features are. And we know how to mix these features"}, {"start": 2232.64, "end": 2241.52, "text": " as imposers of the task. So what happens if we only have the reward function, we specify the"}, {"start": 2241.52, "end": 2245.4399999999996, "text": " task only in terms of their word functions, but we're kind of looking at the features and we're"}, {"start": 2245.4399999999996, "end": 2254.08, "text": " like, agent, please figure out yourself how to apply these features in order to make the reward"}, {"start": 2254.08, "end": 2260.7999999999997, "text": " high. And that's what this thing is right here, this GP and GPI with regress w so you don't no"}, {"start": 2260.7999999999997, "end": 2268.88, "text": " longer tell it what the W is. It needs to infer it through reinforcement learning, right? And it's"}, {"start": 2268.88, "end": 2276.3199999999997, "text": " not really reinforcement learning. But what it does, where is it? Yeah, it's simply it because"}, {"start": 2276.3199999999997, "end": 2281.84, "text": " all of this is linear. And this thing here is given. So always remember, this thing here is"}, {"start": 2281.84, "end": 2289.44, "text": " given. And these are the rewards that you obtain, you can simply do a regression to figure out the"}, {"start": 2289.44, "end": 2295.76, "text": " W of the task. Now that's going to take some time. But as you can see, right here, it is going to"}, {"start": 2295.76, "end": 2304.88, "text": " take a lot less time than doing Q learning from scratch, notably because you have good features."}, {"start": 2304.88, "end": 2311.44, "text": " So this is some this is this gets closer and closer to transfer learning, right? And so what"}, {"start": 2311.44, "end": 2321.2000000000003, "text": " this does is it gives you a lot of information. So if you imagine that this right here is your"}, {"start": 2321.2000000000003, "end": 2330.4, "text": " pre trained neural network, and you simply learn the last layer of it. You freeze this, you do"}, {"start": 2330.4, "end": 2338.8, "text": " transfer learning, fine tune the last layer, here we are. So it gets closer and closer. And you'll"}, {"start": 2338.8, "end": 2345.28, "text": " but basically, I think it's a lot of math around a framework. And the more and more you relax"}, {"start": 2345.92, "end": 2354.0800000000004, "text": " the kind of impositions that they need for their framework, the more it gets back to simply,"}, {"start": 2354.0800000000004, "end": 2362.2400000000002, "text": " well, we do reinforcement learning, at least in my estimation. So before we look at that,"}, {"start": 2362.24, "end": 2373.3599999999997, "text": " this here is a pretty, pretty cool experiment, where they they look at how the how the different"}, {"start": 2373.3599999999997, "end": 2379.04, "text": " tasks can be achieved, if you give different policies. So you'll have noticed that we have"}, {"start": 2379.04, "end": 2386.64, "text": " always given these two, two tasks one, zero, and zero, one, these were our tasks that we trained on,"}, {"start": 2386.64, "end": 2394.16, "text": " and then one negative one is task we evaluated on. Okay, and you might object and say, wait a minute,"}, {"start": 2394.16, "end": 2400.48, "text": " these these two tasks, you know, they're pretty good, as let's say, pre training tasks, because,"}, {"start": 2400.48, "end": 2407.7599999999998, "text": " and it's basically the standard basis, right? And any other tasks can be mixed from those. So"}, {"start": 2408.48, "end": 2414.8799999999997, "text": " these are orthogonal vectors in this vector space. So you're being pretty generous to this system,"}, {"start": 2414.88, "end": 2422.32, "text": " what happens if we're not as generous, so that's what they do here. So they have different policies,"}, {"start": 2422.32, "end": 2428.88, "text": " and they evaluate how much you can learn with these different policies. So the way you have to"}, {"start": 2428.88, "end": 2437.2000000000003, "text": " read this diagram is right here, it's going to be the one zero axis as they will, they label it right"}, {"start": 2437.2000000000003, "end": 2444.2400000000002, "text": " here. And this is going to be the zero one axis, and this is evaluation. So every direction on this"}, {"start": 2444.24, "end": 2450.64, "text": " circle defines a task. For example, this task right here, as you can see, is going to define"}, {"start": 2450.64, "end": 2456.72, "text": " the task of picking up both the squares and the triangles, right, whatever you pick up, you get a"}, {"start": 2456.72, "end": 2464.56, "text": " reward. However, the task down here is going to be please pick up the squares, but avoid the triangles"}, {"start": 2464.56, "end": 2473.12, "text": " at all costs. Okay, and now they're going to look what happens if we supply different policies to"}, {"start": 2473.12, "end": 2477.6, "text": " choose from. Remember, we're in this situation, we're again in this situation where we give"}, {"start": 2477.6, "end": 2483.52, "text": " everything. And we give initial policies, we give the task vector. And now it's about deriving a"}, {"start": 2483.52, "end": 2491.44, "text": " good policy just from looking at the old policy, so no learning. As a baseline, you have Q learning,"}, {"start": 2491.44, "end": 2501.7599999999998, "text": " which into a given direction, tells you basically how long Q learning takes or how far Q learning"}, {"start": 2501.76, "end": 2510.2400000000002, "text": " gets with a given amount of steps indicated by this one, two, three, four, and so on. Yeah, you"}, {"start": 2510.2400000000002, "end": 2518.0800000000004, "text": " see, I think this is this is this in how far Q learning gets with these amounts of steps is the"}, {"start": 2518.0800000000004, "end": 2525.76, "text": " dotted lines right here. So Q learning gets this far with 10 to the I don't know, four, and then"}, {"start": 2525.76, "end": 2534.0800000000004, "text": " this far 10 to the five and so on. So these are comparisons. You can see that on the outside Q"}, {"start": 2534.0800000000004, "end": 2541.1200000000003, "text": " learning is going to beat this these methods. But our hope is going to be that of course, if we have"}, {"start": 2541.1200000000003, "end": 2547.36, "text": " this zero shot generalization, it's much better than running Q learning for really long if we get"}, {"start": 2547.36, "end": 2555.6, "text": " close to it. So the green thing is what we've already seen policies one and two will give you"}, {"start": 2555.6, "end": 2562.7200000000003, "text": " a fairly, you know, good, fairly good extent right here. So what does it mean? It means it can solve"}, {"start": 2563.84, "end": 2570.96, "text": " it can solve pretty much everything from here, here, this task, this this task, this task,"}, {"start": 2570.96, "end": 2578.08, "text": " it kind of falls off once we go down here. So once we go to the avoid section, it sort of falls off"}, {"start": 2578.08, "end": 2584.48, "text": " because it has never learned to avoid. Now, still, we can of course, do the avoidance by simply"}, {"start": 2584.48, "end": 2590.56, "text": " imposing a negative collection. But negative collecting and avoiding aren't exactly the same"}, {"start": 2590.56, "end": 2597.84, "text": " thing in these in these environments, right? Because avoiding can also be going really close"}, {"start": 2597.84, "end": 2603.36, "text": " to something but not hitting it while collecting. It's not the inverse of collecting, the inverse"}, {"start": 2603.36, "end": 2610.1600000000003, "text": " of collecting would be like run away as far as as far as possible. So we can expect that we've only"}, {"start": 2610.1600000000003, "end": 2621.84, "text": " ever learned to collect, we're not going to be super good at avoiding. Then the other extreme is"}, {"start": 2621.84, "end": 2628.2400000000002, "text": " when we give policies three and four, I haven't told you but you can see it right here. Policy"}, {"start": 2628.2400000000002, "end": 2635.6000000000004, "text": " three is explicitly to collect one and avoid the other. Well, policy four is the opposite right"}, {"start": 2635.6000000000004, "end": 2645.28, "text": " here, avoid the squares, collect the triangles. And now this policy, this policy is should be"}, {"start": 2645.28, "end": 2652.6400000000003, "text": " pretty good on all of the tasks in between. As you can see, it has the biggest extent right here. And"}, {"start": 2652.6400000000003, "end": 2659.6000000000004, "text": " that also makes sense. By the way, there's nothing down here because the task of avoiding both things"}, {"start": 2659.6000000000004, "end": 2665.76, "text": " doesn't really make sense because you can just stay where you are. Because there are also these"}, {"start": 2665.76, "end": 2674.0800000000004, "text": " these squares where there's nothing. But you can see that the mixture of those is quite potent. So"}, {"start": 2674.08, "end": 2682.96, "text": " already we can see even though these span a basis, in fact, an orthogonal basis as much as these,"}, {"start": 2684.08, "end": 2688.7999999999997, "text": " because of the nature of the features that we define for the task, they are not equivalent"}, {"start": 2688.7999999999997, "end": 2695.68, "text": " in mixing after so we can be more generous, we can also be less generous. If we only provide policy"}, {"start": 2695.68, "end": 2702.88, "text": " five and policy five is simply to pick up to pick up both objects, then we're going to have a pretty"}, {"start": 2702.88, "end": 2709.36, "text": " hard time when it comes to avoiding things. So you can see it can do fairly well picking up the"}, {"start": 2709.36, "end": 2715.36, "text": " various things in a positive manner. But as soon as we cross this line into the like this horizontal"}, {"start": 2715.36, "end": 2725.2000000000003, "text": " line into where it's about avoiding a particular object, it's not it's not the choices of actions"}, {"start": 2725.2, "end": 2737.12, "text": " we have from policy five aren't going to be super good at that. And they do another they do another"}, {"start": 2737.12, "end": 2743.2799999999997, "text": " thing right here. So that the left thing is where they say, it's important which policies we provide."}, {"start": 2743.28, "end": 2755.92, "text": " And the right thing, they want to say something like, it's important. So they want to say, if we"}, {"start": 2755.92, "end": 2762.2400000000002, "text": " provide more policies, that can be advantageous, because we basically have more options to choose"}, {"start": 2762.2400000000002, "end": 2769.28, "text": " from. Okay, so now they start off with policy four. And policy four is simply avoid the squares,"}, {"start": 2769.28, "end": 2774.0800000000004, "text": " collect the triangle, you can see it performs fairly well over here, where it's all about"}, {"start": 2774.0800000000004, "end": 2780.5600000000004, "text": " avoiding the squares and collecting the triangles as soon as you get into, you know, collecting,"}, {"start": 2781.1200000000003, "end": 2787.36, "text": " or even here, the opposite directions, it's pretty bad, right? That's the red thing. And now they add"}, {"start": 2787.36, "end": 2797.6800000000003, "text": " policy two to policy four. So policy two is going to be also to collect the the triangles, but to"}, {"start": 2797.68, "end": 2804.64, "text": " just neglect the squares. And that will also do a bit better. Why does it do better? Because it's"}, {"start": 2804.64, "end": 2812.3199999999997, "text": " better at collecting, because this policy here also needs to avoid. And this policy here doesn't"}, {"start": 2812.3199999999997, "end": 2820.48, "text": " care. So in the regimes where it's better to not care than to avoid, adding this policy, adding"}, {"start": 2820.48, "end": 2825.2799999999997, "text": " these options is going to be good. And you can see that there's a general expansion here, as we add"}, {"start": 2825.28, "end": 2831.44, "text": " more policies. However, I want to point out that, for example, here, this black thing,"}, {"start": 2833.44, "end": 2838.7200000000003, "text": " which should be technically superior to the blue thing, because it contains, as you can see here,"}, {"start": 2838.7200000000003, "end": 2844.0800000000004, "text": " all the policies that the blue thing contains plus another policy."}, {"start": 2846.32, "end": 2853.1200000000003, "text": " I don't I don't know if my vision, but I'm pretty sure here, the black thing is inside the blue"}, {"start": 2853.12, "end": 2861.92, "text": " thing. So that means there can also be a disadvantage to adding more policies right here,"}, {"start": 2861.92, "end": 2871.8399999999997, "text": " because maybe you got you have too much to choose from. And so right here, what we say is we add a"}, {"start": 2871.8399999999997, "end": 2878.88, "text": " policy that is all about collecting the squares. And it is performing, it is actually decreasing"}, {"start": 2878.88, "end": 2883.84, "text": " the perform. The addition of this is decreasing the performance on tasks where you have to avoid"}, {"start": 2883.84, "end": 2894.2400000000002, "text": " the squares, which I'm not sure if, if that makes sense. Again, the opposite of collecting isn't"}, {"start": 2894.2400000000002, "end": 2899.6, "text": " avoiding, but I'm just pointing this out. And this isn't really mentioned in the paper, the paper"}, {"start": 2899.6, "end": 2907.36, "text": " simply says, see, we add policies, and therefore we are getting better. I'm not, I don't agree with"}, {"start": 2907.36, "end": 2916.08, "text": " this, given these results, or maybe the plotting, the plotting is bad. Alright, so they say, okay,"}, {"start": 2916.08, "end": 2925.04, "text": " more policies better, which I disagree with. They also say, oh, we can, as as much as we can regress"}, {"start": 2925.04, "end": 2932.7200000000003, "text": " the W, right, we regress W, we figure out the task, we can even learn the successor features."}, {"start": 2932.72, "end": 2939.52, "text": " Okay, we can not the successor features, the pi functions that lead to the succession,"}, {"start": 2939.52, "end": 2944.24, "text": " successor features. And you can see, if you do it with the true W, you're really good at the"}, {"start": 2944.24, "end": 2954.0, "text": " beginning. If you do it with a regress W, we can see that before you can you. So this is the small"}, {"start": 2954.0, "end": 2962.64, "text": " version of this plot right here. This is like this section, I think, yeah. You know, you improve,"}, {"start": 2962.64, "end": 2968.48, "text": " however, we can also learn this pi function, we can also learn the features, where if we're not"}, {"start": 2968.48, "end": 2973.7599999999998, "text": " given the features, maybe we can learn the features. And they say, well, we can do this"}, {"start": 2973.7599999999998, "end": 2982.96, "text": " with but also by regression. So here, what we can do is we can find the function that minimizes the"}, {"start": 2982.96, "end": 2990.3199999999997, "text": " function and the W along with it that minimizes this error right here. Okay. So you're finding"}, {"start": 2990.32, "end": 2996.0800000000004, "text": " the function and the W that that matches this error. And this now really is like learning"}, {"start": 2996.6400000000003, "end": 3004.7200000000003, "text": " a neural network. I mean, you know, so I get I get it, you have the I here and the W doesn't"}, {"start": 3004.7200000000003, "end": 3015.6000000000004, "text": " depend on the I and so on. But you're getting more and more back to actually simply learning"}, {"start": 3015.6, "end": 3021.8399999999997, "text": " nonlinear functions, mixing them linearly right here. And I think that's going to be kind of the"}, {"start": 3021.8399999999997, "end": 3029.2799999999997, "text": " crux of this method. The fact that the more complicated your problems are, the less you're"}, {"start": 3029.2799999999997, "end": 3035.2, "text": " going to be able to do this kind of stuff. And they even go as far as to say, well, what if like"}, {"start": 3035.2, "end": 3041.2, "text": " before we the reward is actually something like whether or not you have collected an even number"}, {"start": 3041.2, "end": 3050.08, "text": " of triangles or squares, then they say, well, you can simply not have a single W, but you can find"}, {"start": 3050.08, "end": 3058.64, "text": " a function W. And now the policy is a function of the function of W. And you can do potentially the"}, {"start": 3058.64, "end": 3067.04, "text": " same regression problem. But as you can see, it gets so now you this right here is going to be"}, {"start": 3067.04, "end": 3078.88, "text": " a function of state. And so you can see that it more and more, it simply goes back to basically"}, {"start": 3078.88, "end": 3085.84, "text": " Q learning again, the only difference here is that you have this intermediate features. But"}, {"start": 3085.84, "end": 3094.72, "text": " I think you can simply view this, let's say as a hidden layer in a neural network. I get it somewhat"}, {"start": 3094.72, "end": 3109.3599999999997, "text": " held constant across sums and so on. But I like the method in terms of the analysis."}, {"start": 3109.3599999999997, "end": 3114.9599999999996, "text": " So if you are given all this stuff, it seems pretty cool that you can derive new policies."}, {"start": 3115.52, "end": 3121.9199999999996, "text": " Its implication for lifelong learning, they say, look, here, you have a bunch of tasks in your"}, {"start": 3121.92, "end": 3129.44, "text": " database that you've already learned on your agent is going out into the world, it faces a new task,"}, {"start": 3129.44, "end": 3137.44, "text": " it can use this thing, it can use this thing to obtain a new good policy for that task, it can"}, {"start": 3137.44, "end": 3145.04, "text": " then use reinforcement learning, or l to refine that policy. And then it can simply save that"}, {"start": 3145.04, "end": 3155.12, "text": " policy into the database. So it keeps expanding and expanding this thing. So it keeps adding rows"}, {"start": 3155.12, "end": 3161.7599999999998, "text": " and rows and rows right here of new policies that it's learned over the course of its life. So once"}, {"start": 3161.7599999999998, "end": 3168.32, "text": " it's facing a new task, it can just kind of draw from its experience and derive a good initial"}, {"start": 3168.32, "end": 3178.48, "text": " solution. However, the actual analysis only works, I feel, in quite limited circumstances. And if you"}, {"start": 3178.48, "end": 3185.36, "text": " want to relax these limited circumstances, then you need to basically regress and regress and regress"}, {"start": 3188.2400000000002, "end": 3195.6800000000003, "text": " away from their setup. And I'm not sure, I'm not sure where this is going to go. If this is going"}, {"start": 3195.68, "end": 3200.7999999999997, "text": " to be a general framework for people, it seems like it because it's pretty easy. But then also,"}, {"start": 3200.7999999999997, "end": 3207.44, "text": " it seems like most of the world doesn't really fall into this category. In fact, this divide and"}, {"start": 3207.44, "end": 3214.64, "text": " conquer approach, I'm not sure, but from divide and conquer, I always imagine something like"}, {"start": 3214.64, "end": 3220.96, "text": " you subdivide and subdivide and subdivide until you know, you are at some kind of basic task,"}, {"start": 3220.96, "end": 3228.0, "text": " they still only go for no single task like this here, the tasks are somehow in sequence. And"}, {"start": 3228.64, "end": 3236.16, "text": " I'm not I think we should really think about hierarchical RL. Now this can be a good first"}, {"start": 3236.16, "end": 3241.92, "text": " step right here. But most hierarchical RL, even the ones that specify themselves as fully"}, {"start": 3241.92, "end": 3247.92, "text": " hierarchical, like we can do many layers, they rarely go above two layers or three, like like"}, {"start": 3247.92, "end": 3255.6, "text": " one, one meta layer and one actual layer like this one right here. They rarely go further,"}, {"start": 3255.6, "end": 3262.4, "text": " maybe they go two layers, but that's about it. I've seen very little in actual hierarchical"}, {"start": 3262.4, "end": 3268.32, "text": " or divide and conquer reinforcement learning just because it's so hard to train. Yeah, all in all,"}, {"start": 3268.32, "end": 3277.12, "text": " cool paper. And if you want to get into the math a little bit, I think it's pretty easy math. Once"}, {"start": 3277.12, "end": 3283.04, "text": " you kind of set your goals on what it's actually meant to achieve. If you just read from the"}, {"start": 3283.04, "end": 3290.72, "text": " beginning, all these reinforcement learning papers, it seems a bit like, why? Why are we doing this?"}, {"start": 3290.72, "end": 3295.6, "text": " Right? You just oh, we define this, we define that, we define this. And you're a bit like,"}, {"start": 3296.88, "end": 3304.7999999999997, "text": " yeah, but why? So often it pays in these papers to go at the end to the examples, and then come back"}, {"start": 3304.8, "end": 3309.84, "text": " to the theory, knowing what they want to achieve. All right, that was it for me. Long rant. I'll see"}, {"start": 3309.84, "end": 3335.84, "text": " you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=a4VvcmqnkhY
What Matters In On-Policy Reinforcement Learning? A Large-Scale Empirical Study (Paper Explained)
#ai #research #machinelearning Online Reinforcement Learning is a flourishing field with countless methods for practitioners to choose from. However, each of those methods comes with a plethora of hyperparameter choices. This paper builds a unified framework for five continuous control tasks and investigates in a large-scale study the effects of these choices. As a result, they come up with a set of recommendations for future research and applications. OUTLINE: 0:00 - Intro & Overview 3:55 - Parameterized Agents 7:00 - Unified Online RL and Parameter Choices 14:10 - Policy Loss 16:40 - Network Architecture 20:25 - Initial Policy 24:20 - Normalization & Clipping 26:30 - Advantage Estimation 28:55 - Training Setup 33:05 - Timestep Handling 34:10 - Optimizers 35:05 - Regularization 36:10 - Conclusion & Comments Paper: https://arxiv.org/abs/2006.05990 Abstract: In recent years, on-policy reinforcement learning (RL) has been successfully applied to many different continuous control tasks. While RL algorithms are often conceptually simple, their state-of-the-art implementations take numerous low- and high-level design decisions that strongly affect the performance of the resulting agents. Those choices are usually not extensively discussed in the literature, leading to discrepancy between published descriptions of algorithms and their implementations. This makes it hard to attribute progress in RL and slows down overall progress (Engstrom'20). As a step towards filling that gap, we implement over 50 such "choices" in a unified on-policy RL framework, allowing us to investigate their impact in a large-scale empirical study. We train over 250'000 agents in five continuous control environments of different complexity and provide insights and practical recommendations for on-policy training of RL agents. Authors: Marcin Andrychowicz, Anton Raichuk, Piotr Stańczyk, Manu Orsini, Sertan Girgin, Raphael Marinier, Léonard Hussenot, Matthieu Geist, Olivier Pietquin, Marcin Michalski, Sylvain Gelly, Olivier Bachem Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hello there. Today we're looking at what matters in on policy reinforcement learning, a large scale empirical study by Google Brain. On a high level, this paper investigates a five different continuous control tasks, and they train agents with all the different choices that you can make, basically, on these continuous control tasks. So the different choices are like network width and height of the value and policy network, learning rate, type of loss function, regularization constants, and they train all of these agents and they try to parse out what works in general, and what doesn't. And they have some surprising findings that number seven will surprise you. Yeah. Okay, so that's the that's the study on a high level. As always, if you like content like this, consider subscribing and sharing it out. That would be excellent. So they say the on policy reinforcement learning has been successfully applied to many different continuous control tasks. While our algorithms are often conceptually simple, their state of the art implementations take numerous low and high level design decisions that strongly affect the performance of the resulting agents. Those choices are usually not extensively discussed in the literature, leading to discrepancy between published descriptions of algorithms and their implementations. So the sort of things they mean here are the things that when you read the paper, the algorithm will be sort of described pretty well on the main idea. But then if you look at the code, there's a whole bunch of hacks there. Like on the Atari environment, you have to repeat certain actions, you have to introduce sticky actions, then the question is, do you have like a random starts or the OS start at the exact same time, therefore, the randomness of the level is not given, then you whether or not you normalize certain observations. But we've had these things even in supervised learning or NLP, things like this, we've had pre processing, I remember the resonant first resonant paper that beat ImageNet to a significant degree over the last year's baseline. It was, oh, yeah, we have the simple idea of the resonant. And they have an entire section where they go, oh, and we do this normalization, we do this pre processing, we do this and this and this and this and this. And I mean, there's an argument to be made for all of these, these choices. But often, it's hard to disentangle, if the choice, choices of these pre processing things, or whatever the choices are matters, or if the idea in the paper matters. And it's also very hard to compare different things. So what they're doing here, so I would say this is not only a problem in RL, this is a problem generally, they say, as a step towards filling the gap, we implement over 50 such choices in a unified on policy RL framework, allowing us to investigate their impact in a large scale empirical study. So large scale empirical study is basically means grid search over these choices, kind of smart grid search, we train over 250,000 agents in five continuous control environments of different complexity and provide insights and practical recommendations for on policy training of RL agents. So as far as I could figure out the code and or and or the checkpoints of these 250,000 agents, or the code of this unified on policy RL framework is not available yet. And I don't know if it's going to be but basically, what they're doing is they're building one agent. So in usually you have this agent environment dichotomy, right here, you get observation and reward. And here you get you give action, they build one single agent that has a lot of switches that has a lot of like flags that you can say, okay, either Do you want this loss or this loss? Cool. Do you want this regularization or this regularization? And if so, by how much right? And so on. So I have this agent with lots and lots and lots of switches over 50 of these choices that they implement right here. And they can basically turn each one on and off. And therefore they can investigate these algorithms. So let's jump over the most surprising finding, which, okay, the most I can tell you the most surprising finding is that the initialize the policy initialization scheme matters significantly. Okay. That's what people maybe didn't know. What also matters a lot is the learning rate, and things like the discount factor. But I think people in RL were already familiar with that. I find it also interesting what doesn't matter, namely, most things seem to not really matter too much. But there might be other explanations for this. Alright, so they say we consider the setting of on policy reinforcement learning for continuous control. Now, this is where I have a bit of a of a problem right here. Because the title is what matters in on policy reinforcement learning, it's not what matters in on policy reinforcement learning for continuous control. They do say in the abstract here, as you've already seen, in the last sentence that they have continuous control environment, five continuous control environments. But yeah, I get it, you need to make the title a bit click baity. But the title overstates a bit what this paper says this paper basically says, what works in these particular five continuous control environments, right? So they vary a lot of things with respect to the agent, but they keep the environments relatively constant. And it's not five diverse environments, it's five, mu, Joko continuous control environments that are very, very, very similar to each other in terms of their observation in terms of how the world works, and so on. So consider this paper as an investigation in what works and doesn't work for these five, and possibly for very relatively close environments. So that's, that's, I think, my biggest trouble I have with this paper right here is sort of it overstates what it what it says in the title. But, I mean, the investigation itself is done, I feel very, very well. So they say they have a unified on policy learning algorithm, where they research prior work took popular code bases made a list of common Lewis choices and then implemented everything into starting from the seed RL code base, seed RL is kind of a framework for distributed or for reinforcement learning in general. And they say, whenever we faced, we were faced with implementation decisions that required us to take decisions that could not be clearly motivated, or had alternative solutions, we further added such decisions as additional choices. So this I feel, if I write research code, this is generally what I do, right, I write my research code. And whenever I come to a place where I'm like, should I use this or this should use this optimizer or this optimizer, I simply make a flag. And then even if it's just one choice for now, right, just make a flag and parameterize everything. And that's, that's, that's the thing here, they parameterize everything. But other than I would do now, then I would sort of sparsely explore the space of these parameters. Now they do a more dense, dense observation or dense sampling of this space than me myself would do with limited resources. Of course, being Google, it is possible to do these kinds of things where you investigate all the choices. So they say here, difficulty of investigating choices. The primary goal of this paper is to understand how the different choices affect the final performance of an agent and derive recommendations for these choices. There are two key reasons why this is challenging. First, we're mainly interested in insights on choices for good hyper parameters. Yet, if all choices are sampled randomly, the performance is very bad, and little training progress is made. So that means if you have if you have all of these hyper parameters, then let's let's consider like a three dimensional hyper parameter space, then there are combinations of hyper parameters that are very good, right here, maybe here. So there's this, this cube in here, that's sort of very good, but the rest aren't really good. So if you just simply sample from anywhere in the space, like here, or here, or here, or here, here, you will basically never get anything that works, you sort of have to hit the combination correctly. And that's, that's a problem in three dimensions, but it's way more a problem in 50 plus dimensions like they have here. So they have to resort to a different strategy. They have to go basically start out from a good configurations, where they say, they group these, we create groups of choices around thematic groups, where we suspect interactions between different choices. For example, we group together all choices related to neural network architecture. We also include the learning rate in all of the groups, as we suspect it may interact with many other choices. Then in each experiment, we train a large number of models where we randomly sample the choices within the corresponding group. All other settings for choices not in the group are set to settings of a competitive base configuration that is close to the default PPO versus V2 configuration. Okay, so what they're doing basically is they're saying, now let's, let's consider these. So these groups, you can now think of single dimensions in this space. So, or, yes, so let's consider the space of groups. Let's say you have two different groups. One is the group of network architecture parameters, and the other one is a group of learning behavior, like learning rate and training algorithm parameter. What they're saying is they're saying, we know of a configuration right here, that is good. This is PPO versus two, V, version two. And now what we're going to do is we're simply going to keep in each experiment, we're going to, if we want to investigate the network architecture, let's say that's this axis, we're going to keep all the other groups the same as this default configuration. And only investigate, only basically move this point to the left and to the right. And we're not going to move it up and down, we're going to keep the learning dynamic parameters of the other group or all of the other groups, we're going to keep the same, and only move it in in the architecture parameter space. Now, of course, this is not just one parameter, this, since they make these groups, this is a multi, multi parameter. So at each point here, you can imagine like a little subspace of the inner group, and they then sample from these. And that becomes much more feasible, right? So now maybe you have, let's say you have 10 groups of five parameters each, you can densely sample five parameters, like that's sort of possible, you cannot densely sample 50, but you can densely sample five. So what you would do is you would keep the other 45 constant, that would correspond to this dimension and all the other dimensions. And you would only vary within the group, which would correspond to this dimension. But now you see that the problem again, of course, is that you're always starting from this point. And you're basically only exploring along the axis of this of this group space. Because you always keep one can't keep the others constant. And that basically, to me, that means that these experiments are going to be heavily favored in, in terms of which of the algorithms is closest to this to this baseline. Because if so, if I go with, with this particular algorithm, I know that these parameters are the best for this particular algorithm, where if I now use any other algorithm, these parameters might not be the best. And my only my only way of adjusting to that other algorithm is by individually moving here while keeping others constant. So I can basically only improve with it along one of the groups. I hope this makes sort of sense that it feels like this experiment biases the results in favor of whatever is made, whatever choices are made in this baseline. So keep that in mind. Now, that being said, PPO, of course, is very popular baseline. So it makes total sense to use that as a as a base to explore from. But it's not like they're doing an actual dense grid sampling of the space, they're doing a sparse sampling in the group space, and then a dense sampling within each group. Alright, so they, let's go into the experiments. The first thing they investigate are the policy losses. Now this is this is a rather important topic. And that basically means how do you train the policy. And the choices here are, of course, PPO, like we saw the proximal policy optimization, but there are also others, namely, for example, policy gradient, you might know that if you learn about reinforcement learning, you will inevitably learn about policy gradients, like the first thing you learn next to Q learning. And then v trace is another sort of policy loss. v trace is optimized for distributed reinforcement learning. And they have a bunch of others. And they hear they say the goal of this study is to better understand the importance of the policy loss function in the on policy setting considered in this paper was not to provide a general statement that one of the losses is better than the others, as some of them were specifically designed for other settings. Now, I, of course, I agree with this with this statement, it's nice that they repeated again, right here. So all the results right here are just valid for these environments, or environments very similar to these. And you have to keep in mind that the baseline parameters are PPO v two, and they only ever vary one group from these baseline parameters. So that's why in this experiment, for example, it doesn't seem too surprising that the PPO loss, as you can see, outperforms in every single experiment here. Whereas the other losses underperform. So the recommendation is use the PPO policy loss, start with the clipping threshold to point two five, but also try lower and higher values if possible, because they have found and they have they have more experiments. And the appendix, the appendix is full of these experiments, and you can go and look at them. So they, but the general recommendation here for them is to use the PPO policy loss if you have these continuous control tasks, and that there is a strong influence of this clipping threshold that is in PPO. Second thing, network architecture. And that's basically you have you always have a value network and a policy network. And the question is how many layers how deep and so on? Should you make them? These things here are just MLPs. Since this is continuous control tasks, you don't learn from pixels. As far as I understand it, you learn from the states or the sensors on these robot simulated robots. Now, you got this here, they say, separate value and policy networks appear to lead to better performance on four out of the five environments. And further regarding network sizes, the optimal width of the policy m of the policy network depends on the complexity of the environment and to lower to high values costs can cause significant drop in performance. Well, for the value function, there seems to be no downside in using wider networks. Moreover, on some environments, it is beneficial to make the value network wider than the policy one, e.g. on half cheetah, the best results are achieved with 1632 units per layer, da da da da da da da. The so some there, this is a thing that sort of crystallizes out of this paper, because what you're doing is you have these one policy network and one value network, like it's it's this dichotomy where the value network tries to estimate the reward, and the policy network tries to maximize the value. So you have you have two learning things here, you have this is learned. And this is learned. Now there is a certain degree of interaction as the value network. Of course, the reward is dependent on your policy. So the value network sort of has to take into account the policy when it estimates the reward. But it seems to be that the policy network is the brittle or one, and therefore, more care has to be taken to optimize it, whereas the value network seems to be a bit of more robust to changes. And we've seen this already in that the the the loss choice for the policy seems to be quite important. And here also the network parameters for the policy seem to be the things you have to actually tune per environment. Whereas for the value, you can pretty much go you can pretty much get any wide network will kind of do. Okay. So they say as for activation functions, we observe that tanh activations perform best and relu perform worst, which is interesting, right? Because you would think that in other deep learning tasks relu have become pretty popular and usually outperform these others, other activation functions. But in this case, no, but this could also be due to other things, because again, they go from these default parameters, which, for example, do not have entropy regularization built in. And if you have a relu, where it's basically an unbounded function, whereas the tanh is sort of a more or more bounded function. So that could be, you know, there could be significant interactions here where they have split the groups, and then the choices might be reversed if in the other groups, these two parameters were different. But for now, apparently, that tanh activations perform best. The interesting thing here is they say, interestingly, the initial policy appears to have a surprisingly high impact on the training performance. So this is how you initialize the policy network. Again, policy network appears to be the more brittle one and the one that you have to tune more. The key recipe appears to initial the key recipe appears is to initialize the policy at the beginning of training so that the action distribution is centered around zero regardless of the observation, and has a rather small standard deviation. This can be achieved by initializing the policy MLP with smaller weights in the last layer. So if you have this policy MLP as multiple layers, and then it needs to output an action distribution, right. So in these in these continuous control tasks, you basically, for each of the joints you have to affect, so you have like a little, you have like a little walker here with four legs, and what's that? That's like eight joints or something. So you have to tell this how much force it needs to apply to each of these joints. And as I understand it, that's usually given by the network outputting a mean and a standard deviation, I might be wrong here, but meaning the standard deviation for the distribution of action, that's going to be apply here and then this is sampled from that distribution, the actual force is then sampled. Now they say you should initialize the network such that the mean here is zero across or over your observations. And the way to do that is to simply initialize this last layer here with very small weights. So you and I think their recommendation is to divide to initialize this by 100 times smaller weights than all the other layers. They say other choices appear to be less important. The scale of the last layer initialization matters much less for the value MLP again, then for the policy MLP. Apart from the last layer scaling network initialization does not matter too much, yada yada yada, there appears to be no benefits if the standard deviation of the policy is learned for each state, or once globally for all states for the transformation of policy output into standard deviation soft plus and the expenditure performs similarly. So most of these choices in their case appear to be relatively similar except the ones that they point out. The recommendation here is initialize the last policy layer with 100 times smaller weights. Use soft plus to transform network output into action standard deviation and add a negative offset to its input to decrease the initial standard deviation of actions. To this offset is possible use tanh as both the activation function if the networks are not too deep right here. This is probably where the relu would start to shine and transform the samples from the normal distribution to the bounded action space, sorry, and to transform using a tanh. Use a wide value MLP, no layers shared with the policy, but tune the policy width. It might need to be narrower than the value MLP. Now this here, this no layers shared with the policy, this might just this might be now a result that the policy is quite, quite brittle. So if you can detach the value and the policy that might be of advantage. Which is also surprising, right? You would think that these two networks if they are shared layers, they would learn more about the environment, but apparently not. Then normalization and clipping. So you get a bunch of normalization and clipping techniques, which is, for example, observation normalization, basically means that whatever comes in, you normalize it to a given range. So that's usually you do that for supervised learning, like if you have if you have MNIST digits, so this is a mostly black image with Okay, can I draw on this with like a small portion of it is white. And what you want, this is usually in the range of zero to 255. So you have zero to 255. What you want to do is you want to normalize that search that it's in the range negative one to one, or alternatively, such that its mean is zero and its standard deviation is about one. So people use both things and they tend this alone tends to already boost the performance. So the fact that it's non that this is non negative, and the also the fact that this number is somewhat higher than sort of in the zero one range, these are quite important. And they're going to figure out that this is also important right here. So the recommendation is always use observation normalization and check if value function normalization improves performance. So for value function normalization, I believe you would you would normalize the output of the value function. So instead of the value function telling you this is how much worth something is, it simply can tell you sort of that it's more or less worth than something else in a normalized range. gradient clipping might slightly help but is of secondary importance. Okay, cool. Yeah, so all the other things also don't seem to matter too much, like per mini batch advantage normalization, and gradient observation clipping. Yep. Then advantage estimation. So advantage estimation in reinforcement learning is a basically the the value network needs to be trained, right? So you take a step and a step and step and step and in each step, you get a reward. And you get you perform many steps. Now the value network sitting right here, needs to be trained to predict the total rewards that you can get from here on until the end of the episode. Now, usually what you do is you can bootstrap this by sort of a temporal difference thing in that you consider the you you consider a few steps into the future. And then you ask your own value network what it thinks of the rest of the episode. So basically, you train you don't train on the entire rest of the episode, you train on the difference between this and this. And then you can get way more complicated where you actually ask your value network at each step what it thinks and then you go to that value network while integrating this reward. But you also go to this value network while integrating these two rewards and so on. And then your target becomes sort of a mixture of all of these things. You can get super complex with these with these different variants. And they say we compare the most commonly used advantage estimators and step GA and vtrace and their hyper parameters. And their recommendation is use the GA with lambda equals 0.9. Okay. I feel this is not is not too, too, too surprising right here, because this this end step is a very basic estimator. And the GA and the vtrace are better. And they say the GA and the vtrace they appear to perform better. And they have not found a significant performance difference between the two. So cool. Last thing though, this is second, second to last thing, almost last thing, training setup. Now I believe this, this becomes more important. So they investigate choices related to data collection and mini batch handling. So the number of parallel environments, the number of transitions gathered in each iteration, the number of passes over the data, and so on. So this is going to matter quite a bit. The recommendation is to go over experience multiple times. So what you do in these environments is always you have a phase where you collect experience. And then you have a phase where you learn from this experience. And so you collect experience, you start from here, you collect a bunch of experience, you put all of that experience into a buffer, which is like a database. And then you have these, what they're called traces, right. So all of these are now episodes that your agent took. Now all of these episodes consists of many, many steps that the agent took. So here is one step, here is one step, here is one step. And each of these steps are going to be one training sample. So each of these steps and also here and here are going to be one training sample. There are multiple problems here. The first and obvious one is if they if you just leave them in order, then you will have very, very correlated mini batches. And that's not good. So you want to kind of shuffle them around in here. Each time before you go to them, you can go through them multiple times in different order. And that works really well. They say you should go over your experience multiple times, since that doesn't hurt you. And it alleviates you from the necessity to collect more data. The second thing they say is you should shuffle individual transitions before assigning them to mini batches. Okay, we've, we've concluded that. And you should recompute advantages once per data pass. Now what's the point? The point here, before we talked about, you have to, you have these advantage estimators, which basically means you have to look for each step, you have to look ahead a couple of steps, decide what the value of this state is or the advantage. And in order to do that, as we have seen, you kind of look at your own estimation of that future value. So you have this value is dependent on your own estimation of the future value. Now, of course, if you just do, if you can only do this, if you have these episode traces, if you have these blue episode traces still around, you know which step comes after which, you cannot do this anymore, once this is all in mini batches and shuffled. So what some people do is they simply compute these things once at the beginning, with the value network they have, and then they go multiple times over this data. And just they shuffle, they might shuffle each time, but they keep these estimates. And that's, of course, is more and more out of date, the more often you go over the data. So what they recommend is, you should always go back to this set data set, recompute these estimates with your current value network, then do the whole shuffling thing again, and then do another epoch, and then basically come back to here again, and recompute the advantages. It makes a lot of sense, right, but they also find that this actually makes a difference. For faster wall clock time, training use many parallel environments and increase the batch size, both might hurt the sample complexity, but they get you a faster wall clock time, which makes sense, right? If you have more environments than you're going to collect more experience and more different experience, and that will speed up your the time that you need for learning, you might collect more samples, though. So it will also increase your flops. Tune the number of transitions in each iteration if possible. Okay. So next thing is time step handling. What do they do? The choices related to the handling of time steps. So this is the discount factor frame skip. So in these environments, you can choose to like ignore intermediate frames, how episode termination due to time step limit are handled. And their main thing here is that the discount factor is one of the most important hyper parameters and should be tuned per environment and start with a point nine nine discount factor, try frame skip if possible, there's no need to handle environments step limits in a special way for large step limits. Okay, so the discount factor, which is also unsurprising, right, because the discount factor is basically how how much you discount future reward, and that is inherently dependent on the reward structure of the environment itself. So it's really unsurprising that this is a big, an important hyper parameter, but it's good to note. And then last sec, okay, there's more second to last thing. optimizers, they investigate different optimizers, we investigate two gradient based optimizers, Adam and RMS prop, as well as their hyper parameters. And their result says, you should use Adam with momentum, though I think they found that RMS prop isn't too much behind that. But they say, you should tune the learning rate absolutely, which is also known in the community, right, you can't you if you have a different problem, it might require a different learning rate, and they find the learning rate to be a important parameter for an important parameter for these problems. So you should tune it, but the other parameters of the of these algorithms aren't too much of an influence, at least on these particular problems. And then the last thing is regularization. So in regularization, they try different regularizing methods, such as entropy regularization, soft constrained entropy should not be lower than some threshold, callback, libeler, divergent, callback, libeler, divergence between a reference distribution, and so on. And they say, we did not find evidence that any of the investigated regularizers helped significantly on our environments, with the exception of half cheaton, which all constraints help. So they don't find a particular thing. But remember this, again, this, for example, here, entropy regularization is used in the impala paper, which is which in which proposes v trace. Now, they here only have an experiment where they change the loss to v trace without entropy regularization. And in this case, they turn entropy regularization on with the PPO loss, as far as I understand the paper. And there, you can already see that there is a space that is not explored, that is the setting of the original paper that introduced the thing. And I think this this, if you can remember this study, this study, like are all GANs created equal, they concluded that probably all GANs are created equal, especially like Wasserstein GAN isn't too much better than anything else. And the author of the Wasserstein GAN paper was furious because they didn't, they clearly said in the Wasserstein GAN paper that they add an optimizer doesn't work, and they had to use RMS prop and then the RMS prop was not in that study included. So it seems that the limitations of being able to really densely explore these choices is quite, it's quite hurtful in, in that you can only even though this is a super large scale study, and they trained so much, right? You can only ever make very, very, very limited, very limited, sort of conclusions in these things. And I would say, if you are in these types of problems, definitely consider their default settings. Otherwise, what I'd much rather do is to just go to like a piece of code that implements as close to the environment as possible to the one I want and take the hyper parameters from there. In the appendix here, they describe all of the things that they've tried with the choices of hyper parameters and all of the results. And you zoom in on like a random one, you already see that the results oftentimes are very diverse, very wonky, very much like, maybe, you know, this thing isn't so relevant, or there's large performance differences that are unclear between the environments. So it remains to remains to be seen. But the main interpretation here is that you're probably going to have to tune hyper parameters for a while on your own environments. Alright, yeah, the appendix is really long. And if you want details, I invite you to look at it. And apart from that, I'll see you next time. Bye bye.
[{"start": 0.0, "end": 6.8, "text": " Hello there. Today we're looking at what matters in on policy reinforcement learning, a large scale"}, {"start": 6.8, "end": 15.36, "text": " empirical study by Google Brain. On a high level, this paper investigates a five different continuous"}, {"start": 15.36, "end": 22.2, "text": " control tasks, and they train agents with all the different choices that you can make, basically,"}, {"start": 22.2, "end": 27.88, "text": " on these continuous control tasks. So the different choices are like network width and height of the"}, {"start": 27.88, "end": 35.28, "text": " value and policy network, learning rate, type of loss function, regularization constants, and they"}, {"start": 35.28, "end": 42.0, "text": " train all of these agents and they try to parse out what works in general, and what doesn't. And"}, {"start": 42.0, "end": 51.4, "text": " they have some surprising findings that number seven will surprise you. Yeah. Okay, so that's"}, {"start": 51.4, "end": 57.0, "text": " the that's the study on a high level. As always, if you like content like this, consider subscribing"}, {"start": 57.0, "end": 65.2, "text": " and sharing it out. That would be excellent. So they say the on policy reinforcement learning"}, {"start": 65.2, "end": 73.48, "text": " has been successfully applied to many different continuous control tasks. While our algorithms are"}, {"start": 73.48, "end": 78.6, "text": " often conceptually simple, their state of the art implementations take numerous low and high level"}, {"start": 78.6, "end": 84.4, "text": " design decisions that strongly affect the performance of the resulting agents. Those"}, {"start": 84.4, "end": 89.56, "text": " choices are usually not extensively discussed in the literature, leading to discrepancy between"}, {"start": 89.56, "end": 95.16000000000001, "text": " published descriptions of algorithms and their implementations. So the sort of things they mean"}, {"start": 95.16000000000001, "end": 101.4, "text": " here are the things that when you read the paper, the algorithm will be sort of described pretty"}, {"start": 101.4, "end": 106.84, "text": " well on the main idea. But then if you look at the code, there's a whole bunch of hacks there. Like"}, {"start": 106.84, "end": 111.92, "text": " on the Atari environment, you have to repeat certain actions, you have to introduce sticky"}, {"start": 111.92, "end": 117.08, "text": " actions, then the question is, do you have like a random starts or the OS start at the exact same"}, {"start": 117.08, "end": 123.64, "text": " time, therefore, the randomness of the level is not given, then you whether or not you normalize"}, {"start": 123.64, "end": 133.6, "text": " certain observations. But we've had these things even in supervised learning or NLP, things like"}, {"start": 133.6, "end": 140.16, "text": " this, we've had pre processing, I remember the resonant first resonant paper that beat ImageNet"}, {"start": 140.16, "end": 146.88, "text": " to a significant degree over the last year's baseline. It was, oh, yeah, we have the simple"}, {"start": 146.88, "end": 152.51999999999998, "text": " idea of the resonant. And they have an entire section where they go, oh, and we do this"}, {"start": 152.51999999999998, "end": 157.68, "text": " normalization, we do this pre processing, we do this and this and this and this and this. And I"}, {"start": 157.68, "end": 163.35999999999999, "text": " mean, there's an argument to be made for all of these, these choices. But often, it's hard to"}, {"start": 163.36, "end": 170.44000000000003, "text": " disentangle, if the choice, choices of these pre processing things, or whatever the choices are"}, {"start": 170.44000000000003, "end": 177.12, "text": " matters, or if the idea in the paper matters. And it's also very hard to compare different things."}, {"start": 177.32000000000002, "end": 183.72000000000003, "text": " So what they're doing here, so I would say this is not only a problem in RL, this is a problem"}, {"start": 183.76000000000002, "end": 191.48000000000002, "text": " generally, they say, as a step towards filling the gap, we implement over 50 such choices in a"}, {"start": 191.48, "end": 197.67999999999998, "text": " unified on policy RL framework, allowing us to investigate their impact in a large scale"}, {"start": 197.67999999999998, "end": 203.72, "text": " empirical study. So large scale empirical study is basically means grid search over these choices,"}, {"start": 203.79999999999998, "end": 212.07999999999998, "text": " kind of smart grid search, we train over 250,000 agents in five continuous control environments of"}, {"start": 212.07999999999998, "end": 217.88, "text": " different complexity and provide insights and practical recommendations for on policy training"}, {"start": 217.88, "end": 225.35999999999999, "text": " of RL agents. So as far as I could figure out the code and or and or the checkpoints of these"}, {"start": 225.35999999999999, "end": 232.28, "text": " 250,000 agents, or the code of this unified on policy RL framework is not available yet. And I"}, {"start": 232.28, "end": 238.28, "text": " don't know if it's going to be but basically, what they're doing is they're building one agent. So"}, {"start": 238.28, "end": 243.32, "text": " in usually you have this agent environment dichotomy, right here, you get observation and"}, {"start": 243.32, "end": 251.12, "text": " reward. And here you get you give action, they build one single agent that has a lot of switches"}, {"start": 251.12, "end": 256.6, "text": " that has a lot of like flags that you can say, okay, either Do you want this loss or this loss?"}, {"start": 256.6, "end": 264.56, "text": " Cool. Do you want this regularization or this regularization? And if so, by how much right? And"}, {"start": 264.56, "end": 270.68, "text": " so on. So I have this agent with lots and lots and lots of switches over 50 of these choices that"}, {"start": 270.68, "end": 276.64, "text": " they implement right here. And they can basically turn each one on and off. And therefore they can"}, {"start": 276.64, "end": 289.96000000000004, "text": " investigate these algorithms. So let's jump over the most surprising finding, which, okay, the most"}, {"start": 289.96000000000004, "end": 295.2, "text": " I can tell you the most surprising finding is that the initialize the policy initialization scheme"}, {"start": 295.2, "end": 303.28, "text": " matters significantly. Okay. That's what people maybe didn't know. What also matters a lot is the"}, {"start": 303.28, "end": 310.56, "text": " learning rate, and things like the discount factor. But I think people in RL were already familiar"}, {"start": 310.68, "end": 317.28, "text": " with that. I find it also interesting what doesn't matter, namely, most things seem to not really"}, {"start": 317.28, "end": 322.12, "text": " matter too much. But there might be other explanations for this. Alright, so they say we"}, {"start": 322.12, "end": 328.68, "text": " consider the setting of on policy reinforcement learning for continuous control. Now, this is"}, {"start": 328.68, "end": 337.2, "text": " where I have a bit of a of a problem right here. Because the title is what matters in on policy"}, {"start": 337.2, "end": 341.92, "text": " reinforcement learning, it's not what matters in on policy reinforcement learning for continuous"}, {"start": 341.92, "end": 348.56, "text": " control. They do say in the abstract here, as you've already seen, in the last sentence that"}, {"start": 348.56, "end": 355.2, "text": " they have continuous control environment, five continuous control environments. But yeah, I get"}, {"start": 355.2, "end": 360.44, "text": " it, you need to make the title a bit click baity. But the title overstates a bit what this paper"}, {"start": 360.44, "end": 368.96, "text": " says this paper basically says, what works in these particular five continuous control environments,"}, {"start": 369.0, "end": 375.84000000000003, "text": " right? So they vary a lot of things with respect to the agent, but they keep the environments"}, {"start": 375.84, "end": 381.58, "text": " relatively constant. And it's not five diverse environments, it's five, mu, Joko continuous"}, {"start": 381.58, "end": 387.5, "text": " control environments that are very, very, very similar to each other in terms of their observation"}, {"start": 387.5, "end": 394.38, "text": " in terms of how the world works, and so on. So consider this paper as an investigation in what"}, {"start": 394.38, "end": 402.14, "text": " works and doesn't work for these five, and possibly for very relatively close environments. So that's,"}, {"start": 402.14, "end": 407.53999999999996, "text": " that's, I think, my biggest trouble I have with this paper right here is sort of it overstates"}, {"start": 407.58, "end": 416.82, "text": " what it what it says in the title. But, I mean, the investigation itself is done, I feel very,"}, {"start": 416.86, "end": 425.53999999999996, "text": " very well. So they say they have a unified on policy learning algorithm, where they research"}, {"start": 425.53999999999996, "end": 430.65999999999997, "text": " prior work took popular code bases made a list of common Lewis choices and then implemented"}, {"start": 430.66, "end": 438.34000000000003, "text": " everything into starting from the seed RL code base, seed RL is kind of a framework for distributed"}, {"start": 438.58000000000004, "end": 445.02000000000004, "text": " or for reinforcement learning in general. And they say, whenever we faced, we were faced with"}, {"start": 445.02000000000004, "end": 450.70000000000005, "text": " implementation decisions that required us to take decisions that could not be clearly motivated, or"}, {"start": 450.70000000000005, "end": 456.90000000000003, "text": " had alternative solutions, we further added such decisions as additional choices. So this I feel,"}, {"start": 456.9, "end": 462.29999999999995, "text": " if I write research code, this is generally what I do, right, I write my research code. And whenever"}, {"start": 462.29999999999995, "end": 467.5, "text": " I come to a place where I'm like, should I use this or this should use this optimizer or this"}, {"start": 467.5, "end": 473.21999999999997, "text": " optimizer, I simply make a flag. And then even if it's just one choice for now, right, just make a"}, {"start": 473.21999999999997, "end": 481.82, "text": " flag and parameterize everything. And that's, that's, that's the thing here, they parameterize"}, {"start": 481.82, "end": 488.54, "text": " everything. But other than I would do now, then I would sort of sparsely explore the space of these"}, {"start": 488.54, "end": 495.86, "text": " parameters. Now they do a more dense, dense observation or dense sampling of this space than"}, {"start": 496.42, "end": 502.21999999999997, "text": " me myself would do with limited resources. Of course, being Google, it is possible to do these"}, {"start": 502.21999999999997, "end": 509.1, "text": " kinds of things where you investigate all the choices. So they say here, difficulty of investigating"}, {"start": 509.1, "end": 514.3000000000001, "text": " choices. The primary goal of this paper is to understand how the different choices affect the"}, {"start": 514.3000000000001, "end": 520.3000000000001, "text": " final performance of an agent and derive recommendations for these choices. There are"}, {"start": 520.3000000000001, "end": 526.4200000000001, "text": " two key reasons why this is challenging. First, we're mainly interested in insights on choices for"}, {"start": 526.4200000000001, "end": 532.62, "text": " good hyper parameters. Yet, if all choices are sampled randomly, the performance is very bad,"}, {"start": 532.62, "end": 537.78, "text": " and little training progress is made. So that means if you have if you have all of these hyper"}, {"start": 537.78, "end": 546.3399999999999, "text": " parameters, then let's let's consider like a three dimensional hyper parameter space, then there are"}, {"start": 546.3399999999999, "end": 553.14, "text": " combinations of hyper parameters that are very good, right here, maybe here. So there's this,"}, {"start": 553.14, "end": 562.06, "text": " this cube in here, that's sort of very good, but the rest aren't really good. So if you just simply"}, {"start": 562.06, "end": 570.42, "text": " sample from anywhere in the space, like here, or here, or here, or here, here, you will basically"}, {"start": 570.42, "end": 577.78, "text": " never get anything that works, you sort of have to hit the combination correctly. And that's, that's"}, {"start": 577.78, "end": 584.2199999999999, "text": " a problem in three dimensions, but it's way more a problem in 50 plus dimensions like they have here."}, {"start": 584.22, "end": 594.7, "text": " So they have to resort to a different strategy. They have to go basically start out from a good"}, {"start": 594.7, "end": 603.9, "text": " configurations, where they say, they group these, we create groups of choices around thematic groups,"}, {"start": 603.9, "end": 608.78, "text": " where we suspect interactions between different choices. For example, we group together all"}, {"start": 608.78, "end": 613.78, "text": " choices related to neural network architecture. We also include the learning rate in all of the"}, {"start": 613.78, "end": 619.26, "text": " groups, as we suspect it may interact with many other choices. Then in each experiment, we train"}, {"start": 619.26, "end": 625.42, "text": " a large number of models where we randomly sample the choices within the corresponding group. All"}, {"start": 625.42, "end": 632.62, "text": " other settings for choices not in the group are set to settings of a competitive base configuration"}, {"start": 632.62, "end": 640.6999999999999, "text": " that is close to the default PPO versus V2 configuration. Okay, so what they're doing"}, {"start": 640.7, "end": 646.86, "text": " basically is they're saying, now let's, let's consider these. So these groups, you can now think"}, {"start": 646.86, "end": 655.0600000000001, "text": " of single dimensions in this space. So, or, yes, so let's consider the space of groups. Let's say"}, {"start": 655.0600000000001, "end": 659.1, "text": " you have two different groups. One is the group of network architecture parameters, and the other"}, {"start": 659.1, "end": 666.1, "text": " one is a group of learning behavior, like learning rate and training algorithm parameter. What they're"}, {"start": 666.1, "end": 673.7, "text": " saying is they're saying, we know of a configuration right here, that is good. This is PPO versus two,"}, {"start": 673.7, "end": 681.78, "text": " V, version two. And now what we're going to do is we're simply going to keep in each experiment,"}, {"start": 681.78, "end": 687.26, "text": " we're going to, if we want to investigate the network architecture, let's say that's this axis,"}, {"start": 687.26, "end": 697.14, "text": " we're going to keep all the other groups the same as this default configuration. And only investigate,"}, {"start": 697.14, "end": 703.06, "text": " only basically move this point to the left and to the right. And we're not going to move it up and"}, {"start": 703.06, "end": 707.66, "text": " down, we're going to keep the learning dynamic parameters of the other group or all of the other"}, {"start": 707.66, "end": 713.34, "text": " groups, we're going to keep the same, and only move it in in the architecture parameter space. Now,"}, {"start": 713.34, "end": 718.14, "text": " of course, this is not just one parameter, this, since they make these groups, this is a multi,"}, {"start": 718.14, "end": 724.98, "text": " multi parameter. So at each point here, you can imagine like a little subspace of the inner group,"}, {"start": 724.98, "end": 730.74, "text": " and they then sample from these. And that becomes much more feasible, right? So now maybe you have,"}, {"start": 730.74, "end": 739.1, "text": " let's say you have 10 groups of five parameters each, you can densely sample five parameters,"}, {"start": 739.1, "end": 744.74, "text": " like that's sort of possible, you cannot densely sample 50, but you can densely sample five. So"}, {"start": 744.74, "end": 750.1800000000001, "text": " what you would do is you would keep the other 45 constant, that would correspond to this dimension"}, {"start": 750.1800000000001, "end": 755.66, "text": " and all the other dimensions. And you would only vary within the group, which would correspond to"}, {"start": 755.66, "end": 761.66, "text": " this dimension. But now you see that the problem again, of course, is that you're always starting"}, {"start": 761.66, "end": 767.26, "text": " from this point. And you're basically only exploring along the axis of this of this group"}, {"start": 767.26, "end": 773.74, "text": " space. Because you always keep one can't keep the others constant. And that basically, to me,"}, {"start": 773.74, "end": 780.54, "text": " that means that these experiments are going to be heavily favored in, in terms of which of the"}, {"start": 780.54, "end": 791.38, "text": " algorithms is closest to this to this baseline. Because if so, if I go with, with this particular"}, {"start": 791.38, "end": 798.26, "text": " algorithm, I know that these parameters are the best for this particular algorithm, where if I now"}, {"start": 798.26, "end": 805.34, "text": " use any other algorithm, these parameters might not be the best. And my only my only way of"}, {"start": 805.34, "end": 812.86, "text": " adjusting to that other algorithm is by individually moving here while keeping others constant. So I can"}, {"start": 812.86, "end": 818.5, "text": " basically only improve with it along one of the groups. I hope this makes sort of sense that it"}, {"start": 818.5, "end": 825.54, "text": " feels like this experiment biases the results in favor of whatever is made, whatever choices are"}, {"start": 825.54, "end": 830.74, "text": " made in this baseline. So keep that in mind. Now, that being said, PPO, of course, is very popular"}, {"start": 830.74, "end": 837.78, "text": " baseline. So it makes total sense to use that as a as a base to explore from. But it's not like"}, {"start": 837.78, "end": 843.86, "text": " they're doing an actual dense grid sampling of the space, they're doing a sparse sampling in the"}, {"start": 843.86, "end": 852.46, "text": " group space, and then a dense sampling within each group. Alright, so they, let's go into the"}, {"start": 852.46, "end": 860.86, "text": " experiments. The first thing they investigate are the policy losses. Now this is this is a rather"}, {"start": 860.86, "end": 867.02, "text": " important topic. And that basically means how do you train the policy. And the choices here are,"}, {"start": 867.02, "end": 874.46, "text": " of course, PPO, like we saw the proximal policy optimization, but there are also others, namely,"}, {"start": 874.46, "end": 882.46, "text": " for example, policy gradient, you might know that if you learn about reinforcement learning, you will"}, {"start": 882.46, "end": 888.38, "text": " inevitably learn about policy gradients, like the first thing you learn next to Q learning. And then"}, {"start": 888.38, "end": 898.9399999999999, "text": " v trace is another sort of policy loss. v trace is optimized for distributed reinforcement learning."}, {"start": 898.9399999999999, "end": 906.5, "text": " And they have a bunch of others. And they hear they say the goal of this study is to better"}, {"start": 906.5, "end": 910.3, "text": " understand the importance of the policy loss function in the on policy setting considered in"}, {"start": 910.3, "end": 916.7, "text": " this paper was not to provide a general statement that one of the losses is better than the others,"}, {"start": 916.7, "end": 922.22, "text": " as some of them were specifically designed for other settings. Now, I, of course, I agree with"}, {"start": 922.22, "end": 927.94, "text": " this with this statement, it's nice that they repeated again, right here. So all the results"}, {"start": 927.94, "end": 938.62, "text": " right here are just valid for these environments, or environments very similar to these. And you"}, {"start": 938.62, "end": 946.1, "text": " have to keep in mind that the baseline parameters are PPO v two, and they only ever vary one group"}, {"start": 946.1, "end": 952.14, "text": " from these baseline parameters. So that's why in this experiment, for example, it doesn't seem"}, {"start": 952.14, "end": 959.74, "text": " too surprising that the PPO loss, as you can see, outperforms in every single experiment here."}, {"start": 959.74, "end": 972.1, "text": " Whereas the other losses underperform. So the recommendation is use the PPO policy loss,"}, {"start": 972.1, "end": 977.38, "text": " start with the clipping threshold to point two five, but also try lower and higher values if"}, {"start": 977.38, "end": 982.3000000000001, "text": " possible, because they have found and they have they have more experiments. And the appendix,"}, {"start": 982.3000000000001, "end": 988.78, "text": " the appendix is full of these experiments, and you can go and look at them. So they,"}, {"start": 988.78, "end": 993.86, "text": " but the general recommendation here for them is to use the PPO policy loss if you have these"}, {"start": 993.86, "end": 999.78, "text": " continuous control tasks, and that there is a strong influence of this clipping threshold"}, {"start": 999.78, "end": 1007.8199999999999, "text": " that is in PPO. Second thing, network architecture. And that's basically you have you always have a"}, {"start": 1007.8199999999999, "end": 1012.02, "text": " value network and a policy network. And the question is how many layers how deep and so"}, {"start": 1012.02, "end": 1018.02, "text": " on? Should you make them? These things here are just MLPs. Since this is continuous control tasks,"}, {"start": 1018.02, "end": 1023.54, "text": " you don't learn from pixels. As far as I understand it, you learn from the states or the sensors on"}, {"start": 1023.54, "end": 1036.1, "text": " these robot simulated robots. Now, you got this here, they say, separate value and policy networks"}, {"start": 1036.1, "end": 1044.3799999999999, "text": " appear to lead to better performance on four out of the five environments. And further regarding"}, {"start": 1044.3799999999999, "end": 1052.46, "text": " network sizes, the optimal width of the policy m of the policy network depends on the complexity"}, {"start": 1052.46, "end": 1057.38, "text": " of the environment and to lower to high values costs can cause significant drop in performance."}, {"start": 1057.38, "end": 1064.1000000000001, "text": " Well, for the value function, there seems to be no downside in using wider networks. Moreover,"}, {"start": 1064.1000000000001, "end": 1069.66, "text": " on some environments, it is beneficial to make the value network wider than the policy one,"}, {"start": 1069.66, "end": 1075.6200000000001, "text": " e.g. on half cheetah, the best results are achieved with 1632 units per layer,"}, {"start": 1075.62, "end": 1083.8999999999999, "text": " da da da da da da da. The so some there, this is a thing that sort of crystallizes out of this paper,"}, {"start": 1083.8999999999999, "end": 1089.78, "text": " because what you're doing is you have these one policy network and one value network,"}, {"start": 1089.78, "end": 1098.3, "text": " like it's it's this dichotomy where the value network tries to estimate the reward, and the"}, {"start": 1098.3, "end": 1106.6599999999999, "text": " policy network tries to maximize the value. So you have you have two learning things here,"}, {"start": 1106.6599999999999, "end": 1111.8999999999999, "text": " you have this is learned. And this is learned. Now there is a certain degree of interaction as"}, {"start": 1111.8999999999999, "end": 1117.74, "text": " the value network. Of course, the reward is dependent on your policy. So the value network"}, {"start": 1117.74, "end": 1125.54, "text": " sort of has to take into account the policy when it estimates the reward. But it seems to be that"}, {"start": 1125.54, "end": 1132.62, "text": " the policy network is the brittle or one, and therefore, more care has to be taken to optimize"}, {"start": 1132.62, "end": 1137.78, "text": " it, whereas the value network seems to be a bit of more robust to changes. And we've seen this"}, {"start": 1137.78, "end": 1145.98, "text": " already in that the the the loss choice for the policy seems to be quite important. And here also"}, {"start": 1145.98, "end": 1151.3799999999999, "text": " the network parameters for the policy seem to be the things you have to actually tune per"}, {"start": 1151.38, "end": 1157.66, "text": " environment. Whereas for the value, you can pretty much go you can pretty much get any wide network"}, {"start": 1157.66, "end": 1167.7, "text": " will kind of do. Okay. So they say as for activation functions, we observe that tanh activations"}, {"start": 1167.7, "end": 1172.74, "text": " perform best and relu perform worst, which is interesting, right? Because you would think that"}, {"start": 1172.74, "end": 1179.66, "text": " in other deep learning tasks relu have become pretty popular and usually outperform these others,"}, {"start": 1179.66, "end": 1187.1000000000001, "text": " other activation functions. But in this case, no, but this could also be due to other things,"}, {"start": 1187.1000000000001, "end": 1191.78, "text": " because again, they go from these default parameters, which, for example, do not have"}, {"start": 1191.78, "end": 1198.0600000000002, "text": " entropy regularization built in. And if you have a relu, where it's basically an unbounded function,"}, {"start": 1198.0600000000002, "end": 1208.46, "text": " whereas the tanh is sort of a more or more bounded function. So that could be, you know,"}, {"start": 1208.46, "end": 1216.22, "text": " there could be significant interactions here where they have split the groups, and then the choices"}, {"start": 1216.22, "end": 1221.54, "text": " might be reversed if in the other groups, these two parameters were different. But for now,"}, {"start": 1221.54, "end": 1228.5, "text": " apparently, that tanh activations perform best. The interesting thing here is they say,"}, {"start": 1228.5, "end": 1233.82, "text": " interestingly, the initial policy appears to have a surprisingly high impact on the"}, {"start": 1233.82, "end": 1241.6599999999999, "text": " training performance. So this is how you initialize the policy network. Again, policy network appears"}, {"start": 1241.6599999999999, "end": 1248.34, "text": " to be the more brittle one and the one that you have to tune more. The key recipe appears to"}, {"start": 1248.34, "end": 1255.58, "text": " initial the key recipe appears is to initialize the policy at the beginning of training so that"}, {"start": 1255.58, "end": 1260.82, "text": " the action distribution is centered around zero regardless of the observation, and has a rather"}, {"start": 1260.82, "end": 1266.78, "text": " small standard deviation. This can be achieved by initializing the policy MLP with smaller weights"}, {"start": 1266.78, "end": 1274.5, "text": " in the last layer. So if you have this policy MLP as multiple layers, and then it needs to output"}, {"start": 1274.5, "end": 1280.58, "text": " an action distribution, right. So in these in these continuous control tasks, you basically,"}, {"start": 1280.58, "end": 1286.8999999999999, "text": " for each of the joints you have to affect, so you have like a little, you have like a little"}, {"start": 1286.9, "end": 1294.18, "text": " walker here with four legs, and what's that? That's like eight joints or something. So you"}, {"start": 1294.18, "end": 1301.5800000000002, "text": " have to tell this how much force it needs to apply to each of these joints. And as I understand it,"}, {"start": 1301.5800000000002, "end": 1307.46, "text": " that's usually given by the network outputting a mean and a standard deviation, I might be wrong"}, {"start": 1307.46, "end": 1313.5800000000002, "text": " here, but meaning the standard deviation for the distribution of action, that's going to be apply"}, {"start": 1313.58, "end": 1322.06, "text": " here and then this is sampled from that distribution, the actual force is then sampled. Now they say you"}, {"start": 1322.06, "end": 1328.86, "text": " should initialize the network such that the mean here is zero across or over your observations."}, {"start": 1328.86, "end": 1338.26, "text": " And the way to do that is to simply initialize this last layer here with very small weights. So"}, {"start": 1338.26, "end": 1346.02, "text": " you and I think their recommendation is to divide to initialize this by 100 times smaller weights"}, {"start": 1346.02, "end": 1356.3799999999999, "text": " than all the other layers. They say other choices appear to be less important. The scale of the last"}, {"start": 1356.3799999999999, "end": 1361.9, "text": " layer initialization matters much less for the value MLP again, then for the policy MLP. Apart"}, {"start": 1361.9, "end": 1367.54, "text": " from the last layer scaling network initialization does not matter too much, yada yada yada, there"}, {"start": 1367.54, "end": 1373.22, "text": " appears to be no benefits if the standard deviation of the policy is learned for each state, or once"}, {"start": 1373.22, "end": 1379.06, "text": " globally for all states for the transformation of policy output into standard deviation soft plus"}, {"start": 1379.06, "end": 1384.06, "text": " and the expenditure performs similarly. So most of these choices in their case appear to be"}, {"start": 1384.06, "end": 1391.6599999999999, "text": " relatively similar except the ones that they point out. The recommendation here is initialize the last"}, {"start": 1391.66, "end": 1398.94, "text": " policy layer with 100 times smaller weights. Use soft plus to transform network output into action"}, {"start": 1398.94, "end": 1404.94, "text": " standard deviation and add a negative offset to its input to decrease the initial standard deviation"}, {"start": 1404.94, "end": 1412.14, "text": " of actions. To this offset is possible use tanh as both the activation function if the networks"}, {"start": 1412.14, "end": 1419.5, "text": " are not too deep right here. This is probably where the relu would start to shine and transform"}, {"start": 1419.5, "end": 1425.82, "text": " the samples from the normal distribution to the bounded action space, sorry, and to transform"}, {"start": 1425.82, "end": 1434.82, "text": " using a tanh. Use a wide value MLP, no layers shared with the policy, but tune the policy width."}, {"start": 1434.82, "end": 1440.14, "text": " It might need to be narrower than the value MLP. Now this here, this no layers shared with the"}, {"start": 1440.14, "end": 1446.72, "text": " policy, this might just this might be now a result that the policy is quite, quite brittle. So if you"}, {"start": 1446.72, "end": 1455.42, "text": " can detach the value and the policy that might be of advantage. Which is also surprising, right? You"}, {"start": 1455.42, "end": 1460.34, "text": " would think that these two networks if they are shared layers, they would learn more about the"}, {"start": 1460.34, "end": 1469.26, "text": " environment, but apparently not. Then normalization and clipping. So you get a bunch of normalization"}, {"start": 1469.26, "end": 1474.7, "text": " and clipping techniques, which is, for example, observation normalization, basically means that"}, {"start": 1474.7, "end": 1480.54, "text": " whatever comes in, you normalize it to a given range. So that's usually you do that for supervised"}, {"start": 1480.54, "end": 1490.42, "text": " learning, like if you have if you have MNIST digits, so this is a mostly black image with Okay,"}, {"start": 1490.42, "end": 1499.5, "text": " can I draw on this with like a small portion of it is white. And what you want, this is usually in"}, {"start": 1499.5, "end": 1508.18, "text": " the range of zero to 255. So you have zero to 255. What you want to do is you want to normalize that"}, {"start": 1508.18, "end": 1515.46, "text": " search that it's in the range negative one to one, or alternatively, such that its mean is zero and"}, {"start": 1515.46, "end": 1523.2, "text": " its standard deviation is about one. So people use both things and they tend this alone tends to"}, {"start": 1523.2, "end": 1529.82, "text": " already boost the performance. So the fact that it's non that this is non negative, and the also"}, {"start": 1529.82, "end": 1537.6200000000001, "text": " the fact that this number is somewhat higher than sort of in the zero one range, these are quite"}, {"start": 1537.6200000000001, "end": 1542.3400000000001, "text": " important. And they're going to figure out that this is also important right here. So the"}, {"start": 1542.3400000000001, "end": 1549.42, "text": " recommendation is always use observation normalization and check if value function"}, {"start": 1549.42, "end": 1555.26, "text": " normalization improves performance. So for value function normalization, I believe you would you"}, {"start": 1555.26, "end": 1562.5, "text": " would normalize the output of the value function. So instead of the value function telling you this"}, {"start": 1562.5, "end": 1567.74, "text": " is how much worth something is, it simply can tell you sort of that it's more or less worth than"}, {"start": 1567.74, "end": 1575.54, "text": " something else in a normalized range. gradient clipping might slightly help but is of secondary"}, {"start": 1575.54, "end": 1584.1399999999999, "text": " importance. Okay, cool. Yeah, so all the other things also don't seem to matter too much, like"}, {"start": 1584.1399999999999, "end": 1593.7, "text": " per mini batch advantage normalization, and gradient observation clipping. Yep. Then advantage"}, {"start": 1593.7, "end": 1603.74, "text": " estimation. So advantage estimation in reinforcement learning is a basically the the value network"}, {"start": 1603.74, "end": 1609.6200000000001, "text": " needs to be trained, right? So you take a step and a step and step and step and in each step,"}, {"start": 1609.6200000000001, "end": 1618.26, "text": " you get a reward. And you get you perform many steps. Now the value network sitting right here,"}, {"start": 1618.26, "end": 1624.54, "text": " needs to be trained to predict the total rewards that you can get from here on until the end of"}, {"start": 1624.54, "end": 1629.86, "text": " the episode. Now, usually what you do is you can bootstrap this by sort of a temporal difference"}, {"start": 1629.86, "end": 1637.58, "text": " thing in that you consider the you you consider a few steps into the future. And then you ask your"}, {"start": 1637.58, "end": 1643.5, "text": " own value network what it thinks of the rest of the episode. So basically, you train you don't"}, {"start": 1643.5, "end": 1648.9799999999998, "text": " train on the entire rest of the episode, you train on the difference between this and this. And then"}, {"start": 1648.9799999999998, "end": 1655.8999999999999, "text": " you can get way more complicated where you actually ask your value network at each step what"}, {"start": 1655.9, "end": 1663.02, "text": " it thinks and then you go to that value network while integrating this reward. But you also go to"}, {"start": 1663.02, "end": 1668.42, "text": " this value network while integrating these two rewards and so on. And then your target becomes"}, {"start": 1668.42, "end": 1674.38, "text": " sort of a mixture of all of these things. You can get super complex with these with these different"}, {"start": 1674.38, "end": 1682.26, "text": " variants. And they say we compare the most commonly used advantage estimators and step GA and"}, {"start": 1682.26, "end": 1695.18, "text": " vtrace and their hyper parameters. And their recommendation is use the GA with lambda equals"}, {"start": 1695.18, "end": 1709.98, "text": " 0.9. Okay. I feel this is not is not too, too, too surprising right here, because this this end step"}, {"start": 1709.98, "end": 1716.38, "text": " is a very basic estimator. And the GA and the vtrace are better. And they say the GA and the"}, {"start": 1716.38, "end": 1726.42, "text": " vtrace they appear to perform better. And they have not found a significant performance difference"}, {"start": 1726.42, "end": 1739.26, "text": " between the two. So cool. Last thing though, this is second, second to last thing, almost last thing,"}, {"start": 1739.26, "end": 1746.58, "text": " training setup. Now I believe this, this becomes more important. So they investigate choices related"}, {"start": 1746.58, "end": 1751.3, "text": " to data collection and mini batch handling. So the number of parallel environments, the number of"}, {"start": 1751.3, "end": 1756.62, "text": " transitions gathered in each iteration, the number of passes over the data, and so on. So this is"}, {"start": 1756.62, "end": 1763.3799999999999, "text": " going to matter quite a bit. The recommendation is to go over experience multiple times. So what"}, {"start": 1763.3799999999999, "end": 1768.34, "text": " you do in these environments is always you have a phase where you collect experience. And then you"}, {"start": 1768.34, "end": 1776.1, "text": " have a phase where you learn from this experience. And so you collect experience, you start from here,"}, {"start": 1776.1, "end": 1781.82, "text": " you collect a bunch of experience, you put all of that experience into a buffer, which is like a"}, {"start": 1781.82, "end": 1789.1, "text": " database. And then you have these, what they're called traces, right. So all of these are now"}, {"start": 1789.1, "end": 1795.6999999999998, "text": " episodes that your agent took. Now all of these episodes consists of many, many steps that the"}, {"start": 1795.7, "end": 1800.74, "text": " agent took. So here is one step, here is one step, here is one step. And each of these steps are"}, {"start": 1800.74, "end": 1806.5, "text": " going to be one training sample. So each of these steps and also here and here are going to be one"}, {"start": 1806.5, "end": 1811.6200000000001, "text": " training sample. There are multiple problems here. The first and obvious one is if they if you just"}, {"start": 1811.6200000000001, "end": 1818.02, "text": " leave them in order, then you will have very, very correlated mini batches. And that's not good. So"}, {"start": 1818.02, "end": 1823.9, "text": " you want to kind of shuffle them around in here. Each time before you go to them, you can go through"}, {"start": 1823.9, "end": 1830.22, "text": " them multiple times in different order. And that works really well. They say you should go over"}, {"start": 1830.22, "end": 1837.5, "text": " your experience multiple times, since that doesn't hurt you. And it alleviates you from the necessity"}, {"start": 1837.52, "end": 1845.3400000000001, "text": " to collect more data. The second thing they say is you should shuffle individual transitions before"}, {"start": 1845.38, "end": 1852.38, "text": " assigning them to mini batches. Okay, we've, we've concluded that. And you should recompute"}, {"start": 1852.38, "end": 1858.68, "text": " advantages once per data pass. Now what's the point? The point here, before we talked about, you"}, {"start": 1858.68, "end": 1864.7600000000002, "text": " have to, you have these advantage estimators, which basically means you have to look for each step,"}, {"start": 1864.7600000000002, "end": 1871.88, "text": " you have to look ahead a couple of steps, decide what the value of this state is or the advantage."}, {"start": 1872.7600000000002, "end": 1879.8400000000001, "text": " And in order to do that, as we have seen, you kind of look at your own estimation of that future"}, {"start": 1879.84, "end": 1884.48, "text": " value. So you have this value is dependent on your own estimation of the future value. Now, of"}, {"start": 1884.48, "end": 1889.9199999999998, "text": " course, if you just do, if you can only do this, if you have these episode traces, if you have these"}, {"start": 1889.9199999999998, "end": 1895.36, "text": " blue episode traces still around, you know which step comes after which, you cannot do this anymore,"}, {"start": 1895.36, "end": 1902.12, "text": " once this is all in mini batches and shuffled. So what some people do is they simply compute these"}, {"start": 1902.12, "end": 1909.0, "text": " things once at the beginning, with the value network they have, and then they go multiple times"}, {"start": 1909.0, "end": 1915.4, "text": " over this data. And just they shuffle, they might shuffle each time, but they keep these estimates."}, {"start": 1915.4, "end": 1921.4, "text": " And that's, of course, is more and more out of date, the more often you go over the data. So what"}, {"start": 1921.4, "end": 1928.64, "text": " they recommend is, you should always go back to this set data set, recompute these estimates with"}, {"start": 1928.64, "end": 1934.92, "text": " your current value network, then do the whole shuffling thing again, and then do another epoch,"}, {"start": 1934.92, "end": 1943.0800000000002, "text": " and then basically come back to here again, and recompute the advantages. It makes a lot of sense,"}, {"start": 1943.64, "end": 1951.24, "text": " right, but they also find that this actually makes a difference. For faster wall clock time, training"}, {"start": 1951.24, "end": 1956.8400000000001, "text": " use many parallel environments and increase the batch size, both might hurt the sample complexity,"}, {"start": 1956.8400000000001, "end": 1962.44, "text": " but they get you a faster wall clock time, which makes sense, right? If you have more environments"}, {"start": 1962.44, "end": 1970.04, "text": " than you're going to collect more experience and more different experience, and that will speed up"}, {"start": 1970.04, "end": 1975.64, "text": " your the time that you need for learning, you might collect more samples, though. So it will also"}, {"start": 1975.64, "end": 1985.8, "text": " increase your flops. Tune the number of transitions in each iteration if possible. Okay. So next thing"}, {"start": 1985.8, "end": 1992.6, "text": " is time step handling. What do they do? The choices related to the handling of time steps. So"}, {"start": 1992.6, "end": 1998.68, "text": " this is the discount factor frame skip. So in these environments, you can choose to like ignore"}, {"start": 1998.68, "end": 2006.28, "text": " intermediate frames, how episode termination due to time step limit are handled. And their main"}, {"start": 2006.28, "end": 2011.96, "text": " thing here is that the discount factor is one of the most important hyper parameters and should be"}, {"start": 2011.96, "end": 2018.04, "text": " tuned per environment and start with a point nine nine discount factor, try frame skip if possible,"}, {"start": 2018.04, "end": 2025.08, "text": " there's no need to handle environments step limits in a special way for large step limits. Okay, so"}, {"start": 2025.08, "end": 2031.32, "text": " the discount factor, which is also unsurprising, right, because the discount factor is basically"}, {"start": 2032.04, "end": 2039.0, "text": " how how much you discount future reward, and that is inherently dependent on the reward structure of"}, {"start": 2039.0, "end": 2045.4, "text": " the environment itself. So it's really unsurprising that this is a big, an important hyper parameter,"}, {"start": 2045.4, "end": 2052.84, "text": " but it's good to note. And then last sec, okay, there's more second to last thing. optimizers,"}, {"start": 2053.48, "end": 2058.68, "text": " they investigate different optimizers, we investigate two gradient based optimizers,"}, {"start": 2058.68, "end": 2065.64, "text": " Adam and RMS prop, as well as their hyper parameters. And their result says, you should use"}, {"start": 2065.64, "end": 2073.16, "text": " Adam with momentum, though I think they found that RMS prop isn't too much behind that. But they say,"}, {"start": 2073.56, "end": 2078.52, "text": " you should tune the learning rate absolutely, which is also known in the community, right,"}, {"start": 2078.52, "end": 2084.2, "text": " you can't you if you have a different problem, it might require a different learning rate,"}, {"start": 2084.2, "end": 2092.7599999999998, "text": " and they find the learning rate to be a important parameter for an important parameter for these"}, {"start": 2092.76, "end": 2100.28, "text": " problems. So you should tune it, but the other parameters of the of these algorithms aren't too"}, {"start": 2100.28, "end": 2105.96, "text": " much of an influence, at least on these particular problems. And then the last thing is regularization."}, {"start": 2106.92, "end": 2116.2000000000003, "text": " So in regularization, they try different regularizing methods, such as entropy regularization,"}, {"start": 2116.2000000000003, "end": 2121.32, "text": " soft constrained entropy should not be lower than some threshold, callback, libeler, divergent,"}, {"start": 2121.32, "end": 2127.0800000000004, "text": " callback, libeler, divergence between a reference distribution, and so on. And they say, we did not"}, {"start": 2127.0800000000004, "end": 2131.88, "text": " find evidence that any of the investigated regularizers helped significantly on our"}, {"start": 2131.88, "end": 2141.56, "text": " environments, with the exception of half cheaton, which all constraints help. So they don't find a"}, {"start": 2141.56, "end": 2148.52, "text": " particular thing. But remember this, again, this, for example, here, entropy regularization is used"}, {"start": 2148.52, "end": 2156.2, "text": " in the impala paper, which is which in which proposes v trace. Now, they here only have an"}, {"start": 2156.2, "end": 2163.32, "text": " experiment where they change the loss to v trace without entropy regularization. And in this case,"}, {"start": 2163.32, "end": 2170.28, "text": " they turn entropy regularization on with the PPO loss, as far as I understand the paper. And there,"}, {"start": 2170.28, "end": 2176.52, "text": " you can already see that there is a space that is not explored, that is the setting of the original"}, {"start": 2176.52, "end": 2181.96, "text": " paper that introduced the thing. And I think this this, if you can remember this study, this study,"}, {"start": 2181.96, "end": 2188.36, "text": " like are all GANs created equal, they concluded that probably all GANs are created equal,"}, {"start": 2188.36, "end": 2192.6, "text": " especially like Wasserstein GAN isn't too much better than anything else. And the author of the"}, {"start": 2192.6, "end": 2198.92, "text": " Wasserstein GAN paper was furious because they didn't, they clearly said in the Wasserstein GAN"}, {"start": 2198.92, "end": 2206.6, "text": " paper that they add an optimizer doesn't work, and they had to use RMS prop and then the RMS prop was"}, {"start": 2206.6, "end": 2213.64, "text": " not in that study included. So it seems that the limitations of being able to really densely"}, {"start": 2213.64, "end": 2224.28, "text": " explore these choices is quite, it's quite hurtful in, in that you can only even though this is a"}, {"start": 2224.28, "end": 2231.1600000000003, "text": " super large scale study, and they trained so much, right? You can only ever make very, very, very"}, {"start": 2231.1600000000003, "end": 2242.0400000000004, "text": " limited, very limited, sort of conclusions in these things. And I would say, if you are in these types"}, {"start": 2242.0400000000004, "end": 2247.0, "text": " of problems, definitely consider their default settings. Otherwise, what I'd much rather do is"}, {"start": 2247.0, "end": 2253.0, "text": " to just go to like a piece of code that implements as close to the environment as possible to the one"}, {"start": 2253.0, "end": 2258.28, "text": " I want and take the hyper parameters from there. In the appendix here, they describe all of the"}, {"start": 2258.28, "end": 2263.08, "text": " things that they've tried with the choices of hyper parameters and all of the results. And you"}, {"start": 2263.72, "end": 2270.84, "text": " zoom in on like a random one, you already see that the results oftentimes are very diverse,"}, {"start": 2270.84, "end": 2277.96, "text": " very wonky, very much like, maybe, you know, this thing isn't so relevant, or there's large"}, {"start": 2277.96, "end": 2286.28, "text": " performance differences that are unclear between the environments. So it remains to remains to be"}, {"start": 2286.28, "end": 2291.7200000000003, "text": " seen. But the main interpretation here is that you're probably going to have to tune hyper"}, {"start": 2291.7200000000003, "end": 2300.68, "text": " parameters for a while on your own environments. Alright, yeah, the appendix is really long. And"}, {"start": 2300.68, "end": 2308.3599999999997, "text": " if you want details, I invite you to look at it. And apart from that, I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=VgqHitvEbR0
[Rant] REVIEWER #2: How Peer Review is FAILING in Machine Learning
#ai #research #peerreview Machine Learning research is in dire straits as more people flood into the field and competent reviewers are scarce and overloaded. This video takes a look at the incentive structures behind the current system and describes how they create a negative feedback loop. In the end, I'll go through some proposed solutions and add my own thoughts. OUTLINE: 0:00 - Intro 1:05 - The ML Boom 3:10 - Author Incentives 7:00 - Conference Incentives 8:00 - Reviewer Incentives 13:10 - Proposed Solutions 17:20 - A Better Solution 23:50 - The Road Ahead PS: If it is not entirely clear to anyone already, stealing ideas as a reviewer is against most conferences' code of ethics and I disapprove of any such behavior. I mention it because it is being done regularly and good luck proving it in any particular case. Sources: https://thecognitivevortex.wordpress.com/category/phd/ https://susannapaasonen.org/2019/05/31/observations-on-peer-reviewing/ https://www.radicalhistoryreview.org/abusablepast/forum-1-1-on-peer-review/ https://www.meme-arsenal.com/en/create/meme/2012988 https://imgflip.com/i/1pydon https://uqkdhanj.wordpress.com/2015/02/18/10-best-reviewer-comments-in-meme-part-2/ https://susannapaasonen.org/2019/05/31/observations-on-peer-reviewing/ https://www.memecreator.org/meme/what-if-i-told-you-reviewer-2-wanted-more-experiments/ https://www.emaze.com/@ATFTTRRF https://thegradient.pub/neurips-2019-too-big/ https://www.videezy.com/backgrounds/6199-switzerland-flag-4k-motion-loop-stock-video http://blog.mrtz.org/2014/12/15/the-nips-experiment.html https://twitter.com/tdietterich/status/1292217162103316481 https://www.pinterest.de/pin/192951165261323337/ Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
It's review time, review time. So NeurIPS has recently released the reviews for submitted papers and pretty much everyone is not happy. And I think the reason is that even though you have the reasonable reviewers of these conferences, there is always always reviewer number two. And reviewer number two leaves very short review says that either there are not enough experiments, or the theory is too weak, or the assumptions aren't warranted, or they just don't like your face. And that's why they give you a weak reject. Actually, some of them think your paper is fantastic, and give you a weak reject. So a lot of people are angry, upset, dissatisfied with the quality of the reviews in machine learning conferences. And today, I want to go look into bit into how this works, why this is the way that it is, and what we could potentially do about it. So what's happening with publishing in ML, the system seems to be overloaded. There's so much attention in machine learning right now that there hasn't been a few years ago, that there's a huge influx of new people wanting to publish in this field. That creates a lot of submissions and not enough reviewers to peer review these submissions. So a lot of reviewers are recruited that probably shouldn't be reviewers. I hear stories of undergrads being recruited as reviewers, people from way outside the fields, people that don't have time. So too many submissions, too few inexperienced and not really expert reviewers creates pretty much a random process. And this was also shown in a few years ago in the then NIPS experiment, where it showed that for most papers being accepted is pretty much a coin flip with a weighted coin. The natural response as an author is going to be you're going to submit even more papers. If it's a coin flip, you can just submit whatever and there's a chance it might get in, which of course only makes the problem worse. So this entire process of science where you submit your manuscript and then you get the reviews and then you try to improve it, it's completely broken. Because not only do you not care about the reviews, the next set of reviewers at the next conference are going to be different. So no matter what you improve right now, the next set of people will have completely different criticism. It just doesn't work like it is intended to work. The review process is basically just some kind of a random nuisance to people that they have to get through. And at the same time, people who are reviewers have every incentive to make it as hard as possible for the people that are submitting. So in order to analyze this, I want to look at the incentives of the different groups in this process and kind of show how the incentive structure upholds this system that benefits pretty much everyone participating in it, but creates a worse outcome for all of us. So first of all, let's look at paper authors, what are your incentive if you're an author of a paper? First of all, authors, they want to get as many papers as possible as fast as possible. Now in the current conference system, the fastness isn't really up for debate. It's as fast as it is. However, authors can simply upload their paper to archive and be as fast as they want there. Another incentive for authors is to have as little comments on your paper as possible, because comments usually mean criticism. And you don't want comments and especially you don't want public permanent comments. The good thing for authors right now is on archive comments aren't possible and conference reviews even if they're made public, no one goes to look at them, everyone just goes to archive. So authors right now are getting a pretty good deal with respect to not getting their work criticized. Authors are also incentivized to give as little credit to people as possible. And again, the current system is totally in favor of that the no commenting on archive basically means that you can claim whatever you want. And if someone wants to refute you, they have to make a big deal out of it and basically write their own paper. And again, people will probably not find that on the other hand in the conferences, reviewers are supposed to detect when you're not giving proper credit to other people. However, most reviewers don't do that. Going out and really looking if everything is credited properly is one of the most time consuming tasks when you review a paper. And most reviewers simply aren't going through that trouble. The only downside for most authors is even though all of this is pretty much in their favor, a lot of them still require that stamp of approval that peer review accepted at a good conference. So their incentive is to keep submitting to conferences as many papers as possible basically count on that random process to get them accepted. And after that, they're just fine. They have the stamp of approval, there's absolutely no requirement to revise it. There's absolutely no requirement to have other people comment further on the work. So I guess the complaining here right now is just about the noisy process. And everyone complains that their particular paper, which is at the behest of the noisy process as everyone else's paper, got an unfair treatment in that random process, which half the papers do probably more. The incentives in the systems are actually even bigger for what I call the big names. Okay, these are the big research institutions of companies, or big name professors, anyone that has some sort of reputation, people argue that anonymous reviewing is actually good for small authors good for unknown authors because it hides their identity and the big names pretty basically aren't able to play their big name credit to a paper. However, there's an easy way to know that this isn't the case. The big names are doing just fine. Here's the issue. If you want your name to be attached to something, you're gonna find a way to do it. People are suggesting archive blackout periods and whatnot anonymous submissions to archive, you have to realize that if someone wants to give some information to the public, they are going to in fact, right now the big names are finding every possible way to have their names attached to things and massively increase their chances of getting through the anonymous peer review process. You got to realize if you're well connected, not only do you have an advertising platform, but you can also pretty easily find out who your area chairs are, who's reviewing in which track your paper gets and so on. So allow me to be a little bit skeptical about the claim that we need more anonymity in this process. I think we need less. Second, what are the incentives of the conferences itself? So the conference organizers, they want to have a good reputation, which basically means they want to be like a cool nightclub. Lots of people want to get in, but they have to reject a lot of those people in order to make the club exclusive and have a high reputation. So conferences have every reason to invite everyone to submit as much as possible, but then to reject as much as possible to make it seem like it's super hard to get in. This only makes the problem worse. And I think the current explosion isn't really desired by the conferences as the process is super noisy, they're slowly losing their reputation that way. But still, the incentives aren't to lower the amount of submissions and increase the overall quality because that means a higher percentage of submissions will have to get accepted, which means that the conference appears to be less exclusive. And lastly, let's look at the reviewers themselves. This is the most screwed up part in the system. I have every incentive to be a reviewer for one of these conferences because I can write that on my CV, hey, I was a reviewer at big name conference. And then once I am accepted as a reviewer, I have every incentive to do absolutely nothing. In fact, the less time I waste with this, the better because I'm not getting any public credit. I'm anonymous, right? anonymous peer review. I'm not getting any reputation out of this. And in fact, I can only lose from accepting papers. And I can only lose from writing detailed reviews. If I'm short and vague, and I reject a paper, not only can I not really be criticized, because I'm not saying much, it's actually in my overwhelming interest, if the paper has some sort of big mistake, and I overlook it, and I accept the paper and the other reviewers see that mistake, this looks really, really bad for me, even though I'm anonymous in the broader context, it also looks bad for the area chair supervising me if they don't see it, it looks bad for the conference if their area chairs don't see it. So there's a massive push to not make mistakes. However, if I reject a paper that was actually good, I can just say, well, they can resubmit to the next conference. So already have a giant prior to reject a paper. Add to that that usually the papers that are review might be my competition. And by the conference incentive of being pretty exclusive, the more of my competition gets accepted, the less I might get accepted. Because not only are there limited amount of space, not formally, but informally, other work might overlap substantially with my own and therefore make it less likely that I get published. Also other work might actually criticize my work. And I don't like that. And this is a bit cynical. But I'm not saying everyone does this. But there is an incentive for you as a reviewer, especially if the work is close to what you're doing to reject it now, implement the same or a very similar idea, and then submit to the next conference where these other authors also will submit and hope for the random process to just for your paper to get more lucky than their paper. Blackplanting on archive counters this a little bit. But I'm afraid that with proposed solutions like more archive blackout periods, more anonymity, these problems will only get worse. Maybe some people don't realize this, but as a reviewer, it's really easy for me to reject a paper, I can almost always find reasons to reject a paper. If it's a theory paper, I can ask for experiments. If it's an experimental paper, I can ask for more experiments. Why didn't you test that data set? Why didn't you compare against this method? Why are your assumptions so strong? They're never guaranteed in practice is the problem even relevant? Your theory is too weak? Have you looked at this other special case? And if I really want to, I can just ask many, many, many questions, not even criticisms, just many questions. And I know the authors just have a one page rebuttal, they can never answer all my questions if I do that. And then I can simply argue the authors failed to address all my questions properly. So you might be asking, why do some reviewers actually do a good job? And that is, I believe, really a lot to do with goodwill. Most people are actually well intended. Most people actually want to do a good job in reviewing have the ethos of science and do take the time to do the reviews, even though they're incentivized to do them badly, even though they're incentivized to reject papers, a lot of people still do a good job. However, reviewer number two usually doesn't. And it only needs a very few reviewer number twos to make the field a whole lot worse. Now there's a question to be said, aren't we all a bit reviewer number two? Have you ever written a review that the authors might think is completely unreasonable? And while there is some truth to that argument, I definitely know that there are differences in reviews. In fact, I've heard people brag about writing two line reviews where the second line is you didn't cite and compare to my own work and then laugh about that. So goodwill won't carry us all the way if the incentive structure is bad. And I believe most of this is because we've taken out the reputation game out of the review process. In smaller fields of science, it used to be that the journal editors knew the reviewers and their reputation at least towards the journal editor was on the line for all of future. If they did a bad job. Right now everything's so big, so anonymous, people hardly remember the names of their co reviewers, no reputation is being damaged by bad reviews. And that's how we get here. So of course, I'm not the first one to observe these problems. So many people have proposed solutions. And most of these solutions fall into the basis of what I would call a C based methods, which is basically where someone evaluates the reviews while the reviews remain anonymous, and that someone is usually the area chair. So right now the area chair can already decide that a reviewer is really bad. And then the reviewer will not be invited to review the next time around. I just want to point out the irony of the situation. conferences nowadays have so little reviewers that they require every author to be a reviewer. But then your punishment for writing bad reviews is that you won't be invited to be a reviewer the next time around. I mean, can you make a better point that the system is failing? Of course, the problem with all AC based methods is that you're basically moving a problem that has everything to do with people being unaccountable, noisy, not expertly, having no time and every single incentive to do as little as possible. You transfer that problem to even less people that have even less time that have even more stress that have an even broader view and topic area and are single people instead of three or four people. So it's even more noisy. If anything like this is implemented, you'll just instead of seeing complaints about bad reviews. In addition, you will also see complaints about bad ACs that will certainly not make the problem any less. In fact, I would argue any AC based solution will make the problem worse. Other solutions are what I call payment based solutions, like give the reviewers money to review. I don't see how that fixes the incentive for you to reject anything, you just might write it in a bit more eloquent style. Also, as soon as you bring money into the game that automatically excludes a lot of people depending on how you do it, that aren't as affluent, which is certainly something we don't want as a community. Other people are pointing to things like open review, which I agree is a better system. However, it is still anonymous. So the same incentives exist. And it is still a conference where you get a stamp of accept or reject. And once it's accepted, no one cares about the reviews anymore. In fact, in open review, you can write as much text as you want. So the ACs are even more overloaded with lots of texts to make their decisions. So something I want to highlight is a thread by Thomas G. Dietrich on Twitter, where he basically suggests some sort of a wiki and sort of a collaborative research wiki where you'd have a set of senior authors that basically maintain that wiki that do a first check of papers and kind of match them against the wiki of what's already known. I won't go through that here, I will link it. And I definitely advise you to read it because it's very interesting proposal. It's a sort of utopian dream, I would actually welcome if we all work together on increasing the knowledge of mankind in a wiki style way. However, I think lots of people want their names attached to things. And even if you do what Thomas suggests, and basically have people write papers, and then the editors integrate that into the wiki, it is not clear how that system where the editors clearly need to be senior and experienced could deal any better with the explosion of research that we're dealing right now, they would be as overloaded as the current system plus who's going to be an editor, Thomas says becoming an editor would be a very esteemed career path. And again, I completely welcome if that were the case in the future. However, simply decreeing that something would be very esteemed, doesn't make it that way. It's not fiat money. So as much as I would like that, I just don't believe it would work. And especially I don't believe it would work right now. And I think it would be subject to the same problems. So can we come up with a better solution? I think yes. But the way to go there is to align what we want as a community with the incentives of people and not go against it. Because as soon as you go against it too much, people will find a way around it. So the first thing I want to suggest is we abolish conference publishing, this weird notion that you submit your paper to this conference. And then all at the same time, a random process is happening and three random people give their opinion while reading your paper for a couple of minutes. And then you get an accept after which your paper is there never to be revised, or a reject, which simply means you try again seems to be preposterous. I'm sorry. So people wonder, yeah, but how do we know when a paper is accepted? Who cares about acceptance? Who cares? Why can't we just switch to citations? Citations is a pretty good measure of how much people care about a paper. And yes, big names will get more citations, but they do so now and they do so more effectively than ever. Why can't we just put our papers on archive and then run some kind of page rank algorithm over the citations such that self citations aren't worth as much. I mean, search engines figured out how to deliver you the most relevant search result to a query 20 years ago, why can't we simply apply the same techniques to research determining this work is quite relevant. This work is not that quite relevant. I get it citations take time, and you won't immediately know after publishing. But I think that's a step we can take, especially since conference publishing is also lagging like half a year behind publishing on archive during which pretty much nothing happens. And then people say, Oh, but what about peer review, peer review, peer review does not work. peer review is a joke in machine learning. Okay, no one cares about the reviews, reviewers are a nuisance, you have to get past them, all the people still pretend to care that it means something that reviewers agree or disagree with you. It doesn't. In fact, I want to get to a system where peer review starts at the moment, at the moment where you publish a paper on something like archive, and then never finishes for the lifetime of that paper. As new knowledge comes in from the field, the paper can be continuously re examined. And if the paper turns out to be really important, more and more scrutiny can be applied to it seems like a much better system than simply throwing the same amount of pretty random reviewers at every paper and then giving it the stamp or not. So here's what I suggest we keep something like archive, but amended with a commenting function. And the commenting can be pretty feature rich. So you could incorporate plots and references to other things. This goes very much towards a kind of a collaboratively edited wiki, but where people still put their names on things. So let's say I publish a paper, someone else could publish a comment, which would be not less in quality than a paper, it can be it can be a two line comment, it can be a full rewrite of the paper, it can be an amendment. So I could have published a paper and someone else could say, Look, I've done your code on a different data set. And here are the results, people could then cite my paper, or they could cite comments, and the citations will determine the relevance. The comments would also be right there on archive. So every time someone goes to look at the paper, they'll see the comments along with it. So if the paper has a big mistake, they'll basically see the comment that says, Hey, this paper has a mistake, and I can prove it right here. And then they can maybe see a response to that saying, No, you're wrong. And people can make up their own minds, we could build in some kind of voting system, like a stack overflow system for ranking comments. But instead of making this stamp of approval thing a one time event by a random set of people, let everyone make up their own mind and let people discuss. And you can even have anonymous comments on these sites, because the comments will be evaluated on what they are writing, and not who it is by. Now, of course, if it does turn out that commenting will become cool after a while, you can also comment non anonymously, and maybe get little medals like you get on stack overflow. I don't see that happening. But if it does, the better now as a side suggestions, can we please stop publishing stuff in PDFs? It's so like, why do we still do this, this many pages, this margin and so on? I get it, some people still print out their papers. But websites are so much nicer to look at, and can be made to print adequately. Let's start publishing research as HTML, not as PDFs. So remember, when I said the authors have a big incentive to not have comments on their paper, this pretty much goes against that, right? So it is entirely conceivable that the authors will just start self hosting the company like Google could simply not publish to archive anymore, they could simply publish to their own website, and remove themselves from the ability for other people to comment. Now this can be solved technologically pretty easy by creating something like a browser plugin, that if you find a piece of research anywhere, it'll simply fuzzy match the title, find the appropriate comments to that research as a unified set of comments across all of the internet. In contrast, conferences should be conferences, it should be places where people come up, meet up and talk about relevant issues that are happening right now. If I go to a conference now, most of the talks on the papers is from research that is six months old or older, why don't we have conferences that are simply consisting of invited keynotes, panel discussions, and things that are now called workshops where we discuss current maybe unfinished research have poster sessions for many more people. There's no acceptance, there's no declining, if there's not enough room, do a lottery or something like this, but make the conferences a place where science is happening, and not where we flash six months old research. So why is this not happening? I already said that most of the incentives are actually towards the current system as much as people complain about it. Now conferences are slowly losing their reputations, as I said, because over time, people will catch on to the fact that the signal being accepted at a particular conferences is more and more noisy. However, the system is still upheld by most PhD students, for example, needing a certain amount of conference accepted submissions in order to graduate. So what we really need is professors and I'm calling on every professor out there to start giving out PhDs while absolutely not caring about the number of conference accepted submissions that a student has. And that seems like something that's very doable because it requires individuals, professors to simply change their practices with which they let people graduate. So that was it for my little rant on conferences and reviewer number two, please let me know what you think in the comments. I value your input very much. And I hope we can get to a future where conferences are conferences and research is just done on the basis of its coolness and relevance. Alright, I'll see you. Bye bye.
[{"start": 0.96, "end": 3.68, "text": " It's review time, review time."}, {"start": 6.4, "end": 15.040000000000001, "text": " So NeurIPS has recently released the reviews for submitted papers and pretty much everyone is not"}, {"start": 15.040000000000001, "end": 21.52, "text": " happy. And I think the reason is that even though you have the reasonable reviewers of these"}, {"start": 21.52, "end": 30.16, "text": " conferences, there is always always reviewer number two. And reviewer number two leaves very"}, {"start": 30.16, "end": 36.56, "text": " short review says that either there are not enough experiments, or the theory is too weak,"}, {"start": 36.56, "end": 42.879999999999995, "text": " or the assumptions aren't warranted, or they just don't like your face. And that's why they give you"}, {"start": 42.879999999999995, "end": 48.480000000000004, "text": " a weak reject. Actually, some of them think your paper is fantastic, and give you a weak reject."}, {"start": 48.48, "end": 55.76, "text": " So a lot of people are angry, upset, dissatisfied with the quality of the reviews in machine"}, {"start": 55.76, "end": 62.64, "text": " learning conferences. And today, I want to go look into bit into how this works, why this is the way"}, {"start": 62.64, "end": 69.28, "text": " that it is, and what we could potentially do about it. So what's happening with publishing in ML, the"}, {"start": 69.28, "end": 74.72, "text": " system seems to be overloaded. There's so much attention in machine learning right now that"}, {"start": 74.72, "end": 81.03999999999999, "text": " there hasn't been a few years ago, that there's a huge influx of new people wanting to publish"}, {"start": 81.03999999999999, "end": 88.0, "text": " in this field. That creates a lot of submissions and not enough reviewers to peer review these"}, {"start": 88.0, "end": 93.84, "text": " submissions. So a lot of reviewers are recruited that probably shouldn't be reviewers. I hear"}, {"start": 93.84, "end": 99.84, "text": " stories of undergrads being recruited as reviewers, people from way outside the fields, people that"}, {"start": 99.84, "end": 106.88000000000001, "text": " don't have time. So too many submissions, too few inexperienced and not really expert reviewers"}, {"start": 106.88000000000001, "end": 112.96000000000001, "text": " creates pretty much a random process. And this was also shown in a few years ago in the then"}, {"start": 112.96000000000001, "end": 119.04, "text": " NIPS experiment, where it showed that for most papers being accepted is pretty much a coin flip"}, {"start": 119.04, "end": 123.84, "text": " with a weighted coin. The natural response as an author is going to be you're going to submit even"}, {"start": 123.84, "end": 129.92000000000002, "text": " more papers. If it's a coin flip, you can just submit whatever and there's a chance it might get"}, {"start": 129.92000000000002, "end": 135.36, "text": " in, which of course only makes the problem worse. So this entire process of science where you"}, {"start": 135.36, "end": 139.36, "text": " submit your manuscript and then you get the reviews and then you try to improve it,"}, {"start": 139.36, "end": 145.2, "text": " it's completely broken. Because not only do you not care about the reviews, the next set of"}, {"start": 145.2, "end": 150.24, "text": " reviewers at the next conference are going to be different. So no matter what you improve right now,"}, {"start": 150.24, "end": 154.88, "text": " the next set of people will have completely different criticism. It just doesn't work"}, {"start": 154.88, "end": 160.64000000000001, "text": " like it is intended to work. The review process is basically just some kind of a random nuisance"}, {"start": 160.64000000000001, "end": 167.28, "text": " to people that they have to get through. And at the same time, people who are reviewers have every"}, {"start": 167.28, "end": 173.04000000000002, "text": " incentive to make it as hard as possible for the people that are submitting. So in order to analyze"}, {"start": 173.04000000000002, "end": 179.20000000000002, "text": " this, I want to look at the incentives of the different groups in this process and kind of show"}, {"start": 179.2, "end": 185.6, "text": " how the incentive structure upholds this system that benefits pretty much everyone participating"}, {"start": 185.6, "end": 192.0, "text": " in it, but creates a worse outcome for all of us. So first of all, let's look at paper authors,"}, {"start": 192.0, "end": 197.76, "text": " what are your incentive if you're an author of a paper? First of all, authors, they want to get as"}, {"start": 197.76, "end": 204.39999999999998, "text": " many papers as possible as fast as possible. Now in the current conference system, the fastness"}, {"start": 204.4, "end": 210.8, "text": " isn't really up for debate. It's as fast as it is. However, authors can simply upload their paper to"}, {"start": 210.8, "end": 217.36, "text": " archive and be as fast as they want there. Another incentive for authors is to have as little comments"}, {"start": 217.36, "end": 223.36, "text": " on your paper as possible, because comments usually mean criticism. And you don't want comments and"}, {"start": 223.36, "end": 228.88, "text": " especially you don't want public permanent comments. The good thing for authors right now is"}, {"start": 228.88, "end": 233.12, "text": " on archive comments aren't possible and conference reviews even if they're made public,"}, {"start": 233.12, "end": 239.52, "text": " no one goes to look at them, everyone just goes to archive. So authors right now are getting a"}, {"start": 239.52, "end": 244.88, "text": " pretty good deal with respect to not getting their work criticized. Authors are also incentivized to"}, {"start": 244.88, "end": 251.28, "text": " give as little credit to people as possible. And again, the current system is totally in favor of"}, {"start": 251.28, "end": 256.4, "text": " that the no commenting on archive basically means that you can claim whatever you want. And if"}, {"start": 256.4, "end": 261.12, "text": " someone wants to refute you, they have to make a big deal out of it and basically write their own"}, {"start": 261.12, "end": 267.76, "text": " paper. And again, people will probably not find that on the other hand in the conferences, reviewers"}, {"start": 267.76, "end": 272.48, "text": " are supposed to detect when you're not giving proper credit to other people. However, most"}, {"start": 272.48, "end": 279.28000000000003, "text": " reviewers don't do that. Going out and really looking if everything is credited properly is one"}, {"start": 279.28000000000003, "end": 286.08, "text": " of the most time consuming tasks when you review a paper. And most reviewers simply aren't going"}, {"start": 286.08, "end": 291.68, "text": " through that trouble. The only downside for most authors is even though all of this is pretty much"}, {"start": 291.68, "end": 298.8, "text": " in their favor, a lot of them still require that stamp of approval that peer review accepted at a"}, {"start": 298.8, "end": 304.96, "text": " good conference. So their incentive is to keep submitting to conferences as many papers as"}, {"start": 304.96, "end": 311.36, "text": " possible basically count on that random process to get them accepted. And after that, they're just"}, {"start": 311.36, "end": 316.40000000000003, "text": " fine. They have the stamp of approval, there's absolutely no requirement to revise it. There's"}, {"start": 316.40000000000003, "end": 322.08000000000004, "text": " absolutely no requirement to have other people comment further on the work. So I guess the"}, {"start": 322.08000000000004, "end": 326.8, "text": " complaining here right now is just about the noisy process. And everyone complains that"}, {"start": 326.8, "end": 332.48, "text": " their particular paper, which is at the behest of the noisy process as everyone else's paper,"}, {"start": 332.48, "end": 339.28000000000003, "text": " got an unfair treatment in that random process, which half the papers do probably more. The"}, {"start": 339.28, "end": 344.64, "text": " incentives in the systems are actually even bigger for what I call the big names. Okay,"}, {"start": 344.64, "end": 350.55999999999995, "text": " these are the big research institutions of companies, or big name professors, anyone that"}, {"start": 350.55999999999995, "end": 357.28, "text": " has some sort of reputation, people argue that anonymous reviewing is actually good for small"}, {"start": 357.28, "end": 362.0, "text": " authors good for unknown authors because it hides their identity and the big names pretty basically"}, {"start": 362.0, "end": 367.44, "text": " aren't able to play their big name credit to a paper. However, there's an easy way to know"}, {"start": 367.44, "end": 373.76, "text": " that this isn't the case. The big names are doing just fine. Here's the issue. If you want your name"}, {"start": 373.76, "end": 380.0, "text": " to be attached to something, you're gonna find a way to do it. People are suggesting archive blackout"}, {"start": 380.0, "end": 386.56, "text": " periods and whatnot anonymous submissions to archive, you have to realize that if someone"}, {"start": 386.56, "end": 392.56, "text": " wants to give some information to the public, they are going to in fact, right now the big names are"}, {"start": 392.56, "end": 398.8, "text": " finding every possible way to have their names attached to things and massively increase their"}, {"start": 398.8, "end": 404.4, "text": " chances of getting through the anonymous peer review process. You got to realize if you're"}, {"start": 404.4, "end": 409.04, "text": " well connected, not only do you have an advertising platform, but you can also pretty easily find out"}, {"start": 409.04, "end": 416.4, "text": " who your area chairs are, who's reviewing in which track your paper gets and so on. So allow me to"}, {"start": 416.4, "end": 422.24, "text": " be a little bit skeptical about the claim that we need more anonymity in this process. I think we"}, {"start": 422.24, "end": 428.08, "text": " need less. Second, what are the incentives of the conferences itself? So the conference organizers,"}, {"start": 428.08, "end": 433.2, "text": " they want to have a good reputation, which basically means they want to be like a cool"}, {"start": 433.2, "end": 440.08, "text": " nightclub. Lots of people want to get in, but they have to reject a lot of those people in order to"}, {"start": 440.08, "end": 446.08, "text": " make the club exclusive and have a high reputation. So conferences have every reason to invite"}, {"start": 446.08, "end": 452.08, "text": " everyone to submit as much as possible, but then to reject as much as possible to make it seem"}, {"start": 452.08, "end": 457.35999999999996, "text": " like it's super hard to get in. This only makes the problem worse. And I think the current explosion"}, {"start": 457.35999999999996, "end": 463.28, "text": " isn't really desired by the conferences as the process is super noisy, they're slowly losing"}, {"start": 463.28, "end": 469.68, "text": " their reputation that way. But still, the incentives aren't to lower the amount of submissions and"}, {"start": 469.68, "end": 474.71999999999997, "text": " increase the overall quality because that means a higher percentage of submissions will have to get"}, {"start": 474.71999999999997, "end": 481.2, "text": " accepted, which means that the conference appears to be less exclusive. And lastly, let's look at"}, {"start": 481.2, "end": 488.0, "text": " the reviewers themselves. This is the most screwed up part in the system. I have every incentive to"}, {"start": 488.0, "end": 493.36, "text": " be a reviewer for one of these conferences because I can write that on my CV, hey, I was a reviewer"}, {"start": 493.36, "end": 499.52, "text": " at big name conference. And then once I am accepted as a reviewer, I have every incentive to do"}, {"start": 499.52, "end": 508.08, "text": " absolutely nothing. In fact, the less time I waste with this, the better because I'm not getting any"}, {"start": 508.08, "end": 514.8, "text": " public credit. I'm anonymous, right? anonymous peer review. I'm not getting any reputation out of this."}, {"start": 514.8, "end": 522.48, "text": " And in fact, I can only lose from accepting papers. And I can only lose from writing detailed"}, {"start": 522.48, "end": 529.36, "text": " reviews. If I'm short and vague, and I reject a paper, not only can I not really be criticized,"}, {"start": 529.36, "end": 534.96, "text": " because I'm not saying much, it's actually in my overwhelming interest, if the paper has some sort"}, {"start": 534.96, "end": 541.52, "text": " of big mistake, and I overlook it, and I accept the paper and the other reviewers see that mistake,"}, {"start": 541.52, "end": 546.72, "text": " this looks really, really bad for me, even though I'm anonymous in the broader context, it also"}, {"start": 546.72, "end": 552.32, "text": " looks bad for the area chair supervising me if they don't see it, it looks bad for the conference"}, {"start": 552.32, "end": 560.0, "text": " if their area chairs don't see it. So there's a massive push to not make mistakes. However,"}, {"start": 560.0, "end": 566.88, "text": " if I reject a paper that was actually good, I can just say, well, they can resubmit to the next"}, {"start": 566.88, "end": 572.4, "text": " conference. So already have a giant prior to reject a paper. Add to that that usually the"}, {"start": 572.4, "end": 578.56, "text": " papers that are review might be my competition. And by the conference incentive of being pretty"}, {"start": 578.56, "end": 584.4, "text": " exclusive, the more of my competition gets accepted, the less I might get accepted. Because"}, {"start": 584.4, "end": 591.04, "text": " not only are there limited amount of space, not formally, but informally, other work might overlap"}, {"start": 591.04, "end": 596.24, "text": " substantially with my own and therefore make it less likely that I get published. Also other work"}, {"start": 596.24, "end": 603.52, "text": " might actually criticize my work. And I don't like that. And this is a bit cynical. But I'm not saying"}, {"start": 603.52, "end": 608.72, "text": " everyone does this. But there is an incentive for you as a reviewer, especially if the work is close"}, {"start": 608.72, "end": 615.12, "text": " to what you're doing to reject it now, implement the same or a very similar idea, and then submit"}, {"start": 615.12, "end": 621.12, "text": " to the next conference where these other authors also will submit and hope for the random process"}, {"start": 621.12, "end": 627.0400000000001, "text": " to just for your paper to get more lucky than their paper. Blackplanting on archive counters"}, {"start": 627.0400000000001, "end": 633.0400000000001, "text": " this a little bit. But I'm afraid that with proposed solutions like more archive blackout"}, {"start": 633.04, "end": 639.04, "text": " periods, more anonymity, these problems will only get worse. Maybe some people don't realize this,"}, {"start": 639.04, "end": 645.36, "text": " but as a reviewer, it's really easy for me to reject a paper, I can almost always find reasons"}, {"start": 645.36, "end": 651.68, "text": " to reject a paper. If it's a theory paper, I can ask for experiments. If it's an experimental paper,"}, {"start": 651.68, "end": 656.8, "text": " I can ask for more experiments. Why didn't you test that data set? Why didn't you compare against"}, {"start": 656.8, "end": 662.24, "text": " this method? Why are your assumptions so strong? They're never guaranteed in practice is the problem"}, {"start": 662.24, "end": 668.4, "text": " even relevant? Your theory is too weak? Have you looked at this other special case? And if I really"}, {"start": 668.4, "end": 675.2, "text": " want to, I can just ask many, many, many questions, not even criticisms, just many questions. And I"}, {"start": 675.2, "end": 680.88, "text": " know the authors just have a one page rebuttal, they can never answer all my questions if I do"}, {"start": 680.88, "end": 686.4, "text": " that. And then I can simply argue the authors failed to address all my questions properly. So"}, {"start": 686.4, "end": 693.6, "text": " you might be asking, why do some reviewers actually do a good job? And that is, I believe,"}, {"start": 694.16, "end": 700.9599999999999, "text": " really a lot to do with goodwill. Most people are actually well intended. Most people actually"}, {"start": 700.9599999999999, "end": 708.56, "text": " want to do a good job in reviewing have the ethos of science and do take the time to do the reviews,"}, {"start": 708.56, "end": 714.48, "text": " even though they're incentivized to do them badly, even though they're incentivized to reject papers,"}, {"start": 714.48, "end": 720.64, "text": " a lot of people still do a good job. However, reviewer number two usually doesn't. And it only"}, {"start": 720.64, "end": 726.5600000000001, "text": " needs a very few reviewer number twos to make the field a whole lot worse. Now there's a question to"}, {"start": 726.5600000000001, "end": 732.48, "text": " be said, aren't we all a bit reviewer number two? Have you ever written a review that the authors"}, {"start": 732.48, "end": 739.28, "text": " might think is completely unreasonable? And while there is some truth to that argument, I definitely"}, {"start": 739.28, "end": 744.48, "text": " know that there are differences in reviews. In fact, I've heard people brag about writing two"}, {"start": 744.48, "end": 749.76, "text": " line reviews where the second line is you didn't cite and compare to my own work and then laugh"}, {"start": 749.76, "end": 755.68, "text": " about that. So goodwill won't carry us all the way if the incentive structure is bad. And I believe"}, {"start": 755.68, "end": 762.3199999999999, "text": " most of this is because we've taken out the reputation game out of the review process."}, {"start": 762.3199999999999, "end": 767.92, "text": " In smaller fields of science, it used to be that the journal editors knew the reviewers and their"}, {"start": 767.92, "end": 775.12, "text": " reputation at least towards the journal editor was on the line for all of future. If they did a bad"}, {"start": 775.12, "end": 780.7199999999999, "text": " job. Right now everything's so big, so anonymous, people hardly remember the names of their co"}, {"start": 780.7199999999999, "end": 786.0, "text": " reviewers, no reputation is being damaged by bad reviews. And that's how we get here. So of course,"}, {"start": 786.0, "end": 791.52, "text": " I'm not the first one to observe these problems. So many people have proposed solutions. And most"}, {"start": 791.52, "end": 797.76, "text": " of these solutions fall into the basis of what I would call a C based methods, which is basically"}, {"start": 797.76, "end": 805.12, "text": " where someone evaluates the reviews while the reviews remain anonymous, and that someone is"}, {"start": 805.12, "end": 811.12, "text": " usually the area chair. So right now the area chair can already decide that a reviewer is really"}, {"start": 811.12, "end": 815.92, "text": " bad. And then the reviewer will not be invited to review the next time around. I just want to point"}, {"start": 815.92, "end": 821.12, "text": " out the irony of the situation. conferences nowadays have so little reviewers that they"}, {"start": 821.12, "end": 826.48, "text": " require every author to be a reviewer. But then your punishment for writing bad reviews"}, {"start": 826.48, "end": 832.88, "text": " is that you won't be invited to be a reviewer the next time around. I mean, can you make a better"}, {"start": 832.88, "end": 838.64, "text": " point that the system is failing? Of course, the problem with all AC based methods is that you're"}, {"start": 838.64, "end": 846.24, "text": " basically moving a problem that has everything to do with people being unaccountable, noisy, not"}, {"start": 846.24, "end": 853.76, "text": " expertly, having no time and every single incentive to do as little as possible. You transfer that"}, {"start": 853.76, "end": 859.92, "text": " problem to even less people that have even less time that have even more stress that have an even"}, {"start": 859.92, "end": 868.64, "text": " broader view and topic area and are single people instead of three or four people. So it's even more"}, {"start": 868.64, "end": 874.3199999999999, "text": " noisy. If anything like this is implemented, you'll just instead of seeing complaints about bad"}, {"start": 874.3199999999999, "end": 881.12, "text": " reviews. In addition, you will also see complaints about bad ACs that will certainly not make the"}, {"start": 881.12, "end": 887.2, "text": " problem any less. In fact, I would argue any AC based solution will make the problem worse. Other"}, {"start": 887.2, "end": 894.0, "text": " solutions are what I call payment based solutions, like give the reviewers money to review. I don't"}, {"start": 894.0, "end": 899.76, "text": " see how that fixes the incentive for you to reject anything, you just might write it in a bit more"}, {"start": 899.76, "end": 905.2, "text": " eloquent style. Also, as soon as you bring money into the game that automatically excludes a lot"}, {"start": 905.2, "end": 910.48, "text": " of people depending on how you do it, that aren't as affluent, which is certainly something we"}, {"start": 910.48, "end": 916.0, "text": " don't want as a community. Other people are pointing to things like open review, which I agree"}, {"start": 916.0, "end": 923.6800000000001, "text": " is a better system. However, it is still anonymous. So the same incentives exist. And it is still a"}, {"start": 923.6800000000001, "end": 931.52, "text": " conference where you get a stamp of accept or reject. And once it's accepted, no one cares about"}, {"start": 931.52, "end": 938.8000000000001, "text": " the reviews anymore. In fact, in open review, you can write as much text as you want. So the ACs are"}, {"start": 938.8, "end": 944.0, "text": " even more overloaded with lots of texts to make their decisions. So something I want to highlight"}, {"start": 944.0, "end": 951.12, "text": " is a thread by Thomas G. Dietrich on Twitter, where he basically suggests some sort of a wiki"}, {"start": 951.12, "end": 957.5999999999999, "text": " and sort of a collaborative research wiki where you'd have a set of senior authors that basically"}, {"start": 957.5999999999999, "end": 966.0, "text": " maintain that wiki that do a first check of papers and kind of match them against the wiki of what's"}, {"start": 966.0, "end": 972.4, "text": " already known. I won't go through that here, I will link it. And I definitely advise you to read"}, {"start": 972.4, "end": 977.76, "text": " it because it's very interesting proposal. It's a sort of utopian dream, I would actually welcome"}, {"start": 977.76, "end": 983.68, "text": " if we all work together on increasing the knowledge of mankind in a wiki style way. However,"}, {"start": 983.68, "end": 990.0, "text": " I think lots of people want their names attached to things. And even if you do what Thomas suggests,"}, {"start": 990.0, "end": 995.36, "text": " and basically have people write papers, and then the editors integrate that into the wiki, it is"}, {"start": 995.36, "end": 1000.96, "text": " not clear how that system where the editors clearly need to be senior and experienced could"}, {"start": 1000.96, "end": 1006.48, "text": " deal any better with the explosion of research that we're dealing right now, they would be as"}, {"start": 1006.48, "end": 1011.6, "text": " overloaded as the current system plus who's going to be an editor, Thomas says becoming an editor"}, {"start": 1011.6, "end": 1019.6800000000001, "text": " would be a very esteemed career path. And again, I completely welcome if that were the case in the"}, {"start": 1019.68, "end": 1027.04, "text": " future. However, simply decreeing that something would be very esteemed, doesn't make it that way."}, {"start": 1027.04, "end": 1032.32, "text": " It's not fiat money. So as much as I would like that, I just don't believe it would work. And"}, {"start": 1032.32, "end": 1038.72, "text": " especially I don't believe it would work right now. And I think it would be subject to the same"}, {"start": 1038.72, "end": 1047.36, "text": " problems. So can we come up with a better solution? I think yes. But the way to go there is to align"}, {"start": 1047.36, "end": 1053.12, "text": " what we want as a community with the incentives of people and not go against it. Because as soon"}, {"start": 1053.12, "end": 1058.56, "text": " as you go against it too much, people will find a way around it. So the first thing I want to"}, {"start": 1058.56, "end": 1066.7199999999998, "text": " suggest is we abolish conference publishing, this weird notion that you submit your paper to this"}, {"start": 1066.7199999999998, "end": 1072.56, "text": " conference. And then all at the same time, a random process is happening and three random people give"}, {"start": 1072.56, "end": 1078.0, "text": " their opinion while reading your paper for a couple of minutes. And then you get an accept after which"}, {"start": 1078.0, "end": 1084.8, "text": " your paper is there never to be revised, or a reject, which simply means you try again seems to"}, {"start": 1084.8, "end": 1090.24, "text": " be preposterous. I'm sorry. So people wonder, yeah, but how do we know when a paper is accepted? Who"}, {"start": 1090.24, "end": 1096.8799999999999, "text": " cares about acceptance? Who cares? Why can't we just switch to citations? Citations is a pretty"}, {"start": 1096.88, "end": 1103.5200000000002, "text": " good measure of how much people care about a paper. And yes, big names will get more citations,"}, {"start": 1103.5200000000002, "end": 1110.0, "text": " but they do so now and they do so more effectively than ever. Why can't we just put our papers on"}, {"start": 1110.0, "end": 1115.8400000000001, "text": " archive and then run some kind of page rank algorithm over the citations such that self"}, {"start": 1115.8400000000001, "end": 1123.2, "text": " citations aren't worth as much. I mean, search engines figured out how to deliver you the most"}, {"start": 1123.2, "end": 1130.4, "text": " relevant search result to a query 20 years ago, why can't we simply apply the same techniques to"}, {"start": 1130.4, "end": 1136.88, "text": " research determining this work is quite relevant. This work is not that quite relevant. I get it"}, {"start": 1136.88, "end": 1143.44, "text": " citations take time, and you won't immediately know after publishing. But I think that's a step"}, {"start": 1143.44, "end": 1150.0800000000002, "text": " we can take, especially since conference publishing is also lagging like half a year behind publishing"}, {"start": 1150.08, "end": 1154.8799999999999, "text": " on archive during which pretty much nothing happens. And then people say, Oh, but what about"}, {"start": 1154.8799999999999, "end": 1160.8, "text": " peer review, peer review, peer review does not work. peer review is a joke in machine learning."}, {"start": 1160.8, "end": 1168.56, "text": " Okay, no one cares about the reviews, reviewers are a nuisance, you have to get past them, all"}, {"start": 1168.56, "end": 1174.32, "text": " the people still pretend to care that it means something that reviewers agree or disagree with"}, {"start": 1174.32, "end": 1179.28, "text": " you. It doesn't. In fact, I want to get to a system where peer review starts at the moment,"}, {"start": 1179.28, "end": 1184.8799999999999, "text": " at the moment where you publish a paper on something like archive, and then never finishes"}, {"start": 1184.8799999999999, "end": 1191.04, "text": " for the lifetime of that paper. As new knowledge comes in from the field, the paper can be"}, {"start": 1191.04, "end": 1197.28, "text": " continuously re examined. And if the paper turns out to be really important, more and more scrutiny"}, {"start": 1197.28, "end": 1202.96, "text": " can be applied to it seems like a much better system than simply throwing the same amount of"}, {"start": 1202.96, "end": 1207.44, "text": " pretty random reviewers at every paper and then giving it the stamp or not. So here's what I"}, {"start": 1207.44, "end": 1214.16, "text": " suggest we keep something like archive, but amended with a commenting function. And the commenting"}, {"start": 1214.16, "end": 1220.0800000000002, "text": " can be pretty feature rich. So you could incorporate plots and references to other things."}, {"start": 1220.0800000000002, "end": 1225.8400000000001, "text": " This goes very much towards a kind of a collaboratively edited wiki, but where people"}, {"start": 1225.8400000000001, "end": 1232.4, "text": " still put their names on things. So let's say I publish a paper, someone else could publish a"}, {"start": 1232.4, "end": 1238.8000000000002, "text": " comment, which would be not less in quality than a paper, it can be it can be a two line comment,"}, {"start": 1238.8000000000002, "end": 1245.2, "text": " it can be a full rewrite of the paper, it can be an amendment. So I could have published a"}, {"start": 1245.2, "end": 1250.48, "text": " paper and someone else could say, Look, I've done your code on a different data set. And here are"}, {"start": 1250.48, "end": 1256.48, "text": " the results, people could then cite my paper, or they could cite comments, and the citations will"}, {"start": 1256.48, "end": 1261.2800000000002, "text": " determine the relevance. The comments would also be right there on archive. So every time someone"}, {"start": 1261.28, "end": 1267.28, "text": " goes to look at the paper, they'll see the comments along with it. So if the paper has a big mistake,"}, {"start": 1267.28, "end": 1271.84, "text": " they'll basically see the comment that says, Hey, this paper has a mistake, and I can prove it right"}, {"start": 1271.84, "end": 1276.32, "text": " here. And then they can maybe see a response to that saying, No, you're wrong. And people can make"}, {"start": 1276.32, "end": 1281.28, "text": " up their own minds, we could build in some kind of voting system, like a stack overflow system"}, {"start": 1281.28, "end": 1286.3999999999999, "text": " for ranking comments. But instead of making this stamp of approval thing a one time event by a"}, {"start": 1286.4, "end": 1293.2, "text": " random set of people, let everyone make up their own mind and let people discuss. And you can even"}, {"start": 1293.2, "end": 1298.88, "text": " have anonymous comments on these sites, because the comments will be evaluated on what they are"}, {"start": 1298.88, "end": 1304.88, "text": " writing, and not who it is by. Now, of course, if it does turn out that commenting will become cool"}, {"start": 1304.88, "end": 1311.2800000000002, "text": " after a while, you can also comment non anonymously, and maybe get little medals like you get on stack"}, {"start": 1311.28, "end": 1317.12, "text": " overflow. I don't see that happening. But if it does, the better now as a side suggestions, can we"}, {"start": 1317.12, "end": 1325.76, "text": " please stop publishing stuff in PDFs? It's so like, why do we still do this, this many pages, this"}, {"start": 1325.76, "end": 1332.96, "text": " margin and so on? I get it, some people still print out their papers. But websites are so much"}, {"start": 1332.96, "end": 1341.68, "text": " nicer to look at, and can be made to print adequately. Let's start publishing research as HTML,"}, {"start": 1341.68, "end": 1347.8400000000001, "text": " not as PDFs. So remember, when I said the authors have a big incentive to not have comments on their"}, {"start": 1347.8400000000001, "end": 1353.44, "text": " paper, this pretty much goes against that, right? So it is entirely conceivable that the authors"}, {"start": 1353.44, "end": 1359.6000000000001, "text": " will just start self hosting the company like Google could simply not publish to archive anymore,"}, {"start": 1359.6, "end": 1365.9199999999998, "text": " they could simply publish to their own website, and remove themselves from the ability for other"}, {"start": 1365.9199999999998, "end": 1370.48, "text": " people to comment. Now this can be solved technologically pretty easy by creating"}, {"start": 1370.48, "end": 1377.28, "text": " something like a browser plugin, that if you find a piece of research anywhere, it'll simply fuzzy"}, {"start": 1377.28, "end": 1383.9199999999998, "text": " match the title, find the appropriate comments to that research as a unified set of comments across"}, {"start": 1383.92, "end": 1390.48, "text": " all of the internet. In contrast, conferences should be conferences, it should be places where"}, {"start": 1390.48, "end": 1397.2, "text": " people come up, meet up and talk about relevant issues that are happening right now. If I go to a"}, {"start": 1397.2, "end": 1402.8000000000002, "text": " conference now, most of the talks on the papers is from research that is six months old or older,"}, {"start": 1402.8000000000002, "end": 1408.72, "text": " why don't we have conferences that are simply consisting of invited keynotes, panel discussions,"}, {"start": 1408.72, "end": 1414.24, "text": " and things that are now called workshops where we discuss current maybe unfinished research"}, {"start": 1414.24, "end": 1420.48, "text": " have poster sessions for many more people. There's no acceptance, there's no declining,"}, {"start": 1420.48, "end": 1424.72, "text": " if there's not enough room, do a lottery or something like this, but make the conferences"}, {"start": 1424.72, "end": 1431.44, "text": " a place where science is happening, and not where we flash six months old research. So why is this"}, {"start": 1431.44, "end": 1436.56, "text": " not happening? I already said that most of the incentives are actually towards the current"}, {"start": 1436.56, "end": 1442.56, "text": " system as much as people complain about it. Now conferences are slowly losing their reputations,"}, {"start": 1442.56, "end": 1449.04, "text": " as I said, because over time, people will catch on to the fact that the signal being accepted at a"}, {"start": 1449.04, "end": 1456.24, "text": " particular conferences is more and more noisy. However, the system is still upheld by most PhD"}, {"start": 1456.24, "end": 1462.8799999999999, "text": " students, for example, needing a certain amount of conference accepted submissions in order to"}, {"start": 1462.88, "end": 1470.0, "text": " graduate. So what we really need is professors and I'm calling on every professor out there to"}, {"start": 1470.0, "end": 1478.4, "text": " start giving out PhDs while absolutely not caring about the number of conference accepted submissions"}, {"start": 1478.4, "end": 1483.68, "text": " that a student has. And that seems like something that's very doable because it requires individuals,"}, {"start": 1483.68, "end": 1489.5200000000002, "text": " professors to simply change their practices with which they let people graduate. So that was it for"}, {"start": 1489.52, "end": 1495.12, "text": " my little rant on conferences and reviewer number two, please let me know what you think in the"}, {"start": 1495.12, "end": 1502.6399999999999, "text": " comments. I value your input very much. And I hope we can get to a future where conferences are"}, {"start": 1502.6399999999999, "end": 1507.84, "text": " conferences and research is just done on the basis of its coolness and relevance. Alright, I'll see"}, {"start": 1507.84, "end": 1519.84, "text": " you. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=lj-LGrnh1oU
REALM: Retrieval-Augmented Language Model Pre-Training (Paper Explained)
#ai #tech #science Open Domain Question Answering is one of the most challenging tasks in NLP. When answering a question, the model is able to retrieve arbitrary documents from an indexed corpus to gather more information. REALM shows how Masked Language Modeling (MLM) pretraining can be used to train a retriever for relevant documents in an end-to-end fashion and improves over state-of-the-art by a significant margin. OUTLINE: 0:00 - Introduction & Overview 4:30 - World Knowledge in Language Models 8:15 - Masked Language Modeling for Latent Document Retrieval 14:50 - Problem Formulation 17:30 - Knowledge Retriever Model using MIPS 23:50 - Question Answering Model 27:50 - Architecture Recap 29:55 - Analysis of the Loss Gradient 34:15 - Initialization using the Inverse Cloze Task 41:40 - Prohibiting Trivial Retrievals 44:05 - Null Document 45:00 - Salient Span Masking 50:15 - My Idea on Salient Span Masking 51:50 - Experimental Results and Ablations 57:30 - Concrete Example from the Model Paper: https://arxiv.org/abs/2002.08909 Code: https://github.com/google-research/language/tree/master/language/realm My Video on GPT-3: https://www.youtube.com/watch?v=SY5PvZrJhLE My Video on BERT: https://www.youtube.com/watch?v=-9evrZnBorM My Video on Word2Vec: https://www.youtube.com/watch?v=yexR53My2O4 Abstract: Language model pre-training has been shown to capture a surprising amount of world knowledge, crucial for NLP tasks such as question answering. However, this knowledge is stored implicitly in the parameters of a neural network, requiring ever-larger networks to cover more facts. To capture knowledge in a more modular and interpretable way, we augment language model pre-training with a latent knowledge retriever, which allows the model to retrieve and attend over documents from a large corpus such as Wikipedia, used during pre-training, fine-tuning and inference. For the first time, we show how to pre-train such a knowledge retriever in an unsupervised manner, using masked language modeling as the learning signal and backpropagating through a retrieval step that considers millions of documents. We demonstrate the effectiveness of Retrieval-Augmented Language Model pre-training (REALM) by fine-tuning on the challenging task of Open-domain Question Answering (Open-QA). We compare against state-of-the-art models for both explicit and implicit knowledge storage on three popular Open-QA benchmarks, and find that we outperform all previous methods by a significant margin (4-16% absolute accuracy), while also providing qualitative benefits such as interpretability and modularity. Authors: Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, Ming-Wei Chang Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
What's the angle of an equilateral triangle? So if your high school math isn't fresh in your head, you might be forgiven for not knowing this. But what do people do when they want to find out the answer to that question? Of course, the standard way nowadays is to go to search engine like Google, type in the question, find some website that contains the answer, and then sort of read that website and answer the question from there. Now, the goal of this paper here is to do the same thing, but in a machine way. So the machine would see this question right here, and it would be able, it will be able to get additional textual knowledge from a corpus and consult that and then at the end, come up with the answer, which is 60 degrees right here. This type of this type of task is called open question answering. So like open qA or qA. And the distinction here between this and the previous kind of tasks that were often called question answering is that usually in question answering, you simply have a question, and then you have either no help at all, so the model just has to answer the question. And things like GPT-3 demonstrated that that is actually something that's possible if you have a large enough model, or much more common, you would provide the question and then one document. And you would sort of guarantee that the answer is somewhere in this particular document. So even though the task was called question answering, it was more like, it was more a machine reading task, because you knew, okay, all I have to do is I have to find the answer somewhere in the document to this particular question. So the task was more kind of a pattern matching sort of approach. Here, the it's really the task really comes close to what humans understand as question answering, namely, you get a question, you want an answer. And it's open in the sense that you can the machine can go with the question to like a search engine, I have no clue how to draw a globe to a search engine, get multiple documents that would help it kind of rank them and so on. It's basically able to use a search engine and then answer the question from there. So that's what we're going to look at today. There has been a lot of work. I'm not not saying this task is new, there has been a lot of work in open domain question answering. And this is one of the latest incarnations of it. The paper is called realm or realm. I'm really not sure how to pronounce this the word would be called realm, I guess. It's retrieval augmented language model pre training by Kelvin Gu, Kenton Lee, Zora tongue, Panopong puzzle pot and Ming yi chung. So the paper is first and foremost about a pre training method, as you can see, right in the title. So the entire system that's presented here has sort of been explored in papers before like other papers have already done this, or we retrieve other documents. And in this particular case, as you'll see, the documents are retrieved using inner product search through a pre embedded through corpus, which is usually Wikipedia. So you'll see all of this. The new thing about this paper just to make this clear is the way that the pre training works for these systems. And we'll we're going to look at the entire architecture, but just you know, such such that you're aware of what's really coming from here and what's gathered from what's kind of conglomerated from what worked so far. So the improvements here are pretty stunning that they achieve with this new pre training method, which is pretty cool considering that it's, you know, the new thing is a pre training method. So we'll look at this, we'll look at the architecture, the pre training method, the kind of hacks that you need to get it to work. And finally, the results. As always, if you enjoy content like this, don't hesitate to share it out, subscribe if you are not already. And with that, let's jump in. So the abstract says that language model pre training has been shown to capture a surprising amount of world knowledge crucial for NLP tasks such as question answering. And here again, we do we say question answering is kind of the broad category of anywhere where you have to answer a textual question. So what do they mean by world knowledge? What they mean by world knowledge, they mean something like the question that we considered, what's the angle of an equilateral triangle, you can't from the question itself, you can't answer the you can't answer the question is not like a little math question where you just have to do the correct calculations or so on, or, or which one is the longest words of the following words, it really is additional knowledge that you had to have learned somewhere. So that's what we call world knowledge. And the fact that an equilateral triangle has 60 degree angles, you need to have picked that up from somewhere. Now, if you are GPT three, then what you have done is you've taken this giant corpus, right? And you just did language modeling on it, and that gives you GPT three. Now, that means since GPT three is so huge, that means that all the world knowledge that is contained in this corpus is baked into the model and can be sort of parsed out with good querying. So if you provide a correct query, you can sort of parse out what's in the weights of the model. But it's very intransparently, it's very intransparent in the weights of the models baked together with the language modeling. They're, they are criticizing, not criticizing, but sort of arguing against this right here. They say, however, this knowledge is stored implicitly in the parameters of a neural network, requiring ever larger networks to cover more facts. To capture knowledge in a more modular and interpretable way, we augment language model pre training with a latent knowledge retriever, which allows the model to retrieve and attend over documents from a large corpus such as Wikipedia. And sorry, used during pre training, fine tuning, and inference. For the first time, we show how to pre train such a knowledge retriever in an unsupervised manner, using masked language modeling as a learning signal and back propagating through a retrieval step that considers millions of documents. Okay, so that there's that there's a lot of information here. So first of all, what they want to say is they want to say that in such a corpus, there are two kinds of knowledge, right there is there is language. And there is this world knowledge, okay. And they want to make this sort of separate. So they want to have a model that can go to the corpus, retrieve documents, and then use those documents. So whereas previously, the world knowledge has been joined with the language model, they want to sever this connection, say we want a model where we can simply teach it to go look for information, we can teach it to go search for things, and then the searched things will inform its answering of the question. Okay. So that's what that's what these systems are trying to achieve. And we saw that before in the we saw that before in the diagram. So they say we augment language model pre training with a latent knowledge retriever, which allows the model to retrieve and attend over documents from a large corpus. And also they use this masked language modeling as a pre training as a learning signal, and back propagating through the retrieval step. Now, this is the interesting part right here. So what you'll have is you'll have a question. And we can actually look at this diagram right here. So the pre training is going to be masked language modeling, okay. Ultimately, what you want to do is what we looked at before, ultimately, what you want to do is question answering. So this thing right here, where the input is a query. And then you want to retrieve documents, and then you want to join them. And let's actually draw this up. So you have a query. And you want to retrieve documents, how do you do that, you train an embedding for the query, which is usually a, you know, a BERT model. Like that's the fashionable thing to do. If you don't know what BERT is, I've made a video about BERT. But basically, BERT can take a piece of text, and then it will output a vector or multiple vectors for it. In this case, we just need one single vector for the entire query. Okay. And then you have a bunch of documents in your corpus. So in your corpus right here, you have z one, z two, and so on. What you want to do is you want to embed all of those. So you want to have B of z one and B of z two. Okay, you want to embed all of those documents. And then you want to compare these embeddings. And the you want to retrieve the document that's most relevant for your question, right? If your question is about equilateral triangles, the angle in them, then there's probably going to be like a Wikipedia article of triangles or equilateral triangle specifically. So this corpus right here, we're going to consider this to be Wikipedia. Now, ultimately, especially like a company like Google would like this to be the entire internet. But for the these tasks for the academic tasks, this is often a limited corpus. And then the data sets are also made such that they can often be answered with that limited corpus. But in essence, this could be the entire internet. But for now, it's Wikipedia. So we want to embed every single document in Wikipedia and then compare them using the inner product. So you train your model to first of all, take this corpus, and then assign each member of the corpus a vector. So this could be z one, this could be z two, this could be z three, and so on. And you want to train it in such a way that if you have a query, then the query will be very close in inner product space to the to the document that's relevant. So the query might be your question about the angles. And the document right here might be the document about triangles. Okay, and this document might be the document about, I don't know, England. And this one right here might be the document about, I don't know, weightlifting, I have no idea. Like just random Wikipedia documents. Okay, so you want them, you want them to be let's let's, you know, let's draw a little dumbbell right here. So you want you want the other documents to be far apart from the query. So you train two things, you train this model right here, which is the embedding of the corpus, okay. And you train this model right here, which is the embedding of the query, these are two separate models. And then you want the inner product between the two to be small, to be large, whenever the document is relevant for answering the query. And you want them to be far apart whenever it is not. Now, the question is, of course, how do you know, how do you know when it is relevant when it is not because you have to have some training signal right here, right? You, you have to basically know in advance which documents are relevant, and you don't. So they start out with this masked language model pre training, which we see up here. The masked language model pre training does the following. So this is unsupervised, you take some string, right? Like this one, the, and then you mask out a token, this comes straight from BERT, you mask out a token. And then your goal is simply to reproduce that token. Okay. So if we were in BERT, you would forget about all of this, you would simply try to predict what the mask token is. But here we say, well, we allow the model to use additional context in order to read to fill in the blank. And you can see already how this is going to help later. But okay, so we take this sentence, and we allow it to retrieve documents. And maybe the document retrieved is this one right here, the pyramidion on top allows for less material higher up the pyramid. And then you concatenate the input, sorry, the input is this right here, with the mask token, as you can see here, you concatenate that with together with this thing, which is this thing right here. And then you train a different model to take this as an input and tell you what the mask token is. Now, if the retriever is good, then this model has a pretty easy job. Because here you see at the top, something is at the top. And here you see the pyramidion is on top, then it becomes fairly, fairly easy. Hey, the question, again, of course, is how do you teach the retriever to do well. And this is somewhat of a of a loop. So informally, formally, the knowledge retriever right here is going to we're going to model this distribution as a joint distribution. Sorry, this is I this is down here. Alright, so here, the central formula is this, what you want is a model that takes in a question or in pre training a masked string, and it produces the answer or in pre training, this is going to be the mask token. So this is going to be the question. And this is the answer or this is going to be the masked string. And this is going to be the token that has been masked from the string. Now, you're saying I can decompose this probability distribution into the following probability distribution. And here, we take z as a latent variable, usually, but here z is the document, okay. So what we want is a model that takes in your question and a document. That is relevant for answering the question. And from that, it produces the answer. And in order to fill our probability distribution, we have to have this other model that takes in the question and outputs a document. Okay, so this here is the retriever. And this here is going to be the answer. And in order to make this the valid probability distribution, you need to marginalize over all of the documents in your corpus. So now you can see how you train this. You simply retrieve all of you train this model here to predict which documents are relevant to the question. You train this model here to predict which documents are relevant to a certain degree in a back propagatable way. So in a continuous fashion, assign each document a probability to be relevant for answering this particular question. And then you take each of the documents and answer the question, why from it, and you marginalize over all the documents in your, in your data set. And then you get a final probability. And all of this is completely differentiable. The problem, of course, is that, especially in this paper here, there are like 13 million documents. So you won't be able to train very far according to that. So let's look at the individual parts. First of all, this knowledge retriever, the knowledge retriever model is a model that will take in a question and a document and tell you how likely that how relevant that document is for this particular question. And this, as you can see, is defined as a probability distribution, specifically here, this exponential distribution of F. And what is F? We've already seen F is simply the inner product between the embedding and of the question and the document. So that's the kind of thing we drew before, where the document is supposed to be have a high inner product with the query that it is relevant to and a low with all the other queries. Now, since they cannot take all of the documents, what they do is simply they go in. So at the beginning, you're, you know, if, let's say you're somewhere during training, right, and you have this index built up of all of the documents, what you'll do is you'll go, you'll project your query into this space, and you retrieve the couple of documents that are closest to the query. Okay, and, and you only use those. So you sample a few documents, this is the same thing that we do in, you know, contrastive pre training, and so on. It's just taken here to the, the retrieval mode. So you don't marginalize over all documents, because that would be computationally too hard. You simply marginalize over all the documents that have a reasonably high inner product with the query that you're considering. Why does that make sense? Because if you look at any other, like this one here, the inner product is going to be almost zero. So the inner product is going to be almost zero. So the inner product with the query is going to be almost zero. So it does not contribute at all to this probability right here, which also means that the gradient is going to be fairly small. Now, even though the gradient is fairly small, it can still be that you haven't learned something good yet. And actually, the document would be pretty relevant for that query. And because you never use it to train, you will, you know, you will never ever recover it, because you don't ever use it to train, there's no gradient flowing to it, and so on. So you're sort of relying on this being sort of self organizing, like over time, you know, these these turn out to not really be relevant, because you've learned something stupid, and then your query embedding, either would change and change the query, maybe during training, change the query more towards the direction of the relevant documents, or the relevant documents themselves would sort of shift and push each other around and so on. So kind of relying on effects like this, but there's definitely a death spiral that can go on. So they make a they make a address this right here. And yeah, they address this right here. Here, the key computational challenge is that marginal probability p y of x, which is this one involves a summation over all documents in the knowledge corp z, we approximate this instead by summing over the top k documents with the highest probability under this retrieval step. This is reasonable if most documents have near zero probability. Even with this approximation, we still need an efficient way to find the top k documents. Note that the ordering of documents is the same as under the relevance score, okay, which is an inner product. Thus, we can employ maximum inner product search algorithms to find the approximate top k documents using a running time storage space that scales sublinearly with the number of documents. So there are these algorithms to do maximum inner product search, which you can use to find the top k documents. To employ these algorithms, we must pre compute the embedding. So all the embedding of the documents in the corpus must pre compute them for every z and construct an efficient search index over these embeddings. So this now becomes very much like a search engine, where you have to have your corpus and you have to build an index in order to find things fast in there. It looks easy in our 2d examples, but to find maximum inner products in high dimensional spaces actually very challenging task. However, this data structure will no longer be consistent with p with this retrieval thing, right? Because as we train it, our index is going to be old. So as we train it, our index might change. But if we only build it once, then that's of no use. If the parameters of the embedding are later update, hence the search index goes stale after every gradient update on theta. Our solution is to refresh the index by asynchronously re embedding and re indexing all the documents every several 100 training steps and they have a drawing of this right here. So they have two different jobs. The trainer here trains updates itself using the old index. So an index for a couple of 100 steps, then every couple of 100 steps, it sends over its new weights. And the index builder builds a new index using these new weights, right? And then the process starts again, these can run in parallel, as you can imagine. So as soon as the index builder is done, it sends over the new index retrieves the new parameters and starts again, building an index because ideally, you want to rebuild the index after every single step. But of course, that's going to waste too much time as well. So that was the retriever step, the actual answer step is fairly, fairly easy. So once you've retrieved good documents, right, now you don't need, as we said, you don't need all the documents where we are. Right here, you don't need, we're not going to do this with all the documents anymore, we'll simply retrieve the most relevant documents. Because that's going to approximate the sum fairly well, the answer here. That's pretty simple. That's going to be just a BERT model that takes in z and x. Okay, so this is going to be another BERT model that's going to take in the retrieved document and the question, and it's going to output y. How does that look? In case of the masked language model, we've already seen it, right? You simply would input, where is it? You simply would input the concatenation of the two with the mask, as you can see right here, and then the output is going to classify at the classification task. So in the case of BERT, you have your query right here as text, and then you have your document z right here. And there somewhere would be a mask token, you would put BERT on top of that, everything together. And then at the position of the mask token, you would do a classification across all of your vocabulary, right, and see which word is most likely. And that's how you train that and evaluate that. If you are in the fine tuning mode, then you don't have masks anymore. So what you would put is your query right here, and your document that you retrieved. And then you would, you would simply output. Now, here is an assumption and the assumption is often baked into these data sets, you assume that if you have the correct document, the span, the answer is somewhere in in the z document right here. So y is somewhere in here. And what you would do is you would classify the start and the end of the span of y, right, these correspond to these. And then you would put the correspond to these. So that's your training signal right there. As I said, this is not always the case. But very often, especially in these data sets, it's the case that it is a single contiguous span as the answer. Okay, so that's basically the architecture. As I said, the architecture is using inner product to retrieve retrieving top whatever k documents in this case, I think it's about five, they retrieve five documents. For each document, they run it through this bird in this joint way, like on the bottom. And then they classify the output. And you can you can do it with a top one document, but you can marginalize over the top documents for both pre training, and for actually answering a question. There's lots of stuff you can do. The important thing right here is that this thing is what the paper proposes a new it's basically saying, how do we do masked language modeling, pre training with a system like this? All right. Okay. And the rest of the paper basically goes into more detail, like how do you how do you join? How do you exactly what's the input right here? And we've already seen you just concatenate, whatever you have, you concatenate your query and your documents and so on. So the important thing is it's two distinct like there are three models right here, right? Model one, model one is used to take a document from the corpus and map it into a vector in these in this vector space right here. Okay, that's model one. That is the model that you want to build this index for right every now and then, you take that model and build an index for your whole corpus. Then model two is the model that takes a query, okay, a question to answer or a masked string, and also generates a vector in this vector space right here. Okay, that is a different model than the model that embeds the document and you don't build indices for that you continuously train it. And you just because you only need to embed every query once and if you were to not build an index for model one, then you would need to re embed the whole corpus for every training step. And then model three is something yet completely different. Model three takes whatever documents you retrieved right here as z along with the query as text, so not the vectors, but it takes the text of these documents and it takes the text of the query and it produces an answer why which is either the mask token or the answer span in the document. Okay, but this is again, this is a text model. And then model four is a model that takes the query and it takes the text of the query as the answer span in the document. Okay, but this is again, this is a text model. This is nothing to do with the vectors from before. All right, so that was the architecture and the pre training. Now they go into a few different ways. So first of all, they analyze the gradient of something sensible, okay. And thereby, they analyze the gradient of this thing. So if you look at the gradient, here's the gradient of the of py of x py is this is, as we said, the answer. And this is the question. And this probability distribution has everything in it we've discussed before, like retrieving the and so on. Okay, so here you can see that the gradient is first of all, it goes into the direction of this inner product. Okay, this F here, that's, that's the inner product between the embeddings of x and the relevant documents z are relevant according to their relevance. Okay, so the gradient of the entire model is goes into the direction of the gradient of the inner product. So that's already a good thing, right? Now, we can mask ourselves, we can ask ourselves, when do we want the gradient of the entire model to be strongly correlated with the gradient of this inner product? When not, that of course, depends on the document itself. And this is quite this quantity are specifies how much that is. So if this turns out, like we want it, then we can say, okay, the training of this model does something sensible. So what's this quantity are the quantity are notably has this ratio right here, this ratio minus one. Now, what does it say if if the top of the fraction is larger than the bottom of the fraction, then this is a positive number, right? And if the bottom is larger than this is a negative number. Okay, so let's look at the two elements, the top mean the top the ratio basically means that the difference here is this z. So the ratio is larger than one, if the probability of the answer rises when you have z in there, versus when you do not have z right here, there is no z. So what it basically means is that the document helps if the document helps for class for answering the question x, then that probability is larger than the bottom probability. If the document is irrelevant, then that's one right and the entire thing becomes zero and therefore, no gradient. And if the document is counterproductive, and that's often the case, actually, because this documents, they can introduce noise, like noise is often counterproductive for the systems because you have more input, and then the the distribution of y will become more noisy and therefore flatter. And this fraction would be lower than one. So this is going to be negative. So this quantity is positive, the more relevant, the easier it is to answer the question with y, given the document. And that's exactly what we want out of a system like this. So if you look at the gradient of the system, it shows you that what we want to happen, namely, that the system is trained in such a way that the relevant documents will help it is actually happening. Okay. So that's the left hand side. And there's a little bit to be said about this thing right here. The probability. This is proportional always to the probability that your retriever outputs this document. Okay, so the this quantity r is going to be even larger if your retriever outputs that document frequently. So if it is a helpful document, and the retriever outputs it very frequently for the given question, then this quantity r is super large. And that's exactly what we want, right? Okay. So the next thing they do is they they have to they have to sort of take care of the initialization here because the problem we've spoken of before is that if your retriever is bad, right, it will not retrieve the good documents. And so it won't retrieve this z here very often. And then it really doesn't matter what this quantity is right here, because this is going to be very low, like even if it hits upon a correct document, and probably it doesn't because there's like 13 million documents and you retrieve five or so. So very probably, you're not by chance going to hit the correct document. So you never have a chance to get the document that would actually help you answering the question, then you get a bad gradient, then you screw everything up even more, and so on. So the problem is that if you just train this from scratch, you have a pretty bad learning signal. So what they do is they have to take care of initialization. So they have to initialize things such that they are already working fairly well before anything else happens. And this is sort of if I had to, you know, criticize these systems a bit, it's that there are many hacks to getting them to work, right, you have to really take care of initialization and so on because they sort of build in a loop, right, the better the retriever, the better the model that can answer the question and the better the model that can answer the question, the better gradient you get for the retriever. But the retriever only samples so it doesn't even see all the documents. So how can it ever learn that a given document is going to be relevant if never sees it and so on. So there's quite an interdependence and you you only can do that with good initialization, as you know, is the case for a lot of these language tasks. But here, even the pre training, so that's the point, even the masked language model pre training, where they already have this, you know, retrieval step in there, even that needs to be itself initialized at a good point. Otherwise, it doesn't help otherwise, because you want to train the retriever such that the masked language model becomes easier. And you have to take care of a bunch of stuff. So here they say at the beginning of training, if the retriever does not have good embeddings, the retrieved documents will likely be unrelated to x. This causes the knowledge augmented encoder to learn to ignore the retrieved documents. Okay, so it basically just falls back to a model that does not have these other documents because none of the retrieved documents are relevant. Once this occurs, the knowledge retriever does not receive a meaningful gradient and cannot improve creating a vicious cycle to avoid this cold start problem, we warm start the embedding of the input and the doc. So these are these are models one and two, right? I think this is what I called model one, this is what I called model two. Using a simple training objective known as the inverse closed task, where given a sentence, the model is trained to retrieve the document where that sentence came from, refer to this paper. So this paper, I believe is the the the orca paper. And just quickly for the knowledge augmented encoder, we warm started with Bert returning. So this here, I think this is, this is model three. So this is model one, this here is model two, that's model three. So this paper here, I believe that's the orca paper. The orca paper is very, very, very, very, very, very close to this paper, it also has this retrieval step and so on. But it, it took it said that it introduced this inverse closed task as pre training for its own model. So you can see this paper right here as sort of an evolution where they go from from orca and basically use that as an initialization for their own model. Now, it's not exactly the same and so on. But this inverse closed task in that orca paper was quite a central point. So what you want to do is you simply take a document from your corpus, any document, and then you select a span like this span right here. And then you make two things out of that. First of all, the span is going to become your x, okay, and then the document right here, the document but without the span, obviously, so the span you just leave empty, that's going to become the thing to retrieve. And you simply now train a model your models. So this case, this is model one, and this is model two, you train them such that the inner product between between the two, so your embedding of x times your embedding of z is going to be large, I guess they have a weight matrices in front of that, but it doesn't matter. So you can see that you train the model to retrieve the document where a piece of text came from. Okay, and you train train these model in conjunction with each other, you simply make the inner products large and you can do negative sampling for this in order to contrast this with other documents where the text isn't from. If you don't know what negative sampling is, I've done a bunch of papers, most notably the word to vec paper where that was sort of introduced. So that's your pre pre training task. And I'm going to just take a wild guess here. And I'm going to guess and I'm going to guess that in or no in this ICT pre training does this here is started from the public BERT checkpoint or something like this. So technically, this you have the masked language model of models one and two would be the pre pre pre training. And then this ICT would be the pre pre training. And then the masked language modeling with the retriever based on IC built on ICT is going to be the pre training. And then the question answering using that retriever is going to be the actual training. Okay. So there's a lot of build up here. One thing to say is that yeah, as you see here, so here is this pre training on the left unsupervised, where you simply, again, the the thing the way you have to think about it is what document do I have to retrieve to make the job of filling in the blank here easier? Okay. And the hope is that that correlates well with the job of what document do I have to retrieve to answering the question? easier? Okay. What document do I have to retrieve to make to make the job for the model that answers the question easier? I guess that's the way of formulating it. Alright, so the next few things you have to do to get it to work is prohibiting trivial retrievals. They say if the pre training corpus and the knowledge corpus are the same, which I guess they sometimes are because, you know, it pays off to do the pre training on the same corpus as your knowledge corpus if it is large enough, a trivial retrieval candidate z that is too informative, right, there exists a trivial retrieval kind. If the mask sentence comes from document z, the knowledge augmented encoder can trivially predict y by looking at the unmasked version of it. Yes, of course. Like if you do this masked language modeling and you have a lot of knowledge, you can predict the answer and you take your sentence from that corpus, then the retriever can simply go look for that document and then becomes very, very easy to fill in the blank, right? Because you just do this pattern matching. And that's of no use because what you want to teach the model essentially is to kind of look at the semantics of a document. So you simply prohibit that particular thing. So this is during pre training, this is for your masked language modeling, pre training, what we call here realm pre training. During that, you simply prohibit. For this reason, we exclude this trivial candidate during pre training. So that's one thing you have to do. And I feel here is, you know, where the specifics of your task and your data set come in. Because, you know, on the internet, many things are copied, and sort of copied and translated and so on. So if you were to do this, not in Wikipedia, but in a more unstructured way, this would be one of the pain points, I guess, because imagine, you know, there is just a website that translates all the other websites to French, and then your model can simply learn to translate from French and always retrieve the French document and fill in the blank using that it will learn nothing about the word like it will not require acquire any retrieval of along semantics of world knowledge, it will simply learn to translate to French and so on. So I think that this is rather more crucial than this simple one paragraph appears to, to have it. Then they also introduced this null document, along with the things they retrieve. So if they retrieve, maybe not five, but eight, I think they retrieve eight in the experiments if they retrieve. So they retrieve seven documents, the seven closest ones in inner product space plus a null document, such that the model has the opportunity to ignore all the documents, right. So it can basically just go to the null document, assign a large weight to that and just answer the question outright. So if the answer is already contained in the question itself, it can just, you know, point to that it doesn't need the an additional document to answer the question. So they leave room for this possibility right here. Now, this would also be a good metric to assess how much the model makes use of the other documents. And I think they have this further down. And then the last thing here is the salient span masking. So when you do masked language model pre training, what you'll do is simply you'll drop out, not even words, but word pieces, right. So, so here, let's say this, you have this span of text, what you do is you just drop out like at random words, or, as I said, even worse, if this is BERT or something, you have word pieces. So you maybe just drop out this CUS right here, and the low. Now, people have observed that this is now pretty easy for the model. And most notably, it doesn't require a lot of world knowledge, it doesn't require even a lot of attention to the other parts of the sentence, which is what you would like to induce with this pre training, all you basically need to do is you need to say, oh, there is something and then Cal. And maybe you look at the words around it, and you can pretty easily deduce that it's locale. Also, to fo on, you can pretty easily deduce that to focus. So this kind of pre training doesn't really mean the model learns some long range dependencies or understands language pretty well. So people have been upping the kind of smartness with which they drop out things. So the most obvious thing is to drop out entire words, even though you know, BERT works in word pieces, you can simply always enforce that entire words are dropped out now it's a bit harder. Then what people do is like salient span drop outs. And that's what they do right here. So what you want to do is you want to drop out things that are sort of kind of little snippets that are belong together. So for example, if I drop here, local context, if I drop this out, right, then I need, you know, some masculine spans Rick only require what? Right? And that requires much more world knowledge to answer that question requires much more long range dependency resolution in my language model and so on. In order to see that there is world knowledge. And this is exactly what you want to induce here, right? You want to induce your model to learn, learn more global knowledge, more world knowledge, more semantics of the language. And you can relate this to sort of pre training or data augmentation, I'd say, in image in image in vision. For example, there you have the random cropping. So you only crop out part of the picture and then you crop out another part, maybe here. And then you ask the model, does this come from the same or from different images, these two parts, and the more you crop sort of the more the model has to cannot rely on just single pixels somewhere, but actually has to understand image scenes and so on what direction is up and whatnot. So we see qualitative difference between pre training methods, and augmentation methods for images, it only makes sense that we see a qualitative difference and different in differently induced inductive priors in text if we do this. So what they do is they say, since we want to induce this kind of thing, we will not only drop out entire words, we actually drop out entire salient spans, such as right, United Kingdom or July 1969, we use a bird based tagger to identify named entities and a regular expression to identify dates. We select and mask one of these salient spans within a sentence for the mask language modeling task. We show that this significantly outperforms other masking strategies in section 4.5. Now, while I agree with the notion of salient span masking, I have big troubles with the way they do it here. And I think this is where you kind of start to overfit on the particular data set. So I guess they looked at the data set and, you know, you kind of as a developer, you kind of look at your, you know, just kind of questions are there and they saw often it's, you know, questions about entities, question about dates, and so on. So, you know, we can just pre train with those things in mind. And that yeah, that's where it gets a bit wonky and really specific to your task, really specific to your data sets, and so on, to do that. So this is already baking in a bit of knowledge, or a lot of knowledge, I would argue about the task itself. And we're going to see that this is actually fairly important in the results, the salient span masking. And yeah, this, it's sort of, I get it, you get better numbers with it. But also it's kind of dirty, and very, very specified to the task, I won't actually see. And I don't know if people have actually have done this. But the way I would do it in a kind of more principled way is if you have a piece of text, what you do is you start by masking one word, okay? Like, I'm asked spans here. And then I would ask my own model, right, my own half trained model, which, which, if I want to predict this one, right, if I want to do mask language model with this one, I can use one of these saliency methods to ask which other words are most relevant to predicting this one, okay? And it will probably be say, okay, salient is really important, right? Because if I know that there is salient in front of it, I can predict that there spans really easily. And then I can say, well, okay, so I'll mask salient as well. Now I have masked these two. And I do that up to some point I have masked these two. And I do that up to some threshold, right? So the saliency in my mind should come directly from the model you're training. By that you're basically saying that, you know, model, you've sort of learned your local dependencies. Now I want you to go beyond that. You're, you're basically really mean to the model, you, you forbid it from using everything it has learned so far, to make the task more challenging and more challenging over time. I think this is kind of a built in curriculum learning. And that's how what I would see if you, if this is already done, maybe someone's already done it, just let me know in the comments. This already exists kind of expanding the masks by assessing the models own saliency. Alright, so let's jump into the results and the results, as you've already maybe seen in the abstract are pretty, pretty good. So on these open domain questioning data sets, they outperform all the previous state of the art not only by a little but by significant margins, as you can see here. And they do it in when both the pre training corpus is the same as the knowledge corpus and when the pre training corpus is actually a different one. And that tends to work actually even better in in two of the three tasks. So fairly cool. Also, not more parameters than you know, previous models, especially not this, this t five. So this t five here is an example of just, you know, where everything is baked into the language model. Whereas I believe these models right here, they have a retrievers along with it. Yeah, you can see here, they all have retrievers along with it. But their pre training objective and their architecture sometimes is different. I believe you can also see the fact here that orca has the same amount of parameters, it's very close to the model right here. It's just that the pre training here is different. And you also see right here, they do some ablations, where they say, okay, how important are the different parts right here. So you can see on the development set, you get what your 38.2 exact match score. If you only train the retriever, but you reset the encoder before, so that's the thing that actually answers the question. If you reset that before fine tuning, you drop a little bit. If you reset the retriever, you drop actually you drop more. But still, it's I would say it's fairly competitive, as you can see, now, this is probably the test set. But still, it's fairly, fairly competitive right here with the with the sorry, the previous state of the art. Oh, yeah, here, here is the baseline, it's 31.3. Now, interestingly, as you can see right here, if you have uniform masks or random span masks, which is the two types that I have masking that I discussed where either you drop out just word pieces or, you know, entire words or entire spans, so you just you just take that idea further, you say, oh, I'm asking an entire span, but nothing with their saliency. So no, no reg X's for dates, no entity taggers, and so on, you, you drop quite a bit, especially with the uniform masks, you see here, you drop quite a bit. Now with the random random span masks, you also you drop, you drop for the random spans, and then you drop again for the uniform masks. So this seems to be pretty, pretty important. So never forget, when you see things like this, that there are these engineering choices that can make as big a difference as the the actual idea in the paper itself. Okay, so you can see this is pretty, the improvement is it's like three points from uniform masks to random span masks, and then three points again, from the random span masks to their realm pre training. And the actual improvement with the uniform masks over the baseline right here is not as high. Now the baseline, you know, uses a different thing, it uses this ICT as pre training, but still, I haven't seen the saliency masking. Maybe I've seen it, maybe it's somewhere else, but I haven't seen it. Okay, they also have an interesting thing right here. Oh, they also have an interesting plot in the appendix, where they show the number the performance of the different masking styles, with respect to this retrieval utility and the retrieval utility compares this, these two things that we've looked at. So it compares how good is document z and answering the question why versus this null document. So the null document is basically just answer the why, right? So if let's let's play devil's advocate and say that all of this retrieval stuff, it's just bollocks, right? You know, the knowledge is still baked into the language model, they were critical that this helps, and so on, then this would also always be zero. You can pretty easily or you can pretty easily see that this would be zero, right, there will be no improvement having the document versus not having the document having the null document. So if this is high, that means these retrieved documents are actually relevant. So you can see that if you do random uniform masking, then it's it's okay, it gets above zero. All right, if you do random span masking, it gets even higher. And if you do salient span masking, it gets very high. So again, you see here the difference between the salient masking and the others is, you know, I would say higher than the difference between not having the document at all and doing the random uniform masking in pre training. So again, you know, something to think about. At last, they have one example right here where they can show actually helps this is just a concrete example. So the question here is an equilateral triangle is easily constructed using a straight edge and a compass because three is a and then blank prime. So this is the masked word right here. If they just ask the model what they should feel what it should fill in the probability and Fermat is the correct answer is super duper low. Okay, then if they give it the correct document, they just they just search out the correct document, which is here the conditional probability with this document to 57 is a Fermat prime does a regular polygon with 257 sides is constructible with compass. So you can see that it has it has some overlap like the constructible with compass, okay, the constructible with compass, it's not an exact overlap. So it's debatable whether a classic search engine would find this probably but not and then the a something prime a something prime, they are here. So given this document, you can see how a model could easily classify Fermat as the correct answer. And in fact, the probability is, I guess it's not 1.0. But it's around that 1.0. So if you give the model the you know, model three, your if you give it the relevant document, it immediately knows what the answer is. And if you give the if you do this whole retrieval step in between, so this is marginal probability marginalizing over the top eight retrieved documents, so now they don't tell it what the correct answer is, but they actually let it do its whole retrieval thing and marginalize over the top documents, then it still assigns a very high probability. And I'm going to guess that's the top probability for all of the words, but you see, there is a considerable decline. So it's not like it's not like it's always super sure. And I think there is quite a bit of improvement still to be to be done right here, because as a human, if I go look for an answer for this question, and I find even if I consider the top eight documents, I don't think they would confuse me to the point where I'd say that Fermat is only 12% likely, even though it might be more likely than any other word, I would assign it probably a much higher probability. So I think there's there's a bit of improvement still to be made right here. And I'm looking forward to what people can come up with. Alright, I hope you enjoyed this video. I know it's been a bit of a long rant, but I wanted to make sure the individual parts are clear. Let me know what you think of it of the model itself. And I wish you a good one. Bye bye.
[{"start": 0.0, "end": 6.44, "text": " What's the angle of an equilateral triangle? So if your high school math isn't fresh in your head,"}, {"start": 6.44, "end": 12.16, "text": " you might be forgiven for not knowing this. But what do people do when they want to find out the"}, {"start": 12.16, "end": 19.68, "text": " answer to that question? Of course, the standard way nowadays is to go to search engine like Google,"}, {"start": 19.68, "end": 27.240000000000002, "text": " type in the question, find some website that contains the answer, and then sort of read that"}, {"start": 27.24, "end": 34.36, "text": " website and answer the question from there. Now, the goal of this paper here is to do the same"}, {"start": 34.36, "end": 43.28, "text": " thing, but in a machine way. So the machine would see this question right here, and it would be able,"}, {"start": 43.28, "end": 51.84, "text": " it will be able to get additional textual knowledge from a corpus and consult that and"}, {"start": 51.84, "end": 60.0, "text": " then at the end, come up with the answer, which is 60 degrees right here. This type of this type"}, {"start": 60.0, "end": 68.36, "text": " of task is called open question answering. So like open qA or qA. And the distinction here"}, {"start": 68.36, "end": 74.36, "text": " between this and the previous kind of tasks that were often called question answering is that"}, {"start": 74.36, "end": 81.60000000000001, "text": " usually in question answering, you simply have a question, and then you have either no help at all,"}, {"start": 81.6, "end": 89.75999999999999, "text": " so the model just has to answer the question. And things like GPT-3 demonstrated that that is"}, {"start": 89.75999999999999, "end": 95.88, "text": " actually something that's possible if you have a large enough model, or much more common, you would"}, {"start": 95.88, "end": 102.16, "text": " provide the question and then one document. And you would sort of guarantee that the answer is"}, {"start": 102.16, "end": 107.88, "text": " somewhere in this particular document. So even though the task was called question answering,"}, {"start": 107.88, "end": 113.92, "text": " it was more like, it was more a machine reading task, because you knew, okay, all I have to do"}, {"start": 113.92, "end": 120.64, "text": " is I have to find the answer somewhere in the document to this particular question. So the task"}, {"start": 120.64, "end": 128.4, "text": " was more kind of a pattern matching sort of approach. Here, the it's really the task really"}, {"start": 128.4, "end": 134.48, "text": " comes close to what humans understand as question answering, namely, you get a question, you want an"}, {"start": 134.48, "end": 140.88, "text": " answer. And it's open in the sense that you can the machine can go with the question to like a"}, {"start": 140.88, "end": 148.51999999999998, "text": " search engine, I have no clue how to draw a globe to a search engine, get multiple documents that"}, {"start": 148.51999999999998, "end": 154.04, "text": " would help it kind of rank them and so on. It's basically able to use a search engine and then"}, {"start": 154.04, "end": 158.76, "text": " answer the question from there. So that's what we're going to look at today. There has been a"}, {"start": 158.76, "end": 164.2, "text": " lot of work. I'm not not saying this task is new, there has been a lot of work in open domain"}, {"start": 164.2, "end": 171.64, "text": " question answering. And this is one of the latest incarnations of it. The paper is called realm or"}, {"start": 171.64, "end": 177.64, "text": " realm. I'm really not sure how to pronounce this the word would be called realm, I guess. It's"}, {"start": 177.64, "end": 185.64, "text": " retrieval augmented language model pre training by Kelvin Gu, Kenton Lee, Zora tongue, Panopong"}, {"start": 185.64, "end": 195.16, "text": " puzzle pot and Ming yi chung. So the paper is first and foremost about a pre training method,"}, {"start": 195.16, "end": 201.72, "text": " as you can see, right in the title. So the entire system that's presented here has sort of been"}, {"start": 201.72, "end": 207.95999999999998, "text": " explored in papers before like other papers have already done this, or we retrieve other documents."}, {"start": 207.95999999999998, "end": 214.67999999999998, "text": " And in this particular case, as you'll see, the documents are retrieved using inner product search"}, {"start": 214.68, "end": 222.12, "text": " through a pre embedded through corpus, which is usually Wikipedia. So you'll see all of this. The"}, {"start": 222.12, "end": 228.76000000000002, "text": " new thing about this paper just to make this clear is the way that the pre training works"}, {"start": 229.4, "end": 234.60000000000002, "text": " for these systems. And we'll we're going to look at the entire architecture, but just you know,"}, {"start": 234.60000000000002, "end": 240.12, "text": " such such that you're aware of what's really coming from here and what's gathered from what's"}, {"start": 240.12, "end": 246.20000000000002, "text": " kind of conglomerated from what worked so far. So the improvements here are pretty stunning that"}, {"start": 246.20000000000002, "end": 251.48000000000002, "text": " they achieve with this new pre training method, which is pretty cool considering that it's,"}, {"start": 251.48000000000002, "end": 254.76, "text": " you know, the new thing is a pre training method. So we'll look at this, we'll look at the"}, {"start": 254.76, "end": 260.2, "text": " architecture, the pre training method, the kind of hacks that you need to get it to work. And finally,"}, {"start": 260.2, "end": 266.92, "text": " the results. As always, if you enjoy content like this, don't hesitate to share it out,"}, {"start": 266.92, "end": 274.6, "text": " subscribe if you are not already. And with that, let's jump in. So the abstract says"}, {"start": 274.6, "end": 279.56, "text": " that language model pre training has been shown to capture a surprising amount of world knowledge"}, {"start": 279.56, "end": 286.6, "text": " crucial for NLP tasks such as question answering. And here again, we do we say question answering"}, {"start": 286.6, "end": 292.12, "text": " is kind of the broad category of anywhere where you have to answer a textual question. So what"}, {"start": 292.12, "end": 297.96, "text": " do they mean by world knowledge? What they mean by world knowledge, they mean something like"}, {"start": 299.16, "end": 305.72, "text": " the question that we considered, what's the angle of an equilateral triangle, you can't from the"}, {"start": 305.72, "end": 312.04, "text": " question itself, you can't answer the you can't answer the question is not like a little math"}, {"start": 312.04, "end": 319.0, "text": " question where you just have to do the correct calculations or so on, or, or which one is the"}, {"start": 319.0, "end": 325.72, "text": " longest words of the following words, it really is additional knowledge that you had to have learned"}, {"start": 325.72, "end": 332.12, "text": " somewhere. So that's what we call world knowledge. And the fact that an equilateral triangle has 60"}, {"start": 332.12, "end": 338.6, "text": " degree angles, you need to have picked that up from somewhere. Now, if you are GPT three, then"}, {"start": 339.32, "end": 347.08, "text": " what you have done is you've taken this giant corpus, right? And you just did language modeling"}, {"start": 347.08, "end": 355.0, "text": " on it, and that gives you GPT three. Now, that means since GPT three is so huge, that means that"}, {"start": 355.0, "end": 362.03999999999996, "text": " all the world knowledge that is contained in this corpus is baked into the model and can be sort of"}, {"start": 362.03999999999996, "end": 367.64, "text": " parsed out with good querying. So if you provide a correct query, you can sort of parse out what's"}, {"start": 367.64, "end": 372.44, "text": " in the weights of the model. But it's very intransparently, it's very intransparent in"}, {"start": 372.44, "end": 380.2, "text": " the weights of the models baked together with the language modeling. They're, they are criticizing,"}, {"start": 380.2, "end": 386.2, "text": " not criticizing, but sort of arguing against this right here. They say, however, this knowledge is"}, {"start": 386.2, "end": 393.15999999999997, "text": " stored implicitly in the parameters of a neural network, requiring ever larger networks to cover"}, {"start": 393.15999999999997, "end": 400.92, "text": " more facts. To capture knowledge in a more modular and interpretable way, we augment language model"}, {"start": 400.92, "end": 406.92, "text": " pre training with a latent knowledge retriever, which allows the model to retrieve and attend"}, {"start": 406.92, "end": 413.56, "text": " over documents from a large corpus such as Wikipedia. And sorry, used during pre training,"}, {"start": 413.56, "end": 419.0, "text": " fine tuning, and inference. For the first time, we show how to pre train such a knowledge retriever"}, {"start": 419.0, "end": 424.92, "text": " in an unsupervised manner, using masked language modeling as a learning signal and back propagating"}, {"start": 424.92, "end": 431.72, "text": " through a retrieval step that considers millions of documents. Okay, so that there's that there's"}, {"start": 431.72, "end": 437.40000000000003, "text": " a lot of information here. So first of all, what they want to say is they want to say that in such"}, {"start": 437.40000000000003, "end": 445.96000000000004, "text": " a corpus, there are two kinds of knowledge, right there is there is language. And there is this"}, {"start": 445.96000000000004, "end": 453.8, "text": " world knowledge, okay. And they want to make this sort of separate. So they want to have a model"}, {"start": 453.8, "end": 461.08, "text": " that can go to the corpus, retrieve documents, and then use those documents. So whereas previously,"}, {"start": 461.08, "end": 465.40000000000003, "text": " the world knowledge has been joined with the language model, they want to sever this connection,"}, {"start": 465.40000000000003, "end": 472.76, "text": " say we want a model where we can simply teach it to go look for information, we can teach it to go"}, {"start": 472.76, "end": 480.2, "text": " search for things, and then the searched things will inform its answering of the question. Okay."}, {"start": 480.2, "end": 488.76, "text": " So that's what that's what these systems are trying to achieve. And we saw that before in the"}, {"start": 488.76, "end": 498.03999999999996, "text": " we saw that before in the diagram. So they say we augment language model pre training with a latent"}, {"start": 498.03999999999996, "end": 503.32, "text": " knowledge retriever, which allows the model to retrieve and attend over documents from a large"}, {"start": 503.32, "end": 510.84, "text": " corpus. And also they use this masked language modeling as a pre training as a learning signal,"}, {"start": 511.48, "end": 517.8, "text": " and back propagating through the retrieval step. Now, this is the interesting part right here. So"}, {"start": 517.8, "end": 523.4, "text": " what you'll have is you'll have a question. And we can actually look at this diagram right here."}, {"start": 524.4399999999999, "end": 532.04, "text": " So the pre training is going to be masked language modeling, okay. Ultimately, what you want to do"}, {"start": 532.04, "end": 536.76, "text": " is what we looked at before, ultimately, what you want to do is question answering. So this thing"}, {"start": 536.76, "end": 544.4399999999999, "text": " right here, where the input is a query. And then you want to retrieve documents, and then you want"}, {"start": 544.4399999999999, "end": 552.36, "text": " to join them. And let's actually draw this up. So you have a query. And you want to retrieve"}, {"start": 552.36, "end": 557.4, "text": " documents, how do you do that, you train an embedding for the query, which is usually a,"}, {"start": 557.4, "end": 563.24, "text": " you know, a BERT model. Like that's the fashionable thing to do. If you don't know what BERT is, I've"}, {"start": 563.24, "end": 568.4399999999999, "text": " made a video about BERT. But basically, BERT can take a piece of text, and then it will output"}, {"start": 569.0799999999999, "end": 574.92, "text": " a vector or multiple vectors for it. In this case, we just need one single vector for the entire"}, {"start": 574.92, "end": 581.4, "text": " query. Okay. And then you have a bunch of documents in your corpus. So in your corpus right here,"}, {"start": 581.4, "end": 588.76, "text": " you have z one, z two, and so on. What you want to do is you want to embed all of those. So you"}, {"start": 588.76, "end": 600.12, "text": " want to have B of z one and B of z two. Okay, you want to embed all of those documents. And then"}, {"start": 600.12, "end": 607.8, "text": " you want to compare these embeddings. And the you want to retrieve the document that's most"}, {"start": 607.8, "end": 612.1999999999999, "text": " relevant for your question, right? If your question is about equilateral triangles, the"}, {"start": 612.1999999999999, "end": 618.12, "text": " angle in them, then there's probably going to be like a Wikipedia article of triangles or"}, {"start": 618.12, "end": 622.52, "text": " equilateral triangle specifically. So this corpus right here, we're going to consider this to be"}, {"start": 622.52, "end": 630.28, "text": " Wikipedia. Now, ultimately, especially like a company like Google would like this to be the"}, {"start": 630.28, "end": 636.04, "text": " entire internet. But for the these tasks for the academic tasks, this is often a limited"}, {"start": 636.04, "end": 642.36, "text": " corpus. And then the data sets are also made such that they can often be answered with that limited"}, {"start": 642.36, "end": 649.0, "text": " corpus. But in essence, this could be the entire internet. But for now, it's Wikipedia. So we want"}, {"start": 649.0, "end": 655.0799999999999, "text": " to embed every single document in Wikipedia and then compare them using the inner product. So you"}, {"start": 655.0799999999999, "end": 663.3199999999999, "text": " train your model to first of all, take this corpus, and then assign each member of the corpus a"}, {"start": 663.32, "end": 670.44, "text": " vector. So this could be z one, this could be z two, this could be z three, and so on. And you want"}, {"start": 670.44, "end": 679.32, "text": " to train it in such a way that if you have a query, then the query will be very close in inner"}, {"start": 679.32, "end": 684.5200000000001, "text": " product space to the to the document that's relevant. So the query might be your question"}, {"start": 684.5200000000001, "end": 691.1600000000001, "text": " about the angles. And the document right here might be the document about triangles. Okay, and"}, {"start": 691.16, "end": 698.52, "text": " this document might be the document about, I don't know, England. And this one right here might be"}, {"start": 698.52, "end": 707.48, "text": " the document about, I don't know, weightlifting, I have no idea. Like just random Wikipedia"}, {"start": 707.48, "end": 712.76, "text": " documents. Okay, so you want them, you want them to be let's let's, you know, let's draw a little"}, {"start": 712.76, "end": 721.0, "text": " dumbbell right here. So you want you want the other documents to be far apart from the query. So you"}, {"start": 721.0, "end": 731.88, "text": " train two things, you train this model right here, which is the embedding of the corpus, okay. And"}, {"start": 731.88, "end": 736.04, "text": " you train this model right here, which is the embedding of the query, these are two separate"}, {"start": 736.04, "end": 742.76, "text": " models. And then you want the inner product between the two to be small, to be large, whenever"}, {"start": 742.76, "end": 749.3199999999999, "text": " the document is relevant for answering the query. And you want them to be far apart whenever it is"}, {"start": 749.3199999999999, "end": 758.12, "text": " not. Now, the question is, of course, how do you know, how do you know when it is relevant when it"}, {"start": 758.12, "end": 764.92, "text": " is not because you have to have some training signal right here, right? You, you have to basically"}, {"start": 764.92, "end": 771.4799999999999, "text": " know in advance which documents are relevant, and you don't. So they start out with this masked"}, {"start": 771.4799999999999, "end": 778.04, "text": " language model pre training, which we see up here. The masked language model pre training"}, {"start": 778.68, "end": 789.0, "text": " does the following. So this is unsupervised, you take some string, right? Like this one, the, and"}, {"start": 789.0, "end": 795.4, "text": " then you mask out a token, this comes straight from BERT, you mask out a token. And then your goal is"}, {"start": 795.4, "end": 804.2, "text": " simply to reproduce that token. Okay. So if we were in BERT, you would forget about all of this,"}, {"start": 805.24, "end": 811.4, "text": " you would simply try to predict what the mask token is. But here we say, well, we allow the"}, {"start": 811.4, "end": 819.72, "text": " model to use additional context in order to read to fill in the blank. And you can see already how"}, {"start": 819.72, "end": 826.68, "text": " this is going to help later. But okay, so we take this sentence, and we allow it to retrieve"}, {"start": 826.68, "end": 834.1999999999999, "text": " documents. And maybe the document retrieved is this one right here, the pyramidion on top allows"}, {"start": 834.2, "end": 841.4000000000001, "text": " for less material higher up the pyramid. And then you concatenate the input, sorry, the input is this"}, {"start": 841.4000000000001, "end": 848.44, "text": " right here, with the mask token, as you can see here, you concatenate that with together with"}, {"start": 849.0, "end": 857.96, "text": " this thing, which is this thing right here. And then you train a different model to take this as"}, {"start": 857.96, "end": 863.32, "text": " an input and tell you what the mask token is. Now, if the retriever is good, then this model has a"}, {"start": 863.32, "end": 869.64, "text": " pretty easy job. Because here you see at the top, something is at the top. And here you see the"}, {"start": 869.64, "end": 877.8000000000001, "text": " pyramidion is on top, then it becomes fairly, fairly easy. Hey, the question, again, of course,"}, {"start": 877.8000000000001, "end": 885.96, "text": " is how do you teach the retriever to do well. And this is somewhat of a"}, {"start": 885.96, "end": 895.32, "text": " of a loop. So informally, formally, the knowledge retriever right here is going to we're going to"}, {"start": 895.32, "end": 902.76, "text": " model this distribution as a joint distribution. Sorry, this is I this is down here. Alright, so"}, {"start": 902.76, "end": 912.2800000000001, "text": " here, the central formula is this, what you want is a model that takes in a question or in pre"}, {"start": 912.28, "end": 919.0, "text": " training a masked string, and it produces the answer or in pre training, this is going to be"}, {"start": 919.4, "end": 926.12, "text": " the mask token. So this is going to be the question. And this is the answer or this is going"}, {"start": 926.12, "end": 934.04, "text": " to be the masked string. And this is going to be the token that has been masked from the string."}, {"start": 934.04, "end": 940.12, "text": " Now, you're saying I can decompose this probability distribution into the following probability"}, {"start": 940.12, "end": 948.76, "text": " distribution. And here, we take z as a latent variable, usually, but here z is the document,"}, {"start": 948.76, "end": 958.5999999999999, "text": " okay. So what we want is a model that takes in your question and a document."}, {"start": 958.6, "end": 966.28, "text": " That is relevant for answering the question. And from that, it produces the answer. And in order"}, {"start": 966.28, "end": 972.36, "text": " to fill our probability distribution, we have to have this other model that takes in the question"}, {"start": 972.36, "end": 982.0400000000001, "text": " and outputs a document. Okay, so this here is the retriever. And this here is going to be the"}, {"start": 982.04, "end": 992.28, "text": " answer. And in order to make this the valid probability distribution, you need to marginalize"}, {"start": 992.28, "end": 1000.36, "text": " over all of the documents in your corpus. So now you can see how you train this. You simply retrieve"}, {"start": 1000.36, "end": 1006.76, "text": " all of you train this model here to predict which documents are relevant to the question."}, {"start": 1006.76, "end": 1012.84, "text": " You train this model here to predict which documents are relevant to a certain degree"}, {"start": 1012.84, "end": 1018.84, "text": " in a back propagatable way. So in a continuous fashion, assign each document a probability"}, {"start": 1018.84, "end": 1025.24, "text": " to be relevant for answering this particular question. And then you take each of the documents"}, {"start": 1025.24, "end": 1031.8, "text": " and answer the question, why from it, and you marginalize over all the documents in your,"}, {"start": 1031.8, "end": 1038.2, "text": " in your data set. And then you get a final probability. And all of this is completely"}, {"start": 1038.2, "end": 1044.2, "text": " differentiable. The problem, of course, is that, especially in this paper here, there are like 13"}, {"start": 1044.2, "end": 1050.52, "text": " million documents. So you won't be able to train very far according to that."}, {"start": 1052.52, "end": 1057.0, "text": " So let's look at the individual parts. First of all, this knowledge retriever, the knowledge"}, {"start": 1057.0, "end": 1068.68, "text": " retriever model is a model that will take in a question and a document and tell you how likely"}, {"start": 1068.68, "end": 1074.76, "text": " that how relevant that document is for this particular question. And this, as you can see,"}, {"start": 1074.76, "end": 1082.36, "text": " is defined as a probability distribution, specifically here, this exponential distribution"}, {"start": 1082.36, "end": 1087.56, "text": " of F. And what is F? We've already seen F is simply the inner product between the embedding"}, {"start": 1088.36, "end": 1093.8799999999999, "text": " and of the question and the document. So that's the kind of thing we drew before, where"}, {"start": 1095.7199999999998, "end": 1099.24, "text": " the document is supposed to be have a high inner product with the"}, {"start": 1099.8799999999999, "end": 1105.56, "text": " query that it is relevant to and a low with all the other queries."}, {"start": 1105.56, "end": 1114.04, "text": " Now, since they cannot take all of the documents, what they do is simply they go in."}, {"start": 1116.04, "end": 1121.24, "text": " So at the beginning, you're, you know, if, let's say you're somewhere during training, right,"}, {"start": 1121.8799999999999, "end": 1129.32, "text": " and you have this index built up of all of the documents, what you'll do is you'll go,"}, {"start": 1129.32, "end": 1135.1599999999999, "text": " you'll project your query into this space, and you retrieve the couple of documents that are closest"}, {"start": 1135.1599999999999, "end": 1142.76, "text": " to the query. Okay, and, and you only use those. So you sample a few documents, this is the same"}, {"start": 1142.76, "end": 1151.0, "text": " thing that we do in, you know, contrastive pre training, and so on. It's just taken here to the,"}, {"start": 1151.0, "end": 1158.36, "text": " the retrieval mode. So you don't marginalize over all documents, because that would be computationally"}, {"start": 1158.36, "end": 1164.52, "text": " too hard. You simply marginalize over all the documents that have a reasonably high inner"}, {"start": 1164.52, "end": 1169.88, "text": " product with the query that you're considering. Why does that make sense? Because if you look at"}, {"start": 1169.88, "end": 1177.8, "text": " any other, like this one here, the inner product is going to be almost zero. So the inner product"}, {"start": 1177.8, "end": 1184.68, "text": " is going to be almost zero. So the inner product with the query is going to be almost zero. So it"}, {"start": 1184.68, "end": 1191.24, "text": " does not contribute at all to this probability right here, which also means that the gradient"}, {"start": 1191.24, "end": 1199.1599999999999, "text": " is going to be fairly small. Now, even though the gradient is fairly small, it can still be that"}, {"start": 1199.1599999999999, "end": 1204.2, "text": " you haven't learned something good yet. And actually, the document would be pretty relevant"}, {"start": 1204.2, "end": 1213.0800000000002, "text": " for that query. And because you never use it to train, you will, you know, you will never ever"}, {"start": 1213.0800000000002, "end": 1217.32, "text": " recover it, because you don't ever use it to train, there's no gradient flowing to it,"}, {"start": 1217.32, "end": 1223.48, "text": " and so on. So you're sort of relying on this being sort of self organizing, like over time,"}, {"start": 1224.28, "end": 1228.6000000000001, "text": " you know, these these turn out to not really be relevant, because you've learned something stupid,"}, {"start": 1228.6000000000001, "end": 1233.88, "text": " and then your query embedding, either would change and change the query, maybe during training,"}, {"start": 1233.88, "end": 1239.3200000000002, "text": " change the query more towards the direction of the relevant documents, or the relevant documents"}, {"start": 1239.3200000000002, "end": 1245.5600000000002, "text": " themselves would sort of shift and push each other around and so on. So kind of relying on effects"}, {"start": 1245.5600000000002, "end": 1255.8000000000002, "text": " like this, but there's definitely a death spiral that can go on. So they make a they make a address"}, {"start": 1255.8, "end": 1271.8799999999999, "text": " this right here. And yeah, they address this right here. Here, the key computational challenge is that"}, {"start": 1271.8799999999999, "end": 1277.96, "text": " marginal probability p y of x, which is this one involves a summation over all documents in the"}, {"start": 1277.96, "end": 1282.9199999999998, "text": " knowledge corp z, we approximate this instead by summing over the top k documents with the highest"}, {"start": 1282.92, "end": 1287.5600000000002, "text": " probability under this retrieval step. This is reasonable if most documents have near zero"}, {"start": 1287.5600000000002, "end": 1292.8400000000001, "text": " probability. Even with this approximation, we still need an efficient way to find the top k"}, {"start": 1292.8400000000001, "end": 1297.16, "text": " documents. Note that the ordering of documents is the same as under the relevance score, okay,"}, {"start": 1299.24, "end": 1304.28, "text": " which is an inner product. Thus, we can employ maximum inner product search algorithms to find"}, {"start": 1304.28, "end": 1309.3200000000002, "text": " the approximate top k documents using a running time storage space that scales sublinearly with"}, {"start": 1309.32, "end": 1313.6399999999999, "text": " the number of documents. So there are these algorithms to do maximum inner product search,"}, {"start": 1313.6399999999999, "end": 1320.4399999999998, "text": " which you can use to find the top k documents. To employ these algorithms, we must pre compute"}, {"start": 1321.0, "end": 1326.4399999999998, "text": " the embedding. So all the embedding of the documents in the corpus must pre compute them"}, {"start": 1326.4399999999998, "end": 1332.36, "text": " for every z and construct an efficient search index over these embeddings. So this now becomes"}, {"start": 1332.36, "end": 1338.2, "text": " very much like a search engine, where you have to have your corpus and you have to build an index"}, {"start": 1338.2, "end": 1345.32, "text": " in order to find things fast in there. It looks easy in our 2d examples, but to find maximum inner"}, {"start": 1345.32, "end": 1351.56, "text": " products in high dimensional spaces actually very challenging task. However, this data structure will"}, {"start": 1351.56, "end": 1359.48, "text": " no longer be consistent with p with this retrieval thing, right? Because as we train it, our index is"}, {"start": 1359.48, "end": 1366.76, "text": " going to be old. So as we train it, our index might change. But if we only build it once,"}, {"start": 1366.76, "end": 1372.36, "text": " then that's of no use. If the parameters of the embedding are later update, hence the search"}, {"start": 1372.36, "end": 1379.16, "text": " index goes stale after every gradient update on theta. Our solution is to refresh the index"}, {"start": 1379.16, "end": 1384.76, "text": " by asynchronously re embedding and re indexing all the documents every several 100 training"}, {"start": 1384.76, "end": 1392.52, "text": " steps and they have a drawing of this right here. So they have two different jobs. The trainer here"}, {"start": 1392.52, "end": 1399.72, "text": " trains updates itself using the old index. So an index for a couple of 100 steps, then every couple"}, {"start": 1399.72, "end": 1406.76, "text": " of 100 steps, it sends over its new weights. And the index builder builds a new index using these"}, {"start": 1406.76, "end": 1413.16, "text": " new weights, right? And then the process starts again, these can run in parallel, as you can"}, {"start": 1413.16, "end": 1418.92, "text": " imagine. So as soon as the index builder is done, it sends over the new index retrieves the new"}, {"start": 1418.92, "end": 1424.44, "text": " parameters and starts again, building an index because ideally, you want to rebuild the index"}, {"start": 1424.44, "end": 1430.68, "text": " after every single step. But of course, that's going to waste too much time as well. So that was"}, {"start": 1430.68, "end": 1440.2, "text": " the retriever step, the actual answer step is fairly, fairly easy. So once you've retrieved good"}, {"start": 1440.2, "end": 1445.96, "text": " documents, right, now you don't need, as we said, you don't need all the documents where we are."}, {"start": 1445.96, "end": 1449.8, "text": " Right here, you don't need, we're not going to do this with all the documents anymore,"}, {"start": 1449.8, "end": 1457.32, "text": " we'll simply retrieve the most relevant documents. Because that's going to approximate the sum"}, {"start": 1457.32, "end": 1465.72, "text": " fairly well, the answer here. That's pretty simple. That's going to be just a BERT model that takes in"}, {"start": 1465.72, "end": 1473.4, "text": " z and x. Okay, so this is going to be another BERT model that's going to take in the retrieved"}, {"start": 1473.4, "end": 1482.2, "text": " document and the question, and it's going to output y. How does that look? In case of the"}, {"start": 1482.2, "end": 1488.6000000000001, "text": " masked language model, we've already seen it, right? You simply would input, where is it? You"}, {"start": 1488.6000000000001, "end": 1495.3200000000002, "text": " simply would input the concatenation of the two with the mask, as you can see right here, and then"}, {"start": 1495.3200000000002, "end": 1501.64, "text": " the output is going to classify at the classification task. So in the case of BERT,"}, {"start": 1501.64, "end": 1508.5200000000002, "text": " you have your query right here as text, and then you have your document z right here. And there"}, {"start": 1508.5200000000002, "end": 1517.96, "text": " somewhere would be a mask token, you would put BERT on top of that, everything together. And then"}, {"start": 1517.96, "end": 1524.5200000000002, "text": " at the position of the mask token, you would do a classification across all of your vocabulary,"}, {"start": 1524.52, "end": 1531.4, "text": " right, and see which word is most likely. And that's how you train that and evaluate that. If"}, {"start": 1531.4, "end": 1539.16, "text": " you are in the fine tuning mode, then you don't have masks anymore. So what you would put is your"}, {"start": 1539.16, "end": 1547.56, "text": " query right here, and your document that you retrieved. And then you would, you would simply"}, {"start": 1547.56, "end": 1553.72, "text": " output. Now, here is an assumption and the assumption is often baked into these data sets,"}, {"start": 1553.72, "end": 1563.1599999999999, "text": " you assume that if you have the correct document, the span, the answer is somewhere in in the z"}, {"start": 1563.1599999999999, "end": 1567.6399999999999, "text": " document right here. So y is somewhere in here. And what you would do is you would classify the"}, {"start": 1567.6399999999999, "end": 1576.2, "text": " start and the end of the span of y, right, these correspond to these. And then you would put the"}, {"start": 1576.2, "end": 1581.96, "text": " correspond to these. So that's your training signal right there. As I said, this is not always the"}, {"start": 1581.96, "end": 1588.04, "text": " case. But very often, especially in these data sets, it's the case that it is a single contiguous"}, {"start": 1588.04, "end": 1597.8, "text": " span as the answer. Okay, so that's basically the architecture. As I said, the architecture"}, {"start": 1597.8, "end": 1605.0, "text": " is using inner product to retrieve retrieving top whatever k documents in this case, I think it's"}, {"start": 1605.0, "end": 1613.24, "text": " about five, they retrieve five documents. For each document, they run it through this bird in this"}, {"start": 1613.8, "end": 1620.28, "text": " joint way, like on the bottom. And then they classify the output. And you can you can do it"}, {"start": 1620.28, "end": 1626.28, "text": " with a top one document, but you can marginalize over the top documents for both pre training,"}, {"start": 1626.28, "end": 1634.12, "text": " and for actually answering a question. There's lots of stuff you can do. The important thing"}, {"start": 1634.12, "end": 1640.28, "text": " right here is that this thing is what the paper proposes a new it's basically saying,"}, {"start": 1640.28, "end": 1647.8799999999999, "text": " how do we do masked language modeling, pre training with a system like this? All right."}, {"start": 1650.52, "end": 1657.8, "text": " Okay. And the rest of the paper basically goes into more detail, like how do you how do you"}, {"start": 1657.8, "end": 1664.36, "text": " join? How do you exactly what's the input right here? And we've already seen you just concatenate,"}, {"start": 1664.36, "end": 1672.6, "text": " whatever you have, you concatenate your query and your documents and so on. So the important thing"}, {"start": 1672.6, "end": 1681.8799999999999, "text": " is it's two distinct like there are three models right here, right? Model one, model one"}, {"start": 1681.88, "end": 1691.48, "text": " is used to take a document from the corpus and map it into a vector in these in this vector space"}, {"start": 1691.48, "end": 1698.2, "text": " right here. Okay, that's model one. That is the model that you want to build this index for right"}, {"start": 1698.2, "end": 1706.7600000000002, "text": " every now and then, you take that model and build an index for your whole corpus. Then model two"}, {"start": 1706.76, "end": 1714.68, "text": " is the model that takes a query, okay, a question to answer or a masked string, and also generates"}, {"start": 1714.68, "end": 1721.8799999999999, "text": " a vector in this vector space right here. Okay, that is a different model than the model that"}, {"start": 1721.8799999999999, "end": 1729.8, "text": " embeds the document and you don't build indices for that you continuously train it. And you just"}, {"start": 1729.8, "end": 1737.3999999999999, "text": " because you only need to embed every query once and if you were to not build an index for model"}, {"start": 1737.3999999999999, "end": 1742.84, "text": " one, then you would need to re embed the whole corpus for every training step. And then model"}, {"start": 1742.84, "end": 1751.08, "text": " three is something yet completely different. Model three takes whatever documents you retrieved right"}, {"start": 1751.08, "end": 1762.36, "text": " here as z along with the query as text, so not the vectors, but it takes the text of these documents"}, {"start": 1762.36, "end": 1770.4399999999998, "text": " and it takes the text of the query and it produces an answer why which is either the mask token or"}, {"start": 1770.4399999999998, "end": 1777.48, "text": " the answer span in the document. Okay, but this is again, this is a text model. And then model"}, {"start": 1777.48, "end": 1783.4, "text": " four is a model that takes the query and it takes the text of the query as the answer span in the"}, {"start": 1783.4, "end": 1790.1200000000001, "text": " document. Okay, but this is again, this is a text model. This is nothing to do with the vectors from"}, {"start": 1790.1200000000001, "end": 1801.32, "text": " before. All right, so that was the architecture and the pre training. Now they go into a few"}, {"start": 1801.32, "end": 1808.84, "text": " different ways. So first of all, they analyze the gradient of something sensible, okay. And"}, {"start": 1808.84, "end": 1813.72, "text": " thereby, they analyze the gradient of this thing. So if you look at the gradient, here's the gradient"}, {"start": 1813.72, "end": 1823.1599999999999, "text": " of the of py of x py is this is, as we said, the answer. And this is the question. And this"}, {"start": 1823.1599999999999, "end": 1827.8, "text": " probability distribution has everything in it we've discussed before, like retrieving the"}, {"start": 1827.8, "end": 1836.36, "text": " and so on. Okay, so here you can see that the gradient is first of all, it goes into the"}, {"start": 1836.36, "end": 1843.32, "text": " direction of this inner product. Okay, this F here, that's, that's the inner product between"}, {"start": 1843.32, "end": 1851.1599999999999, "text": " the embeddings of x and the relevant documents z are relevant according to their relevance."}, {"start": 1851.16, "end": 1857.88, "text": " Okay, so the gradient of the entire model is goes into the direction of the gradient of the inner"}, {"start": 1857.88, "end": 1863.72, "text": " product. So that's already a good thing, right? Now, we can mask ourselves, we can ask ourselves,"}, {"start": 1865.16, "end": 1872.68, "text": " when do we want the gradient of the entire model to be strongly correlated with the gradient of"}, {"start": 1872.68, "end": 1877.4, "text": " this inner product? When not, that of course, depends on the document itself. And this is"}, {"start": 1877.4, "end": 1883.64, "text": " quite this quantity are specifies how much that is. So if this turns out, like we want it, then we"}, {"start": 1883.64, "end": 1889.4, "text": " can say, okay, the training of this model does something sensible. So what's this quantity are"}, {"start": 1889.4, "end": 1898.1200000000001, "text": " the quantity are notably has this ratio right here, this ratio minus one. Now, what does it say"}, {"start": 1898.1200000000001, "end": 1905.88, "text": " if if the top of the fraction is larger than the bottom of the fraction, then this is a positive"}, {"start": 1905.88, "end": 1917.24, "text": " number, right? And if the bottom is larger than this is a negative number. Okay, so let's look"}, {"start": 1917.24, "end": 1925.5600000000002, "text": " at the two elements, the top mean the top the ratio basically means that the difference here is this"}, {"start": 1925.5600000000002, "end": 1934.5200000000002, "text": " z. So the ratio is larger than one, if the probability of the answer rises when you"}, {"start": 1934.52, "end": 1941.32, "text": " have z in there, versus when you do not have z right here, there is no z. So what it basically"}, {"start": 1941.32, "end": 1947.96, "text": " means is that the document helps if the document helps for class for answering the question x,"}, {"start": 1947.96, "end": 1954.28, "text": " then that probability is larger than the bottom probability. If the document is irrelevant, then"}, {"start": 1954.28, "end": 1960.2, "text": " that's one right and the entire thing becomes zero and therefore, no gradient. And if the document is"}, {"start": 1960.2, "end": 1964.1200000000001, "text": " counterproductive, and that's often the case, actually, because this documents, they can"}, {"start": 1964.1200000000001, "end": 1968.68, "text": " introduce noise, like noise is often counterproductive for the systems because you have"}, {"start": 1968.68, "end": 1977.88, "text": " more input, and then the the distribution of y will become more noisy and therefore flatter. And"}, {"start": 1978.6000000000001, "end": 1986.2, "text": " this fraction would be lower than one. So this is going to be negative. So this quantity is positive,"}, {"start": 1986.2, "end": 1996.44, "text": " the more relevant, the easier it is to answer the question with y, given the document. And that's"}, {"start": 1996.44, "end": 2001.4, "text": " exactly what we want out of a system like this. So if you look at the gradient of the system,"}, {"start": 2001.96, "end": 2010.92, "text": " it shows you that what we want to happen, namely, that the system is trained in such a way that the"}, {"start": 2010.92, "end": 2019.96, "text": " relevant documents will help it is actually happening. Okay. So that's the left hand side."}, {"start": 2019.96, "end": 2026.28, "text": " And there's a little bit to be said about this thing right here. The probability. This is"}, {"start": 2026.28, "end": 2034.28, "text": " proportional always to the probability that your retriever outputs this document. Okay, so the this"}, {"start": 2034.28, "end": 2041.3999999999999, "text": " quantity r is going to be even larger if your retriever outputs that document frequently. So if"}, {"start": 2041.3999999999999, "end": 2047.72, "text": " it is a helpful document, and the retriever outputs it very frequently for the given question, then"}, {"start": 2047.72, "end": 2056.68, "text": " this quantity r is super large. And that's exactly what we want, right? Okay. So the next thing they"}, {"start": 2056.68, "end": 2067.24, "text": " do is they they have to they have to sort of take care of the initialization here because the problem"}, {"start": 2067.24, "end": 2073.0, "text": " we've spoken of before is that if your retriever is bad, right, it will not retrieve the good"}, {"start": 2073.0, "end": 2081.96, "text": " documents. And so it won't retrieve this z here very often. And then it really doesn't matter"}, {"start": 2081.96, "end": 2087.7200000000003, "text": " what this quantity is right here, because this is going to be very low, like even if it hits upon"}, {"start": 2087.7200000000003, "end": 2092.6, "text": " a correct document, and probably it doesn't because there's like 13 million documents and you"}, {"start": 2092.6, "end": 2101.2400000000002, "text": " retrieve five or so. So very probably, you're not by chance going to hit the correct document. So"}, {"start": 2101.2400000000002, "end": 2106.44, "text": " you never have a chance to get the document that would actually help you answering the question,"}, {"start": 2106.44, "end": 2113.2400000000002, "text": " then you get a bad gradient, then you screw everything up even more, and so on. So the problem"}, {"start": 2113.2400000000002, "end": 2118.84, "text": " is that if you just train this from scratch, you have a pretty bad learning signal. So what they"}, {"start": 2118.84, "end": 2127.08, "text": " do is they have to take care of initialization. So they have to initialize things such that they"}, {"start": 2127.08, "end": 2138.12, "text": " are already working fairly well before anything else happens. And this is sort of if I had to,"}, {"start": 2138.12, "end": 2146.92, "text": " you know, criticize these systems a bit, it's that there are many hacks to getting them to work,"}, {"start": 2146.92, "end": 2151.4, "text": " right, you have to really take care of initialization and so on because they sort of build"}, {"start": 2151.4, "end": 2155.56, "text": " in a loop, right, the better the retriever, the better the model that can answer the question and"}, {"start": 2155.56, "end": 2160.04, "text": " the better the model that can answer the question, the better gradient you get for the retriever."}, {"start": 2160.52, "end": 2165.72, "text": " But the retriever only samples so it doesn't even see all the documents. So how can it ever learn"}, {"start": 2165.72, "end": 2172.92, "text": " that a given document is going to be relevant if never sees it and so on. So there's quite an"}, {"start": 2172.92, "end": 2179.56, "text": " interdependence and you you only can do that with good initialization, as you know, is the case for"}, {"start": 2179.56, "end": 2185.96, "text": " a lot of these language tasks. But here, even the pre training, so that's the point, even the masked"}, {"start": 2185.96, "end": 2191.4, "text": " language model pre training, where they already have this, you know, retrieval step in there,"}, {"start": 2191.4, "end": 2198.6, "text": " even that needs to be itself initialized at a good point. Otherwise, it doesn't help otherwise,"}, {"start": 2198.6, "end": 2203.4, "text": " because you want to train the retriever such that the masked language model becomes easier."}, {"start": 2203.4, "end": 2207.88, "text": " And you have to take care of a bunch of stuff. So here they say at the beginning of training, if the"}, {"start": 2207.88, "end": 2212.76, "text": " retriever does not have good embeddings, the retrieved documents will likely be unrelated to"}, {"start": 2212.76, "end": 2219.0, "text": " x. This causes the knowledge augmented encoder to learn to ignore the retrieved documents. Okay,"}, {"start": 2219.0, "end": 2224.2000000000003, "text": " so it basically just falls back to a model that does not have these other documents because none"}, {"start": 2224.2000000000003, "end": 2229.32, "text": " of the retrieved documents are relevant. Once this occurs, the knowledge retriever does not receive"}, {"start": 2229.32, "end": 2234.2000000000003, "text": " a meaningful gradient and cannot improve creating a vicious cycle to avoid this cold start problem,"}, {"start": 2234.2000000000003, "end": 2240.92, "text": " we warm start the embedding of the input and the doc. So these are these are models one and two,"}, {"start": 2240.92, "end": 2244.28, "text": " right? I think this is what I called model one, this is what I called model two."}, {"start": 2245.6400000000003, "end": 2250.92, "text": " Using a simple training objective known as the inverse closed task, where given a sentence,"}, {"start": 2250.92, "end": 2255.1600000000003, "text": " the model is trained to retrieve the document where that sentence came from,"}, {"start": 2255.16, "end": 2260.92, "text": " refer to this paper. So this paper, I believe is the the the orca paper. And just quickly for the"}, {"start": 2260.92, "end": 2267.0, "text": " knowledge augmented encoder, we warm started with Bert returning. So this here, I think this is,"}, {"start": 2267.7999999999997, "end": 2276.2799999999997, "text": " this is model three. So this is model one, this here is model two, that's model three. So this"}, {"start": 2276.2799999999997, "end": 2284.8399999999997, "text": " paper here, I believe that's the orca paper. The orca paper is very, very, very, very, very,"}, {"start": 2284.84, "end": 2291.8, "text": " very close to this paper, it also has this retrieval step and so on. But it, it took it"}, {"start": 2291.8, "end": 2298.52, "text": " said that it introduced this inverse closed task as pre training for its own model. So you can see"}, {"start": 2298.52, "end": 2305.4, "text": " this paper right here as sort of an evolution where they go from from orca and basically use"}, {"start": 2305.4, "end": 2312.92, "text": " that as an initialization for their own model. Now, it's not exactly the same and so on. But"}, {"start": 2312.92, "end": 2319.56, "text": " this inverse closed task in that orca paper was quite a central point. So what you want to do is"}, {"start": 2319.56, "end": 2327.7200000000003, "text": " you simply take a document from your corpus, any document, and then you select a span like this"}, {"start": 2327.7200000000003, "end": 2335.64, "text": " span right here. And then you make two things out of that. First of all, the span is going to become"}, {"start": 2335.64, "end": 2343.16, "text": " your x, okay, and then the document right here, the document but without the span, obviously,"}, {"start": 2343.16, "end": 2350.04, "text": " so the span you just leave empty, that's going to become the thing to retrieve. And you simply now"}, {"start": 2350.04, "end": 2358.2, "text": " train a model your models. So this case, this is model one, and this is model two, you train them"}, {"start": 2358.2, "end": 2367.24, "text": " such that the inner product between between the two, so your embedding of x times your embedding"}, {"start": 2367.24, "end": 2373.56, "text": " of z is going to be large, I guess they have a weight matrices in front of that, but it doesn't"}, {"start": 2373.56, "end": 2380.4399999999996, "text": " matter. So you can see that you train the model to retrieve the document where a piece of text came"}, {"start": 2380.4399999999996, "end": 2385.96, "text": " from. Okay, and you train train these model in conjunction with each other, you simply make the"}, {"start": 2385.96, "end": 2391.64, "text": " inner products large and you can do negative sampling for this in order to contrast this with"}, {"start": 2391.64, "end": 2398.2, "text": " other documents where the text isn't from. If you don't know what negative sampling is, I've done a"}, {"start": 2398.2, "end": 2406.92, "text": " bunch of papers, most notably the word to vec paper where that was sort of introduced. So that's"}, {"start": 2406.92, "end": 2412.84, "text": " your pre pre training task. And I'm going to just take a wild guess here. And I'm going to guess"}, {"start": 2412.84, "end": 2420.36, "text": " and I'm going to guess that in or no in this ICT pre training does this here is started from the"}, {"start": 2420.36, "end": 2428.2000000000003, "text": " public BERT checkpoint or something like this. So technically, this you have the masked language"}, {"start": 2428.2000000000003, "end": 2435.7200000000003, "text": " model of models one and two would be the pre pre pre training. And then this ICT would be the pre"}, {"start": 2435.72, "end": 2443.3199999999997, "text": " pre training. And then the masked language modeling with the retriever based on IC built on ICT is"}, {"start": 2443.3199999999997, "end": 2452.12, "text": " going to be the pre training. And then the question answering using that retriever is going to be the"}, {"start": 2452.12, "end": 2461.0, "text": " actual training. Okay. So there's a lot of build up here. One thing to say is that yeah, as you see"}, {"start": 2461.0, "end": 2468.12, "text": " here, so here is this pre training on the left unsupervised, where you simply, again, the the"}, {"start": 2468.12, "end": 2474.6, "text": " thing the way you have to think about it is what document do I have to retrieve to make the job of"}, {"start": 2474.6, "end": 2482.2, "text": " filling in the blank here easier? Okay. And the hope is that that correlates well with the job of"}, {"start": 2482.2, "end": 2488.2, "text": " what document do I have to retrieve to answering the question? easier? Okay."}, {"start": 2488.2, "end": 2494.2, "text": " What document do I have to retrieve to make to make the job for the model that answers the"}, {"start": 2494.2, "end": 2500.9199999999996, "text": " question easier? I guess that's the way of formulating it. Alright, so the next few things"}, {"start": 2500.9199999999996, "end": 2508.4399999999996, "text": " you have to do to get it to work is prohibiting trivial retrievals. They say if the pre training"}, {"start": 2508.4399999999996, "end": 2513.7999999999997, "text": " corpus and the knowledge corpus are the same, which I guess they sometimes are because, you know,"}, {"start": 2513.8, "end": 2521.0, "text": " it pays off to do the pre training on the same corpus as your knowledge corpus if it is large"}, {"start": 2521.0, "end": 2526.84, "text": " enough, a trivial retrieval candidate z that is too informative, right, there exists a trivial"}, {"start": 2526.84, "end": 2532.44, "text": " retrieval kind. If the mask sentence comes from document z, the knowledge augmented encoder can"}, {"start": 2532.44, "end": 2538.1200000000003, "text": " trivially predict y by looking at the unmasked version of it. Yes, of course. Like if you do"}, {"start": 2538.1200000000003, "end": 2543.48, "text": " this masked language modeling and you have a lot of knowledge, you can predict the answer"}, {"start": 2543.48, "end": 2550.36, "text": " and you take your sentence from that corpus, then the retriever can simply go look for that document"}, {"start": 2550.36, "end": 2555.56, "text": " and then becomes very, very easy to fill in the blank, right? Because you just do this pattern"}, {"start": 2555.56, "end": 2560.68, "text": " matching. And that's of no use because what you want to teach the model essentially is to kind of"}, {"start": 2560.68, "end": 2568.2, "text": " look at the semantics of a document. So you simply prohibit that particular thing. So this is during"}, {"start": 2568.2, "end": 2575.3199999999997, "text": " pre training, this is for your masked language modeling, pre training, what we call here realm"}, {"start": 2575.3199999999997, "end": 2583.08, "text": " pre training. During that, you simply prohibit. For this reason, we exclude this trivial candidate"}, {"start": 2583.08, "end": 2588.3599999999997, "text": " during pre training. So that's one thing you have to do. And I feel here is, you know, where the"}, {"start": 2588.3599999999997, "end": 2596.12, "text": " specifics of your task and your data set come in. Because, you know, on the internet, many things"}, {"start": 2596.12, "end": 2604.2, "text": " are copied, and sort of copied and translated and so on. So if you were to do this, not in Wikipedia,"}, {"start": 2604.2, "end": 2610.04, "text": " but in a more unstructured way, this would be one of the pain points, I guess, because"}, {"start": 2610.04, "end": 2616.2799999999997, "text": " imagine, you know, there is just a website that translates all the other websites to French,"}, {"start": 2616.2799999999997, "end": 2621.0, "text": " and then your model can simply learn to translate from French and always retrieve the French"}, {"start": 2621.0, "end": 2626.92, "text": " document and fill in the blank using that it will learn nothing about the word like it will not"}, {"start": 2626.92, "end": 2634.04, "text": " require acquire any retrieval of along semantics of world knowledge, it will simply learn to"}, {"start": 2634.04, "end": 2640.2, "text": " translate to French and so on. So I think that this is rather more crucial than this simple"}, {"start": 2640.2, "end": 2647.64, "text": " one paragraph appears to, to have it. Then they also introduced this null document,"}, {"start": 2647.64, "end": 2653.16, "text": " along with the things they retrieve. So if they retrieve, maybe not five, but eight, I think they"}, {"start": 2653.16, "end": 2658.2, "text": " retrieve eight in the experiments if they retrieve. So they retrieve seven documents, the seven"}, {"start": 2658.2, "end": 2666.2799999999997, "text": " closest ones in inner product space plus a null document, such that the model has the opportunity"}, {"start": 2666.2799999999997, "end": 2672.04, "text": " to ignore all the documents, right. So it can basically just go to the null document, assign a"}, {"start": 2672.04, "end": 2679.56, "text": " large weight to that and just answer the question outright. So if the answer is already contained in"}, {"start": 2679.56, "end": 2685.24, "text": " the question itself, it can just, you know, point to that it doesn't need the an additional"}, {"start": 2685.24, "end": 2690.92, "text": " document to answer the question. So they leave room for this possibility right here. Now,"}, {"start": 2690.92, "end": 2697.8, "text": " this would also be a good metric to assess how much the model makes use of the other documents."}, {"start": 2697.8, "end": 2705.5600000000004, "text": " And I think they have this further down. And then the last thing here is the salient span masking."}, {"start": 2705.5600000000004, "end": 2712.44, "text": " So when you do masked language model pre training, what you'll do is simply you'll drop out, not even"}, {"start": 2712.44, "end": 2719.5600000000004, "text": " words, but word pieces, right. So, so here, let's say this, you have this span of text, what you do"}, {"start": 2719.5600000000004, "end": 2727.0800000000004, "text": " is you just drop out like at random words, or, as I said, even worse, if this is BERT or something,"}, {"start": 2727.08, "end": 2737.3199999999997, "text": " you have word pieces. So you maybe just drop out this CUS right here, and the low. Now, people have"}, {"start": 2737.3199999999997, "end": 2745.24, "text": " observed that this is now pretty easy for the model. And most notably, it doesn't require a lot"}, {"start": 2745.24, "end": 2750.84, "text": " of world knowledge, it doesn't require even a lot of attention to the other parts of the sentence,"}, {"start": 2750.84, "end": 2756.52, "text": " which is what you would like to induce with this pre training, all you basically need to do is"}, {"start": 2756.52, "end": 2762.2, "text": " you need to say, oh, there is something and then Cal. And maybe you look at the words around it,"}, {"start": 2762.2, "end": 2770.44, "text": " and you can pretty easily deduce that it's locale. Also, to fo on, you can pretty easily"}, {"start": 2770.44, "end": 2778.44, "text": " deduce that to focus. So this kind of pre training doesn't really mean the model learns some long"}, {"start": 2778.44, "end": 2784.28, "text": " range dependencies or understands language pretty well. So people have been upping the kind of"}, {"start": 2784.28, "end": 2792.6800000000003, "text": " smartness with which they drop out things. So the most obvious thing is to drop out entire words,"}, {"start": 2792.6800000000003, "end": 2798.1200000000003, "text": " even though you know, BERT works in word pieces, you can simply always enforce that entire words"}, {"start": 2798.1200000000003, "end": 2805.1600000000003, "text": " are dropped out now it's a bit harder. Then what people do is like salient span drop outs. And"}, {"start": 2805.16, "end": 2813.7999999999997, "text": " that's what they do right here. So what you want to do is you want to drop out things that are sort"}, {"start": 2813.7999999999997, "end": 2820.92, "text": " of kind of little snippets that are belong together. So for example, if I drop here, local"}, {"start": 2820.92, "end": 2827.8799999999997, "text": " context, if I drop this out, right, then I need, you know, some masculine spans Rick only require"}, {"start": 2827.88, "end": 2835.0, "text": " what? Right? And that requires much more world knowledge to answer that question requires much"}, {"start": 2835.0, "end": 2841.32, "text": " more long range dependency resolution in my language model and so on. In order to see that"}, {"start": 2841.32, "end": 2845.56, "text": " there is world knowledge. And this is exactly what you want to induce here, right? You want to induce"}, {"start": 2845.56, "end": 2854.44, "text": " your model to learn, learn more global knowledge, more world knowledge, more semantics of the"}, {"start": 2854.44, "end": 2862.6, "text": " language. And you can relate this to sort of pre training or data augmentation, I'd say, in image"}, {"start": 2862.68, "end": 2869.16, "text": " in image in vision. For example, there you have the random cropping. So you only crop out part of"}, {"start": 2869.16, "end": 2874.92, "text": " the picture and then you crop out another part, maybe here. And then you ask the model, does this"}, {"start": 2874.92, "end": 2881.96, "text": " come from the same or from different images, these two parts, and the more you crop sort of the more"}, {"start": 2881.96, "end": 2889.32, "text": " the model has to cannot rely on just single pixels somewhere, but actually has to understand"}, {"start": 2889.88, "end": 2895.96, "text": " image scenes and so on what direction is up and whatnot. So we see qualitative difference between"}, {"start": 2895.96, "end": 2902.2, "text": " pre training methods, and augmentation methods for images, it only makes sense that we see a"}, {"start": 2902.2, "end": 2910.36, "text": " qualitative difference and different in differently induced inductive priors in text if we do this."}, {"start": 2910.36, "end": 2915.6400000000003, "text": " So what they do is they say, since we want to induce this kind of thing, we will not only drop"}, {"start": 2915.6400000000003, "end": 2923.1600000000003, "text": " out entire words, we actually drop out entire salient spans, such as right, United Kingdom or"}, {"start": 2923.1600000000003, "end": 2929.88, "text": " July 1969, we use a bird based tagger to identify named entities and a regular expression to"}, {"start": 2929.88, "end": 2936.92, "text": " identify dates. We select and mask one of these salient spans within a sentence for the mask"}, {"start": 2936.92, "end": 2941.8, "text": " language modeling task. We show that this significantly outperforms other masking strategies"}, {"start": 2941.8, "end": 2951.08, "text": " in section 4.5. Now, while I agree with the notion of salient span masking, I have big troubles with"}, {"start": 2951.64, "end": 2958.52, "text": " the way they do it here. And I think this is where you kind of start to overfit on the particular"}, {"start": 2958.52, "end": 2963.0, "text": " data set. So I guess they looked at the data set and, you know, you kind of as a developer, you"}, {"start": 2963.0, "end": 2967.8, "text": " kind of look at your, you know, just kind of questions are there and they saw often it's,"}, {"start": 2967.8, "end": 2974.44, "text": " you know, questions about entities, question about dates, and so on. So, you know, we can just"}, {"start": 2974.76, "end": 2980.68, "text": " pre train with those things in mind. And that yeah, that's where it gets a bit wonky and really"}, {"start": 2980.68, "end": 2987.8, "text": " specific to your task, really specific to your data sets, and so on, to do that. So this is already"}, {"start": 2987.8, "end": 2994.52, "text": " baking in a bit of knowledge, or a lot of knowledge, I would argue about the task itself. And"}, {"start": 2994.52, "end": 2999.6400000000003, "text": " we're going to see that this is actually fairly important in the results, the salient span masking."}, {"start": 2999.6400000000003, "end": 3008.6000000000004, "text": " And yeah, this, it's sort of, I get it, you get better numbers with it. But also it's kind of"}, {"start": 3008.6000000000004, "end": 3015.1600000000003, "text": " dirty, and very, very specified to the task, I won't actually see. And I don't know if people"}, {"start": 3015.16, "end": 3019.7999999999997, "text": " have actually have done this. But the way I would do it in a kind of more principled way is if you"}, {"start": 3019.7999999999997, "end": 3028.12, "text": " have a piece of text, what you do is you start by masking one word, okay? Like, I'm asked spans here."}, {"start": 3028.52, "end": 3036.52, "text": " And then I would ask my own model, right, my own half trained model, which, which, if I want to"}, {"start": 3036.52, "end": 3041.3199999999997, "text": " predict this one, right, if I want to do mask language model with this one, I can use one of"}, {"start": 3041.32, "end": 3048.6000000000004, "text": " these saliency methods to ask which other words are most relevant to predicting this one, okay? And"}, {"start": 3048.6000000000004, "end": 3054.44, "text": " it will probably be say, okay, salient is really important, right? Because if I know that there is"}, {"start": 3054.6000000000004, "end": 3063.48, "text": " salient in front of it, I can predict that there spans really easily. And then I can say, well,"}, {"start": 3063.48, "end": 3068.84, "text": " okay, so I'll mask salient as well. Now I have masked these two. And I do that up to some point"}, {"start": 3068.84, "end": 3074.1200000000003, "text": " I have masked these two. And I do that up to some threshold, right? So the saliency in my mind"}, {"start": 3074.1200000000003, "end": 3079.56, "text": " should come directly from the model you're training. By that you're basically saying that,"}, {"start": 3079.56, "end": 3086.44, "text": " you know, model, you've sort of learned your local dependencies. Now I want you to go beyond that."}, {"start": 3087.56, "end": 3093.48, "text": " You're, you're basically really mean to the model, you, you forbid it from using everything it has"}, {"start": 3093.48, "end": 3099.2400000000002, "text": " learned so far, to make the task more challenging and more challenging over time. I think this is"}, {"start": 3099.2400000000002, "end": 3104.2, "text": " kind of a built in curriculum learning. And that's how what I would see if you, if this is already"}, {"start": 3104.2, "end": 3110.28, "text": " done, maybe someone's already done it, just let me know in the comments. This already exists kind of"}, {"start": 3110.28, "end": 3119.48, "text": " expanding the masks by assessing the models own saliency. Alright, so let's jump into the results"}, {"start": 3119.48, "end": 3126.04, "text": " and the results, as you've already maybe seen in the abstract are pretty, pretty good. So on these"}, {"start": 3126.04, "end": 3132.12, "text": " open domain questioning data sets, they outperform all the previous state of the art not only by a"}, {"start": 3132.12, "end": 3138.92, "text": " little but by significant margins, as you can see here. And they do it in when both the pre training"}, {"start": 3138.92, "end": 3143.72, "text": " corpus is the same as the knowledge corpus and when the pre training corpus is actually a different"}, {"start": 3143.72, "end": 3152.2799999999997, "text": " one. And that tends to work actually even better in in two of the three tasks. So fairly cool. Also,"}, {"start": 3152.2799999999997, "end": 3158.3599999999997, "text": " not more parameters than you know, previous models, especially not this, this t five. So this t five"}, {"start": 3158.3599999999997, "end": 3164.04, "text": " here is an example of just, you know, where everything is baked into the language model."}, {"start": 3164.04, "end": 3170.2799999999997, "text": " Whereas I believe these models right here, they have a retrievers along with it. Yeah, you can see"}, {"start": 3170.28, "end": 3175.4, "text": " here, they all have retrievers along with it. But their pre training objective and their architecture"}, {"start": 3175.4, "end": 3181.0800000000004, "text": " sometimes is different. I believe you can also see the fact here that orca has the same amount of"}, {"start": 3181.0800000000004, "end": 3186.76, "text": " parameters, it's very close to the model right here. It's just that the pre training here is"}, {"start": 3186.76, "end": 3193.96, "text": " different. And you also see right here, they do some ablations, where they say, okay, how important"}, {"start": 3193.96, "end": 3199.48, "text": " are the different parts right here. So you can see on the development set, you get what your 38.2"}, {"start": 3199.48, "end": 3209.16, "text": " exact match score. If you only train the retriever, but you reset the encoder before, so that's the"}, {"start": 3209.16, "end": 3214.28, "text": " thing that actually answers the question. If you reset that before fine tuning, you drop a little"}, {"start": 3214.28, "end": 3221.72, "text": " bit. If you reset the retriever, you drop actually you drop more. But still, it's I would say it's"}, {"start": 3221.72, "end": 3228.04, "text": " fairly competitive, as you can see, now, this is probably the test set. But still, it's fairly,"}, {"start": 3228.04, "end": 3236.84, "text": " fairly competitive right here with the with the sorry, the previous state of the art. Oh, yeah,"}, {"start": 3236.84, "end": 3243.64, "text": " here, here is the baseline, it's 31.3. Now, interestingly, as you can see right here,"}, {"start": 3243.64, "end": 3250.44, "text": " if you have uniform masks or random span masks, which is the two types that I have masking that"}, {"start": 3250.44, "end": 3256.44, "text": " I discussed where either you drop out just word pieces or, you know, entire words or entire spans,"}, {"start": 3256.44, "end": 3261.88, "text": " so you just you just take that idea further, you say, oh, I'm asking an entire span, but"}, {"start": 3262.6, "end": 3271.16, "text": " nothing with their saliency. So no, no reg X's for dates, no entity taggers, and so on, you,"}, {"start": 3271.16, "end": 3277.64, "text": " you drop quite a bit, especially with the uniform masks, you see here, you drop quite a bit. Now with"}, {"start": 3277.64, "end": 3283.4, "text": " the random random span masks, you also you drop, you drop for the random spans, and then you drop"}, {"start": 3283.4, "end": 3290.12, "text": " again for the uniform masks. So this seems to be pretty, pretty important. So never forget,"}, {"start": 3290.12, "end": 3295.08, "text": " when you see things like this, that there are these engineering choices that can make"}, {"start": 3296.6, "end": 3304.6, "text": " as big a difference as the the actual idea in the paper itself. Okay, so you can see this"}, {"start": 3304.6, "end": 3309.32, "text": " is pretty, the improvement is it's like three points from uniform masks to random span masks,"}, {"start": 3309.32, "end": 3315.48, "text": " and then three points again, from the random span masks to their realm pre training. And the actual"}, {"start": 3315.48, "end": 3322.28, "text": " improvement with the uniform masks over the baseline right here is not as high. Now the"}, {"start": 3322.28, "end": 3330.2000000000003, "text": " baseline, you know, uses a different thing, it uses this ICT as pre training, but still, I haven't"}, {"start": 3330.2, "end": 3339.72, "text": " seen the saliency masking. Maybe I've seen it, maybe it's somewhere else, but I haven't seen it."}, {"start": 3339.72, "end": 3346.52, "text": " Okay, they also have an interesting thing right here. Oh, they also have an interesting plot in"}, {"start": 3346.52, "end": 3357.48, "text": " the appendix, where they show the number the performance of the different masking styles,"}, {"start": 3357.48, "end": 3365.96, "text": " with respect to this retrieval utility and the retrieval utility compares this, these two things"}, {"start": 3365.96, "end": 3372.2, "text": " that we've looked at. So it compares how good is document z and answering the question why versus"}, {"start": 3372.2, "end": 3378.12, "text": " this null document. So the null document is basically just answer the why, right? So if"}, {"start": 3379.2400000000002, "end": 3384.28, "text": " let's let's play devil's advocate and say that all of this retrieval stuff, it's just bollocks,"}, {"start": 3384.28, "end": 3393.0, "text": " right? You know, the knowledge is still baked into the language model, they were critical"}, {"start": 3393.0, "end": 3400.36, "text": " that this helps, and so on, then this would also always be zero. You can pretty easily or you can"}, {"start": 3400.36, "end": 3405.1600000000003, "text": " pretty easily see that this would be zero, right, there will be no improvement having the document"}, {"start": 3405.1600000000003, "end": 3411.7200000000003, "text": " versus not having the document having the null document. So if this is high, that means these"}, {"start": 3411.72, "end": 3419.48, "text": " retrieved documents are actually relevant. So you can see that if you do random uniform masking,"}, {"start": 3420.04, "end": 3427.48, "text": " then it's it's okay, it gets above zero. All right, if you do random span masking,"}, {"start": 3428.12, "end": 3435.3199999999997, "text": " it gets even higher. And if you do salient span masking, it gets very high. So again,"}, {"start": 3435.32, "end": 3443.0800000000004, "text": " you see here the difference between the salient masking and the others is, you know, I would say"}, {"start": 3443.0800000000004, "end": 3448.28, "text": " higher than the difference between not having the document at all and doing the random uniform"}, {"start": 3448.28, "end": 3454.52, "text": " masking in pre training. So again, you know, something to think about. At last, they have"}, {"start": 3454.52, "end": 3461.0800000000004, "text": " one example right here where they can show actually helps this is just a concrete example."}, {"start": 3461.08, "end": 3467.96, "text": " So the question here is an equilateral triangle is easily constructed using a straight edge and a"}, {"start": 3467.96, "end": 3475.3199999999997, "text": " compass because three is a and then blank prime. So this is the masked word right here. If they"}, {"start": 3475.3199999999997, "end": 3480.84, "text": " just ask the model what they should feel what it should fill in the probability and Fermat is the"}, {"start": 3480.84, "end": 3488.6, "text": " correct answer is super duper low. Okay, then if they give it the correct document, they just"}, {"start": 3488.6, "end": 3495.24, "text": " they just search out the correct document, which is here the conditional probability with this"}, {"start": 3495.24, "end": 3502.92, "text": " document to 57 is a Fermat prime does a regular polygon with 257 sides is constructible with"}, {"start": 3502.92, "end": 3511.56, "text": " compass. So you can see that it has it has some overlap like the constructible with compass,"}, {"start": 3511.56, "end": 3518.2, "text": " okay, the constructible with compass, it's not an exact overlap. So it's debatable whether a"}, {"start": 3518.2, "end": 3525.72, "text": " classic search engine would find this probably but not and then the a something prime a something"}, {"start": 3525.72, "end": 3533.08, "text": " prime, they are here. So given this document, you can see how a model could easily classify"}, {"start": 3533.08, "end": 3539.3199999999997, "text": " Fermat as the correct answer. And in fact, the probability is, I guess it's not 1.0. But it's"}, {"start": 3539.32, "end": 3548.28, "text": " around that 1.0. So if you give the model the you know, model three, your if you give it the relevant"}, {"start": 3548.28, "end": 3557.7200000000003, "text": " document, it immediately knows what the answer is. And if you give the if you do this whole"}, {"start": 3557.7200000000003, "end": 3564.2000000000003, "text": " retrieval step in between, so this is marginal probability marginalizing over the top eight"}, {"start": 3564.2, "end": 3569.3999999999996, "text": " retrieved documents, so now they don't tell it what the correct answer is, but they actually"}, {"start": 3569.3999999999996, "end": 3575.3199999999997, "text": " let it do its whole retrieval thing and marginalize over the top documents, then it still assigns a"}, {"start": 3575.3199999999997, "end": 3580.52, "text": " very high probability. And I'm going to guess that's the top probability for all of the words,"}, {"start": 3580.52, "end": 3587.3999999999996, "text": " but you see, there is a considerable decline. So it's not like it's not like it's always super"}, {"start": 3587.3999999999996, "end": 3593.24, "text": " sure. And I think there is quite a bit of improvement still to be to be done right here,"}, {"start": 3593.24, "end": 3599.72, "text": " because as a human, if I go look for an answer for this question, and I find even if I consider"}, {"start": 3599.72, "end": 3605.56, "text": " the top eight documents, I don't think they would confuse me to the point where I'd say that Fermat"}, {"start": 3605.56, "end": 3613.9599999999996, "text": " is only 12% likely, even though it might be more likely than any other word, I would assign it"}, {"start": 3613.9599999999996, "end": 3621.24, "text": " probably a much higher probability. So I think there's there's a bit of improvement still to be"}, {"start": 3621.24, "end": 3626.7599999999998, "text": " made right here. And I'm looking forward to what people can come up with. Alright, I hope you"}, {"start": 3626.7599999999998, "end": 3633.3999999999996, "text": " enjoyed this video. I know it's been a bit of a long rant, but I wanted to make sure the individual"}, {"start": 3633.3999999999996, "end": 3639.8799999999997, "text": " parts are clear. Let me know what you think of it of the model itself. And I wish you a good one. Bye"}, {"start": 3639.88, "end": 3651.4, "text": " bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=v2GRWzIhaqQ
Meta-Learning through Hebbian Plasticity in Random Networks (Paper Explained)
#ai #neuroscience #rl Reinforcement Learning is a powerful tool, but it lacks biological plausibility because it learns a fixed policy network. Animals use neuroplasticity to reconfigure their policies on the fly and quickly adapt to new situations. This paper uses Hebbian Learning, a biologically inspired technique, to have agents adapt random networks to high-performing solutions as an episode is progressing, leading to agents that can reconfigure themselves in response to new observations. OUTLINE: 0:00 - Intro & Overview 2:30 - Reinforcement Learning vs Hebbian Plasticity 9:00 - Episodes in Hebbian Learning 10:00 - Hebbian Plasticity Rules 18:10 - Quadruped Experiment Results 21:20 - Evolutionary Learning of Hebbian Plasticity 29:10 - More Experimental Results 34:50 - Conclusions 35:30 - Broader Impact Statement Videos: https://twitter.com/risi1979/status/1280544779630186499 Paper: https://arxiv.org/abs/2007.02686 Abstract: Lifelong learning and adaptability are two defining aspects of biological agents. Modern reinforcement learning (RL) approaches have shown significant progress in solving complex tasks, however once training is concluded, the found solutions are typically static and incapable of adapting to new information or perturbations. While it is still not completely understood how biological brains learn and adapt so efficiently from experience, it is believed that synaptic plasticity plays a prominent role in this process. Inspired by this biological mechanism, we propose a search method that, instead of optimizing the weight parameters of neural networks directly, only searches for synapse-specific Hebbian learning rules that allow the network to continuously self-organize its weights during the lifetime of the agent. We demonstrate our approach on several reinforcement learning tasks with different sensory modalities and more than 450K trainable plasticity parameters. We find that starting from completely random weights, the discovered Hebbian rules enable an agent to navigate a dynamical 2D-pixel environment; likewise they allow a simulated 3D quadrupedal robot to learn how to walk while adapting to different morphological damage in the absence of any explicit reward or error signal. Authors: Elias Najarro, Sebastian Risi Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, take a look at the following problem on the left right here. So you have this quadruped, and the goal is to have it walk forward or in any direction as far as possible. Now, usually this is the domain of sort of reinforcement learning. So you have inputs, which is the sensors of the joints of the quadruped, and you have outputs, which is how much force you want to put on each of the legs. And you have to somehow learn a policy to make it walk forward. Reinforcement learning does that by sort of trial and error using an environment to learn the policy directly. However, this paper does something different. What it does is it learns a policy that is adaptive during training, which basically means that at the beginning of each episode, the policy in it is initialized randomly. And by policy here, we mean a policy network, policy neural network, which you can see at the bottom. So that's initialized randomly. And then during the episode, depending on the input, this network is changed and adapted in order to achieve high performance. So even at test time, the network is started randomly, and then adapted during the episode. So this paper deals with this problem and tries to implement this sort of more biologically plausible way of learning a policy adapting to the environment, and achieve ultimately good performance in this task. And it has some nice property, namely that it can deal with these things, as you can see here, front right leg damage, front left leg damage, but we'll get to that later. But just so you know what's coming. So the paper is called meta learning through Hebbian plasticity in random networks by Elias Naharo and Sebastian Rizzi. So we'll go through the paper, what it does, what evolutionary methods are really briefly, which they use, what Hebbian plasticity is, and the difference to classic reinforcement learning. And then we'll look at the experiments. And that's going to be it. If you like content like this, as always, don't hesitate to subscribe and share it out. And tell me what you think in the comments. I still read all the comments. So I am very interested in what you think about works like this and about the video itself. Okay, so they say lifelong learning and adaptability are two defining aspects of biological agents. Modern reinforcement learning approaches have shown significant progress in solving complex tasks. However, once training is concluded, the found solutions are typically static and incapable of adapting to new information or perturbations. So they contrast the two things here. Reinforcement learning, as you know, is very powerful in these domains. But its goal is to learn a policy and then that policy is fixed. And it's specific to that particular problem. However, biological agents, you know, humans, animals, and so on, they are able to adapt usually very, very quickly, they give some sort of examples right here, like, if a if an animal is born, it almost immediately knows how to walk. So even if it has some sort of injury, even if it has some sort of disability, usually the animal can walk pretty much instantly. And that means it sort of adapts to the body that it is in sort of reconfigures itself on the fly. And that's what we're going to explore here. So this isn't going to outcompete our L anytime soon, it's just a different way and a biologically more plausible way in order to do that. Again, they say, we still don't know completely how biological brains learn and adapt so efficiently from experience. It is believed that synaptic plasticity plays a prominent role in this process. And that's why they are using these Hebbian learning rules in order to configure the network. So let's contrast the two things for a second. In reinforcement learning, what you have is a policy network. Now the policy network is a neural network that maps sensory inputs to actions, okay, so you have the observation goes in and outcomes and action. This is your policy network. Now, during training in reinforcement learning, what you do is you have some sort of environment, okay, this is the environment, and you play this back and forth game with the environment. And you try to improve this policy network right here, as best as you can in order to achieve a high reward. Then during testing, so this is train, then during testing, you freeze, you freeze this network right here. So you freeze the network. And then you and then you simply play that game and you see how well it does. Okay, so this gives you some sort of reward. And that's going to be your testing reward. And you know, that can be generalization, it can be two different environments and so on. But the crucial part is that you in train, you learn, and then you freeze during test. In this, in this particular paper right here, they do something different. So let's call that the Hebbian plasticity world. In the Hebbian plasticity world, again, you have your environment, and you play this game. But you play the game in episodes, and at the beginning of each episode, you initialize this using some sort of distribution here, a normal distribution, you initialize the network, and then you learn, you adapt. During the episode, you adapt the network to have good performance. Okay, so this thing right here, these are the Hebbian rules. So you update the network during the episode, and then at the end of the episode, you go back, you initialize the network again, you start a new episode, and you again, adapt that randomly initialized network. So what's actually learned here isn't the weight of the network, what's learned during training is these rules that transform any randomly initialized network into a high performing network. Now, of course, you might just object and say, Hey, wait a minute, I can just basically hard code the, you know, the optimal weights here into these Hebbian rules. Like my rules can simply, you know, not care about the input and simply output whatever good weights there are. And ultimately, that would lead back to RL. But as you will be able to see in the experiments, they also have some videos provided that I invite you to watch, you can really see that the network reconfigures itself. First of all, at the beginning, it reconfigures itself to a good state, but then also, as the episode is progressing, it continuously reconfigures itself depending on the input. So this is the real power of these Hebbian rules in that during the episode, the network can continuously reconfigure itself in order to achieve higher rewards. So it's not just that I can go from the random initialization to a good performing policy, I can adapt that policy depending on what the input is. So at test time in this Hebbian world, what we're going to do is again, we are going to freeze the learning rules. So you have to kind of rethink we're going to freeze the Hebbian rules, but still, we're going to randomly initialize our policy in each episode. And then we're going to change that during the episode, okay, and then that's ultimately going to give us our reward. So that the thing that's learned is just something different. Here, you learn the weights directly in the RL setting. And then the Hebbian plasticity setting, you learn the rules to update the weights dynamically depending on the input. This is a form of meta learning, right? It's not exactly but it is a form of meta learning. So let's see what those Hebbian rules are. And you can as again, you can see this right here during training. So this is one episode. And it always starts with these random networks at the beginning. And then you can see as you progress, there is structure emerging. And again, I linked to the videos. And you can see that during the episode, even this is changing. And this is especially visible on their other example that they have here, like this, this car example. So in this car example, during the video, you'll see that now there's a curve like this. And then as imagine you're a driver, like there's a kind of a left curve coming and you adjust your mental state, let's say, to say, okay, I don't know what's around the curve, I need to be ready to break and so on. And then there is a straight piece coming and you'll be like, well, I see everything, you know, I can focus on different things that you can reconfigure your state in order to adapt to the observation. And that's exactly what you'll see in that video is that the weights are continuously updating not so much in these quarter pets to which we'll get later. So these Hebbian rules, what do they look like? These are biologically inspired rules. And they say the following. So this here is the delta w i j. And our perspective of policy networks is going to be that this is a neural network, as we said, and we'll just pick out one layer right here. And there is going to be weights right here, you know, weights from all to all these are going to be fully connected networks. And like this, and there's going to be neuron I somewhere here and neuron j somewhere here. Okay, so neuron I and neuron j are going to have a connection together, this thing right here. And there's going this, the question is going to be how do we update that weight from one time step to the next remembering the weights here are changed in each time step, each time step during the episode, we update the weights. So how are they going to be updated? Let's contrast this first to classic reinforcement learning. So in classic reinforcement learning, we would keep these weights the same during the entire episode, and then at the end of the episode, right, we keep those the same. And at the end of the episode, we'll get a reward. And then we'll go back, we'll look back and say, how do we need to change the weights such that in the next episode, the reward will be higher. And in again, in classic reinforcement learning, for example, in policy gradient methods, you will actually calculate a gradient with respect to these weights right here. Actually, let's let's go into that later when we contrast evolutionary methods. So the important part right here is that we change the weights in each time step. So how do we change the weights? Of course, we don't have access to the reward, right, in order to change the weights, the reward is going to come into play when we change the rules to change the weights. But during the episode, we don't have the reward. At least we assume we only get kind of the reward at the end. So we need a different method. And the method is going to be the following right here. The important things in this formula are going to be so how do we change the weights that's dependent on two quantities that appear during each time step, o i and o j. And these are going to be the outputs of neuron i and neuron j. So how do we change the connection that's going to be dependent on the output of neuron i, which is here called the pre synaptic output, and the output of neuron j, which is going to be the post synaptic output. The rule, the kind of mantra here is the fire together wire together means that if two neurons are active at the same time regularly, then they probably should be connected together because they already correlate. And you can see right here that there is a term in this formula that is o i times o j. So this here is the correlation between or the covariance or just the product, if we're exact between these two neurons. And if they are both active regularly, then this quantity is going to be high. And if they're both not active regularly that or if one is active and the other one isn't that quantity is going to be low. And the a parameter here specifies how the weights are updated in response to this. So the a, b, c, d, and eta parameters right here are these are the learned parameters, these are going to be your learned rules to update the weights. So these change once after once per learning step was a once per. So after the episode is done, you're going to change these capital constants right here, including the eta, which is the learning rate. These things right here, these are per step. So this is each step gives you a different o i and o j. And then you'll adjust the weight based on that, you'll see that these constants here, they are per weight. So for each weight in this neural network, we learn a separate rule of how to update that particular weight. So the algorithm can, it can basically decide for a particular way, they can decide, well, if these two things fire together, often, I want to update my weight very heavily in response to that. Okay, so if the a is very high, that means the connection responds very thoroughly to when the two neurons fire together. That is not the same as to say that connection should always be very strong, it's dependent on the input. So only when this quantity is high, should the network or should the weight be updated, and the a parameter modulates how well it's updated or how, how strongly it's up, it can also be negative, it can be zero, basically, meaning that, you know, it doesn't matter if they fire together, I don't want to update the weight, this particular weight and response that so you can see that you can learn these rules that can adapt to different inputs, because all of the changes, the delta here is dependent on the inputs, so on the correlation, but also on the different inputs themselves. And then there is also a constant right here. Okay, this is, as you can see, it's a linear function of the inputs of the oi and oj and their product. So I hope this is clear that the these Hebbian, these Hebbian rules, you learn a, b, c, d and eta, and that gives rise to an adaptive network that can change and reconfigure itself over the course of an episode, depending on the inputs. And one of the things right here, and we'll get to how you actually learn the rules itself in a second. But one of the things right here is very visible, as I said, in this first experiment, where it reconfigures itself continuously, but also in this experiment with this quadruped right here. So this quadruped, usually, it's, you know, you simply walk in a direction, that's your reward, and RL is perfectly fine at this as well. However, this is a bit of a has a bit of a trick to it, namely, you are always in one of three situations, either you have an undamaged quadruped, or it's kind of left leg, front left leg is damaged, or its front right leg is damaged. Okay, and you don't tell the, you simply sample these situations uniformly, and you don't tell the algorithm which situation it is in. Now, if you look at, if you compare two methods, one where you directly learn the weights, you learn a fixed policy to solve, you know, this is one task, right, this is one task. And all of these three things appear with equal probability. So you have to learn one policy to make all of this work. If you learn the weights directly, and you don't have a power, like, there's no doubt that like a powerful RL approach could deal with this task. But if in this case, if you just put a standard weight learner with the same number of the same size of policy as the Hebbian, they compare to, if you put a weight learner on it, it will not be able to solve this task satisfactorily. What it will do is it will say, well, I need one set of rules that make me walk as far as possible as often as possible. So, if you can see at the table, I'm already showing you the results right here. The table right here, if you have these static weights, you can see that it's performing pretty well in two out of two out of three situations, right? So it what it basically does, it says, okay, here is what where there's damage. What it does is it says, I'm going to learn to walk with my left leg using my left front leg. That means when I have no damage or damage to the right front leg, I'm just fine. And I'm just going to take the hit basically, where I have damage to the left front leg, because I'm it's just going to suck. So they solved, they solve this like walk more than 100 steps. So that doesn't, since it can only learn a fixed policy, it basically discards the case where there's damage to the left front leg, it takes that hit in order to be better in the other two methods, you can see it's outperforming the Hebbian rule in the other two methods. But this shows you kind of the difference and the power that these Hebbian rules or these generally neuroplasticity might have because the Hebbian one is perfectly capable of at least in part adapting to the different situations. Now you can see that is not symmetric. Also the Hebbian rules they learn to know there's 860 and there's 440 of a thing that should actually be symmetric, we do expect a drop when there's damage, but it's not symmetric, which means that also the Hebbian rules, they kind of randomly focus on one over the other, but at least they're able in some degree to adapt to both. And that's because it depending on the input, you know, it has a rule in there that basically says, well, if the if the back left leg and the front right leg, you know, if they fire together, then I want to, if they if they fire together, the sensors that show me that they're moving, if they fire together, I'm going to wire them together, because that's how I walk, you know, front, right, back, left, and then the other way around. And if that's not the case, I'm not going to wire them together. So that would be the situation where you have damage. Instead, if they are not wired together, I'm going to and can do this in the next layer of the neural network, wire these other two things together, you know, if, if the first thing is not the case, I'm going to wire these other two things together to make up for that loss. And there you can see, there is kind of this logic built into the network. Now, again, I know you can do this with learning a fixed policy, you can achieve the same effects. The point here is just to show that given kind of a same size networks and so on, that you that there might be, there might be like a qualitative difference in certain situations. Again, by no means this is meant to outcompete RL or anything like this. Okay, so we'll we went there. Now, how are these rules actually learned? And there we have to again, make a distinction that is completely separate from the Hebbian non-Hebbian way. Okay, so the Hebbian non-Hebbian distinction was, do we learn the weights of the policy network directly? Or do we learn the rules to update the weights? Now the question is, whatever we learn, how do we learn it? And again, we have to draw the distinction this time between, I'm going to say classic, or even though the terminology is not really correct, classic RL and evolutionary methods. Okay. So in classic RL, what I would do is I would use my weights in order to obtain a reward. And then I would update my weights. So my delta w would be proportional to the gradient of w of the reward. Okay, so in the classic RL, especially in this is a policy gradient method right now. So I use my policy, my weights to get the reward, and then I would calculate a gradient. And, you know, usually the reward isn't differentiable. So you have this reinforced trick in order to pull the reward out. And you can read all of this up if you look at policy. Gradient, the basic policy gradient methods, but this here tells me I need a gradient, you know, usually this is going to be the reward times the gradient of my fw of my input. So what this means is what this means is that if my reward is high, then I, I just want to know what do I need to do? What do I need to do to make more of what I just did? Okay, and the gradient ensures that for every single weight in your neural network, you know what to do. So the gradient means that I have an exact handle on how do I need to change this weight? How do I need to change that weight? How do I need to change this weight? In order, if the reward is high, and because of this multiplication here, I want to make more of what I just did. And the gradient tells me how if the reward is low, on the other hand, I want to make less of what I just did. But also the gradient tells me how that can be achieved, I simply go into the other direction than I would if the reward is high. In evolutionary methods, we don't have we don't do this gradient calculation. Okay, now there can be advantages to not doing gradient calculation. Sometimes back propagation simply isn't possible, even if it is possible. And this is maybe the case where we're now. What we need to learn in our case is these rules to update the rules. And imagine you have an episode, and that's kind of episode you have step step step step and in each step, these rules are applied, right in each of these steps, the rules are applied, and at the end, you get a reward. So what you need to do is to back propagate that reward through all the steps and then through all the rules. Okay, and that might be just computationally not feasible or the rules. The rules right here are pretty, pretty easy, but the rules might not be differentiable. You actually have the same problem in general in classic RL as well. But you know, you can cut off time steps and so on. There are various hacks. In any case, there can be advantages to not having that gradient and evolutionary methods are a way to do that. In evolutionary method, usually you are don't train one agent, you train a population of agents. So you have a bunch of these neural network agents in here. And the way you update the neural network agent is you simply let them run, you know, you let them run your app, the episode. So this is your W, one of them, you let them run the episode, they get a reward. And then you can do multiple things. So this depends on the evolutionary method. So you can either pick out the best performing agent, or you can update each agent according to some rule. The goal here is simply to to basically, you always want to take your weights, you want to add some noise to them. And you want to see, does it get better or worse? If it gets better, good. If it gets worse, not good. Okay, the difference is without the gradient, you don't have a handle on how do you need to change each individual weight. All you can do is basically random walk and observe what happens. And if the random walk is, you know, turns out to be good, you go more into that direction of that random walk. So it's sort of a sort of a poor, poor man's gradient method in these evolutionary methods. Again, completely independent of what we learn, you can use the evolution evolutionary method to learn the fixed weights. And that's what actually what happens in the table I've shown you below. Or you can use the evolutionary method to learn the Hebbian update rules. As well, you can use RL to learn the fixed weight or the update rules. In this paper, they use evolutionary methods to learn the Hebbian update rules. And they compare mostly with using evolutionary methods to learn the fixed weights. Okay, the exact evolutionary step they use right here is the following. So ht here is going to be the thing that you learn. Now as compared to w being the network weights, h is going to be the Hebbian weights, because since we learn the Hebbian weights, so how they'll update each agent is going to be they'll take the Hebbian weights. And this, this here is how you update right, this is your delta h, how do you update the Hebbian weights? Well, what you do is you you perform n random perturbations. So I take my weights and I add noise, I just add noise, okay, so I am here, and I just make a bunch of versions of it. And then I observe how well are these versions doing? So how well are my random perturbations doing? This is going to be the fitness fi right here is going to be the fitness. And then I'm just going to perform a weighted average. So this is my weighted average of these new solutions. Okay, so if this solution here did pretty well, and this solution did pretty poorly, I want to walk you know, in this direction. And then again, I do the same thing here from here, I do a bunch of perturbations. And maybe this one did pretty well. And this one did pretty poorly, I want to walk in this direction, and so on. Okay, so that's how you you'll change the, you'll change weights or rules or whatever you want in an evolutionary method is, you know, it's pretty easy. It's easier than reinforcement learning, no back prop, no nothing. Basically, a black box optimizer. There are more complicated evolutionary methods, but no, we don't go into those here right now. Okay, so again, I've already shown you these results. Now I said these static weights are also with evolutionary method, they also report what you would get with like a RL approach, like PPO, you would get kind of the same thing as they get as they get here. So, oh, sorry. This is not the same as the table. Yeah, I was confused for a second. This here is for the car environment. Okay, this is this vision based environment. So with their method, they get like an 870 rewards with the heavy and based approach. With the static weight, but still evolutionary method, they get a much lower reward. In fact, the heavy and based approach is about the same as you get here with an RL algorithm. And as we said, the RL algorithm, more complicated. And if you use like a if you use like a state of the art RL algorithm, not just PPO, you get a bit of a better performance, but not that much if you look at if you look at the actual numbers. So, you know, pretty cool to see that, again, this is not outperforming anything. This is simply showing that you can do that. They do a number of experiments where they go in the episode and they kind of change stuff in the episode. And one cool thing here is that they go and you know, this is an episode. So at the episode, you start with a random network each time in this heavy and setting, and then pretty quickly the rules adapt for a high performing right. So it starts to walk, it reconfigures itself and starts to walk. The reward here again, it doesn't have access to that, but we can measure it, of course. And then at this step A right here, they simply go to the weights and zero them out. So they just delete these weights right here. And only 10 time steps later, 10 time steps later, it has reconfigured itself, as you can see right here, in order to walk again. So 10 time steps later, reconfigures itself, reconfigures itself and after a short while, right here, it's back to its kind of original performance, as you can see. So that's, I'd say that's fairly, fairly impressive. In this very short amount of time able to recover from such an and such an intervention. If you do this, of course, if you do this to your policy network, that's statically learned, it's going to be garbage. But I guess the fair comparison would be to delete the heavy and rules themselves. And, you know, so it's not like it's not like this can adapt to new situations, or something like this, this is still learned for particular environments, right. But the point here is that you learn the rules. And this is kind of a study on neuroplasticity. Now, my question actually would be why this diagonal pattern appears and I have not seen like a clear explanation. Especially is this anti diagonal pattern. It's not so much here in the output layer, right? This is the output layer, there are 21 actions or so. And this one is this, this dimension. So not that much there, but there seems to be this rule. And this is not the case at the beginning, right? You saw the beginning you saw at the beginning, it was pretty random matrix. So why? Why? Yeah, here, pretty random. And then there's this diagonal pattern. I don't know why. If you know, let me know. I mean, it's anti diagonal, maybe it is actually diagonal and the forward the fully connected layer is just defined as something like w t times x. And but maybe this also depends on the random initialization. But there is no inherent way why particular neuron would you know, care about sending information to like the same height of neuron on the other side. Or is there? I don't know. I'm so is this a property of the evolutionary or the learning rules? It seems not because the learning rules don't depend on the position. I'm genuinely confused about this. And maybe, you know, maybe they've written it somewhere, I've just overlooked it, though I they do reference it, they say, Oh, there's this diagonal pattern appearing, but I don't think they ever say why it is diagonal. Okay, I might just be I might just be real dumb. Yeah. So they also, you know, they do some more experiments, they show, for example, that if you just have random Hebbian coefficients, then your algorithm just jumps around kind of in in weight space around the zero point. However, if you actually learn these Hebbian coefficients, as they do, you have like this clear attractor here. And you have these kind of oscillating curves. When, you know, when when you do that, you can see you're in the different situations where things are damaged, and so on. So all in all, I think it's a pretty interesting study. And I think these neuroplasticity is, it's a different way, you know, it's unclear to say if it will ever deliver the performance that RL delivers. But certainly there are situations where such plasticity is desired. And if we can also combine this with greater generalization performance, then, you know, we have agents that can quickly kind of reconfigure and a lot of work by these these kind of open ended learning community also plays into this roles, all in all pretty, pretty cool, non standard way of doing things. Last thing, the broader impact statement. Every now and then we'll look at a broader impact statement, since these are new, just to get kind of an overview of what they look like. So they say the ethical and future societal consequences of this are hard to predict, but likely similar to other work dealing with more adaptive agents and robots. In particular, by giving the robots the ability to still function when injured could make it easier from them being deployed in areas that have both a positive and negative impact on society. Okay, well, again, this it's not really giving robots the ability to still function when they're injured. I first I thought first I thought, okay, they train it when it's fully functioning, but then they damage it during test time. But as I understand it, as I understand the paper, they already train it with the damaged versions, they just don't tell the algorithm in which version it is right now. So it's not the same as being able to work when injured unless you've specifically trained for it. In this case, again, I could be wrong about this. Yeah. In the very long term robots that can adapt could help in industrial automation or help to care for the elderly. On the other hand, more adaptive robots could also be more easily used for military applications. The approach presented in this paper is far from being deployed in these areas, but is important to discuss its potential long term consequences early on. Now, okay, so let's evaluate the broader impact statement. Let's, well, the first check to do is always to simply replace whatever their method is with the word technology. Okay, so let's do that. In the very long term, technology could help in industrial automation or help to care for the elderly check. On the other hand, technology could also be more easily used for military application check. Technology is far from being deployed in these areas. Okay, I guess some technology isn't but advanced technology. Yeah. So again, the rule for broader impact statements seem to be you take whatever your method is and you go up until you find, you know, you're basically at technology or something equivalent. Because no one actually, I've never seen a broader impact statement that writes about the actual thing in the paper, they always go up like one layer or two. And then it basically regresses to technology, even though very few papers actually would be able to discuss their particular thing. But you know, and that and that. And then in terms of guidelines on broader impact statement, this one is missing, there's there's always this, the Holy Trifecta. So the Holy Trifecta is you go like a you know, like you're a, you're a Catholic, you go with your finger to your head, chest, left and right. And you say technology, good technology, bad technology biased. Okay, so you want to write a broader impact statement, go up the layers, technology, good, bad bias. And we're missing the bias here. So that's, you know, I'm just following what these guidelines to broader impact statements are, I don't make the rules, I'm sorry, the the heavy ins make the rules, apparently. I'm not heavy in. Okay, I hope you've enjoyed this paper and this video. Let me know what you think. Check out the videos that they have, I'll link them. And with that, I wish you a pleasant day. Bye bye.
[{"start": 0.72, "end": 6.640000000000001, "text": " Hi there, take a look at the following problem on the left right here. So you have this quadruped,"}, {"start": 6.640000000000001, "end": 14.0, "text": " and the goal is to have it walk forward or in any direction as far as possible. Now, usually this"}, {"start": 14.0, "end": 20.32, "text": " is the domain of sort of reinforcement learning. So you have inputs, which is the sensors of the"}, {"start": 20.32, "end": 26.240000000000002, "text": " joints of the quadruped, and you have outputs, which is how much force you want to put on each"}, {"start": 26.24, "end": 32.32, "text": " of the legs. And you have to somehow learn a policy to make it walk forward. Reinforcement"}, {"start": 32.32, "end": 39.44, "text": " learning does that by sort of trial and error using an environment to learn the policy directly."}, {"start": 40.239999999999995, "end": 47.84, "text": " However, this paper does something different. What it does is it learns a policy that is adaptive"}, {"start": 47.84, "end": 54.480000000000004, "text": " during training, which basically means that at the beginning of each episode, the policy in it is"}, {"start": 54.48, "end": 61.919999999999995, "text": " initialized randomly. And by policy here, we mean a policy network, policy neural network, which you"}, {"start": 61.919999999999995, "end": 68.64, "text": " can see at the bottom. So that's initialized randomly. And then during the episode, depending"}, {"start": 68.64, "end": 77.6, "text": " on the input, this network is changed and adapted in order to achieve high performance. So even at"}, {"start": 77.6, "end": 86.39999999999999, "text": " test time, the network is started randomly, and then adapted during the episode. So this paper"}, {"start": 86.39999999999999, "end": 93.6, "text": " deals with this problem and tries to implement this sort of more biologically plausible way of"}, {"start": 94.16, "end": 101.11999999999999, "text": " learning a policy adapting to the environment, and achieve ultimately good performance in this task."}, {"start": 101.11999999999999, "end": 107.03999999999999, "text": " And it has some nice property, namely that it can deal with these things, as you can see here,"}, {"start": 107.04, "end": 112.88000000000001, "text": " front right leg damage, front left leg damage, but we'll get to that later. But just so you know"}, {"start": 112.88000000000001, "end": 119.04, "text": " what's coming. So the paper is called meta learning through Hebbian plasticity in random"}, {"start": 119.04, "end": 126.56, "text": " networks by Elias Naharo and Sebastian Rizzi. So we'll go through the paper, what it does, what"}, {"start": 126.56, "end": 132.0, "text": " evolutionary methods are really briefly, which they use, what Hebbian plasticity is, and the"}, {"start": 132.0, "end": 138.0, "text": " difference to classic reinforcement learning. And then we'll look at the experiments. And that's"}, {"start": 138.0, "end": 144.32, "text": " going to be it. If you like content like this, as always, don't hesitate to subscribe and share it"}, {"start": 144.32, "end": 151.2, "text": " out. And tell me what you think in the comments. I still read all the comments. So I am very"}, {"start": 151.2, "end": 157.2, "text": " interested in what you think about works like this and about the video itself. Okay, so they say"}, {"start": 157.2, "end": 162.32, "text": " lifelong learning and adaptability are two defining aspects of biological agents."}, {"start": 163.44, "end": 168.0, "text": " Modern reinforcement learning approaches have shown significant progress in solving complex"}, {"start": 168.0, "end": 175.2, "text": " tasks. However, once training is concluded, the found solutions are typically static and incapable"}, {"start": 175.2, "end": 182.32, "text": " of adapting to new information or perturbations. So they contrast the two things here. Reinforcement"}, {"start": 182.32, "end": 189.76, "text": " learning, as you know, is very powerful in these domains. But its goal is to learn a policy and"}, {"start": 189.76, "end": 197.28, "text": " then that policy is fixed. And it's specific to that particular problem. However, biological agents,"}, {"start": 197.84, "end": 204.32, "text": " you know, humans, animals, and so on, they are able to adapt usually very, very quickly, they"}, {"start": 204.32, "end": 211.6, "text": " give some sort of examples right here, like, if a if an animal is born, it almost immediately knows"}, {"start": 211.6, "end": 217.44, "text": " how to walk. So even if it has some sort of injury, even if it has some sort of disability,"}, {"start": 218.32, "end": 226.88, "text": " usually the animal can walk pretty much instantly. And that means it sort of adapts to the body that"}, {"start": 226.88, "end": 232.4, "text": " it is in sort of reconfigures itself on the fly. And that's what we're going to explore here. So"}, {"start": 232.4, "end": 239.92, "text": " this isn't going to outcompete our L anytime soon, it's just a different way and a biologically more"}, {"start": 239.92, "end": 247.76, "text": " plausible way in order to do that. Again, they say, we still don't know completely how biological"}, {"start": 247.76, "end": 252.48, "text": " brains learn and adapt so efficiently from experience. It is believed that synaptic"}, {"start": 252.48, "end": 259.03999999999996, "text": " plasticity plays a prominent role in this process. And that's why they are using these Hebbian"}, {"start": 259.03999999999996, "end": 266.0, "text": " learning rules in order to configure the network. So let's contrast the two things for a second."}, {"start": 266.0, "end": 272.0, "text": " In reinforcement learning, what you have is a policy network. Now the policy network is a neural"}, {"start": 272.0, "end": 279.44, "text": " network that maps sensory inputs to actions, okay, so you have the observation goes in and outcomes"}, {"start": 279.44, "end": 285.6, "text": " and action. This is your policy network. Now, during training in reinforcement learning, what"}, {"start": 285.6, "end": 291.36, "text": " you do is you have some sort of environment, okay, this is the environment, and you play this back"}, {"start": 291.36, "end": 300.16, "text": " and forth game with the environment. And you try to improve this policy network right here, as best"}, {"start": 300.16, "end": 308.72, "text": " as you can in order to achieve a high reward. Then during testing, so this is train, then during"}, {"start": 308.72, "end": 318.08000000000004, "text": " testing, you freeze, you freeze this network right here. So you freeze the network. And then you"}, {"start": 318.08, "end": 323.44, "text": " and then you simply play that game and you see how well it does. Okay, so this gives you some"}, {"start": 323.44, "end": 327.28, "text": " sort of reward. And that's going to be your testing reward. And you know, that can be"}, {"start": 327.28, "end": 332.15999999999997, "text": " generalization, it can be two different environments and so on. But the crucial part is"}, {"start": 332.15999999999997, "end": 342.0, "text": " that you in train, you learn, and then you freeze during test. In this, in this particular paper"}, {"start": 342.0, "end": 348.64, "text": " right here, they do something different. So let's call that the Hebbian plasticity world."}, {"start": 349.76, "end": 357.04, "text": " In the Hebbian plasticity world, again, you have your environment, and you play this game. But"}, {"start": 360.32, "end": 365.28, "text": " you play the game in episodes, and at the beginning of each episode, you initialize this"}, {"start": 365.84, "end": 370.56, "text": " using some sort of distribution here, a normal distribution, you initialize the network,"}, {"start": 370.56, "end": 379.68, "text": " and then you learn, you adapt. During the episode, you adapt the network to have good performance."}, {"start": 379.68, "end": 390.24, "text": " Okay, so this thing right here, these are the Hebbian rules. So you update the network during"}, {"start": 390.24, "end": 396.24, "text": " the episode, and then at the end of the episode, you go back, you initialize the network again,"}, {"start": 396.24, "end": 402.64, "text": " you start a new episode, and you again, adapt that randomly initialized network. So what's"}, {"start": 402.64, "end": 407.92, "text": " actually learned here isn't the weight of the network, what's learned during training is these"}, {"start": 407.92, "end": 415.12, "text": " rules that transform any randomly initialized network into a high performing network. Now,"}, {"start": 415.68, "end": 423.52, "text": " of course, you might just object and say, Hey, wait a minute, I can just basically hard code"}, {"start": 423.52, "end": 429.44, "text": " the, you know, the optimal weights here into these Hebbian rules. Like my rules can simply,"}, {"start": 429.44, "end": 434.88, "text": " you know, not care about the input and simply output whatever good weights there are. And"}, {"start": 434.88, "end": 441.2, "text": " ultimately, that would lead back to RL. But as you will be able to see in the experiments,"}, {"start": 441.2, "end": 447.44, "text": " they also have some videos provided that I invite you to watch, you can really see that the network"}, {"start": 447.44, "end": 453.03999999999996, "text": " reconfigures itself. First of all, at the beginning, it reconfigures itself to a good state,"}, {"start": 453.04, "end": 459.92, "text": " but then also, as the episode is progressing, it continuously reconfigures itself depending on the"}, {"start": 459.92, "end": 465.28000000000003, "text": " input. So this is the real power of these Hebbian rules in that during the episode, the network can"}, {"start": 465.28000000000003, "end": 470.08000000000004, "text": " continuously reconfigure itself in order to achieve higher rewards. So it's not just that"}, {"start": 470.96000000000004, "end": 476.56, "text": " I can go from the random initialization to a good performing policy, I can adapt that policy"}, {"start": 476.56, "end": 483.2, "text": " depending on what the input is. So at test time in this Hebbian world, what we're going to do is"}, {"start": 483.2, "end": 490.08, "text": " again, we are going to freeze the learning rules. So you have to kind of rethink we're going to"}, {"start": 490.08, "end": 500.24, "text": " freeze the Hebbian rules, but still, we're going to randomly initialize our policy in each episode."}, {"start": 500.24, "end": 507.04, "text": " And then we're going to change that during the episode, okay, and then that's ultimately going"}, {"start": 507.04, "end": 514.48, "text": " to give us our reward. So that the thing that's learned is just something different. Here, you"}, {"start": 514.48, "end": 521.04, "text": " learn the weights directly in the RL setting. And then the Hebbian plasticity setting, you learn the"}, {"start": 521.04, "end": 528.24, "text": " rules to update the weights dynamically depending on the input. This is a form of meta learning,"}, {"start": 528.24, "end": 535.44, "text": " right? It's not exactly but it is a form of meta learning. So let's see what those Hebbian rules"}, {"start": 535.44, "end": 543.6800000000001, "text": " are. And you can as again, you can see this right here during training. So this is one episode. And"}, {"start": 543.6800000000001, "end": 548.4, "text": " it always starts with these random networks at the beginning. And then you can see as you progress,"}, {"start": 548.4, "end": 555.92, "text": " there is structure emerging. And again, I linked to the videos. And you can see that during the"}, {"start": 555.92, "end": 561.04, "text": " episode, even this is changing. And this is especially visible on their other example that"}, {"start": 561.04, "end": 567.5999999999999, "text": " they have here, like this, this car example. So in this car example, during the video, you'll see that"}, {"start": 567.5999999999999, "end": 573.36, "text": " now there's a curve like this. And then as imagine you're a driver, like there's a kind of a left"}, {"start": 573.36, "end": 579.76, "text": " curve coming and you adjust your mental state, let's say, to say, okay, I don't know what's"}, {"start": 579.76, "end": 584.7199999999999, "text": " around the curve, I need to be ready to break and so on. And then there is a straight piece coming"}, {"start": 584.72, "end": 589.0400000000001, "text": " and you'll be like, well, I see everything, you know, I can focus on different things that you"}, {"start": 589.0400000000001, "end": 596.64, "text": " can reconfigure your state in order to adapt to the observation. And that's exactly what you'll"}, {"start": 596.64, "end": 600.88, "text": " see in that video is that the weights are continuously updating not so much in these"}, {"start": 600.88, "end": 608.24, "text": " quarter pets to which we'll get later. So these Hebbian rules, what do they look like? These are"}, {"start": 608.24, "end": 617.36, "text": " biologically inspired rules. And they say the following. So this here is the delta w i j. And"}, {"start": 617.92, "end": 623.84, "text": " our perspective of policy networks is going to be that this is a neural network, as we said,"}, {"start": 624.5600000000001, "end": 629.6, "text": " and we'll just pick out one layer right here. And there is going to be weights right here,"}, {"start": 629.6, "end": 633.52, "text": " you know, weights from all to all these are going to be fully connected networks."}, {"start": 633.52, "end": 642.72, "text": " And like this, and there's going to be neuron I somewhere here and neuron j somewhere here. Okay,"}, {"start": 642.72, "end": 649.1999999999999, "text": " so neuron I and neuron j are going to have a connection together, this thing right here. And"}, {"start": 649.1999999999999, "end": 655.6, "text": " there's going this, the question is going to be how do we update that weight from one time step"}, {"start": 655.6, "end": 662.0799999999999, "text": " to the next remembering the weights here are changed in each time step, each time step during"}, {"start": 662.08, "end": 667.76, "text": " the episode, we update the weights. So how are they going to be updated? Let's contrast this"}, {"start": 667.76, "end": 673.6800000000001, "text": " first to classic reinforcement learning. So in classic reinforcement learning, we would keep"}, {"start": 673.6800000000001, "end": 679.0400000000001, "text": " these weights the same during the entire episode, and then at the end of the episode, right, we keep"}, {"start": 679.0400000000001, "end": 683.6800000000001, "text": " those the same. And at the end of the episode, we'll get a reward. And then we'll go back,"}, {"start": 683.6800000000001, "end": 688.08, "text": " we'll look back and say, how do we need to change the weights such that in the next episode, the"}, {"start": 688.08, "end": 694.32, "text": " reward will be higher. And in again, in classic reinforcement learning, for example, in policy"}, {"start": 694.32, "end": 701.2, "text": " gradient methods, you will actually calculate a gradient with respect to these weights right here."}, {"start": 702.72, "end": 707.76, "text": " Actually, let's let's go into that later when we contrast evolutionary methods. So the important"}, {"start": 707.76, "end": 712.4000000000001, "text": " part right here is that we change the weights in each time step. So how do we change the weights?"}, {"start": 712.4000000000001, "end": 717.76, "text": " Of course, we don't have access to the reward, right, in order to change the weights, the reward"}, {"start": 717.76, "end": 722.96, "text": " is going to come into play when we change the rules to change the weights. But during the episode,"}, {"start": 722.96, "end": 728.88, "text": " we don't have the reward. At least we assume we only get kind of the reward at the end. So we need"}, {"start": 728.88, "end": 737.36, "text": " a different method. And the method is going to be the following right here. The important things"}, {"start": 737.36, "end": 742.48, "text": " in this formula are going to be so how do we change the weights that's dependent on two"}, {"start": 742.48, "end": 750.32, "text": " quantities that appear during each time step, o i and o j. And these are going to be the outputs"}, {"start": 750.32, "end": 757.36, "text": " of neuron i and neuron j. So how do we change the connection that's going to be dependent on"}, {"start": 758.08, "end": 764.08, "text": " the output of neuron i, which is here called the pre synaptic output, and the output of neuron j,"}, {"start": 764.08, "end": 772.5600000000001, "text": " which is going to be the post synaptic output. The rule, the kind of mantra here is the fire"}, {"start": 772.5600000000001, "end": 779.6800000000001, "text": " together wire together means that if two neurons are active at the same time regularly, then they"}, {"start": 779.6800000000001, "end": 787.2, "text": " probably should be connected together because they already correlate. And you can see right here that"}, {"start": 787.2, "end": 795.2800000000001, "text": " there is a term in this formula that is o i times o j. So this here is the correlation between or"}, {"start": 795.2800000000001, "end": 805.2, "text": " the covariance or just the product, if we're exact between these two neurons. And if they are both"}, {"start": 805.2, "end": 810.5600000000001, "text": " active regularly, then this quantity is going to be high. And if they're both not active regularly"}, {"start": 810.5600000000001, "end": 816.32, "text": " that or if one is active and the other one isn't that quantity is going to be low. And the a parameter"}, {"start": 816.32, "end": 826.48, "text": " here specifies how the weights are updated in response to this. So the a, b, c, d, and eta"}, {"start": 826.48, "end": 832.1600000000001, "text": " parameters right here are these are the learned parameters, these are going to be your learned"}, {"start": 832.1600000000001, "end": 839.6, "text": " rules to update the weights. So these change once after once per learning step was a once per. So"}, {"start": 839.6, "end": 844.08, "text": " after the episode is done, you're going to change these capital constants right here, including the"}, {"start": 844.08, "end": 852.96, "text": " eta, which is the learning rate. These things right here, these are per step. So this is each step"}, {"start": 852.96, "end": 858.1600000000001, "text": " gives you a different o i and o j. And then you'll adjust the weight based on that, you'll see that"}, {"start": 858.1600000000001, "end": 864.96, "text": " these constants here, they are per weight. So for each weight in this neural network, we learn a"}, {"start": 864.96, "end": 872.88, "text": " separate rule of how to update that particular weight. So the algorithm can, it can basically"}, {"start": 872.88, "end": 878.24, "text": " decide for a particular way, they can decide, well, if these two things fire together, often,"}, {"start": 878.24, "end": 885.76, "text": " I want to update my weight very heavily in response to that. Okay, so if the a is very high,"}, {"start": 885.76, "end": 894.0, "text": " that means the connection responds very thoroughly to when the two neurons fire together."}, {"start": 894.88, "end": 900.56, "text": " That is not the same as to say that connection should always be very strong, it's dependent on"}, {"start": 900.56, "end": 908.2399999999999, "text": " the input. So only when this quantity is high, should the network or should the weight be updated,"}, {"start": 908.2399999999999, "end": 916.7199999999999, "text": " and the a parameter modulates how well it's updated or how, how strongly it's up, it can also"}, {"start": 916.7199999999999, "end": 922.0, "text": " be negative, it can be zero, basically, meaning that, you know, it doesn't matter if they fire"}, {"start": 922.0, "end": 927.5999999999999, "text": " together, I don't want to update the weight, this particular weight and response that so you can see"}, {"start": 927.6, "end": 934.16, "text": " that you can learn these rules that can adapt to different inputs, because all of the changes,"}, {"start": 934.16, "end": 943.36, "text": " the delta here is dependent on the inputs, so on the correlation, but also on the different inputs"}, {"start": 943.36, "end": 950.96, "text": " themselves. And then there is also a constant right here. Okay, this is, as you can see, it's"}, {"start": 950.96, "end": 960.96, "text": " a linear function of the inputs of the oi and oj and their product. So I hope this is clear that"}, {"start": 961.6800000000001, "end": 968.08, "text": " the these Hebbian, these Hebbian rules, you learn a, b, c, d and eta, and that gives rise to an"}, {"start": 968.08, "end": 974.5600000000001, "text": " adaptive network that can change and reconfigure itself over the course of an episode, depending"}, {"start": 974.56, "end": 982.4799999999999, "text": " on the inputs. And one of the things right here, and we'll get to how you actually learn the rules"}, {"start": 982.4799999999999, "end": 987.3599999999999, "text": " itself in a second. But one of the things right here is very visible, as I said, in this first"}, {"start": 987.3599999999999, "end": 993.1199999999999, "text": " experiment, where it reconfigures itself continuously, but also in this experiment with"}, {"start": 993.1199999999999, "end": 998.9599999999999, "text": " this quadruped right here. So this quadruped, usually, it's, you know, you simply walk in a"}, {"start": 998.96, "end": 1005.76, "text": " direction, that's your reward, and RL is perfectly fine at this as well. However, this is a bit of a"}, {"start": 1005.76, "end": 1011.76, "text": " has a bit of a trick to it, namely, you are always in one of three situations, either you have an"}, {"start": 1011.76, "end": 1021.2, "text": " undamaged quadruped, or it's kind of left leg, front left leg is damaged, or its front right leg"}, {"start": 1021.2, "end": 1029.1200000000001, "text": " is damaged. Okay, and you don't tell the, you simply sample these situations uniformly, and"}, {"start": 1029.1200000000001, "end": 1036.8, "text": " you don't tell the algorithm which situation it is in. Now, if you look at, if you compare two"}, {"start": 1036.8, "end": 1042.88, "text": " methods, one where you directly learn the weights, you learn a fixed policy to solve, you know, this"}, {"start": 1042.88, "end": 1050.56, "text": " is one task, right, this is one task. And all of these three things appear with equal probability."}, {"start": 1050.56, "end": 1057.04, "text": " So you have to learn one policy to make all of this work. If you learn the weights directly,"}, {"start": 1057.6, "end": 1062.6399999999999, "text": " and you don't have a power, like, there's no doubt that like a powerful RL approach could deal with"}, {"start": 1062.6399999999999, "end": 1069.6799999999998, "text": " this task. But if in this case, if you just put a standard weight learner with the same number of"}, {"start": 1070.24, "end": 1075.76, "text": " the same size of policy as the Hebbian, they compare to, if you put a weight learner on it,"}, {"start": 1075.76, "end": 1081.52, "text": " it will not be able to solve this task satisfactorily. What it will do is it will say,"}, {"start": 1081.52, "end": 1087.6, "text": " well, I need one set of rules that make me walk as far as possible as often as possible. So,"}, {"start": 1088.4, "end": 1095.28, "text": " if you can see at the table, I'm already showing you the results right here. The table right here,"}, {"start": 1095.28, "end": 1102.0, "text": " if you have these static weights, you can see that it's performing pretty well in two out of"}, {"start": 1102.0, "end": 1108.48, "text": " two out of three situations, right? So it what it basically does, it says, okay,"}, {"start": 1109.92, "end": 1117.44, "text": " here is what where there's damage. What it does is it says, I'm going to learn to walk with my left"}, {"start": 1117.44, "end": 1123.52, "text": " leg using my left front leg. That means when I have no damage or damage to the right front leg,"}, {"start": 1123.52, "end": 1129.52, "text": " I'm just fine. And I'm just going to take the hit basically, where I have damage to the left front"}, {"start": 1129.52, "end": 1134.72, "text": " leg, because I'm it's just going to suck. So they solved, they solve this like walk more than 100"}, {"start": 1134.72, "end": 1144.96, "text": " steps. So that doesn't, since it can only learn a fixed policy, it basically discards the case"}, {"start": 1144.96, "end": 1150.56, "text": " where there's damage to the left front leg, it takes that hit in order to be better in the other"}, {"start": 1150.56, "end": 1156.48, "text": " two methods, you can see it's outperforming the Hebbian rule in the other two methods. But this"}, {"start": 1156.48, "end": 1162.96, "text": " shows you kind of the difference and the power that these Hebbian rules or these generally"}, {"start": 1162.96, "end": 1170.72, "text": " neuroplasticity might have because the Hebbian one is perfectly capable of at least in part"}, {"start": 1170.72, "end": 1177.76, "text": " adapting to the different situations. Now you can see that is not symmetric. Also the Hebbian"}, {"start": 1177.76, "end": 1185.2, "text": " rules they learn to know there's 860 and there's 440 of a thing that should actually be symmetric,"}, {"start": 1185.2, "end": 1192.48, "text": " we do expect a drop when there's damage, but it's not symmetric, which means that also the Hebbian"}, {"start": 1192.48, "end": 1199.28, "text": " rules, they kind of randomly focus on one over the other, but at least they're able in some"}, {"start": 1199.28, "end": 1207.1200000000001, "text": " degree to adapt to both. And that's because it depending on the input, you know, it has a rule"}, {"start": 1207.1200000000001, "end": 1213.1200000000001, "text": " in there that basically says, well, if the if the back left leg and the front right leg, you know,"}, {"start": 1213.12, "end": 1221.04, "text": " if they fire together, then I want to, if they if they fire together, the sensors that show me that"}, {"start": 1221.04, "end": 1225.52, "text": " they're moving, if they fire together, I'm going to wire them together, because that's how I walk,"}, {"start": 1225.52, "end": 1232.08, "text": " you know, front, right, back, left, and then the other way around. And if that's not the case,"}, {"start": 1232.08, "end": 1236.8799999999999, "text": " I'm not going to wire them together. So that would be the situation where you have damage. Instead,"}, {"start": 1236.8799999999999, "end": 1241.6, "text": " if they are not wired together, I'm going to and can do this in the next layer of the neural"}, {"start": 1241.6, "end": 1247.6, "text": " network, wire these other two things together, you know, if, if the first thing is not the case,"}, {"start": 1247.6, "end": 1253.84, "text": " I'm going to wire these other two things together to make up for that loss. And there you can see,"}, {"start": 1253.84, "end": 1260.08, "text": " there is kind of this logic built into the network. Now, again, I know you can do this with"}, {"start": 1260.8, "end": 1265.76, "text": " learning a fixed policy, you can achieve the same effects. The point here is just to show that"}, {"start": 1265.76, "end": 1273.44, "text": " given kind of a same size networks and so on, that you that there might be, there might be like a"}, {"start": 1273.44, "end": 1279.84, "text": " qualitative difference in certain situations. Again, by no means this is meant to outcompete"}, {"start": 1279.84, "end": 1289.52, "text": " RL or anything like this. Okay, so we'll we went there. Now, how are these rules actually learned?"}, {"start": 1289.52, "end": 1295.2, "text": " And there we have to again, make a distinction that is completely separate from the Hebbian"}, {"start": 1295.2, "end": 1301.52, "text": " non-Hebbian way. Okay, so the Hebbian non-Hebbian distinction was, do we learn the weights of the"}, {"start": 1301.52, "end": 1307.76, "text": " policy network directly? Or do we learn the rules to update the weights? Now the question is,"}, {"start": 1307.76, "end": 1314.56, "text": " whatever we learn, how do we learn it? And again, we have to draw the distinction this time between,"}, {"start": 1314.56, "end": 1319.9199999999998, "text": " I'm going to say classic, or even though the terminology is not really correct, classic RL"}, {"start": 1320.8799999999999, "end": 1330.1599999999999, "text": " and evolutionary methods. Okay. So in classic RL, what I would do is I would use my weights in order"}, {"start": 1330.1599999999999, "end": 1339.9199999999998, "text": " to obtain a reward. And then I would update my weights. So my delta w would be proportional to"}, {"start": 1339.92, "end": 1349.52, "text": " the gradient of w of the reward. Okay, so in the classic RL, especially in this is a policy gradient"}, {"start": 1349.52, "end": 1354.8000000000002, "text": " method right now. So I use my policy, my weights to get the reward, and then I would calculate a"}, {"start": 1354.8000000000002, "end": 1361.68, "text": " gradient. And, you know, usually the reward isn't differentiable. So you have this reinforced trick"}, {"start": 1362.16, "end": 1368.64, "text": " in order to pull the reward out. And you can read all of this up if you look at policy."}, {"start": 1368.64, "end": 1377.0400000000002, "text": " Gradient, the basic policy gradient methods, but this here tells me I need a gradient, you know,"}, {"start": 1377.0400000000002, "end": 1387.3600000000001, "text": " usually this is going to be the reward times the gradient of my fw of my input. So what this means"}, {"start": 1387.3600000000001, "end": 1397.2800000000002, "text": " is what this means is that if my reward is high, then I, I just want to know what do I need to"}, {"start": 1397.28, "end": 1405.44, "text": " do? What do I need to do to make more of what I just did? Okay, and the gradient ensures that for"}, {"start": 1405.44, "end": 1413.6, "text": " every single weight in your neural network, you know what to do. So the gradient means that I have"}, {"start": 1413.6, "end": 1419.6, "text": " an exact handle on how do I need to change this weight? How do I need to change that weight? How"}, {"start": 1419.6, "end": 1425.84, "text": " do I need to change this weight? In order, if the reward is high, and because of this multiplication"}, {"start": 1425.84, "end": 1431.9199999999998, "text": " here, I want to make more of what I just did. And the gradient tells me how if the reward is low,"}, {"start": 1431.9199999999998, "end": 1438.08, "text": " on the other hand, I want to make less of what I just did. But also the gradient tells me how that"}, {"start": 1438.08, "end": 1443.1999999999998, "text": " can be achieved, I simply go into the other direction than I would if the reward is high."}, {"start": 1443.84, "end": 1450.9599999999998, "text": " In evolutionary methods, we don't have we don't do this gradient calculation. Okay, now there can be"}, {"start": 1450.96, "end": 1456.4, "text": " advantages to not doing gradient calculation. Sometimes back propagation simply isn't possible,"}, {"start": 1456.4, "end": 1464.32, "text": " even if it is possible. And this is maybe the case where we're now. What we need to learn in our case"}, {"start": 1464.88, "end": 1469.92, "text": " is these rules to update the rules. And imagine you have an episode, and that's kind of episode"}, {"start": 1471.52, "end": 1476.96, "text": " you have step step step step and in each step, these rules are applied, right in each of these"}, {"start": 1476.96, "end": 1483.44, "text": " steps, the rules are applied, and at the end, you get a reward. So what you need to do is to back"}, {"start": 1483.44, "end": 1489.8400000000001, "text": " propagate that reward through all the steps and then through all the rules. Okay, and that might"}, {"start": 1489.8400000000001, "end": 1496.64, "text": " be just computationally not feasible or the rules. The rules right here are pretty, pretty easy, but"}, {"start": 1496.64, "end": 1503.92, "text": " the rules might not be differentiable. You actually have the same problem in general in classic RL as"}, {"start": 1503.92, "end": 1509.2, "text": " well. But you know, you can cut off time steps and so on. There are various hacks. In any case,"}, {"start": 1509.2, "end": 1514.88, "text": " there can be advantages to not having that gradient and evolutionary methods are a way to do"}, {"start": 1514.88, "end": 1522.8000000000002, "text": " that. In evolutionary method, usually you are don't train one agent, you train a population of agents."}, {"start": 1522.8000000000002, "end": 1531.3600000000001, "text": " So you have a bunch of these neural network agents in here. And the way you update the neural network"}, {"start": 1531.36, "end": 1536.24, "text": " agent is you simply let them run, you know, you let them run your app, the episode. So this is"}, {"start": 1536.9599999999998, "end": 1545.76, "text": " your W, one of them, you let them run the episode, they get a reward. And then you can do multiple"}, {"start": 1545.76, "end": 1550.24, "text": " things. So this depends on the evolutionary method. So you can either pick out the best"}, {"start": 1550.24, "end": 1559.12, "text": " performing agent, or you can update each agent according to some rule. The goal here is simply to"}, {"start": 1559.12, "end": 1564.32, "text": " to basically, you always want to take your weights, you want to add some noise to them."}, {"start": 1565.12, "end": 1570.9599999999998, "text": " And you want to see, does it get better or worse? If it gets better, good. If it gets worse,"}, {"start": 1570.9599999999998, "end": 1575.76, "text": " not good. Okay, the difference is without the gradient, you don't have a handle on how do you"}, {"start": 1575.76, "end": 1580.8799999999999, "text": " need to change each individual weight. All you can do is basically random walk and observe what"}, {"start": 1580.8799999999999, "end": 1586.6399999999999, "text": " happens. And if the random walk is, you know, turns out to be good, you go more into that direction of"}, {"start": 1586.64, "end": 1594.8000000000002, "text": " that random walk. So it's sort of a sort of a poor, poor man's gradient method in these evolutionary"}, {"start": 1594.8000000000002, "end": 1600.4, "text": " methods. Again, completely independent of what we learn, you can use the evolution evolutionary"}, {"start": 1600.4, "end": 1605.76, "text": " method to learn the fixed weights. And that's what actually what happens in the table I've shown you"}, {"start": 1606.48, "end": 1612.24, "text": " below. Or you can use the evolutionary method to learn the Hebbian update rules. As well, you can"}, {"start": 1612.24, "end": 1618.08, "text": " use RL to learn the fixed weight or the update rules. In this paper, they use evolutionary methods"}, {"start": 1618.08, "end": 1625.36, "text": " to learn the Hebbian update rules. And they compare mostly with using evolutionary methods to learn"}, {"start": 1625.36, "end": 1635.52, "text": " the fixed weights. Okay, the exact evolutionary step they use right here is the following. So ht"}, {"start": 1635.52, "end": 1641.28, "text": " here is going to be the thing that you learn. Now as compared to w being the network weights, h is"}, {"start": 1641.28, "end": 1648.08, "text": " going to be the Hebbian weights, because since we learn the Hebbian weights, so how they'll update"}, {"start": 1648.96, "end": 1655.44, "text": " each agent is going to be they'll take the Hebbian weights. And this, this here is how you update"}, {"start": 1655.44, "end": 1662.0, "text": " right, this is your delta h, how do you update the Hebbian weights? Well, what you do is you you"}, {"start": 1663.52, "end": 1670.96, "text": " perform n random perturbations. So I take my weights and I add noise, I just add noise,"}, {"start": 1670.96, "end": 1679.2, "text": " okay, so I am here, and I just make a bunch of versions of it. And then I observe how well are"}, {"start": 1679.2, "end": 1684.4, "text": " these versions doing? So how well are my random perturbations doing? This is going to be the"}, {"start": 1684.4, "end": 1690.08, "text": " fitness fi right here is going to be the fitness. And then I'm just going to perform a weighted"}, {"start": 1690.08, "end": 1700.08, "text": " average. So this is my weighted average of these new solutions. Okay, so if this solution here did"}, {"start": 1700.08, "end": 1707.28, "text": " pretty well, and this solution did pretty poorly, I want to walk you know, in this direction. And"}, {"start": 1707.28, "end": 1715.1999999999998, "text": " then again, I do the same thing here from here, I do a bunch of perturbations. And maybe this one did"}, {"start": 1715.1999999999998, "end": 1721.36, "text": " pretty well. And this one did pretty poorly, I want to walk in this direction, and so on. Okay,"}, {"start": 1721.36, "end": 1729.28, "text": " so that's how you you'll change the, you'll change weights or rules or whatever you want in an"}, {"start": 1729.28, "end": 1736.24, "text": " evolutionary method is, you know, it's pretty easy. It's easier than reinforcement learning,"}, {"start": 1736.24, "end": 1743.12, "text": " no back prop, no nothing. Basically, a black box optimizer. There are more complicated"}, {"start": 1743.12, "end": 1752.8, "text": " evolutionary methods, but no, we don't go into those here right now. Okay, so again, I've already"}, {"start": 1752.8, "end": 1758.8, "text": " shown you these results. Now I said these static weights are also with evolutionary method, they"}, {"start": 1758.8, "end": 1766.72, "text": " also report what you would get with like a RL approach, like PPO, you would get kind of the same"}, {"start": 1766.72, "end": 1776.24, "text": " thing as they get as they get here. So, oh, sorry. This is not the same as the table. Yeah, I was"}, {"start": 1776.24, "end": 1783.12, "text": " confused for a second. This here is for the car environment. Okay, this is this vision based"}, {"start": 1783.12, "end": 1790.8799999999999, "text": " environment. So with their method, they get like an 870 rewards with the heavy and based approach."}, {"start": 1792.0, "end": 1798.4799999999998, "text": " With the static weight, but still evolutionary method, they get a much lower reward. In fact,"}, {"start": 1798.4799999999998, "end": 1804.6399999999999, "text": " the heavy and based approach is about the same as you get here with an RL algorithm."}, {"start": 1805.6799999999998, "end": 1808.3999999999999, "text": " And as we said, the RL algorithm, more complicated."}, {"start": 1808.4, "end": 1815.52, "text": " And if you use like a if you use like a state of the art RL algorithm, not just PPO, you get a bit"}, {"start": 1815.52, "end": 1822.48, "text": " of a better performance, but not that much if you look at if you look at the actual numbers. So,"}, {"start": 1822.96, "end": 1828.96, "text": " you know, pretty cool to see that, again, this is not outperforming anything. This is simply"}, {"start": 1828.96, "end": 1838.48, "text": " showing that you can do that. They do a number of experiments where they go in the episode and they"}, {"start": 1838.48, "end": 1845.28, "text": " kind of change stuff in the episode. And one cool thing here is that they go and you know, this is"}, {"start": 1845.28, "end": 1851.68, "text": " an episode. So at the episode, you start with a random network each time in this heavy and setting,"}, {"start": 1851.68, "end": 1858.48, "text": " and then pretty quickly the rules adapt for a high performing right. So it starts to walk,"}, {"start": 1858.48, "end": 1864.3200000000002, "text": " it reconfigures itself and starts to walk. The reward here again, it doesn't have access to that,"}, {"start": 1864.3200000000002, "end": 1871.2, "text": " but we can measure it, of course. And then at this step A right here, they simply go to the weights"}, {"start": 1872.0800000000002, "end": 1878.96, "text": " and zero them out. So they just delete these weights right here. And only 10 time steps later,"}, {"start": 1878.96, "end": 1886.32, "text": " 10 time steps later, it has reconfigured itself, as you can see right here, in order to walk again."}, {"start": 1886.32, "end": 1892.0, "text": " So 10 time steps later, reconfigures itself, reconfigures itself and after a short while,"}, {"start": 1892.0, "end": 1900.48, "text": " right here, it's back to its kind of original performance, as you can see. So that's, I'd say"}, {"start": 1900.48, "end": 1907.92, "text": " that's fairly, fairly impressive. In this very short amount of time able to recover from such an"}, {"start": 1907.92, "end": 1914.0, "text": " and such an intervention. If you do this, of course, if you do this to your policy network,"}, {"start": 1914.0, "end": 1918.48, "text": " that's statically learned, it's going to be garbage. But I guess the fair comparison would be"}, {"start": 1918.48, "end": 1926.4, "text": " to delete the heavy and rules themselves. And, you know, so it's not like it's not like this can"}, {"start": 1926.4, "end": 1932.4, "text": " adapt to new situations, or something like this, this is still learned for particular environments,"}, {"start": 1932.4, "end": 1940.16, "text": " right. But the point here is that you learn the rules. And this is kind of a study on neuroplasticity."}, {"start": 1940.16, "end": 1946.96, "text": " Now, my question actually would be why this diagonal pattern appears and I have not seen"}, {"start": 1948.0800000000002, "end": 1955.3600000000001, "text": " like a clear explanation. Especially is this anti diagonal pattern. It's not so much here in the"}, {"start": 1955.3600000000001, "end": 1961.2, "text": " output layer, right? This is the output layer, there are 21 actions or so. And this one is this,"}, {"start": 1961.2, "end": 1968.56, "text": " this dimension. So not that much there, but there seems to be this rule. And this is not the case"}, {"start": 1969.2, "end": 1974.96, "text": " at the beginning, right? You saw the beginning you saw at the beginning, it was pretty random matrix."}, {"start": 1976.24, "end": 1985.04, "text": " So why? Why? Yeah, here, pretty random. And then there's this diagonal pattern. I don't know why."}, {"start": 1985.04, "end": 1991.92, "text": " If you know, let me know. I mean, it's anti diagonal, maybe it is actually diagonal and the"}, {"start": 1991.92, "end": 1997.6, "text": " forward the fully connected layer is just defined as something like w t times x. And"}, {"start": 2000.1599999999999, "end": 2007.12, "text": " but maybe this also depends on the random initialization. But there is no inherent way"}, {"start": 2007.12, "end": 2015.4399999999998, "text": " why particular neuron would you know, care about sending information to like the same"}, {"start": 2016.4799999999998, "end": 2024.4799999999998, "text": " height of neuron on the other side. Or is there? I don't know. I'm so is this a property of the"}, {"start": 2024.4799999999998, "end": 2031.76, "text": " evolutionary or the learning rules? It seems not because the learning rules don't depend on the"}, {"start": 2031.76, "end": 2040.08, "text": " position. I'm genuinely confused about this. And maybe, you know, maybe they've written it somewhere,"}, {"start": 2040.08, "end": 2045.52, "text": " I've just overlooked it, though I they do reference it, they say, Oh, there's this diagonal"}, {"start": 2045.52, "end": 2054.24, "text": " pattern appearing, but I don't think they ever say why it is diagonal. Okay, I might just be I"}, {"start": 2054.24, "end": 2060.0, "text": " might just be real dumb. Yeah. So they also, you know, they do some more experiments, they show,"}, {"start": 2060.0, "end": 2066.4, "text": " for example, that if you just have random Hebbian coefficients, then your algorithm just jumps"}, {"start": 2066.4, "end": 2072.88, "text": " around kind of in in weight space around the zero point. However, if you actually learn these"}, {"start": 2072.88, "end": 2078.08, "text": " Hebbian coefficients, as they do, you have like this clear attractor here. And you have these"}, {"start": 2078.08, "end": 2085.76, "text": " kind of oscillating curves. When, you know, when when you do that, you can see you're in the"}, {"start": 2085.76, "end": 2091.6800000000003, "text": " different situations where things are damaged, and so on. So all in all, I think it's a pretty"}, {"start": 2091.6800000000003, "end": 2098.96, "text": " interesting study. And I think these neuroplasticity is, it's a different way, you know, it's unclear"}, {"start": 2098.96, "end": 2104.6400000000003, "text": " to say if it will ever deliver the performance that RL delivers. But certainly there are"}, {"start": 2104.6400000000003, "end": 2111.36, "text": " situations where such plasticity is desired. And if we can also combine this with greater"}, {"start": 2111.36, "end": 2117.52, "text": " generalization performance, then, you know, we have agents that can quickly kind of reconfigure"}, {"start": 2118.08, "end": 2124.7200000000003, "text": " and a lot of work by these these kind of open ended learning community also plays into this"}, {"start": 2124.7200000000003, "end": 2130.7200000000003, "text": " roles, all in all pretty, pretty cool, non standard way of doing things. Last thing,"}, {"start": 2130.7200000000003, "end": 2135.84, "text": " the broader impact statement. Every now and then we'll look at a broader impact statement,"}, {"start": 2135.84, "end": 2140.0, "text": " since these are new, just to get kind of an overview of what they look like. So they say"}, {"start": 2140.0, "end": 2144.8, "text": " the ethical and future societal consequences of this are hard to predict, but likely similar"}, {"start": 2144.8, "end": 2151.12, "text": " to other work dealing with more adaptive agents and robots. In particular, by giving the robots"}, {"start": 2151.12, "end": 2155.92, "text": " the ability to still function when injured could make it easier from them being deployed in areas"}, {"start": 2156.56, "end": 2164.48, "text": " that have both a positive and negative impact on society. Okay, well, again, this it's not really"}, {"start": 2164.48, "end": 2170.2400000000002, "text": " giving robots the ability to still function when they're injured. I first I thought first I thought,"}, {"start": 2170.2400000000002, "end": 2178.56, "text": " okay, they train it when it's fully functioning, but then they damage it during test time. But as"}, {"start": 2178.56, "end": 2185.12, "text": " I understand it, as I understand the paper, they already train it with the damaged versions,"}, {"start": 2185.12, "end": 2193.6, "text": " they just don't tell the algorithm in which version it is right now. So it's not the same as"}, {"start": 2193.6, "end": 2199.68, "text": " being able to work when injured unless you've specifically trained for it. In this case, again,"}, {"start": 2199.68, "end": 2205.52, "text": " I could be wrong about this. Yeah. In the very long term robots that can adapt could help in"}, {"start": 2205.52, "end": 2212.16, "text": " industrial automation or help to care for the elderly. On the other hand, more adaptive robots"}, {"start": 2212.16, "end": 2217.04, "text": " could also be more easily used for military applications. The approach presented in this"}, {"start": 2217.04, "end": 2221.04, "text": " paper is far from being deployed in these areas, but is important to discuss its potential long"}, {"start": 2221.04, "end": 2227.84, "text": " term consequences early on. Now, okay, so let's evaluate the broader impact statement. Let's,"}, {"start": 2228.56, "end": 2236.96, "text": " well, the first check to do is always to simply replace whatever their method is with the word"}, {"start": 2236.96, "end": 2247.44, "text": " technology. Okay, so let's do that. In the very long term, technology could help in industrial"}, {"start": 2247.44, "end": 2253.84, "text": " automation or help to care for the elderly check. On the other hand, technology could also be more"}, {"start": 2253.84, "end": 2260.64, "text": " easily used for military application check. Technology is far from being deployed in these"}, {"start": 2260.64, "end": 2269.36, "text": " areas. Okay, I guess some technology isn't but advanced technology. Yeah. So again, the rule for"}, {"start": 2269.36, "end": 2276.48, "text": " broader impact statements seem to be you take whatever your method is and you go up until you"}, {"start": 2276.48, "end": 2283.12, "text": " find, you know, you're basically at technology or something equivalent. Because no one actually,"}, {"start": 2283.12, "end": 2289.52, "text": " I've never seen a broader impact statement that writes about the actual thing in the paper, they"}, {"start": 2289.52, "end": 2296.0, "text": " always go up like one layer or two. And then it basically regresses to technology, even though"}, {"start": 2296.64, "end": 2304.88, "text": " very few papers actually would be able to discuss their particular thing. But you know, and that and"}, {"start": 2304.88, "end": 2310.48, "text": " that. And then in terms of guidelines on broader impact statement, this one is missing, there's"}, {"start": 2310.48, "end": 2315.76, "text": " there's always this, the Holy Trifecta. So the Holy Trifecta is you go like a you know, like"}, {"start": 2315.76, "end": 2322.48, "text": " you're a, you're a Catholic, you go with your finger to your head, chest, left and right. And"}, {"start": 2322.48, "end": 2328.7200000000003, "text": " you say technology, good technology, bad technology biased. Okay, so you want to write a broader"}, {"start": 2328.72, "end": 2335.7599999999998, "text": " impact statement, go up the layers, technology, good, bad bias. And we're missing the bias here."}, {"start": 2336.56, "end": 2342.0, "text": " So that's, you know, I'm just following what these guidelines to broader impact statements are,"}, {"start": 2342.0, "end": 2348.24, "text": " I don't make the rules, I'm sorry, the the heavy ins make the rules, apparently. I'm not heavy in."}, {"start": 2348.8799999999997, "end": 2354.72, "text": " Okay, I hope you've enjoyed this paper and this video. Let me know what you think. Check out the"}, {"start": 2354.72, "end": 2361.8399999999997, "text": " videos that they have, I'll link them. And with that, I wish you a pleasant day. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=nv6oFDp6rNQ
Hopfield Networks is All You Need (Paper Explained)
#ai #transformer #attention Hopfield Networks are one of the classic models of biological memory networks. This paper generalizes modern Hopfield Networks to continuous states and shows that the corresponding update rule is equal to the attention mechanism used in modern Transformers. It further analyzes a pre-trained BERT model through the lens of Hopfield Networks and uses a Hopfield Attention Layer to perform Immune Repertoire Classification. OUTLINE: 0:00 - Intro & Overview 1:35 - Binary Hopfield Networks 5:55 - Continuous Hopfield Networks 8:15 - Update Rules & Energy Functions 13:30 - Connection to Transformers 14:35 - Hopfield Attention Layers 26:45 - Theoretical Analysis 48:10 - Investigating BERT 1:02:30 - Immune Repertoire Classification Paper: https://arxiv.org/abs/2008.02217 Code: https://github.com/ml-jku/hopfield-layers Immune Repertoire Classification Paper: https://arxiv.org/abs/2007.13505 My Video on Attention: https://youtu.be/iDulhoQ2pro My Video on BERT: https://youtu.be/-9evrZnBorM Abstract: We show that the transformer attention mechanism is the update rule of a modern Hopfield network with continuous states. This new Hopfield network can store exponentially (with the dimension) many patterns, converges with one update, and has exponentially small retrieval errors. The number of stored patterns is traded off against convergence speed and retrieval error. The new Hopfield network has three types of energy minima (fixed points of the update): (1) global fixed point averaging over all patterns, (2) metastable states averaging over a subset of patterns, and (3) fixed points which store a single pattern. Transformer and BERT models operate in their first layers preferably in the global averaging regime, while they operate in higher layers in metastable states. The gradient in transformers is maximal for metastable states, is uniformly distributed for global averaging, and vanishes for a fixed point near a stored pattern. Using the Hopfield network interpretation, we analyzed learning of transformer and BERT models. Learning starts with attention heads that average and then most of them switch to metastable states. However, the majority of heads in the first layers still averages and can be replaced by averaging, e.g. our proposed Gaussian weighting. In contrast, heads in the last layers steadily learn and seem to use metastable states to collect information created in lower layers. These heads seem to be a promising target for improving transformers. Neural networks with Hopfield networks outperform other methods on immune repertoire classification, where the Hopfield net stores several hundreds of thousands of patterns. We provide a new PyTorch layer called "Hopfield", which allows to equip deep learning architectures with modern Hopfield networks as a new powerful concept comprising pooling, memory, and attention. GitHub: this https URL Authors: Hubert Ramsauer, Bernhard Schäfl, Johannes Lehner, Philipp Seidl, Michael Widrich, Lukas Gruber, Markus Holzleitner, Milena Pavlović, Geir Kjetil Sandve, Victor Greiff, David Kreil, Michael Kopp, Günter Klambauer, Johannes Brandstetter, Sepp Hochreiter Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, today we'll look at Hopfield networks is all you need by researchers from the Johannes Kepler University in Linz and the University of Oslo. So on high level this paper proposes a new type of Hopfield networks that generalizes modern Hopfield networks from binary patterns to continuous patterns, and then shows that the retrieval update rule of these new Hopfield networks is equivalent to the attention mechanism that's used in modern transformers. And it's actually a more general formulation of the attention mechanism. And therefore, it can be used to do kind of a variety of things to improve modern deep learning. And it also has a companion paper where it applies this to some kind of immunology research and gets chiefs state of the art in a task that is specifically suited to this type of attention. Alright, let's dive in together, we'll go over what this paper does, what it proposes, and so on. If you like pay if you like videos like this, consider subscribing, sharing it out. And I hope you're enjoying this. Alright, also, thanks to my discord community for you know, very helpful bringing me up to speed on this paper. Super interesting discussions there. If you're not on the discord yet, I invite you to join. It's fun. Okay. So what is a Hopfield network? A Hopfield network is a pretty kind of old style, old conceptualization of a neural network. So in a Hopfield network, what your goal would be is you can conceptualize it as a bit of a neural network. So let's say we have five neurons or something like this. What your goal would be is to have a neural network where you can store so called patterns. And a pattern in this case would be a binary string of size five. So for example, 10100 or 11010. And you'd have a list of these patterns. And what your goal would be is to store these patterns in the neural network, such that in here, you know, we'll just consider everything to be sort of connected to everything else. And what your goal would be in this is that you can kind of store patterns inside this neural network and you adjust the weights somehow. So this was, as I said, this was this was this is kind of an old model. You store, you adapt the weights such that you store these patterns. And what does it mean for a pattern to be stored? If you have stored a pattern, you can you will then be able to retrieve it. And you retrieve a pattern in these kind of old style Hopfield networks by providing a partial pattern. So what you'll say is, for example, I, I want a pattern that starts with 110. And you give that to the network. And there would be a so called update rule. And the update rule is kind of an internal rule. So let's just go through this. So here, this 110, maybe this is 110. And you know, and then they would kind of send messages around. So this update rule would somehow adjust the value of this and this neuron here to what's most compatible with the network weights. And if if the network weights have been adjusted correctly, this will turn out then at the end of applying this update rule, that this is a one and this is a zero. And therefore, this pattern here is retrieved. Now had I input 101 at the beginning, then the outcome would be different, hopefully, this pattern here would have been retrieved. Okay, so you can see the applications of this, like you can have the first three digits as sort of a database key, and then the last ones as sort of the value that you store along with it. And then you can simply provide the first few, you can also provide you don't always have to provide three. So this all depends this is, this is sort of an, as I said, an old conceptualization of neural networks. So people were imagining that this is kind of how the brain works, you know, fire together wire together. And also with research into this, it turns out that, you know, you might think, you know, there's there's kind of five neurons. So maybe I can store five different patterns, you know, accurately, because if I store too many patterns, right, if I have many, many, many, many patterns, then I can't expect to be able to retrieve all the patterns again, because some of them will just be so equal that, you know, many will start maybe with this, and I won't have a chance to, to retrieve the one I want, or the update rule will make a mistake. So you might think this might be like five, because I have five neurons, or maybe 10, because I have 10 connections. But it turns out that in modern Hopfield networks with the appropriate update rule, you can store exponentially many patterns in these networks exponentially many in the in the dimension of the in the dimension of the patterns. And here, I guess that will be the length of the pattern. So this is a little bit surprising the kind of storage capacity of these networks. And we'll, this, this paper here generalizes that to continuous to continuous states. So what do we mean? With continuous states, I guess I mean continuous patterns. So no longer is a pattern, a binary string, but a pattern now is a string of floating point numbers, like 0.5, 1.3, and so on. And, you know, a string of floating or a sequence of floating point numbers is naturally depicted as a vector, okay. So our patterns are going to be different vectors that we store. And, you know, in high dimensions that the vectors will be kind of separated well from each other as long as we don't have too many. But this paper shows that all these properties for the modern Hopfield networks that hold for binary strings still hold if you go to these kind of continuous to these vector patterns. That means you can store exponentially many patterns in the dimensions of the vector, which is pretty surprising, right? Because you'd think like, you know, after you have one vector per dimension, that, you know, after that, it might get a bit shaky. But no, you can actually store exponentially many. That's pretty surprising. And this paper is a lot about how to do that, and the fact that that the fact that that happens, and so on. So we've talked about update rules for these kind of Hopfield networks. And I haven't really specified what that is, I've just said that, you know, I enter a pattern, and then the network does something and outcomes, outcomes, the whatever the pattern that matches my query. So this here is called a query. You might already, this is on purpose, like the kind of overlap between the attention mechanism, lingo and the Hopfield network lingo, we're going to conflate the two to kind of make clear where the two overlap. If you don't know what an attention mechanism is, or aren't familiar with it, watch my video on attention is all you need. Once you watch that, this video will make a lot more sense. Alright, so in what the update rule does is specifically in the update rule that there isn't only one, right, there are many different proposals of Hopfield networks, and they all lead to different properties. But what an update rule does ultimately is it minimizes what's called an energy. So every type of Hopfield network is associated with an energy function. And this the energy function of the modern Hopfield network for binary strings is this energy function right here. So with x, x is the pattern, the pattern, this is the kind of state of the Hopfield network. And these are the whatever is stored in the network. And then the Xi here is the query that you enter into the network. And then the energy here tells you this quantity, you have to minimize this quantity in order to retrieve the pattern that you want. Okay, now, we are never directly working with the energy as such. So what you could do is, for example, use backprop or something to use gradient descent to decrease the decrease the energy. But usually, along with an energy function comes an update function. And the update function is what I've talked about here, like you do something, and then the network does something and then you get the pattern out, what the network does is it minimizes its energy function. And the update rule is made such that the corresponding energy function is minimized. So the energy function is more like a theoretical consideration that you say, okay, here is my energy function of my Hopfield network. And the there will be a corresponding update rule that minimizes that energy function. And if you use that update rule, maybe multiple times, then the energy function will be minimized, and you will have retrieved your pattern, or not, if, if you have too many patterns stored, it might also fail. Right? So they, they say what the update rules are in the, in the text here for the old Hopfield networks, but we're not really interested in the old ones, we're interested in the ones that this paper cares about, namely, where the patterns that you store in the Hopfield network are these vectors over our vector patterns. And the query is also a vector pattern. So you want to store all of these patterns into the Hopfield network. So I'm going to draw it like this here, I'm going to store it into the Hopfield network. And then after that, you want to come up with a query. And the query is like this. And in the case of the binary strings, we had something like, well, I sort of know half of my binary string. Now, in the vector Hopfield network, it's more like, well, I sort of kind of know the direction that my vector should point in, okay. And you will read what you want to retrieve is the vector that has kind of a large inner product. Okay, so if I enter this query into my Hopfield network, what I hope is that this vector here is retrieved. Now you see, it's not exactly the same vector, like they do point if I translate that here by I, it's maybe something like this. But so they are different. But you want to say, well, I kind of know what I want, I kind of want something like this. And then the Hopfield network would answer with, ah, I have something like this, it's this right here. Okay, so that the connection to attention mechanism should become pretty, pretty obvious right now. But the to actually establish this formally is the kind of the point of this paper. And, you know, it's pretty cool to see. So they formulate this new energy right here, this is the energy of this new continuous Hopfield network. Specifically, they have to have this term right here, because they now have continuous states and continuous queries. This, if you minimize the energy, it basically means that your query can never go to infinity, because you have the query right here in the energy function. The update rule is this right here. And we'll look at that in a moment. But remember, the update rule is what you actually implement in code. So if I, if I have a query right here, I plug it in here, this is the state of my Hopfield network. And I apply this rule multiple times. And out comes the kind of answer of the Hopfield network to my question. So the input this and the outcomes this after I update, after I apply the update rule, maybe multiple times, right. And interestingly, you can already see that this here, if you rewrite a bunch of these quantities, if you rewrite the beta here, which is the softmax temperature in a way to be one over square root of D. And if you take the query the psi here to be the query matrix, and if you take the x here to be the key matrix, then this is equivalent to the update or sorry, the attention mechanism of a modern transformer. So that's the point of the paper is that we can look at the transformer attention mechanism as a Hopfield network. And they have this interesting, this interesting diagram at the end right here. So the appendix, you know, this is typical, I guess, Sepp Hocher, I remember the Seeloo paper had like 60 pages of machine proof appendix. This also this has like 70 page appendix, crazy. But at the end of the appendix, you'll find this diagram right here. Now, usually, in an attention mechanism, you have whatever the input is, so you have an input right here. So this is attention mechanisms, or at least transformers, they work on sequences or sets of objects. And from these, you'll generate three things, you'll generate the, you'll generate the queries, the keys and the values. Now, you can either generate the queries from the same objects, which would be self attention, or you can generate the queries from like a different object over here. It doesn't, it doesn't matter too much for our discussions. But either you, you know, have a reference input, or you have, you know, this kind of same input all the way. And then what you do is use three different heads, or three different matrices to transform that input into queries, keys and values. So I often conceptualize this as you have kind of your input set, and each of the input sets outputs a key. And also each one, which would be a vector. And also each one outputs a query. So I often draw this here, the same sequence, and each one outputs a query. And the query sort of the query is kind of a request for information. So the key exposes sort of what exposes something about the input here. So this could be a sentence down here, this could be my cat is very pretty. And the, the, the vector, the key vector right here could encode something like this is a noun, or this is an animal or anything like this, right. And the query here, it could ask for, for other things. So, for example, since this is cat, this vector right here, the query vector is generated from that, you know, token cat. Now, it could recognize that cat is a noun. And it could ask the other nodes to basically say, are there any adjectives around here? Because, you know, adjectives, because it itself is a noun, it's the object of the sentence, right? It could ask, are there any kind of adjectives that describe the object? Because that would be naturally a thing to ask. If you were the noun, you would want to know, are there any kind of modifiers for for me? So it could output the query and the query here could mean, you know, this direction could mean adjectives. And you see here, the word pretty is an adjective. So it itself would output a key that says, by the way, I'm an adjective, right? So if the cat asks, then if this node asks for an adjective, and this outputs the the adjective vector, then because the inner product between the two things is high, this will be routed here. So attention mechanisms, basically information routing, that's how I always describe it. But in this paper, we look at it more like these here are the patterns that are stored in a Hopfield network. And I by inputting a query, and the dot product being the update rule of the Hopfield network, I retrieve from the Hopfield network, I retrieve the appropriate pattern that I asked for, okay. And then you know, the values, the values are simply a modification of the keys in this form. But a lot of people also do keys and values to be the same thing. Yeah, but the this routing of information happens here, where you multiply the queries and the keys, and then you put a softmax over them. Okay, so if you just look from the perspective of a single node, like this node here, this cat node, what it would do is it would inner product its own query vector with all of the key vectors, right? So it would build an inner product with all of these. And then it would normalize, it would put it through a softmax, which will kind of give it a distribution, right? So here would give it like, so this is actually matches because my well my is also very important for cat. This, this, this is just an accident. I did not plan this, this here, this also well, many things match. But that, in our example, we would just say that this last one, it's, it's not only higher, it's also wider. It matches very well, right. And so the information routing would route mostly information from this pretty token to the cat token, which makes sense in our case, right? This is the attention mechanism. Now, since if we are interpreting this as a Hopfield network, and the update rule here is the dot product, you can actually think of applying this rule multiple times. So what happens now, if we and this is where this update rule comes in? What happens if we take this distribution? And we don't aggregate the values, like usually, we would aggregate the values by this distribution? What if we aggregate the keys by this distribution? Okay, what comes out? Well, if we look at this, and you know, let's just assume that this key right here matches really well, but the others also match a little bit, what would come out would be a weighted average where a lot of weight is put on this particular key. So what will turn out would be something like something that's very close to that key, you can see. I'm going to draw the old key here in green. And I want to draw the old query in blue. So you see that it's the whatever comes out is not the query. But it's also not that only key that matches, right? It's kind of a weighted average, but with that key dominating. Okay, now, since, you know, in a Hopfield network, what we would do is we would go again, we would put this new thing, the red thing, instead of the query vector. Okay, so we would use this aggregated keys, this weighted average, as a new query vector for that node right here. So duplicate that node over here, I'll use that query vector again, and do the same thing again, okay, inner product with all of the query vectors. And now since this is already an aggregate of the query vectors, what's going to happen, of course, the distribution that's going to come out is going to be weighted even more heavily into the direction. So let's make it even wider into the direction of that key that matches, okay. And you can pretty clearly see if I do that iteratively, then that will lead to a situation where everything is like very low, except that one key will sort of dominate the distribution and ultra high and ultra wide. Okay, and that's how that's exactly how a Hopfield network works, right? I would input the query, which would be sort of what I want, right? I kind of know what I want, okay. And then I apply this rule multiple times. And with each time, I refine, refine, refine until I decide on a pattern, right? The Hopfield network is made for pattern retrieval. And these here are the patterns that I want to retrieve. So here, the patterns aren't kind of stored in the network beforehand, but the patterns are also generated like in an attention layer. So the keys are generated by the previous layer or by these matrices. But that doesn't matter for the Hopfield network update rule. So you see here that the attention mechanism can be interpreted as simply one step making one step of this update rule, but you can think of making actually multiple steps and retrieving the particular key. So, you know, deciding on a sort of a hard routing of particular information. Now that only works if, if there are no other vectors that are close to that particular key, right? So if the query is this, and you know, the way I drew it here, you can see that there are many, there is this one, and this one, and this one that matches. So technically, the way I drew it, what would happen most likely is no many, no matter how many times you apply your update rule, it would sort of result in kind of the average of the three keys, right? So because they're all matching, and they would all contribute to that weighted average of the query in the next step. And then that means basically the conversions would be to something in the middle. And that's going to be a central point of this paper in which situation we are. So they call the first part is retrieving a single pattern. And they call the second situation where you have multiple patterns that all match that are not well separated from each other. They call this a meta stable state. And it's going to be pretty interesting to look at transform like BERT language models and look at where they actually are. Are they actually operating in this single pattern retrieval mode? Or are they operating in the meta stable state mode? Alright, so here you can see it in the diagram, the only thing different this from a Hopfield network, sorry, from an attention mechanism is this branch right here. So here you ask, do you want to do multiple updates after you've, you've multiplied the queries and the keys? Do you want to do multiple updates? If yes, so if you're in a this Hopfield network situation, you want to do multiple updates, then you go back, as you can see, and you do you use the keys together with the output of the softmax to generate a new query. So this query queue here is now generated from the output here and the key. So the keys are the same. These are this is the same thing. It's just put here twice. Okay, this is exactly what we discussed. Okay, I hope that's some somehow clear that these the the attention mechanism is simply a one step Hopfield network pattern retrieval algorithm with a particular update rule that is that is matches this energy function that they propose right here. Of course, they do this, you know, particularly because the update rule that turns out is the transformer update rule. But but I actually don't know if they backwards engineered the energy function to match the transformer or if they first came up with a continuous Hopfield networks and then just kind of discovered that it's like the transformer. We'll maybe never find out. Okay, so let's go. There are a couple of theorems. I believe there are four, five theorems right here that show that kind of make some points about this about this stuff. And we'll go through them won't go through the proofs or any, you know, super in depth meaning, but it's pretty cool to go through them. And they are proved very rigorously. As I said, there's a 70 page appendix. So have a look at that if you're up for it. Okay, so they say here we have an update rule. This is our update rule for our new Hopfield networks. So the first theorem they say is the update rule that we propose converges globally. If we apply the update rule repeatedly, the energy for t goes equals infinity and the energy will converge, sorry, the energy will converge to a fixed point, this being a fixed point for t equals sort of for t goes to infinity. Yeah, if this is a fixed point, basically saying that if I apply this update rule here over and over and over again, it will, it will make this energy function converge to a fixed, it will make this energy function converge. Don't want to say anything mistakenly here or claim too much. But that basically connects the update rule to the energy. Okay, so just showing like this really is the update rule for that particular energy function. Okay, now as as itself, it's not super duper interesting yet. But now we get to theorem two. So theorem two, for the iteration, that's the update rule that we just looked at, we have, we have that this convergence holds as t goes to infinity for some stationary point. stationary point. Furthermore, this quantity here goes to zero. So that means this is the the update at t plus one, and this is the update at t, and the difference between them goes to zero. So that means not only does the energy converge, but the iterates themselves convert. So the algorithm actually converges the individual updates of the algorithm. So this e new at some point that will no longer change because the the norm between it and the previous one will go to zero. You can see that either the sequence here converges, or in the other case, the set of limit points yada yada is a connecting subset. This is a bit over the top here. They say, okay, it can either converge to a point or it can converge to a connected subset. But if the loss is finite, then any sequence generated by the iteration equation three converges to some fixed point. So, you know, basically saying that here we have this is not the loss, I'm sorry. No, this is the domain. Never mind. I'm an idiot. This is basically saying that this algorithm will converge. Okay. And they define here what it means for a pattern to be stored and retrieved. And that's for establishing what the kind of storage capacity of a Hopfield network is. So we've established that the update rule minimizes the appropriate energy, and the update rule will converge at some point, which means that we can, you know, if it converges, we can retrieve the pattern that it converges to. So now we define how many patterns can we actually store. For that, we need to know what does it mean for a pattern to be stored. So we assume that we have patterns and these patterns are called x. Okay, x i, we have n different patterns. Each one is called x with a subscript. We assume that around every pattern, a sphere is given. So how do we imagine this? We have these patterns, and this is this is just a space that they consider patterns of the on the sphere. But we'll just conceptualize it as this will have a space. There are patterns we want to store, okay. And we'll say around every pattern, there is a sphere. Okay, sphere like this. And naturally, the patterns are going to be there's going to be a notion of well separated patterns. And you can imagine this a little bit like these spheres won't be touching each other. If these spheres aren't touching each other, that means that the patterns are kind of well separated. And that means that if we initialize the query, remember, the query here is a vector that kind of sort of looks like a pattern. And that means the query is kind of close to the pattern in some notion of distance. So if we initialize the query somewhere in that sphere, then it might if it converges to that sphere to that pattern, then we retrieve the pattern. Okay. Now it gets a bit more complicated than this, but not much more. We say a pattern is stored, if there is a single fixed point inside the sphere, to which all points that start inside the sphere converge, and none of the spheres intersect. So the sphere of point i doesn't intersect with the sphere of point j. So that's where we say all these spheres are non intersecting. We say x i is retrieved if the iteration equation three converged to the single fixed point in that sphere, the retrieval error is the distance. So you'll notice you have two things you have x i, this is the actual pattern, and you have x i star, this is the retrieved pattern. So these hopfers, they don't always have to give you the same thing that you stored. That's part of the nature of continuous neural networks, whatnot. So for every sphere, we say there is a pattern, there is a sphere. Now, we as pattern is stored, if every, I can start wherever I want in this sphere, okay, wherever I want, it will always converge to a point that's inside the sphere. Okay, and maybe that point isn't the pattern that I stored, but actually this point right here, but wherever I start, I will always converge to that particular point. If that's the case, then I have stored this particular pattern. Now, the fact is, I don't retrieve this particular pattern, I retrieve the blue thing. But I can then define the error of retrieval. And the error of retrieval is simply the distance between the two things. Ideally, this distance is very small, right? But you know, we can't, can't guarantee it. Now, there are going to be theorems that deal exactly with this retrieval error. But first, you can see that here, if, if these spheres become larger, you can't accurately store a pattern anymore. So this is the kind of ideal situation. But there are also situations where these spheres, you know, if I have these patterns right here, these spheres are so large, kind of the attractions of the patterns are so large that if I start, let's say here, then I don't converge to either of these two patterns, I converge to like something in the middle, I converge to maybe this point right here. And that's going to be one of these meta stable states, okay, we're going to encounter situations like this, but we're also going to encounter situations like this. And the bottom thing isn't necessarily bad. And that's what you have to keep in mind. And yeah, as I said, we'll get to it, but just keep this kind of sphere image in mind. Okay. So first, we'll just deal with the, you know, the up the top situation where we store patterns and then retrieve patterns. So we'll assume a failure probability, which is p, and p is going to be no pretty, pretty low for their example. So they have p equals 0.001, you know, like a 0.1% error probability of retrieving your pattern, things like this. And randomly chosen patterns on the sphere with radius m, we define some constants, yada, yada, yada, then with probability one minus p, the number of random patterns that can be stored and stored in the sense of having these spheres around them so that you can retrieve them accurately, or at least you can retrieve something that's close to them is is bounded lower bounded by this quantity right here. So there's the square root of p, there is this constant c, but then you see that d is in the exponent right here. So that means it's exponential in the number of dimensions. So that's, that's pretty cool. So if you add a dimension, you exponentially increase the number of the number of patterns you can store. And, you know, that's, that is a kind of, I mean, it's, it's been known for modern Hopfield networks with binary strings. So it's not uber surprising, but if you have, you know, it's not what you would imagine, like that. Okay, so they may give a few examples of these, you have to set these constants, you know, in a particular fashion, such that this is given and so on. But they say, examples here are where c is something like three, and d is 20. So if you were to add a 21st dimension, then your, I guess, storage capacity would increase by a factor of three, which is pretty cool. All right, so this is how many that we can store infinitely, not sorry, exponentially many patterns in these networks. Now, they deal, they say, the next theorem states that the update rule typically converges after one update if the patterns are well separated. Okay, so if we're in a situation where these patterns are well separated, which is kind of like this, but you can also imagine this in terms of dot products, because we operate in the space of dot products. So if the patterns are well separated, that sort of means that they all kind of sort of point away from each other. And this notion of separation is going to be captured by this quantity right here. This is the separation of example of pattern i, which is just the inner product with itself, minus the maximum inner product with any other pattern. And this quantity is going to be like and this quantity is going to be large when no other pattern is close to it. So when the separation is large, then the update rule, the retrieval rule of calculating, you know, if a query, calculate the inner product with all of those, then I reweigh all of the patterns by that inner product by the softmax, then I use that new thing as a query again, and so on, as we discussed, it will converge to the closest pattern. But this theorem says it actually converges pretty fast. And here I have my problems with saying that it converges after one step, typically converges after one update, because that, you know, generally depends on a lot of constants, as we'll see, but it does converge exponentially fast in this separation constant. As a theorem for says, with queries I after one update, the distance of the new point to the fixed point is exponentially small in the separation delta i, the precise bound using the Jacobian and its value in the mean value theorem are the following. So here you can see, this is the distance between the updated psi after one step, and the and the fixed point right here, this is what it converges to is going to be the distance as it was before times this thing right here. So you can see since this is a this is a multiplicative update. And in this Jacobian, so this is expanded down here, this is this. You can see here you have the you have this, sorry, yeah, this is this. So this is bounded by that, you have the exponent, the exponential function, negative this separation right here. So the higher the separation, the faster this algorithm converges, okay. To say that it converges after one step is, you know, might be a bit of bragging. I don't know if this is a common thing, if you have like an exponential convergence that you are allowed to say, it's after one step. I'm not sure especially what I'm not sure about is that you have n here as linear constants in that factor, okay. So if you if you and that's what they do in their code. So if you look at their code and the codes available, which is pretty cool, it's implemented in PyTorch as a general module that can you can just drop in. So this is not only for transformers, this is for you can replace like LSTM you can replace pooling mechanisms, you can, you know, do a whole bunch of stuff in their paper in the accompanying paper, they do this multi instance learning with giant sets on using these hopfield layers. So pretty, pretty cool. This code is definitely worth kind of checking out and maybe you want to replace some stuff with you. But the question is, how many of these update steps should you do, right? Because we looked at the diagram, at least in the attention mechanism, it seems like you have attention layers, right, you have a transformer, and the transformer consists of, you know, you have this input right here, and you go through layer, layer, layer, layer, layer, and in each layer, there's contained in it, and one of these attention mechanism, right, this entire thing is in this layer, okay. And now if you interpret this as a hopfield network, and you want to do multiple steps, that means you go this branch right here. So in each layer, potentially, you do multiple steps of these things. So for whatever computational constraints transformers had already, this will certainly make it worse. But also, you need to decide how many steps you want to do. Now you can hard code that, of course, but they say you should do these steps until this norm here, until the norm between the old and the new is small enough. So where is that? So you can't measure how close you are to the convergence points, right, because you don't know in practice. But you can measure how far you're away, you can measure, where did we have it, you can measure this quantity right here, that's something you can measure how far two iterates are apart. So what you'll simply do is you'll measure that, and if that is small enough, then you'll, you'll stop. But that, I guess, is very related to this. So how if you, we've already proven it converges to this x star. So I guess, we can approximate this quantity right here with the quantity above. And that tells you how many updates you need to do. And that quantity is linear, not only linear, but actually here quadratic in n, I don't care, you know, yes, it's exponential in the separation. But it's quadratic in n. And if I've learned anything from kind of my fast code courses, is that constants actually matter when you're not dealing with infinity with an infinite number of steps. So the number of the number of steps you need to do, I guess, will depend on the sequence length in a quadratic fashion. So I'm not sure you can always claim this is converges in one step. Now I might be super mistaken here. And none of this will can, none of this actually makes a difference in the in the light of the exponential decay here. But I would just, I'm just a bit worried saying this usually converges in one step. It's clear, I guess, why they do it, right? Because the attention mechanism in transformers is a one step application of this rule. And this here is kind of a theoretical justification for interpreting this precisely as a Hopfield network, because you'd say, well, in a Hopfield network, you would do multiple steps. But wait, wait, we can actually prove that even if you interpret it as a Hopfield network, you it can it usually converges after one step. So what you're actually doing in a transformer is applying a Hopfield network update rule to convergence. So yeah, I'm not Yeah, I might be bickering on a high level here luxury problems. Theorem five then says so theorem four is how fast does this converge? Theorem five, the last theorem right here, says that the retrieval error of a pattern, and so this is the this is what you converge to, and this is what you've stored, is bounded by, again, something that's exponential in the separation right here, as you can see. Okay, so that was the theorem. So we go quickly through them again, theorems one and two deal with the convergence of this algorithm and the fact that it actually minimizes the proposed energy. Then theorem three says you can store exponentially many patterns in terms of the dimension of your space. And theorems four and five say that this update rule will converge exponentially fast after after one step, if you believe that, and the retrieval error will also go down exponentially fast with the number of update steps that you do. Okay, that sounds pretty, pretty, pretty good. But we've heard it, it's very dependent on how well separated these patterns are. And it turns out that it's, you know, at least in transformers, they aren't always well separated. And that might be on purpose. Remember, the the states here, the patterns aren't pre stored, like in a classic Hopfield network, but the patterns, if you interpret an attention mechanism as this, are also generated by the network itself. So the pattern matrix that you retrieve from, and the query are generated by the attention mechanism. In this case, as I said, this is applicable to many, many more domains than just this. But yeah, so there's another slight modification that you have to do to make this actually equivalent to an attention mechanism. And that is, you'll have to recast the value, because usually what you'll do is you have some sort of input, and then you make queries, keys and values from that using different heads. The only thing to make it formally equivalent is you have to make the values generated from the keys. So the keys give rise to the values, as you can see right here, you first multiply with the key matrix, and then with the value matrix, I think that's, you know, that I don't, I doubt that this will will change anything. If you, if you, the only way that could really change anything is if this matrix here would be super low rank, like collapse the space of into like very few dimensions, which the value matrix wouldn't do. So, you know, but just letting you know that the technical equality requires this slight modification. Okay, now we said that it might not, you know, be that this is always super well separate, and you retrieve a single pattern. And that's what they research here in a pre trained BERT model. So they take a pre trained BERT model from I guess, from Hugging Face, and they run, they just run a data set through it. And what they do is, so for each, for each query, and sorry, for each attention head, because you've multiple ones of these attention heads, right? In each layer, to each layer, you have multiple ones of these heads for each head, they look at over the course of the whole data set, how do these softmax distributions look like? So when you believe that this is a Hopfield network, and you believe that this converges in one step, then if the patterns are well separated, what we would expect is a distribution, as we said, like this, okay, there will be one dominant pattern that you retrieve, you know, that's what you want to retrieve, that's what comes out, but a bang, you retrieve that accurate pattern, anything else would mean that the Hopfield network sort of failed, right? It wouldn't give you back one particular pattern. So they have, I think that's a pretty, it's a pretty smart experiment, they look, how many bars do we need to add? How many of these bars in the softmax distribution do we need to add to reach 90%? It depends a bit on the temperature of the softmax, which is hard coded in attention mechanism, bdb is one, this squared over d. So they say, how many do we need to add to get to 0.9 to 90% of the mass of this distribution? And if this is the Hopfield network, where you retrieve one pattern, then one will be enough, right? One of these bars will probably be, I don't know, like 99%. Okay, but there are other cases, imagine the case where the patterns and the query you retrieve the spheres that it gives rise to are all like overlapping, okay? So what that will do is it won't converge to any particular pattern, but the attractor space in this kind. So you can imagine if you have two spheres that are apart from each other, the update rule converges either. So if it's closer to here, it converge here, if it's closer to here, it will converge here. But if they are overlapping, like this, the energy landscape will actually make it such that it will neither if it starts somewhere, it will neither converge to here nor to here, it will actually converge to somewhere in the middle, okay, into the mean of the stored patterns. And if we take that to the extreme, what could be is it could be that the softmax distribution looks completely uniform, okay, which would basically mean that, you know, I don't care where my information comes from just average. And this has its applications. So if you, for example, want to make a sentiment classifier, very cheap way to do that is to simply take pre trained word embeddings like glove or word2vec, you know, assign each word, word embedding, and then just average the word embeddings, okay. And you count on the fact if there are a lot of kind of negative words in there, like bad, sad, angry, the word embedding kind of will, you know, reflect that and the average word embedding will point more into the bad direction. And if there's a lot of happy words, the average will point into the happy direction. Okay, so there are applications of averaging information, not caring particularly where it comes from. And in that case, what we'd expect is that this number and we'll call that, so we'll call that the number K. In this case, it equals one. But in this case, K equals, I guess, n, the number of inputs, okay, because we need, well, not maybe n, but, you know, approximately, we need almost all of them to, to reach the 90%. Okay, and there is an in between, and these are called these meta stable states, where in the in between is something like, you'd have a couple of patterns here, a couple here, and a couple, maybe here. It's almost like a clustering like and these overlap, and these overlap, and these overlap, but they don't overlap with each other, which means that if you start somewhere here, you would converge to the mean, but not to the mean of all the patterns, but just to the mean of these patterns, and here, here and here, here. So this, this is like a clustering in latent space, right? So you can interpret these Hopfield update rules as somehow, you know, getting not going to a particular pattern, but going to sort of a cluster. And this is, if you ask something like, hey, is there any adjective around, right? And all of these patterns, they kind of overlap in that space in that query space of adjective, they overlap. And therefore, the update rule would converge to sort of the mean, which would basically say, yes, there is an adjective here, right? And the information would not be routed. So that the distribution, if we start here, I think we converge to this, the distribution would look something like small, small, small, and then you'd have a couple of large ones. Right, you'd have like, maybe two or three or four of large ones. And these would exactly correspond to the patterns here. So the information will be routed from all of those in that cluster to this particular note that asks the query. Okay, these are these are what's called these meta stable states. And what they do is they calculate over the entire data set this number k. And here they show you the distribution. So in these plots, what you'll see is over the entire data set, k goes into that direction. So I guess let's go to this here, this this seems pretty easy. So k is in this direction. And then you can see that this is pretty easy. So k is in this direction. And this is simply the amount of like how. So in each you let a data point run through it, you measure k for that particular layer one. You see this is layer one head four. Okay, this is one layer one attention head. And then you can see that number k is distributed like this. Okay, so contrast this to this head right here, where it's a lot of weight on the number one or like very few numbers. Okay, so these blue ones would be these are your typical like when you retrieve one particular pattern. So this attention head, let's conclude, in this particular attention head, this is very specific, it looks at its input, they look at its token, and it decides what information do I want. And it retrieves one particular thing from the other nodes. Okay. Whereas here, it's more like kind of an, an averaging is more like I want this kind of information. And on average, I don't even know what the sequence length is here, I guess it's maybe 512. So of the 512, the median, this number is always the median, it median, it collects information from 231 of them. Okay, so you can see that this corresponds these green and orange ones correspond to these meta stable states, where there's kind of an implicit clustering done in the in this space of attention, whereas the blue ones, they correspond to attention has that ask for particular information retrieve one particular maybe few patterns. And happy with that. And the red ones here, you can see that they often just average, they just, you know, because K is so high means that I need all of the I need all of these bars to get to the 90% or I need almost all of them, which basically means it's a uniform distribution, right? So it's like, I don't care where information comes from just average, whatever average, I just want the average in some particular space. And as we said, that also has its uses. Interesting how this translate through. So this here is as we go down the BERT model on the bottom, you have layer one, you see there are a lot of these averaging operations going on. So a lot of the heads are simply doing averaging. And as you go up the layers, the heads get more and more specific in the types of information they seek. But then again, in the last layers, interestingly, you get into a lot of these meta stable states again, which, I guess, I get interpret this as you as you want, I'm going to leave this up to you. But sort of says like here, you want kind of general patterns at the bottom. And then the middle layers are kind of the logical workhorses. So you look for very specific things in the input. This is, I guess this is where I guess this is where the thinking happens. So this is sort of pre processing. I'm just making stuff up here, by the way, this is this must be in no way true. This is maybe thinking. And this, this here, this might already be output again, because, you know, after that, you have language modeling or classification. So this might already be like, aggregating types of information. This is how I sort of interpreted. Okay. Yeah, so so this, these, these experiments are pretty, pretty, pretty interesting. And here they have, they do. These are the last experiments for this paper. They do an interesting experiment where they actually replace the attention heads by simply an average mechanism. And later, they actually replace them by Gaussians. But in this case, they simply average, and they show that look, if I replace layer one with this averaging, the perplexity doesn't rise that much. Right? So it's pretty good. Even if I replace the entire layer here with averaging, it perplexity goes more up. And you can see the corresponds if you remember the previous plot, the correspondence is pretty one to one with how much blue and green heads there are as in contrast to how much red and orange ones there are. So here you have lots of blue ones. And you can see that the error kind of goes up. And interestingly, here, you have more meta stable states at the end, but still, the perplexity goes up more. So I guess you can only really replace the red ones with the averaging. So this is always averaging in one particular layer. And they go into more detail here, where they say, look, this is this is layer six, and this is layer 12. So this is one particular attention head from layer six and layer 12. And the updates don't be confused, it goes in this direction. Okay, I was confused at first. And you can see right here, this number K, at first, you know, it's kind of spread out. But then it pretty quickly converges to a very small number. And there is this kind of point right here, I don't know if the learning rates decrease, I don't think so. I think that's just kind of a, a phase transition right here. This is the blue line, by the way, the blue training line, a phase transition, where all of a sudden, these just these attention heads, they somehow decide, okay, this is the thing I want to specialize in. This is the type of task I like a sub task of linguistic sub task on specialize in and then they concentrate on one particular pattern per input. So they are really specializing, whereas in the last layer, you see here, that even during training, they are sort of continuously learning. So first, they also do this averaging, then they go into this meta stable region, right? This is this meta stable region, K isn't one, but also K isn't a very high number. So they continuously learn. And it's even indicative of this training might not be done here, first of all, and second of all, it would be really interesting to see how this works out with, you know, sizes of transformers and like, especially these, these huge transformers, just the fact that they can keep learning, the more we train them might be, you know, be interpreted in the light of what kind of states they converge to. And the fact that their attention heads, I don't know, how does this go on? Do they stay in the meta stable states, because it makes sense to have meta stable states, as I said, it makes sense to kind of cluster things. Or are they simply into is this simply an intermediate step? And if you go really far down, they would actually also converge to the K equals one where they really specialize? Or maybe do we need more attention heads for this? I don't know. It's just, I think this is just the the beginning of kind of research in this direction, I think, just this kind of number K, how it's how it's made, it's pretty simple. And apparently, it's pretty, pretty revealing. So, you know, that's pretty cool. So that was the paper and its experiments. It's it's a pretty sizable paper. As I said, even the paper itself is 10 pages. And then there is this immune repertoire classification, which I will spend one minute looking at it. So you have you have these set classifications. So for each human, you obtain a set of immune receptors. And you simply obtain one label whether that human is immune to a particular disease or not. And your task is kind of and then a different human has a different set, you have no idea which one of these things is responsible for it being for the human being for the human being immune or not. In fact, there is a, you can't even decide based on these, you can only decide based on like sub sequences of these and they might be in combination with each other. So there might not be a single one responsible, but like a combination, but you don't have labels for the individual ones. And you have different ones per human and they are different length. All of this is just a giant, giant task. And you have many of them, you have 10s of 1000s per human, right. So they build a system here where first they do this 1d convolutions to process the inside sequences. And then they do this hopfield attention mechanism, or with with learned queries over these things. And then they train on the output label. And surprisingly, that actually works even with 10s of 1000s of inside sequences and only one label for all of them. And so they they achieve, I guess, favorable results compared to other baselines on this task using these Hopfield network, which is pretty interesting. But I'll let you look at that paper yourself. So I hope this somehow made it a bit clear what happens here. And it would actually be pretty interesting if we, you know, to see what happens if we just do maybe two rounds of these updates. Is this even desirable, right? Is it desirable to run this to convergence? Is there something good about not running into convergence? Or does it actually not matter because it actually does converge in one step? I don't know. But have a look at the code. It's pretty cool. And I hope you enjoy this video. I'm sure you have many open questions as do I don't hesitate to ask me in the comments, or join our discord. As I said, there are lots of helpful people on our discord. And I'll see you next time. Bye bye.
[{"start": 0.8, "end": 6.08, "text": " Hi there, today we'll look at Hopfield networks is all you need by researchers from the Johannes"}, {"start": 6.08, "end": 14.16, "text": " Kepler University in Linz and the University of Oslo. So on high level this paper proposes a new"}, {"start": 14.16, "end": 20.8, "text": " type of Hopfield networks that generalizes modern Hopfield networks from binary patterns to"}, {"start": 20.8, "end": 26.8, "text": " continuous patterns, and then shows that the retrieval update rule of these new Hopfield"}, {"start": 26.8, "end": 35.04, "text": " networks is equivalent to the attention mechanism that's used in modern transformers. And it's"}, {"start": 35.04, "end": 40.0, "text": " actually a more general formulation of the attention mechanism. And therefore, it can be"}, {"start": 40.0, "end": 47.519999999999996, "text": " used to do kind of a variety of things to improve modern deep learning. And it also has a companion"}, {"start": 47.519999999999996, "end": 54.400000000000006, "text": " paper where it applies this to some kind of immunology research and gets chiefs state of the"}, {"start": 54.4, "end": 62.32, "text": " art in a task that is specifically suited to this type of attention. Alright, let's dive in together,"}, {"start": 62.32, "end": 69.2, "text": " we'll go over what this paper does, what it proposes, and so on. If you like pay if you"}, {"start": 69.2, "end": 75.75999999999999, "text": " like videos like this, consider subscribing, sharing it out. And I hope you're enjoying this."}, {"start": 76.72, "end": 83.68, "text": " Alright, also, thanks to my discord community for you know, very helpful bringing me up to"}, {"start": 83.68, "end": 91.04, "text": " speed on this paper. Super interesting discussions there. If you're not on the discord yet, I invite"}, {"start": 91.04, "end": 101.68, "text": " you to join. It's fun. Okay. So what is a Hopfield network? A Hopfield network is a pretty kind of"}, {"start": 101.68, "end": 111.36000000000001, "text": " old style, old conceptualization of a neural network. So in a Hopfield network, what your"}, {"start": 111.36, "end": 117.84, "text": " goal would be is you can conceptualize it as a bit of a neural network. So let's say we have"}, {"start": 118.32, "end": 124.48, "text": " five neurons or something like this. What your goal would be is to have a neural network where"}, {"start": 124.48, "end": 133.2, "text": " you can store so called patterns. And a pattern in this case would be a binary string of size five."}, {"start": 133.2, "end": 144.39999999999998, "text": " So for example, 10100 or 11010. And you'd have a list of these patterns. And what your goal would"}, {"start": 144.39999999999998, "end": 150.39999999999998, "text": " be is to store these patterns in the neural network, such that in here, you know, we'll just"}, {"start": 150.39999999999998, "end": 157.35999999999999, "text": " consider everything to be sort of connected to everything else. And what your goal would be"}, {"start": 157.36, "end": 163.76000000000002, "text": " in this is that you can kind of store patterns inside this neural network and you adjust the"}, {"start": 163.76000000000002, "end": 171.20000000000002, "text": " weights somehow. So this was, as I said, this was this was this is kind of an old model. You store,"}, {"start": 171.92000000000002, "end": 177.28000000000003, "text": " you adapt the weights such that you store these patterns. And what does it mean for a pattern to"}, {"start": 177.28000000000003, "end": 183.76000000000002, "text": " be stored? If you have stored a pattern, you can you will then be able to retrieve it. And you"}, {"start": 183.76, "end": 191.04, "text": " retrieve a pattern in these kind of old style Hopfield networks by providing a partial pattern."}, {"start": 191.04, "end": 198.16, "text": " So what you'll say is, for example, I, I want a pattern that starts with 110. And you give that"}, {"start": 198.16, "end": 203.76, "text": " to the network. And there would be a so called update rule. And the update rule is kind of an"}, {"start": 203.76, "end": 213.51999999999998, "text": " internal rule. So let's just go through this. So here, this 110, maybe this is 110. And you"}, {"start": 213.52, "end": 220.08, "text": " know, and then they would kind of send messages around. So this update rule would somehow adjust"}, {"start": 220.08, "end": 227.36, "text": " the value of this and this neuron here to what's most compatible with the network weights. And if"}, {"start": 227.92000000000002, "end": 232.96, "text": " if the network weights have been adjusted correctly, this will turn out then at the end"}, {"start": 232.96, "end": 240.4, "text": " of applying this update rule, that this is a one and this is a zero. And therefore, this pattern"}, {"start": 240.4, "end": 249.28, "text": " here is retrieved. Now had I input 101 at the beginning, then the outcome would be different,"}, {"start": 249.28, "end": 256.16, "text": " hopefully, this pattern here would have been retrieved. Okay, so you can see the applications"}, {"start": 256.16, "end": 262.24, "text": " of this, like you can have the first three digits as sort of a database key, and then the last ones"}, {"start": 262.24, "end": 267.44, "text": " as sort of the value that you store along with it. And then you can simply provide the first few,"}, {"start": 267.44, "end": 273.28, "text": " you can also provide you don't always have to provide three. So this all depends this is,"}, {"start": 273.84, "end": 279.52, "text": " this is sort of an, as I said, an old conceptualization of neural networks. So people"}, {"start": 279.52, "end": 285.84, "text": " were imagining that this is kind of how the brain works, you know, fire together wire together. And"}, {"start": 286.88, "end": 292.88, "text": " also with research into this, it turns out that, you know, you might think, you know, there's"}, {"start": 292.88, "end": 298.08, "text": " there's kind of five neurons. So maybe I can store five different patterns, you know, accurately,"}, {"start": 298.08, "end": 304.96, "text": " because if I store too many patterns, right, if I have many, many, many, many patterns, then I can't"}, {"start": 304.96, "end": 311.36, "text": " expect to be able to retrieve all the patterns again, because some of them will just be so equal"}, {"start": 311.92, "end": 319.92, "text": " that, you know, many will start maybe with this, and I won't have a chance to, to retrieve the one"}, {"start": 319.92, "end": 325.6, "text": " I want, or the update rule will make a mistake. So you might think this might be like five,"}, {"start": 325.6, "end": 330.64000000000004, "text": " because I have five neurons, or maybe 10, because I have 10 connections. But it turns out that"}, {"start": 331.68, "end": 339.12, "text": " in modern Hopfield networks with the appropriate update rule, you can store exponentially many"}, {"start": 339.12, "end": 346.56, "text": " patterns in these networks exponentially many in the in the dimension of the in the dimension of"}, {"start": 346.56, "end": 352.32, "text": " the patterns. And here, I guess that will be the length of the pattern. So this is a little bit"}, {"start": 352.32, "end": 360.56, "text": " surprising the kind of storage capacity of these networks. And we'll, this, this paper here"}, {"start": 360.56, "end": 368.24, "text": " generalizes that to continuous to continuous states. So what do we mean? With continuous states,"}, {"start": 368.24, "end": 375.12, "text": " I guess I mean continuous patterns. So no longer is a pattern, a binary string, but a pattern now"}, {"start": 375.12, "end": 384.08, "text": " is a string of floating point numbers, like 0.5, 1.3, and so on. And, you know, a string of floating"}, {"start": 384.08, "end": 390.4, "text": " or a sequence of floating point numbers is naturally depicted as a vector, okay. So our"}, {"start": 390.4, "end": 397.36, "text": " patterns are going to be different vectors that we store. And, you know, in high dimensions that"}, {"start": 397.36, "end": 404.56, "text": " the vectors will be kind of separated well from each other as long as we don't have too many."}, {"start": 404.56, "end": 411.76, "text": " But this paper shows that all these properties for the modern Hopfield networks that hold for"}, {"start": 411.76, "end": 420.08000000000004, "text": " binary strings still hold if you go to these kind of continuous to these vector patterns. That means"}, {"start": 420.08, "end": 426.8, "text": " you can store exponentially many patterns in the dimensions of the vector, which is pretty"}, {"start": 426.8, "end": 433.03999999999996, "text": " surprising, right? Because you'd think like, you know, after you have one vector per dimension,"}, {"start": 433.03999999999996, "end": 438.79999999999995, "text": " that, you know, after that, it might get a bit shaky. But no, you can actually store exponentially"}, {"start": 438.79999999999995, "end": 446.08, "text": " many. That's pretty surprising. And this paper is a lot about how to do that, and the fact that that"}, {"start": 446.08, "end": 452.96, "text": " the fact that that happens, and so on. So we've talked about update rules for these kind of"}, {"start": 452.96, "end": 458.32, "text": " Hopfield networks. And I haven't really specified what that is, I've just said that, you know,"}, {"start": 458.32, "end": 464.79999999999995, "text": " I enter a pattern, and then the network does something and outcomes, outcomes, the whatever"}, {"start": 464.79999999999995, "end": 472.08, "text": " the pattern that matches my query. So this here is called a query. You might already, this is on"}, {"start": 472.08, "end": 479.03999999999996, "text": " purpose, like the kind of overlap between the attention mechanism, lingo and the Hopfield"}, {"start": 479.03999999999996, "end": 485.59999999999997, "text": " network lingo, we're going to conflate the two to kind of make clear where the two overlap. If you"}, {"start": 485.59999999999997, "end": 490.64, "text": " don't know what an attention mechanism is, or aren't familiar with it, watch my video on attention"}, {"start": 490.64, "end": 499.2, "text": " is all you need. Once you watch that, this video will make a lot more sense. Alright, so in what"}, {"start": 499.2, "end": 505.12, "text": " the update rule does is specifically in the update rule that there isn't only one, right, there are"}, {"start": 505.12, "end": 511.03999999999996, "text": " many different proposals of Hopfield networks, and they all lead to different properties. But what an"}, {"start": 511.03999999999996, "end": 518.0, "text": " update rule does ultimately is it minimizes what's called an energy. So every type of Hopfield"}, {"start": 518.0, "end": 525.84, "text": " network is associated with an energy function. And this the energy function of the modern Hopfield"}, {"start": 525.84, "end": 536.08, "text": " network for binary strings is this energy function right here. So with x, x is the pattern, the"}, {"start": 536.08, "end": 542.72, "text": " pattern, this is the kind of state of the Hopfield network. And these are the whatever is stored in"}, {"start": 542.72, "end": 549.6, "text": " the network. And then the Xi here is the query that you enter into the network. And then the"}, {"start": 549.6, "end": 557.76, "text": " energy here tells you this quantity, you have to minimize this quantity in order to retrieve the"}, {"start": 557.76, "end": 565.36, "text": " pattern that you want. Okay, now, we are never directly working with the energy as such. So what"}, {"start": 565.36, "end": 571.0400000000001, "text": " you could do is, for example, use backprop or something to use gradient descent to decrease the"}, {"start": 571.04, "end": 580.16, "text": " decrease the energy. But usually, along with an energy function comes an update function. And the"}, {"start": 580.16, "end": 584.3199999999999, "text": " update function is what I've talked about here, like you do something, and then the network does"}, {"start": 584.3199999999999, "end": 590.48, "text": " something and then you get the pattern out, what the network does is it minimizes its energy"}, {"start": 590.48, "end": 596.48, "text": " function. And the update rule is made such that the corresponding energy function is minimized. So"}, {"start": 596.48, "end": 601.6800000000001, "text": " the energy function is more like a theoretical consideration that you say, okay, here is my"}, {"start": 601.6800000000001, "end": 608.64, "text": " energy function of my Hopfield network. And the there will be a corresponding update rule that"}, {"start": 608.64, "end": 614.32, "text": " minimizes that energy function. And if you use that update rule, maybe multiple times, then"}, {"start": 614.88, "end": 620.24, "text": " the energy function will be minimized, and you will have retrieved your pattern, or not, if,"}, {"start": 620.24, "end": 628.32, "text": " if you have too many patterns stored, it might also fail. Right? So they, they say what the update"}, {"start": 628.32, "end": 634.48, "text": " rules are in the, in the text here for the old Hopfield networks, but we're not really interested"}, {"start": 634.48, "end": 640.08, "text": " in the old ones, we're interested in the ones that this paper cares about, namely, where the patterns"}, {"start": 640.08, "end": 646.8, "text": " that you store in the Hopfield network are these vectors over our vector patterns. And the query"}, {"start": 646.8, "end": 653.28, "text": " is also a vector pattern. So you want to store all of these patterns into the Hopfield network."}, {"start": 653.28, "end": 659.4399999999999, "text": " So I'm going to draw it like this here, I'm going to store it into the Hopfield network. And then"}, {"start": 660.0, "end": 667.12, "text": " after that, you want to come up with a query. And the query is like this. And in the case of"}, {"start": 667.12, "end": 673.76, "text": " the binary strings, we had something like, well, I sort of know half of my binary string. Now,"}, {"start": 673.76, "end": 682.24, "text": " in the vector Hopfield network, it's more like, well, I sort of kind of know the direction that"}, {"start": 682.24, "end": 689.52, "text": " my vector should point in, okay. And you will read what you want to retrieve is the vector"}, {"start": 689.52, "end": 696.24, "text": " that has kind of a large inner product. Okay, so if I enter this query into my Hopfield network,"}, {"start": 696.24, "end": 702.08, "text": " what I hope is that this vector here is retrieved. Now you see, it's not exactly the same vector,"}, {"start": 702.08, "end": 709.5200000000001, "text": " like they do point if I translate that here by I, it's maybe something like this. But so they are"}, {"start": 709.5200000000001, "end": 715.2800000000001, "text": " different. But you want to say, well, I kind of know what I want, I kind of want something like"}, {"start": 715.2800000000001, "end": 720.24, "text": " this. And then the Hopfield network would answer with, ah, I have something like this, it's this"}, {"start": 720.24, "end": 727.76, "text": " right here. Okay, so that the connection to attention mechanism should become pretty, pretty"}, {"start": 727.76, "end": 736.3199999999999, "text": " obvious right now. But the to actually establish this formally is the kind of the point of this"}, {"start": 736.3199999999999, "end": 742.8, "text": " paper. And, you know, it's pretty cool to see. So they formulate this new energy right here,"}, {"start": 742.8, "end": 751.6, "text": " this is the energy of this new continuous Hopfield network. Specifically, they have to have this term"}, {"start": 751.6, "end": 756.96, "text": " right here, because they now have continuous states and continuous queries. This, if you minimize the"}, {"start": 756.96, "end": 764.48, "text": " energy, it basically means that your query can never go to infinity, because you have the query"}, {"start": 764.48, "end": 772.0, "text": " right here in the energy function. The update rule is this right here. And we'll look at that"}, {"start": 772.0, "end": 778.8000000000001, "text": " in a moment. But remember, the update rule is what you actually implement in code. So if I,"}, {"start": 778.8, "end": 787.68, "text": " if I have a query right here, I plug it in here, this is the state of my Hopfield network. And I"}, {"start": 787.68, "end": 797.4399999999999, "text": " apply this rule multiple times. And out comes the kind of answer of the Hopfield network to my"}, {"start": 797.4399999999999, "end": 807.28, "text": " question. So the input this and the outcomes this after I update, after I apply the update rule,"}, {"start": 807.28, "end": 815.4399999999999, "text": " maybe multiple times, right. And interestingly, you can already see that this here, if you rewrite a"}, {"start": 815.4399999999999, "end": 820.8, "text": " bunch of these quantities, if you rewrite the beta here, which is the softmax temperature in a way"}, {"start": 821.4399999999999, "end": 828.72, "text": " to be one over square root of D. And if you take the query the psi here to be the query matrix,"}, {"start": 829.28, "end": 837.12, "text": " and if you take the x here to be the key matrix, then this is equivalent to the update or sorry,"}, {"start": 837.12, "end": 842.88, "text": " the attention mechanism of a modern transformer. So that's the point of the paper is that we can"}, {"start": 842.88, "end": 852.4, "text": " look at the transformer attention mechanism as a Hopfield network. And they have this interesting,"}, {"start": 854.48, "end": 863.44, "text": " this interesting diagram at the end right here. So the appendix, you know, this is typical,"}, {"start": 863.44, "end": 872.08, "text": " I guess, Sepp Hocher, I remember the Seeloo paper had like 60 pages of machine proof appendix. This"}, {"start": 872.08, "end": 879.0400000000001, "text": " also this has like 70 page appendix, crazy. But at the end of the appendix, you'll find this diagram"}, {"start": 879.0400000000001, "end": 886.72, "text": " right here. Now, usually, in an attention mechanism, you have whatever the input is,"}, {"start": 886.72, "end": 892.8000000000001, "text": " so you have an input right here. So this is attention mechanisms, or at least transformers,"}, {"start": 892.8, "end": 899.12, "text": " they work on sequences or sets of objects. And from these, you'll generate three things,"}, {"start": 899.12, "end": 907.3599999999999, "text": " you'll generate the, you'll generate the queries, the keys and the values. Now, you can either"}, {"start": 907.3599999999999, "end": 912.64, "text": " generate the queries from the same objects, which would be self attention, or you can generate the"}, {"start": 912.64, "end": 919.4399999999999, "text": " queries from like a different object over here. It doesn't, it doesn't matter too much for our"}, {"start": 919.44, "end": 926.24, "text": " discussions. But either you, you know, have a reference input, or you have, you know, this"}, {"start": 926.24, "end": 935.2800000000001, "text": " kind of same input all the way. And then what you do is use three different heads, or three different"}, {"start": 935.2800000000001, "end": 944.32, "text": " matrices to transform that input into queries, keys and values. So I often conceptualize this as"}, {"start": 944.32, "end": 953.5200000000001, "text": " you have kind of your input set, and each of the input sets outputs a key. And also each one,"}, {"start": 953.5200000000001, "end": 961.36, "text": " which would be a vector. And also each one outputs a query. So I often draw this here,"}, {"start": 962.0, "end": 970.96, "text": " the same sequence, and each one outputs a query. And the query sort of the query is kind of a"}, {"start": 970.96, "end": 979.84, "text": " request for information. So the key exposes sort of what exposes something about the input here."}, {"start": 979.84, "end": 991.0400000000001, "text": " So this could be a sentence down here, this could be my cat is very pretty. And the, the, the"}, {"start": 991.84, "end": 997.2800000000001, "text": " vector, the key vector right here could encode something like this is a noun, or this is an"}, {"start": 997.28, "end": 1005.1999999999999, "text": " animal or anything like this, right. And the query here, it could ask for, for other things. So,"}, {"start": 1005.8399999999999, "end": 1014.16, "text": " for example, since this is cat, this vector right here, the query vector is generated from that,"}, {"start": 1014.16, "end": 1023.28, "text": " you know, token cat. Now, it could recognize that cat is a noun. And it could ask the other nodes"}, {"start": 1023.28, "end": 1032.16, "text": " to basically say, are there any adjectives around here? Because, you know, adjectives, because it"}, {"start": 1032.16, "end": 1037.2, "text": " itself is a noun, it's the object of the sentence, right? It could ask, are there any kind of"}, {"start": 1037.2, "end": 1043.04, "text": " adjectives that describe the object? Because that would be naturally a thing to ask. If you were the"}, {"start": 1043.04, "end": 1050.16, "text": " noun, you would want to know, are there any kind of modifiers for for me? So it could output the"}, {"start": 1050.16, "end": 1056.16, "text": " query and the query here could mean, you know, this direction could mean adjectives. And you see"}, {"start": 1056.16, "end": 1065.3600000000001, "text": " here, the word pretty is an adjective. So it itself would output a key that says, by the way, I'm an"}, {"start": 1065.3600000000001, "end": 1073.44, "text": " adjective, right? So if the cat asks, then if this node asks for an adjective, and this outputs the"}, {"start": 1073.44, "end": 1080.96, "text": " the adjective vector, then because the inner product between the two things is high, this will"}, {"start": 1080.96, "end": 1086.88, "text": " be routed here. So attention mechanisms, basically information routing, that's how I always describe"}, {"start": 1086.88, "end": 1094.56, "text": " it. But in this paper, we look at it more like these here are the patterns that are stored in a"}, {"start": 1094.56, "end": 1102.72, "text": " Hopfield network. And I by inputting a query, and the dot product being the update rule of the Hopfield"}, {"start": 1102.72, "end": 1111.3600000000001, "text": " network, I retrieve from the Hopfield network, I retrieve the appropriate pattern that I asked for,"}, {"start": 1111.3600000000001, "end": 1118.96, "text": " okay. And then you know, the values, the values are simply a modification of the keys in this"}, {"start": 1118.96, "end": 1125.92, "text": " form. But a lot of people also do keys and values to be the same thing. Yeah, but the this routing"}, {"start": 1125.92, "end": 1132.24, "text": " of information happens here, where you multiply the queries and the keys, and then you put a"}, {"start": 1132.24, "end": 1139.92, "text": " softmax over them. Okay, so if you just look from the perspective of a single node, like this node"}, {"start": 1139.92, "end": 1148.8, "text": " here, this cat node, what it would do is it would inner product its own query vector with all of the"}, {"start": 1148.8, "end": 1154.08, "text": " key vectors, right? So it would build an inner product with all of these. And then it would"}, {"start": 1154.08, "end": 1159.76, "text": " normalize, it would put it through a softmax, which will kind of give it a distribution, right? So"}, {"start": 1159.76, "end": 1165.76, "text": " here would give it like, so this is actually matches because my well my is also very important"}, {"start": 1165.76, "end": 1173.2, "text": " for cat. This, this, this is just an accident. I did not plan this, this here, this also well,"}, {"start": 1173.2, "end": 1179.92, "text": " many things match. But that, in our example, we would just say that this last one, it's, it's not"}, {"start": 1179.92, "end": 1190.0, "text": " only higher, it's also wider. It matches very well, right. And so the information routing would route"}, {"start": 1190.0, "end": 1197.68, "text": " mostly information from this pretty token to the cat token, which makes sense in our case, right?"}, {"start": 1198.48, "end": 1205.44, "text": " This is the attention mechanism. Now, since if we are interpreting this as a Hopfield network,"}, {"start": 1205.44, "end": 1214.24, "text": " and the update rule here is the dot product, you can actually think of applying this rule multiple"}, {"start": 1214.24, "end": 1222.96, "text": " times. So what happens now, if we and this is where this update rule comes in? What happens"}, {"start": 1223.6000000000001, "end": 1230.72, "text": " if we take this distribution? And we don't aggregate the values, like usually, we would"}, {"start": 1230.72, "end": 1238.0, "text": " aggregate the values by this distribution? What if we aggregate the keys by this distribution? Okay,"}, {"start": 1238.0, "end": 1243.28, "text": " what comes out? Well, if we look at this, and you know, let's just assume that this key right here"}, {"start": 1243.28, "end": 1249.76, "text": " matches really well, but the others also match a little bit, what would come out would be a weighted"}, {"start": 1249.76, "end": 1256.4, "text": " average where a lot of weight is put on this particular key. So what will turn out would be"}, {"start": 1256.4, "end": 1264.5600000000002, "text": " something like something that's very close to that key, you can see. I'm going to draw the old key"}, {"start": 1264.5600000000002, "end": 1275.6000000000001, "text": " here in green. And I want to draw the old query in blue. So you see that it's the whatever comes out"}, {"start": 1275.6000000000001, "end": 1282.4, "text": " is not the query. But it's also not that only key that matches, right? It's kind of a weighted"}, {"start": 1282.4, "end": 1288.88, "text": " average, but with that key dominating. Okay, now, since, you know, in a Hopfield network, what we"}, {"start": 1288.88, "end": 1296.64, "text": " would do is we would go again, we would put this new thing, the red thing, instead of the query"}, {"start": 1296.64, "end": 1303.68, "text": " vector. Okay, so we would use this aggregated keys, this weighted average, as a new query vector for"}, {"start": 1303.68, "end": 1310.24, "text": " that node right here. So duplicate that node over here, I'll use that query vector again, and do the"}, {"start": 1310.24, "end": 1316.48, "text": " same thing again, okay, inner product with all of the query vectors. And now since this is already"}, {"start": 1316.48, "end": 1321.52, "text": " an aggregate of the query vectors, what's going to happen, of course, the distribution that's going"}, {"start": 1321.52, "end": 1329.76, "text": " to come out is going to be weighted even more heavily into the direction. So let's make it even"}, {"start": 1329.76, "end": 1337.6, "text": " wider into the direction of that key that matches, okay. And you can pretty clearly see if I do that"}, {"start": 1337.6, "end": 1347.52, "text": " iteratively, then that will lead to a situation where everything is like very low, except that"}, {"start": 1347.52, "end": 1355.9199999999998, "text": " one key will sort of dominate the distribution and ultra high and ultra wide. Okay, and that's"}, {"start": 1355.9199999999998, "end": 1361.4399999999998, "text": " how that's exactly how a Hopfield network works, right? I would input the query, which would be"}, {"start": 1361.4399999999998, "end": 1367.36, "text": " sort of what I want, right? I kind of know what I want, okay. And then I apply this rule multiple"}, {"start": 1367.36, "end": 1374.8, "text": " times. And with each time, I refine, refine, refine until I decide on a pattern, right? The"}, {"start": 1374.8, "end": 1379.76, "text": " Hopfield network is made for pattern retrieval. And these here are the patterns that I want to"}, {"start": 1379.76, "end": 1385.84, "text": " retrieve. So here, the patterns aren't kind of stored in the network beforehand, but the patterns"}, {"start": 1385.84, "end": 1394.08, "text": " are also generated like in an attention layer. So the keys are generated by the previous layer or by"}, {"start": 1394.08, "end": 1401.1999999999998, "text": " these matrices. But that doesn't matter for the Hopfield network update rule. So you see here that"}, {"start": 1401.1999999999998, "end": 1406.72, "text": " the attention mechanism can be interpreted as simply one step making one step of this update"}, {"start": 1406.72, "end": 1413.36, "text": " rule, but you can think of making actually multiple steps and retrieving the particular key. So,"}, {"start": 1414.32, "end": 1422.72, "text": " you know, deciding on a sort of a hard routing of particular information. Now that only works if,"}, {"start": 1422.72, "end": 1431.1200000000001, "text": " if there are no other vectors that are close to that particular key, right? So if the query is"}, {"start": 1431.1200000000001, "end": 1436.64, "text": " this, and you know, the way I drew it here, you can see that there are many, there is this one,"}, {"start": 1436.64, "end": 1441.04, "text": " and this one, and this one that matches. So technically, the way I drew it,"}, {"start": 1443.04, "end": 1448.88, "text": " what would happen most likely is no many, no matter how many times you apply your update rule,"}, {"start": 1448.88, "end": 1456.8000000000002, "text": " it would sort of result in kind of the average of the three keys, right? So because they're all"}, {"start": 1456.8000000000002, "end": 1462.24, "text": " matching, and they would all contribute to that weighted average of the query in the next step."}, {"start": 1462.24, "end": 1466.48, "text": " And then that means basically the conversions would be to something in the middle. And that's"}, {"start": 1466.48, "end": 1474.96, "text": " going to be a central point of this paper in which situation we are. So they call the first part is"}, {"start": 1474.96, "end": 1480.32, "text": " retrieving a single pattern. And they call the second situation where you have multiple patterns"}, {"start": 1480.32, "end": 1486.08, "text": " that all match that are not well separated from each other. They call this a meta stable state."}, {"start": 1486.08, "end": 1493.6000000000001, "text": " And it's going to be pretty interesting to look at transform like BERT language models and look at"}, {"start": 1493.6000000000001, "end": 1499.3600000000001, "text": " where they actually are. Are they actually operating in this single pattern retrieval mode? Or are they"}, {"start": 1499.36, "end": 1508.6399999999999, "text": " operating in the meta stable state mode? Alright, so here you can see it in the diagram, the only"}, {"start": 1508.6399999999999, "end": 1514.7199999999998, "text": " thing different this from a Hopfield network, sorry, from an attention mechanism is this branch"}, {"start": 1514.7199999999998, "end": 1522.3999999999999, "text": " right here. So here you ask, do you want to do multiple updates after you've, you've multiplied"}, {"start": 1522.3999999999999, "end": 1528.32, "text": " the queries and the keys? Do you want to do multiple updates? If yes, so if you're in a"}, {"start": 1528.32, "end": 1533.84, "text": " this Hopfield network situation, you want to do multiple updates, then you go back, as you can see,"}, {"start": 1534.8799999999999, "end": 1544.1599999999999, "text": " and you do you use the keys together with the output of the softmax to generate a new query. So"}, {"start": 1544.1599999999999, "end": 1550.8799999999999, "text": " this query queue here is now generated from the output here and the key. So the keys are the same."}, {"start": 1550.8799999999999, "end": 1557.2, "text": " These are this is the same thing. It's just put here twice. Okay, this is exactly what we"}, {"start": 1557.2, "end": 1564.88, "text": " discussed. Okay, I hope that's some somehow clear that these the the attention mechanism is simply"}, {"start": 1564.88, "end": 1574.4, "text": " a one step Hopfield network pattern retrieval algorithm with a particular update rule that is"}, {"start": 1574.96, "end": 1580.8, "text": " that is matches this energy function that they propose right here. Of course, they do this,"}, {"start": 1580.8, "end": 1586.96, "text": " you know, particularly because the update rule that turns out is the transformer update rule. But"}, {"start": 1587.68, "end": 1592.1599999999999, "text": " but I actually don't know if they backwards engineered the energy function to match the"}, {"start": 1592.1599999999999, "end": 1597.68, "text": " transformer or if they first came up with a continuous Hopfield networks and then just"}, {"start": 1598.1599999999999, "end": 1608.08, "text": " kind of discovered that it's like the transformer. We'll maybe never find out. Okay, so let's go."}, {"start": 1608.08, "end": 1615.6, "text": " There are a couple of theorems. I believe there are four, five theorems right here that show that"}, {"start": 1615.6, "end": 1620.8799999999999, "text": " kind of make some points about this about this stuff. And we'll go through them won't go through"}, {"start": 1620.8799999999999, "end": 1625.84, "text": " the proofs or any, you know, super in depth meaning, but it's pretty cool to go through them."}, {"start": 1625.84, "end": 1631.76, "text": " And they are proved very rigorously. As I said, there's a 70 page appendix. So have a look at"}, {"start": 1631.76, "end": 1639.84, "text": " that if you're up for it. Okay, so they say here we have an update rule. This is our update rule"}, {"start": 1639.84, "end": 1646.0, "text": " for our new Hopfield networks. So the first theorem they say is the update rule that we"}, {"start": 1646.0, "end": 1656.4, "text": " propose converges globally. If we apply the update rule repeatedly, the energy for t goes"}, {"start": 1656.4, "end": 1663.76, "text": " equals infinity and the energy will converge, sorry, the energy will converge to a fixed point,"}, {"start": 1663.76, "end": 1671.1200000000001, "text": " this being a fixed point for t equals sort of for t goes to infinity. Yeah, if this is a fixed point,"}, {"start": 1671.1200000000001, "end": 1678.48, "text": " basically saying that if I apply this update rule here over and over and over again, it will, it will"}, {"start": 1678.48, "end": 1686.32, "text": " make this energy function converge to a fixed, it will make this energy function converge. Don't"}, {"start": 1686.32, "end": 1693.84, "text": " want to say anything mistakenly here or claim too much. But that basically connects the update rule"}, {"start": 1693.84, "end": 1699.6, "text": " to the energy. Okay, so just showing like this really is the update rule for that particular"}, {"start": 1699.6, "end": 1709.28, "text": " energy function. Okay, now as as itself, it's not super duper interesting yet. But now we get to"}, {"start": 1709.28, "end": 1716.3999999999999, "text": " theorem two. So theorem two, for the iteration, that's the update rule that we just looked at,"}, {"start": 1717.4399999999998, "end": 1725.6, "text": " we have, we have that this convergence holds as t goes to infinity for some stationary point."}, {"start": 1725.6, "end": 1732.6399999999999, "text": " stationary point. Furthermore, this quantity here goes to zero. So that means"}, {"start": 1734.56, "end": 1742.48, "text": " this is the the update at t plus one, and this is the update at t, and the difference between them"}, {"start": 1742.48, "end": 1749.36, "text": " goes to zero. So that means not only does the energy converge, but the iterates themselves"}, {"start": 1749.36, "end": 1756.7199999999998, "text": " convert. So the algorithm actually converges the individual updates of the algorithm. So this e new"}, {"start": 1756.7199999999998, "end": 1763.36, "text": " at some point that will no longer change because the the norm between it and the previous one will"}, {"start": 1763.36, "end": 1771.36, "text": " go to zero. You can see that either the sequence here converges, or in the other case, the set of"}, {"start": 1771.36, "end": 1777.84, "text": " limit points yada yada is a connecting subset. This is a bit over the top here. They say,"}, {"start": 1777.84, "end": 1786.3999999999999, "text": " okay, it can either converge to a point or it can converge to a connected subset. But if the loss is"}, {"start": 1786.3999999999999, "end": 1793.12, "text": " finite, then any sequence generated by the iteration equation three converges to some fixed"}, {"start": 1793.12, "end": 1802.32, "text": " point. So, you know, basically saying that here we have this is not the loss, I'm sorry. No, this"}, {"start": 1802.32, "end": 1811.28, "text": " is the domain. Never mind. I'm an idiot. This is basically saying that this algorithm will converge."}, {"start": 1811.28, "end": 1820.56, "text": " Okay. And they define here what it means for a pattern to be stored and retrieved. And that's"}, {"start": 1820.56, "end": 1826.32, "text": " for establishing what the kind of storage capacity of a Hopfield network is. So we've established that"}, {"start": 1826.32, "end": 1832.56, "text": " the update rule minimizes the appropriate energy, and the update rule will converge at some point,"}, {"start": 1833.36, "end": 1840.48, "text": " which means that we can, you know, if it converges, we can retrieve the pattern that it converges to."}, {"start": 1840.48, "end": 1846.32, "text": " So now we define how many patterns can we actually store. For that, we need to know what does it mean"}, {"start": 1846.32, "end": 1852.32, "text": " for a pattern to be stored. So we assume that we have patterns and these patterns are called"}, {"start": 1852.32, "end": 1858.1599999999999, "text": " x. Okay, x i, we have n different patterns. Each one is called x with a subscript."}, {"start": 1859.28, "end": 1866.3999999999999, "text": " We assume that around every pattern, a sphere is given. So how do we imagine this?"}, {"start": 1868.48, "end": 1873.9199999999998, "text": " We have these patterns, and this is this is just a space that they consider patterns of the on the"}, {"start": 1873.9199999999998, "end": 1879.2, "text": " sphere. But we'll just conceptualize it as this will have a space. There are patterns we want to"}, {"start": 1879.2, "end": 1887.44, "text": " store, okay. And we'll say around every pattern, there is a sphere. Okay, sphere like this. And"}, {"start": 1887.44, "end": 1893.6000000000001, "text": " naturally, the patterns are going to be there's going to be a notion of well separated patterns."}, {"start": 1893.6000000000001, "end": 1900.32, "text": " And you can imagine this a little bit like these spheres won't be touching each other. If these"}, {"start": 1900.32, "end": 1905.28, "text": " spheres aren't touching each other, that means that the patterns are kind of well separated."}, {"start": 1905.28, "end": 1910.96, "text": " And that means that if we initialize the query, remember, the query here is a vector that kind"}, {"start": 1910.96, "end": 1916.08, "text": " of sort of looks like a pattern. And that means the query is kind of close to the pattern in some"}, {"start": 1916.08, "end": 1926.0, "text": " notion of distance. So if we initialize the query somewhere in that sphere, then it might if it"}, {"start": 1926.0, "end": 1935.92, "text": " converges to that sphere to that pattern, then we retrieve the pattern. Okay. Now it gets a bit more"}, {"start": 1935.92, "end": 1943.6, "text": " complicated than this, but not much more. We say a pattern is stored, if there is a single fixed"}, {"start": 1943.6, "end": 1951.28, "text": " point inside the sphere, to which all points that start inside the sphere converge, and none of the"}, {"start": 1951.28, "end": 1957.76, "text": " spheres intersect. So the sphere of point i doesn't intersect with the sphere of point j. So that's"}, {"start": 1957.76, "end": 1965.92, "text": " where we say all these spheres are non intersecting. We say x i is retrieved if the iteration equation"}, {"start": 1965.92, "end": 1972.56, "text": " three converged to the single fixed point in that sphere, the retrieval error is the distance. So"}, {"start": 1972.56, "end": 1978.08, "text": " you'll notice you have two things you have x i, this is the actual pattern, and you have x i star,"}, {"start": 1978.08, "end": 1984.08, "text": " this is the retrieved pattern. So these hopfers, they don't always have to give you the same thing"}, {"start": 1984.08, "end": 1989.6799999999998, "text": " that you stored. That's part of the nature of continuous neural networks, whatnot."}, {"start": 1991.36, "end": 2000.48, "text": " So for every sphere, we say there is a pattern, there is a sphere. Now, we as pattern is stored,"}, {"start": 2000.48, "end": 2007.36, "text": " if every, I can start wherever I want in this sphere, okay, wherever I want, it will always"}, {"start": 2007.36, "end": 2013.12, "text": " converge to a point that's inside the sphere. Okay, and maybe that point isn't the pattern that"}, {"start": 2013.12, "end": 2017.84, "text": " I stored, but actually this point right here, but wherever I start, I will always converge to that"}, {"start": 2017.84, "end": 2025.12, "text": " particular point. If that's the case, then I have stored this particular pattern. Now, the fact is,"}, {"start": 2025.12, "end": 2029.9199999999998, "text": " I don't retrieve this particular pattern, I retrieve the blue thing. But I can then define"}, {"start": 2029.9199999999998, "end": 2036.32, "text": " the error of retrieval. And the error of retrieval is simply the distance between the two things."}, {"start": 2036.32, "end": 2042.0, "text": " Ideally, this distance is very small, right? But you know, we can't, can't guarantee it. Now,"}, {"start": 2042.0, "end": 2047.12, "text": " there are going to be theorems that deal exactly with this retrieval error. But first,"}, {"start": 2048.3199999999997, "end": 2059.6, "text": " you can see that here, if, if these spheres become larger, you can't accurately store a"}, {"start": 2059.6, "end": 2066.48, "text": " pattern anymore. So this is the kind of ideal situation. But there are also situations where"}, {"start": 2066.48, "end": 2071.04, "text": " these spheres, you know, if I have these patterns right here, these spheres are so large, kind of"}, {"start": 2072.3199999999997, "end": 2080.4, "text": " the attractions of the patterns are so large that if I start, let's say here, then I don't converge"}, {"start": 2080.4, "end": 2085.7599999999998, "text": " to either of these two patterns, I converge to like something in the middle, I converge to maybe"}, {"start": 2085.76, "end": 2091.84, "text": " this point right here. And that's going to be one of these meta stable states, okay, we're going to"}, {"start": 2091.84, "end": 2096.88, "text": " encounter situations like this, but we're also going to encounter situations like this. And the"}, {"start": 2096.88, "end": 2104.6400000000003, "text": " bottom thing isn't necessarily bad. And that's what you have to keep in mind. And yeah, as I"}, {"start": 2104.6400000000003, "end": 2114.1600000000003, "text": " said, we'll get to it, but just keep this kind of sphere image in mind. Okay. So first, we'll just"}, {"start": 2114.16, "end": 2119.6, "text": " deal with the, you know, the up the top situation where we store patterns and then retrieve patterns."}, {"start": 2120.7999999999997, "end": 2128.08, "text": " So we'll assume a failure probability, which is p, and p is going to be no pretty, pretty low for"}, {"start": 2128.08, "end": 2136.08, "text": " their example. So they have p equals 0.001, you know, like a 0.1% error probability of retrieving"}, {"start": 2136.08, "end": 2143.2799999999997, "text": " your pattern, things like this. And randomly chosen patterns on the sphere with radius m,"}, {"start": 2143.28, "end": 2150.48, "text": " we define some constants, yada, yada, yada, then with probability one minus p, the number of random"}, {"start": 2150.48, "end": 2157.44, "text": " patterns that can be stored and stored in the sense of having these spheres around them so that"}, {"start": 2157.44, "end": 2164.96, "text": " you can retrieve them accurately, or at least you can retrieve something that's close to them is"}, {"start": 2166.8, "end": 2172.0, "text": " is bounded lower bounded by this quantity right here. So there's the square root of p, there is"}, {"start": 2172.0, "end": 2178.72, "text": " this constant c, but then you see that d is in the exponent right here. So that means it's"}, {"start": 2178.72, "end": 2184.72, "text": " exponential in the number of dimensions. So that's, that's pretty cool. So if you add a dimension,"}, {"start": 2185.28, "end": 2194.32, "text": " you exponentially increase the number of the number of patterns you can store. And, you know,"}, {"start": 2194.32, "end": 2200.56, "text": " that's, that is a kind of, I mean, it's, it's been known for modern Hopfield networks with"}, {"start": 2200.56, "end": 2206.64, "text": " binary strings. So it's not uber surprising, but if you have, you know, it's not what you would"}, {"start": 2206.64, "end": 2214.08, "text": " imagine, like that. Okay, so they may give a few examples of these, you have to set these constants,"}, {"start": 2214.08, "end": 2220.64, "text": " you know, in a particular fashion, such that this is given and so on. But they say, examples here"}, {"start": 2220.64, "end": 2233.44, "text": " are where c is something like three, and d is 20. So if you were to add a 21st dimension, then your,"}, {"start": 2233.44, "end": 2238.64, "text": " I guess, storage capacity would increase by a factor of three, which is pretty cool."}, {"start": 2242.56, "end": 2247.68, "text": " All right, so this is how many that we can store infinitely, not sorry, exponentially many patterns"}, {"start": 2247.68, "end": 2258.3999999999996, "text": " in these networks. Now, they deal, they say, the next theorem states that the update rule"}, {"start": 2258.3999999999996, "end": 2263.8399999999997, "text": " typically converges after one update if the patterns are well separated. Okay, so if we're"}, {"start": 2263.8399999999997, "end": 2268.72, "text": " in a situation where these patterns are well separated, which is kind of like this, but you"}, {"start": 2268.72, "end": 2273.52, "text": " can also imagine this in terms of dot products, because we operate in the space of dot products."}, {"start": 2273.52, "end": 2279.36, "text": " So if the patterns are well separated, that sort of means that they all kind of sort of point away"}, {"start": 2279.36, "end": 2286.32, "text": " from each other. And this notion of separation is going to be captured by this quantity right here."}, {"start": 2286.32, "end": 2294.0, "text": " This is the separation of example of pattern i, which is just the inner product with itself,"}, {"start": 2294.0, "end": 2301.92, "text": " minus the maximum inner product with any other pattern. And this quantity is going to be like"}, {"start": 2301.92, "end": 2308.0, "text": " and this quantity is going to be large when no other pattern is close to it. So when the separation"}, {"start": 2308.0, "end": 2315.84, "text": " is large, then the update rule, the retrieval rule of calculating, you know, if a query,"}, {"start": 2316.48, "end": 2323.52, "text": " calculate the inner product with all of those, then I reweigh all of the patterns by that inner"}, {"start": 2323.52, "end": 2329.76, "text": " product by the softmax, then I use that new thing as a query again, and so on, as we discussed,"}, {"start": 2329.76, "end": 2338.2400000000002, "text": " it will converge to the closest pattern. But this theorem says it actually converges pretty fast."}, {"start": 2338.2400000000002, "end": 2345.6800000000003, "text": " And here I have my problems with saying that it converges after one step, typically converges"}, {"start": 2345.6800000000003, "end": 2353.0400000000004, "text": " after one update, because that, you know, generally depends on a lot of constants, as we'll see,"}, {"start": 2353.04, "end": 2361.12, "text": " but it does converge exponentially fast in this separation constant. As a theorem for says,"}, {"start": 2361.12, "end": 2368.64, "text": " with queries I after one update, the distance of the new point to the fixed point is exponentially"}, {"start": 2368.64, "end": 2375.92, "text": " small in the separation delta i, the precise bound using the Jacobian and its value in the mean value"}, {"start": 2375.92, "end": 2383.6, "text": " theorem are the following. So here you can see, this is the distance between the updated psi"}, {"start": 2383.6, "end": 2392.2400000000002, "text": " after one step, and the and the fixed point right here, this is what it converges to is going to be"}, {"start": 2393.12, "end": 2401.52, "text": " the distance as it was before times this thing right here. So you can see since this is a this"}, {"start": 2401.52, "end": 2411.12, "text": " is a multiplicative update. And in this Jacobian, so this is expanded down here, this is this."}, {"start": 2416.16, "end": 2423.04, "text": " You can see here you have the you have this, sorry, yeah, this is this. So this is bounded"}, {"start": 2423.04, "end": 2431.12, "text": " by that, you have the exponent, the exponential function, negative this separation right here. So"}, {"start": 2431.12, "end": 2438.48, "text": " the higher the separation, the faster this algorithm converges, okay. To say that it converges after one"}, {"start": 2438.48, "end": 2444.16, "text": " step is, you know, might be a bit of bragging. I don't know if this is a common thing, if you have"}, {"start": 2444.16, "end": 2450.96, "text": " like an exponential convergence that you are allowed to say, it's after one step. I'm not sure"}, {"start": 2450.96, "end": 2458.16, "text": " especially what I'm not sure about is that you have n here as linear constants in that factor,"}, {"start": 2458.16, "end": 2466.08, "text": " okay. So if you if you and that's what they do in their code. So if you look at their code and the"}, {"start": 2466.08, "end": 2470.56, "text": " codes available, which is pretty cool, it's implemented in PyTorch as a general module that"}, {"start": 2470.56, "end": 2476.3999999999996, "text": " can you can just drop in. So this is not only for transformers, this is for you can replace like LSTM"}, {"start": 2476.3999999999996, "end": 2483.3599999999997, "text": " you can replace pooling mechanisms, you can, you know, do a whole bunch of stuff in their paper"}, {"start": 2483.36, "end": 2491.84, "text": " in the accompanying paper, they do this multi instance learning with giant sets on using these"}, {"start": 2491.84, "end": 2497.44, "text": " hopfield layers. So pretty, pretty cool. This code is definitely worth kind of checking out and maybe"}, {"start": 2497.44, "end": 2503.44, "text": " you want to replace some stuff with you. But the question is, how many of these update steps should"}, {"start": 2503.44, "end": 2509.76, "text": " you do, right? Because we looked at the diagram, at least in the attention mechanism, it seems like"}, {"start": 2509.76, "end": 2514.7200000000003, "text": " you have attention layers, right, you have a transformer, and the transformer consists of,"}, {"start": 2514.7200000000003, "end": 2519.92, "text": " you know, you have this input right here, and you go through layer, layer, layer, layer, layer,"}, {"start": 2519.92, "end": 2527.0400000000004, "text": " and in each layer, there's contained in it, and one of these attention mechanism, right, this entire"}, {"start": 2527.0400000000004, "end": 2534.6400000000003, "text": " thing is in this layer, okay. And now if you interpret this as a hopfield network, and you want"}, {"start": 2534.64, "end": 2540.72, "text": " to do multiple steps, that means you go this branch right here. So in each layer, potentially, you do"}, {"start": 2540.72, "end": 2549.3599999999997, "text": " multiple steps of these things. So for whatever computational constraints transformers had already,"}, {"start": 2550.0, "end": 2556.16, "text": " this will certainly make it worse. But also, you need to decide how many steps you want to do. Now"}, {"start": 2556.16, "end": 2564.64, "text": " you can hard code that, of course, but they say you should do these steps until this norm here, until"}, {"start": 2564.64, "end": 2571.68, "text": " the norm between the old and the new is small enough. So where is that? So you can't measure"}, {"start": 2571.68, "end": 2577.04, "text": " how close you are to the convergence points, right, because you don't know in practice. But you can"}, {"start": 2577.04, "end": 2582.8799999999997, "text": " measure how far you're away, you can measure, where did we have it, you can measure this quantity"}, {"start": 2582.88, "end": 2588.48, "text": " right here, that's something you can measure how far two iterates are apart. So what you'll simply"}, {"start": 2588.48, "end": 2595.92, "text": " do is you'll measure that, and if that is small enough, then you'll, you'll stop. But that, I guess,"}, {"start": 2595.92, "end": 2602.6400000000003, "text": " is very related to this. So how if you, we've already proven it converges to this x star."}, {"start": 2603.52, "end": 2610.7200000000003, "text": " So I guess, we can approximate this quantity right here with the quantity above. And that tells you"}, {"start": 2610.72, "end": 2616.3999999999996, "text": " how many updates you need to do. And that quantity is linear, not only linear, but actually here"}, {"start": 2616.3999999999996, "end": 2625.12, "text": " quadratic in n, I don't care, you know, yes, it's exponential in the separation. But it's quadratic"}, {"start": 2625.12, "end": 2634.48, "text": " in n. And if I've learned anything from kind of my fast code courses, is that constants actually"}, {"start": 2634.48, "end": 2641.36, "text": " matter when you're not dealing with infinity with an infinite number of steps. So the number of the"}, {"start": 2641.36, "end": 2648.64, "text": " number of steps you need to do, I guess, will depend on the sequence length in a quadratic"}, {"start": 2648.64, "end": 2654.2400000000002, "text": " fashion. So I'm not sure you can always claim this is converges in one step. Now I might be"}, {"start": 2654.2400000000002, "end": 2661.36, "text": " super mistaken here. And none of this will can, none of this actually makes a difference in the"}, {"start": 2661.36, "end": 2667.1200000000003, "text": " in the light of the exponential decay here. But I would just, I'm just a bit worried saying this"}, {"start": 2667.1200000000003, "end": 2671.92, "text": " usually converges in one step. It's clear, I guess, why they do it, right? Because the"}, {"start": 2671.92, "end": 2679.04, "text": " attention mechanism in transformers is a one step application of this rule. And this here is kind of"}, {"start": 2679.04, "end": 2685.6800000000003, "text": " a theoretical justification for interpreting this precisely as a Hopfield network, because you'd say,"}, {"start": 2685.6800000000003, "end": 2691.28, "text": " well, in a Hopfield network, you would do multiple steps. But wait, wait, we can actually prove that"}, {"start": 2691.28, "end": 2696.4, "text": " even if you interpret it as a Hopfield network, you it can it usually converges after one step. So"}, {"start": 2696.4, "end": 2701.0400000000004, "text": " what you're actually doing in a transformer is applying a Hopfield network update rule"}, {"start": 2701.84, "end": 2708.88, "text": " to convergence. So yeah, I'm not Yeah, I might be bickering on a high level here luxury problems."}, {"start": 2709.76, "end": 2717.84, "text": " Theorem five then says so theorem four is how fast does this converge? Theorem five, the last"}, {"start": 2717.84, "end": 2725.84, "text": " theorem right here, says that the retrieval error of a pattern, and so this is the this is what you"}, {"start": 2725.84, "end": 2733.36, "text": " converge to, and this is what you've stored, is bounded by, again, something that's exponential"}, {"start": 2733.36, "end": 2743.04, "text": " in the separation right here, as you can see. Okay, so that was the theorem. So we go quickly"}, {"start": 2743.04, "end": 2749.44, "text": " through them again, theorems one and two deal with the convergence of this algorithm and the fact that"}, {"start": 2749.44, "end": 2756.88, "text": " it actually minimizes the proposed energy. Then theorem three says you can store exponentially"}, {"start": 2756.88, "end": 2765.7599999999998, "text": " many patterns in terms of the dimension of your space. And theorems four and five say that this"}, {"start": 2765.76, "end": 2772.7200000000003, "text": " update rule will converge exponentially fast after after one step, if you believe that, and the"}, {"start": 2772.7200000000003, "end": 2778.7200000000003, "text": " retrieval error will also go down exponentially fast with the number of update steps that you do."}, {"start": 2780.4, "end": 2786.32, "text": " Okay, that sounds pretty, pretty, pretty good. But we've heard it, it's very dependent on how"}, {"start": 2786.32, "end": 2793.5200000000004, "text": " well separated these patterns are. And it turns out that it's, you know, at least in transformers,"}, {"start": 2793.52, "end": 2800.08, "text": " they aren't always well separated. And that might be on purpose. Remember, the the states here,"}, {"start": 2800.08, "end": 2805.36, "text": " the patterns aren't pre stored, like in a classic Hopfield network, but the patterns,"}, {"start": 2805.92, "end": 2811.44, "text": " if you interpret an attention mechanism as this, are also generated by the network itself. So the"}, {"start": 2811.44, "end": 2818.48, "text": " pattern matrix that you retrieve from, and the query are generated by the attention mechanism."}, {"start": 2818.48, "end": 2826.56, "text": " In this case, as I said, this is applicable to many, many more domains than just this. But yeah,"}, {"start": 2827.68, "end": 2832.56, "text": " so there's another slight modification that you have to do to make this actually equivalent to"}, {"start": 2832.56, "end": 2839.04, "text": " an attention mechanism. And that is, you'll have to recast the value, because usually what you'll"}, {"start": 2839.04, "end": 2844.4, "text": " do is you have some sort of input, and then you make queries, keys and values from that using"}, {"start": 2844.4, "end": 2851.2000000000003, "text": " different heads. The only thing to make it formally equivalent is you have to make the values generated"}, {"start": 2851.2000000000003, "end": 2857.12, "text": " from the keys. So the keys give rise to the values, as you can see right here, you first"}, {"start": 2857.12, "end": 2863.04, "text": " multiply with the key matrix, and then with the value matrix, I think that's, you know, that I"}, {"start": 2863.04, "end": 2871.36, "text": " don't, I doubt that this will will change anything. If you, if you, the only way that could really"}, {"start": 2871.36, "end": 2876.4, "text": " change anything is if this matrix here would be super low rank, like collapse the space of"}, {"start": 2877.44, "end": 2881.76, "text": " into like very few dimensions, which the value matrix wouldn't do. So,"}, {"start": 2882.48, "end": 2888.88, "text": " you know, but just letting you know that the technical equality requires this slight modification."}, {"start": 2890.56, "end": 2898.56, "text": " Okay, now we said that it might not, you know, be that this is always super well"}, {"start": 2898.56, "end": 2904.0, "text": " separate, and you retrieve a single pattern. And that's what they research here in a pre trained"}, {"start": 2904.0, "end": 2911.04, "text": " BERT model. So they take a pre trained BERT model from I guess, from Hugging Face, and they run,"}, {"start": 2911.7599999999998, "end": 2918.48, "text": " they just run a data set through it. And what they do is, so for each, for each query, and sorry,"}, {"start": 2918.48, "end": 2924.64, "text": " for each attention head, because you've multiple ones of these attention heads, right? In each"}, {"start": 2924.64, "end": 2930.48, "text": " layer, to each layer, you have multiple ones of these heads for each head, they look at over the"}, {"start": 2930.48, "end": 2939.3599999999997, "text": " course of the whole data set, how do these softmax distributions look like? So when you believe that"}, {"start": 2939.3599999999997, "end": 2946.0, "text": " this is a Hopfield network, and you believe that this converges in one step, then if the patterns"}, {"start": 2946.0, "end": 2952.7999999999997, "text": " are well separated, what we would expect is a distribution, as we said, like this, okay,"}, {"start": 2952.8, "end": 2958.4, "text": " there will be one dominant pattern that you retrieve, you know, that's what you want to"}, {"start": 2958.4, "end": 2966.0, "text": " retrieve, that's what comes out, but a bang, you retrieve that accurate pattern, anything else would"}, {"start": 2966.0, "end": 2971.04, "text": " mean that the Hopfield network sort of failed, right? It wouldn't give you back one particular"}, {"start": 2971.04, "end": 2978.48, "text": " pattern. So they have, I think that's a pretty, it's a pretty smart experiment, they look, how"}, {"start": 2978.48, "end": 2984.48, "text": " many bars do we need to add? How many of these bars in the softmax distribution do we need to"}, {"start": 2984.48, "end": 2991.2, "text": " add to reach 90%? It depends a bit on the temperature of the softmax, which is hard coded"}, {"start": 2991.2, "end": 2998.64, "text": " in attention mechanism, bdb is one, this squared over d. So they say, how many do we need to add to"}, {"start": 2998.64, "end": 3009.52, "text": " get to 0.9 to 90% of the mass of this distribution? And if this is the Hopfield network, where you"}, {"start": 3009.52, "end": 3015.44, "text": " retrieve one pattern, then one will be enough, right? One of these bars will probably be,"}, {"start": 3015.44, "end": 3022.56, "text": " I don't know, like 99%. Okay, but there are other cases, imagine the case where the patterns"}, {"start": 3022.56, "end": 3030.7999999999997, "text": " and the query you retrieve the spheres that it gives rise to are all like overlapping, okay? So"}, {"start": 3031.52, "end": 3038.88, "text": " what that will do is it won't converge to any particular pattern, but the attractor space in"}, {"start": 3038.88, "end": 3043.12, "text": " this kind. So you can imagine if you have two spheres that are apart from each other,"}, {"start": 3043.92, "end": 3049.2799999999997, "text": " the update rule converges either. So if it's closer to here, it converge here, if it's closer"}, {"start": 3049.28, "end": 3057.6800000000003, "text": " to here, it will converge here. But if they are overlapping, like this, the energy landscape"}, {"start": 3057.6800000000003, "end": 3063.28, "text": " will actually make it such that it will neither if it starts somewhere, it will neither converge"}, {"start": 3063.28, "end": 3068.8, "text": " to here nor to here, it will actually converge to somewhere in the middle, okay, into the mean"}, {"start": 3068.8, "end": 3077.2000000000003, "text": " of the stored patterns. And if we take that to the extreme, what could be is it could be that"}, {"start": 3077.2, "end": 3083.7599999999998, "text": " the softmax distribution looks completely uniform, okay, which would basically mean that,"}, {"start": 3083.7599999999998, "end": 3089.04, "text": " you know, I don't care where my information comes from just average. And this has its applications."}, {"start": 3089.04, "end": 3095.9199999999996, "text": " So if you, for example, want to make a sentiment classifier, very cheap way to do that is to simply"}, {"start": 3095.9199999999996, "end": 3102.16, "text": " take pre trained word embeddings like glove or word2vec, you know, assign each word, word embedding,"}, {"start": 3102.16, "end": 3106.3199999999997, "text": " and then just average the word embeddings, okay. And you count on the fact if there are a lot of"}, {"start": 3106.32, "end": 3113.36, "text": " kind of negative words in there, like bad, sad, angry, the word embedding kind of will, you know,"}, {"start": 3113.36, "end": 3118.6400000000003, "text": " reflect that and the average word embedding will point more into the bad direction. And if there's"}, {"start": 3118.6400000000003, "end": 3124.7200000000003, "text": " a lot of happy words, the average will point into the happy direction. Okay, so there are"}, {"start": 3124.7200000000003, "end": 3130.4, "text": " applications of averaging information, not caring particularly where it comes from. And"}, {"start": 3130.4, "end": 3136.1600000000003, "text": " in that case, what we'd expect is that this number and we'll call that, so we'll call that the number"}, {"start": 3136.1600000000003, "end": 3145.04, "text": " K. In this case, it equals one. But in this case, K equals, I guess, n, the number of inputs, okay,"}, {"start": 3145.04, "end": 3152.32, "text": " because we need, well, not maybe n, but, you know, approximately, we need almost all of them to, to"}, {"start": 3152.32, "end": 3161.1200000000003, "text": " reach the 90%. Okay, and there is an in between, and these are called these meta stable states,"}, {"start": 3161.1200000000003, "end": 3168.48, "text": " where in the in between is something like, you'd have a couple of patterns here, a couple here,"}, {"start": 3168.48, "end": 3174.88, "text": " and a couple, maybe here. It's almost like a clustering like and these overlap, and these"}, {"start": 3174.88, "end": 3182.2400000000002, "text": " overlap, and these overlap, but they don't overlap with each other, which means that if you start"}, {"start": 3182.2400000000002, "end": 3186.2400000000002, "text": " somewhere here, you would converge to the mean, but not to the mean of all the patterns, but just"}, {"start": 3186.2400000000002, "end": 3192.4, "text": " to the mean of these patterns, and here, here and here, here. So this, this is like a clustering in"}, {"start": 3192.4, "end": 3197.92, "text": " latent space, right? So you can interpret these Hopfield update rules as somehow, you know,"}, {"start": 3198.48, "end": 3203.12, "text": " getting not going to a particular pattern, but going to sort of a cluster. And this is,"}, {"start": 3203.12, "end": 3209.12, "text": " if you ask something like, hey, is there any adjective around, right? And all of these patterns,"}, {"start": 3209.12, "end": 3214.48, "text": " they kind of overlap in that space in that query space of adjective, they overlap. And therefore,"}, {"start": 3214.48, "end": 3219.92, "text": " the update rule would converge to sort of the mean, which would basically say, yes, there is"}, {"start": 3219.92, "end": 3226.48, "text": " an adjective here, right? And the information would not be routed. So that the distribution,"}, {"start": 3226.48, "end": 3232.4, "text": " if we start here, I think we converge to this, the distribution would look something like small, small,"}, {"start": 3232.4, "end": 3239.36, "text": " small, and then you'd have a couple of large ones. Right, you'd have like, maybe two or three or four"}, {"start": 3239.36, "end": 3245.6, "text": " of large ones. And these would exactly correspond to the patterns here. So the information will be"}, {"start": 3245.6, "end": 3252.88, "text": " routed from all of those in that cluster to this particular note that asks the query."}, {"start": 3252.88, "end": 3256.96, "text": " Okay, these are these are what's called these meta stable states. And what they do is they"}, {"start": 3256.96, "end": 3262.8, "text": " calculate over the entire data set this number k. And here they show you the distribution. So in"}, {"start": 3262.8, "end": 3270.88, "text": " these plots, what you'll see is over the entire data set, k goes into that direction. So I guess"}, {"start": 3271.44, "end": 3279.52, "text": " let's go to this here, this this seems pretty easy. So k is in this direction. And then you"}, {"start": 3279.52, "end": 3287.52, "text": " can see that this is pretty easy. So k is in this direction. And this is simply the amount of like"}, {"start": 3287.52, "end": 3293.92, "text": " how. So in each you let a data point run through it, you measure k for that particular layer one."}, {"start": 3293.92, "end": 3302.16, "text": " You see this is layer one head four. Okay, this is one layer one attention head. And then you can"}, {"start": 3302.16, "end": 3313.44, "text": " see that number k is distributed like this. Okay, so contrast this to this head right here, where"}, {"start": 3313.44, "end": 3320.24, "text": " it's a lot of weight on the number one or like very few numbers. Okay, so these blue ones would"}, {"start": 3320.24, "end": 3327.04, "text": " be these are your typical like when you retrieve one particular pattern. So this attention head,"}, {"start": 3327.04, "end": 3334.24, "text": " let's conclude, in this particular attention head, this is very specific, it looks at its input,"}, {"start": 3334.24, "end": 3340.08, "text": " they look at its token, and it decides what information do I want. And it retrieves one"}, {"start": 3340.08, "end": 3348.24, "text": " particular thing from the other nodes. Okay. Whereas here, it's more like kind of an, an"}, {"start": 3348.24, "end": 3353.6, "text": " averaging is more like I want this kind of information. And on average, I don't even know"}, {"start": 3353.6, "end": 3362.56, "text": " what the sequence length is here, I guess it's maybe 512. So of the 512, the median, this number"}, {"start": 3362.56, "end": 3370.96, "text": " is always the median, it median, it collects information from 231 of them. Okay, so you can"}, {"start": 3370.96, "end": 3377.12, "text": " see that this corresponds these green and orange ones correspond to these meta stable states,"}, {"start": 3377.12, "end": 3384.3199999999997, "text": " where there's kind of an implicit clustering done in the in this space of attention, whereas the"}, {"start": 3384.3199999999997, "end": 3389.92, "text": " blue ones, they correspond to attention has that ask for particular information retrieve one"}, {"start": 3389.92, "end": 3397.2799999999997, "text": " particular maybe few patterns. And happy with that. And the red ones here, you can see that"}, {"start": 3397.2799999999997, "end": 3405.8399999999997, "text": " they often just average, they just, you know, because K is so high means that I need all of the"}, {"start": 3405.84, "end": 3410.8, "text": " I need all of these bars to get to the 90% or I need almost all of them, which basically means"}, {"start": 3410.8, "end": 3416.6400000000003, "text": " it's a uniform distribution, right? So it's like, I don't care where information comes from just"}, {"start": 3416.6400000000003, "end": 3425.6000000000004, "text": " average, whatever average, I just want the average in some particular space. And as we said, that also"}, {"start": 3425.6000000000004, "end": 3432.32, "text": " has its uses. Interesting how this translate through. So this here is as we go down the BERT"}, {"start": 3432.32, "end": 3436.56, "text": " model on the bottom, you have layer one, you see there are a lot of these averaging operations"}, {"start": 3436.56, "end": 3443.2000000000003, "text": " going on. So a lot of the heads are simply doing averaging. And as you go up the layers, the heads"}, {"start": 3443.2000000000003, "end": 3449.84, "text": " get more and more specific in the types of information they seek. But then again, in the"}, {"start": 3449.84, "end": 3457.44, "text": " last layers, interestingly, you get into a lot of these meta stable states again, which, I guess,"}, {"start": 3457.44, "end": 3463.12, "text": " I get interpret this as you as you want, I'm going to leave this up to you. But sort of says like"}, {"start": 3463.12, "end": 3468.48, "text": " here, you want kind of general patterns at the bottom. And then the middle layers are kind of the"}, {"start": 3468.48, "end": 3474.2400000000002, "text": " logical workhorses. So you look for very specific things in the input. This is, I guess this is"}, {"start": 3474.2400000000002, "end": 3484.32, "text": " where I guess this is where the thinking happens. So this is sort of pre processing. I'm just making"}, {"start": 3484.32, "end": 3492.2400000000002, "text": " stuff up here, by the way, this is this must be in no way true. This is maybe thinking. And this,"}, {"start": 3492.8, "end": 3497.6800000000003, "text": " this here, this might already be output again, because, you know, after that, you have language"}, {"start": 3497.6800000000003, "end": 3504.32, "text": " modeling or classification. So this might already be like, aggregating types of information."}, {"start": 3505.76, "end": 3513.2000000000003, "text": " This is how I sort of interpreted. Okay. Yeah, so so this, these, these experiments are pretty,"}, {"start": 3513.2, "end": 3521.12, "text": " pretty, pretty interesting. And here they have, they do. These are the last experiments for this"}, {"start": 3521.12, "end": 3527.2799999999997, "text": " paper. They do an interesting experiment where they actually replace the attention heads by"}, {"start": 3527.2799999999997, "end": 3533.8399999999997, "text": " simply an average mechanism. And later, they actually replace them by Gaussians. But in this"}, {"start": 3533.8399999999997, "end": 3540.0, "text": " case, they simply average, and they show that look, if I replace layer one with this averaging,"}, {"start": 3540.0, "end": 3547.12, "text": " the perplexity doesn't rise that much. Right? So it's pretty good. Even if I replace the entire"}, {"start": 3547.12, "end": 3553.76, "text": " layer here with averaging, it perplexity goes more up. And you can see the corresponds if you"}, {"start": 3553.76, "end": 3559.76, "text": " remember the previous plot, the correspondence is pretty one to one with how much blue and green"}, {"start": 3560.64, "end": 3568.4, "text": " heads there are as in contrast to how much red and orange ones there are. So here you have lots of"}, {"start": 3568.4, "end": 3577.2000000000003, "text": " blue ones. And you can see that the error kind of goes up. And interestingly, here, you have more"}, {"start": 3577.2000000000003, "end": 3583.44, "text": " meta stable states at the end, but still, the perplexity goes up more. So I guess you can only"}, {"start": 3583.44, "end": 3590.96, "text": " really replace the red ones with the averaging. So this is always averaging in one particular layer."}, {"start": 3590.96, "end": 3598.48, "text": " And they go into more detail here, where they say, look, this is this is layer six, and this is layer"}, {"start": 3598.48, "end": 3604.0, "text": " 12. So this is one particular attention head from layer six and layer 12. And the updates don't be"}, {"start": 3604.0, "end": 3610.0, "text": " confused, it goes in this direction. Okay, I was confused at first. And you can see right here,"}, {"start": 3610.0, "end": 3615.84, "text": " this number K, at first, you know, it's kind of spread out. But then it pretty quickly converges"}, {"start": 3615.84, "end": 3621.44, "text": " to a very small number. And there is this kind of point right here, I don't know if the learning"}, {"start": 3621.44, "end": 3626.2400000000002, "text": " rates decrease, I don't think so. I think that's just kind of a, a phase transition right here."}, {"start": 3626.2400000000002, "end": 3631.6000000000004, "text": " This is the blue line, by the way, the blue training line, a phase transition, where all of a"}, {"start": 3631.6000000000004, "end": 3637.04, "text": " sudden, these just these attention heads, they somehow decide, okay, this is the thing I want to"}, {"start": 3637.04, "end": 3643.76, "text": " specialize in. This is the type of task I like a sub task of linguistic sub task on specialize in"}, {"start": 3643.76, "end": 3650.5600000000004, "text": " and then they concentrate on one particular pattern per input. So they are really specializing,"}, {"start": 3650.5600000000004, "end": 3657.2000000000003, "text": " whereas in the last layer, you see here, that even during training, they are sort of continuously"}, {"start": 3657.2000000000003, "end": 3663.92, "text": " learning. So first, they also do this averaging, then they go into this meta stable region, right?"}, {"start": 3663.92, "end": 3671.76, "text": " This is this meta stable region, K isn't one, but also K isn't a very high number. So they"}, {"start": 3671.76, "end": 3678.96, "text": " continuously learn. And it's even indicative of this training might not be done here, first of"}, {"start": 3678.96, "end": 3683.5200000000004, "text": " all, and second of all, it would be really interesting to see how this works out with,"}, {"start": 3683.5200000000004, "end": 3688.2400000000002, "text": " you know, sizes of transformers and like, especially these, these huge transformers,"}, {"start": 3688.2400000000002, "end": 3695.36, "text": " just the fact that they can keep learning, the more we train them might be, you know, be"}, {"start": 3695.36, "end": 3701.6, "text": " interpreted in the light of what kind of states they converge to. And the fact that their attention"}, {"start": 3701.6, "end": 3706.7200000000003, "text": " heads, I don't know, how does this go on? Do they stay in the meta stable states, because it makes"}, {"start": 3706.7200000000003, "end": 3713.6, "text": " sense to have meta stable states, as I said, it makes sense to kind of cluster things. Or are they"}, {"start": 3713.6, "end": 3719.52, "text": " simply into is this simply an intermediate step? And if you go really far down, they would actually"}, {"start": 3719.52, "end": 3725.68, "text": " also converge to the K equals one where they really specialize? Or maybe do we need more"}, {"start": 3725.68, "end": 3732.64, "text": " attention heads for this? I don't know. It's just, I think this is just the the beginning of kind of"}, {"start": 3732.64, "end": 3739.68, "text": " research in this direction, I think, just this kind of number K, how it's how it's made, it's"}, {"start": 3739.68, "end": 3746.72, "text": " pretty simple. And apparently, it's pretty, pretty revealing. So, you know, that's pretty cool. So"}, {"start": 3746.72, "end": 3753.9199999999996, "text": " that was the paper and its experiments. It's it's a pretty sizable paper. As I said, even the paper"}, {"start": 3753.9199999999996, "end": 3761.8399999999997, "text": " itself is 10 pages. And then there is this immune repertoire classification, which I will spend one"}, {"start": 3761.8399999999997, "end": 3768.16, "text": " minute looking at it. So you have you have these set classifications. So for each human, you obtain"}, {"start": 3768.16, "end": 3774.08, "text": " a set of immune receptors. And you simply obtain one label whether that human is immune to a"}, {"start": 3774.08, "end": 3779.6, "text": " particular disease or not. And your task is kind of and then a different human has a different set,"}, {"start": 3779.6, "end": 3785.84, "text": " you have no idea which one of these things is responsible for it being for the human being"}, {"start": 3787.2, "end": 3794.96, "text": " for the human being immune or not. In fact, there is a, you can't even decide based on these, you can"}, {"start": 3794.96, "end": 3801.04, "text": " only decide based on like sub sequences of these and they might be in combination with each other."}, {"start": 3801.04, "end": 3805.7599999999998, "text": " So there might not be a single one responsible, but like a combination, but you don't have labels"}, {"start": 3805.7599999999998, "end": 3810.72, "text": " for the individual ones. And you have different ones per human and they are different length. All"}, {"start": 3810.72, "end": 3818.56, "text": " of this is just a giant, giant task. And you have many of them, you have 10s of 1000s per human,"}, {"start": 3818.56, "end": 3826.08, "text": " right. So they build a system here where first they do this 1d convolutions to process the inside"}, {"start": 3826.08, "end": 3833.7599999999998, "text": " sequences. And then they do this hopfield attention mechanism, or with with learned queries"}, {"start": 3834.3199999999997, "end": 3841.2, "text": " over these things. And then they train on the output label. And surprisingly, that actually"}, {"start": 3841.2, "end": 3850.48, "text": " works even with 10s of 1000s of inside sequences and only one label for all of them. And so they"}, {"start": 3850.48, "end": 3856.96, "text": " they achieve, I guess, favorable results compared to other baselines on this task using these"}, {"start": 3856.96, "end": 3864.16, "text": " Hopfield network, which is pretty interesting. But I'll let you look at that paper yourself. So I hope"}, {"start": 3864.16, "end": 3870.72, "text": " this somehow made it a bit clear what happens here. And it would actually be pretty interesting"}, {"start": 3870.72, "end": 3879.3599999999997, "text": " if we, you know, to see what happens if we just do maybe two rounds of these updates. Is this even"}, {"start": 3879.3599999999997, "end": 3885.3599999999997, "text": " desirable, right? Is it desirable to run this to convergence? Is there something good about not"}, {"start": 3885.3599999999997, "end": 3890.24, "text": " running into convergence? Or does it actually not matter because it actually does converge in one"}, {"start": 3890.24, "end": 3897.2799999999997, "text": " step? I don't know. But have a look at the code. It's pretty cool. And I hope you enjoy"}, {"start": 3897.28, "end": 3904.5600000000004, "text": " this video. I'm sure you have many open questions as do I don't hesitate to ask me in the comments,"}, {"start": 3904.5600000000004, "end": 3910.2400000000002, "text": " or join our discord. As I said, there are lots of helpful people on our discord. And I'll see you"}, {"start": 3910.24, "end": 3927.3599999999997, "text": " next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=udS2OPohs_s
I TRAINED AN AI TO SOLVE 2+2 (w/ Live Coding)
#ai #tech #code A whole bunch of humans are arguing whether 2+2=4 or 2+2=5. Pointless! Let the machines handle this! Colab: https://colab.research.google.com/drive/1tDjFW7CFGQG8vHdUAVNpr2EG9z0JZGYC?usp=sharing Disclaimer: This is a joke. Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there! You might have seen the recent debate about 2 plus 2 where everyone tries to weigh in the big question being is 2 plus 2 equal to 4 or is 2 plus 2 equal to 5 and for some reason the entirety of Western civilization hangs in the balance right here but everyone's missing the point everyone's just kind of arguing about this but I want to point something out right here just have a look at the accounts arguing right here you know James Eric you know what all of these have in common they're humans humans arguing about fundamental questions of the universe and culture what could possibly go wrong so today we're going to replace fallible weak-minded humans by AI we're going to build an AI that's going to answer the question what is 2 plus 2 now first thing we're going to do is to import Pytorch if you're using tensorflow what's wrong with you come on just checking whether CUDA is available CUDA is basically shorthanded AI for magic so don't worry about that part now we're going to borrow quite a bit of code from the Pytorch example because they've already implemented sort of the same thing so the model we're going to use right here is going to be a generative adversarial network now you might be wondering hey is it really smart to build AI on something that's called adversarial is that a little bit dangerous to that I say all right now so we're going to grab the code from over here first thing we need is the model itself now the model is composed of a generator and a discriminator the generator is right here think block let's plop that in here that looks good look at that generator transpose convolutions batch norms relu's this is going to be so artificial and so intelligent won't believe it so the generator is responsible for basically outputting things in our case what we're going to input a 2 and the plus and the 2 and then the output should be you know whatever the result of that is now as a data set we're going to use the famous MNIST data set this data set is a very challenging data set it's very large data set but I think in order to tackle an important question like this we need to go for the cram de la cram of data sets so MNIST is a data set that contains a lot of these handwritten digits you might think these are just numbers but these are more than numbers these numbers have a meaning so the computer just sees this in numbers but as a human you would see this right here see the zero this data set is filled with digits a four wow that's one of the things we need look at that a nine beautiful beautiful so we're going to be to try to make the network learn what 2 plus 2 is now if you know machine learning you know that you need training data so we need a labeled data set of 2 plus 2 equals and then whatever 2 plus 2 equals so first we're going to filter out all of the examples where that show a 2 so we need to train this network right so we need a number of training steps you know in AI we like to train for a lot of steps let's just go for 9,000 what we'll do is we'll train 9,000 times 64 images and the air is gonna learn what 2 plus 2 is alright so in each step we need to create a batch of training samples what we need is a 2 a plus and a 2 so for the 2 is we can just select a 2 of the 2's that we had before now the plus is a little bit more tricky so in order to make a plus there's none in the MNIST data set you have to understand the MNIST data set is also quite old I think it was invented before the plus sign was invented so that's not in the data set so we have to create a plus by ourselves it's going to be hard but we'll give it a try now I'm usually way too dumb to use mesh grid but I'm just gonna try I mean you know what can go wrong okay so as you can see we're absolutely on the wrong track right here ladies and gentlemen the most beautiful plus in the history of AI alright so we got a plus and we got all of our 2's so now let's put them together look at that 2 plus 2 next sample 2 plus 2 next sample 2 plus 2 so our AI is going to be trained on data samples just like this now in order to make the generator accept samples like this we sort of need to change it a little bit because if we try to just put this into the generator probably it won't work you see there's an error the generator is not artificially intelligent enough yet so we need to make it take samples so our samples are of size 28 by 84 and what the generator right now expects is a sample of size 100 by 512 by 4 by 4 so you may notice we have never made use of our batch size so let's fix that right now so now we're training in batches of images but it's still not cool for the generator so we need to change the generator right here here what's this good for nothing nothing alright so expects the input to be of a certain size and we are going to change that right here we also don't want any strides strides are for losers and let's see where that gets us okay so we made our generator accept images that we want and produce images of the size that we want now the entire question here is we need labels for our training data set because who's to say what two plus two is and as I said usually I would outsource this to grad students but these are humans as well so we're kind of in a pinch right here so what we're going to do is employ a heuristic we're going to ask our machine right here what two plus two for the training examples is okay so in Python you can do this by typing two plus two and you know in this case that happens to be four but who knows so for each of these training examples we're going to take the class label which is provided in the data set and we're going to take these class labels and add them together and whatever comes out is going to be the label for this in in this case it's it's for you know but it could be anything and we're just going to use these as training data for our model so we're going to need the label of the first sample and the label of the second sample and our final label is simply going to be label one plus the label two as I said this is a heuristic for training the AI now usually in a generative adversarial network or a GAN for short you'd have something that's called a generator which we do and you'd have something that's called a discriminator now I have my problems with this discrimination there is no space for discrimination in the AI field so we're going to leave away the discriminator right here I'm sorry I'm sorry we're going to directly go to the loss from the generator in order to calculate the loss we need a reference and for that we're simply going to go to our data set with our label and find any of the images that correspond to that label so if our heuristic if our Oracle says two plus two is equal to nine we're just going to go to our data set get a nine and put that as a training output okay okay so if we look at one of the labels that just happens to be a four in this case but we're going to go through the entire number of 9,000 steps and in each steps will train 64 of these different combinations of two plus two and we'll give one of the labels each time and we'll see what the AI comes up with for that we need a loss now the loss we're going to use here is going to be the L2 loss now there's some controversy but you know it is the most powerful loss proven and we have to employ the most powerful tools so let's do that so our loss here at the beginning is 509 now that's a lot of loss that's a big loss we need to get that loss down and to do that we need one of these optimizers now optimizers are kind of the secret workhorses of AI and people don't talk about them enough I wish there was like a field of research that deals with optimizers like could be called optimization or something like this I'm not sure I just I just think it would make a lot of sense so my favorite learning rate is 3e minus 4 just because contains all of the different things like a letter and the dash and that seems like a pretty good thing to do so we're going to use Adam here as an optimizer Adam I know I don't know Adam personally but I know a couple of his friends and they tell me he's pretty good so you know it's going to go zero grad and I'm dumb so I need to look up how to use an optimizer and boom okay okay so it's again a four don't don't worry about this I think this is it this is it this is AI history right here right now for five steps ten steps all right I have waited and waited and waited and it's finally done we have now trained the generator to calculate what two plus two equals from the training data set so now we actually need to ask it what is two plus two and of course we can't ask it a sample that it is already seen we need to take a new sample from the test set as is customary in machine learning so let's get the MNIST test set now the test data set consists of images as does the train data set but the model has never seen the test data set before this is a property we call generalization so let's find two nice twos all right that's the first one okay these are two nice twos let's put them together okay so this is gonna be our input to the generator okay so I'm putting the test sample here into the generator that is trained and I've labeled the output in all caps just to tell the model that this is really important computation I'm just gonna run this cell for a couple of times just to make sure that generator is in fact very sure about how important that is all right I think that's enough let's have a look at that final output I'm shaking are you ready for AI history
[{"start": 0.0, "end": 4.48, "text": " Hi there! You might have seen the recent debate about 2 plus 2 where everyone"}, {"start": 4.48, "end": 10.120000000000001, "text": " tries to weigh in the big question being is 2 plus 2 equal to 4 or is 2 plus 2"}, {"start": 10.120000000000001, "end": 16.48, "text": " equal to 5 and for some reason the entirety of Western civilization hangs"}, {"start": 16.48, "end": 22.240000000000002, "text": " in the balance right here but everyone's missing the point everyone's just kind"}, {"start": 22.240000000000002, "end": 26.68, "text": " of arguing about this but I want to point something out right here just have"}, {"start": 26.68, "end": 33.18, "text": " a look at the accounts arguing right here you know James Eric you know what"}, {"start": 33.18, "end": 38.68, "text": " all of these have in common they're humans humans arguing about fundamental"}, {"start": 38.68, "end": 43.66, "text": " questions of the universe and culture what could possibly go wrong so today"}, {"start": 43.66, "end": 49.8, "text": " we're going to replace fallible weak-minded humans by AI we're going to"}, {"start": 49.8, "end": 56.620000000000005, "text": " build an AI that's going to answer the question what is 2 plus 2 now first thing"}, {"start": 56.62, "end": 61.0, "text": " we're going to do is to import Pytorch if you're using tensorflow what's wrong"}, {"start": 61.0, "end": 66.47999999999999, "text": " with you come on just checking whether CUDA is available CUDA is basically"}, {"start": 66.47999999999999, "end": 71.75999999999999, "text": " shorthanded AI for magic so don't worry about that part now we're going to"}, {"start": 71.75999999999999, "end": 76.32, "text": " borrow quite a bit of code from the Pytorch example because they've already"}, {"start": 76.32, "end": 80.75999999999999, "text": " implemented sort of the same thing so the model we're going to use right here"}, {"start": 80.75999999999999, "end": 85.32, "text": " is going to be a generative adversarial network now you might be wondering hey"}, {"start": 85.32, "end": 90.19999999999999, "text": " is it really smart to build AI on something that's called adversarial is"}, {"start": 90.19999999999999, "end": 95.24, "text": " that a little bit dangerous to that I say all right now so we're going to"}, {"start": 95.24, "end": 99.89999999999999, "text": " grab the code from over here first thing we need is the model itself now the"}, {"start": 99.89999999999999, "end": 104.63999999999999, "text": " model is composed of a generator and a discriminator the generator is right"}, {"start": 104.63999999999999, "end": 110.96, "text": " here think block let's plop that in here that looks good look at that generator"}, {"start": 110.96, "end": 117.8, "text": " transpose convolutions batch norms relu's this is going to be so artificial"}, {"start": 117.8, "end": 122.16, "text": " and so intelligent won't believe it so the generator is responsible for"}, {"start": 122.16, "end": 128.72, "text": " basically outputting things in our case what we're going to input a 2 and the"}, {"start": 128.72, "end": 133.92, "text": " plus and the 2 and then the output should be you know whatever the result"}, {"start": 133.92, "end": 139.2, "text": " of that is now as a data set we're going to use the famous MNIST data set this"}, {"start": 139.2, "end": 144.35999999999999, "text": " data set is a very challenging data set it's very large data set but I think in"}, {"start": 144.35999999999999, "end": 148.89999999999998, "text": " order to tackle an important question like this we need to go for the cram"}, {"start": 148.89999999999998, "end": 154.79999999999998, "text": " de la cram of data sets so MNIST is a data set that contains a lot of these"}, {"start": 154.79999999999998, "end": 159.16, "text": " handwritten digits you might think these are just numbers but these are more than"}, {"start": 159.16, "end": 163.56, "text": " numbers these numbers have a meaning so the computer just sees this in numbers"}, {"start": 163.56, "end": 171.04, "text": " but as a human you would see this right here see the zero this data set is filled"}, {"start": 171.04, "end": 177.6, "text": " with digits a four wow that's one of the things we need look at that a nine"}, {"start": 177.6, "end": 184.22, "text": " beautiful beautiful so we're going to be to try to make the network learn what 2"}, {"start": 184.22, "end": 188.24, "text": " plus 2 is now if you know machine learning you know that you need training"}, {"start": 188.24, "end": 196.04000000000002, "text": " data so we need a labeled data set of 2 plus 2 equals and then whatever 2 plus 2"}, {"start": 196.04000000000002, "end": 201.08, "text": " equals so first we're going to filter out all of the examples where that show"}, {"start": 201.08, "end": 205.72, "text": " a 2 so we need to train this network right so we need a number of training"}, {"start": 205.72, "end": 212.44, "text": " steps you know in AI we like to train for a lot of steps let's just go for 9,000"}, {"start": 212.44, "end": 218.0, "text": " what we'll do is we'll train 9,000 times 64 images and the air is gonna learn"}, {"start": 218.0, "end": 223.8, "text": " what 2 plus 2 is alright so in each step we need to create a batch of training"}, {"start": 223.8, "end": 229.8, "text": " samples what we need is a 2 a plus and a 2 so for the 2 is we can just select a"}, {"start": 229.8, "end": 236.44, "text": " 2 of the 2's that we had before now the plus is a little bit more tricky so in"}, {"start": 236.44, "end": 241.72, "text": " order to make a plus there's none in the MNIST data set you have to understand"}, {"start": 241.72, "end": 246.76, "text": " the MNIST data set is also quite old I think it was invented before the plus"}, {"start": 246.76, "end": 251.67999999999998, "text": " sign was invented so that's not in the data set so we have to create a plus by"}, {"start": 251.67999999999998, "end": 256.12, "text": " ourselves it's going to be hard but we'll give it a try now I'm usually way"}, {"start": 256.12, "end": 260.68, "text": " too dumb to use mesh grid but I'm just gonna try I mean you know what can go"}, {"start": 260.68, "end": 267.64, "text": " wrong okay so as you can see we're absolutely on the wrong track right here"}, {"start": 268.15999999999997, "end": 275.62, "text": " ladies and gentlemen the most beautiful plus in the history of AI alright so we"}, {"start": 275.62, "end": 282.4, "text": " got a plus and we got all of our 2's so now let's put them together look at that"}, {"start": 282.4, "end": 293.88, "text": " 2 plus 2 next sample 2 plus 2 next sample 2 plus 2 so our AI is going to be"}, {"start": 293.88, "end": 298.32, "text": " trained on data samples just like this now in order to make the generator"}, {"start": 298.32, "end": 303.1, "text": " accept samples like this we sort of need to change it a little bit because if we"}, {"start": 303.1, "end": 308.20000000000005, "text": " try to just put this into the generator probably it won't work you see there's"}, {"start": 308.20000000000005, "end": 312.64000000000004, "text": " an error the generator is not artificially intelligent enough yet so"}, {"start": 312.64000000000004, "end": 318.82000000000005, "text": " we need to make it take samples so our samples are of size 28 by 84 and what"}, {"start": 318.82000000000005, "end": 326.56, "text": " the generator right now expects is a sample of size 100 by 512 by 4 by 4 so"}, {"start": 326.56, "end": 330.84000000000003, "text": " you may notice we have never made use of our batch size so let's fix that right"}, {"start": 330.84, "end": 335.23999999999995, "text": " now so now we're training in batches of images but it's still not cool for the"}, {"start": 335.23999999999995, "end": 339.23999999999995, "text": " generator so we need to change the generator right here here what's this"}, {"start": 339.23999999999995, "end": 344.28, "text": " good for nothing nothing alright so expects the input to be of a certain"}, {"start": 344.28, "end": 349.28, "text": " size and we are going to change that right here we also don't want any"}, {"start": 349.28, "end": 356.35999999999996, "text": " strides strides are for losers and let's see where that gets us okay so we made"}, {"start": 356.36, "end": 362.54, "text": " our generator accept images that we want and produce images of the size that we"}, {"start": 362.54, "end": 367.66, "text": " want now the entire question here is we need labels for our training data set"}, {"start": 367.66, "end": 372.6, "text": " because who's to say what two plus two is and as I said usually I would"}, {"start": 372.6, "end": 378.92, "text": " outsource this to grad students but these are humans as well so we're kind"}, {"start": 378.92, "end": 382.52000000000004, "text": " of in a pinch right here so what we're going to do is employ a heuristic we're"}, {"start": 382.52, "end": 389.32, "text": " going to ask our machine right here what two plus two for the training examples"}, {"start": 389.32, "end": 397.71999999999997, "text": " is okay so in Python you can do this by typing two plus two and you know in this"}, {"start": 397.71999999999997, "end": 402.88, "text": " case that happens to be four but who knows so for each of these training"}, {"start": 402.88, "end": 408.71999999999997, "text": " examples we're going to take the class label which is provided in the data set"}, {"start": 408.72, "end": 412.52000000000004, "text": " and we're going to take these class labels and add them together and whatever"}, {"start": 412.52000000000004, "end": 417.08000000000004, "text": " comes out is going to be the label for this in in this case it's it's for you"}, {"start": 417.08000000000004, "end": 422.04, "text": " know but it could be anything and we're just going to use these as training data"}, {"start": 422.04, "end": 427.0, "text": " for our model so we're going to need the label of the first sample and the label"}, {"start": 427.0, "end": 432.16, "text": " of the second sample and our final label is simply going to be label one plus the"}, {"start": 432.16, "end": 438.40000000000003, "text": " label two as I said this is a heuristic for training the AI now usually in a"}, {"start": 438.4, "end": 442.91999999999996, "text": " generative adversarial network or a GAN for short you'd have something that's"}, {"start": 442.91999999999996, "end": 446.47999999999996, "text": " called a generator which we do and you'd have something that's called a"}, {"start": 446.47999999999996, "end": 451.9, "text": " discriminator now I have my problems with this discrimination there is no"}, {"start": 451.9, "end": 456.88, "text": " space for discrimination in the AI field so we're going to leave away the"}, {"start": 456.88, "end": 461.4, "text": " discriminator right here I'm sorry I'm sorry we're going to directly go to the"}, {"start": 461.4, "end": 467.2, "text": " loss from the generator in order to calculate the loss we need a reference"}, {"start": 467.2, "end": 473.0, "text": " and for that we're simply going to go to our data set with our label and find any"}, {"start": 473.0, "end": 478.88, "text": " of the images that correspond to that label so if our heuristic if our Oracle"}, {"start": 478.88, "end": 483.24, "text": " says two plus two is equal to nine we're just going to go to our data set get a"}, {"start": 483.24, "end": 489.52, "text": " nine and put that as a training output okay okay so if we look at one of the"}, {"start": 489.52, "end": 495.12, "text": " labels that just happens to be a four in this case but we're going to go through"}, {"start": 495.12, "end": 501.48, "text": " the entire number of 9,000 steps and in each steps will train 64 of these"}, {"start": 501.48, "end": 505.8, "text": " different combinations of two plus two and we'll give one of the labels each"}, {"start": 505.8, "end": 510.8, "text": " time and we'll see what the AI comes up with for that we need a loss now the"}, {"start": 510.8, "end": 514.5600000000001, "text": " loss we're going to use here is going to be the L2 loss now there's some"}, {"start": 514.5600000000001, "end": 521.36, "text": " controversy but you know it is the most powerful loss proven and we have to"}, {"start": 521.36, "end": 525.6800000000001, "text": " employ the most powerful tools so let's do that so our loss here at the"}, {"start": 525.6800000000001, "end": 532.28, "text": " beginning is 509 now that's a lot of loss that's a big loss we need to get"}, {"start": 532.28, "end": 537.32, "text": " that loss down and to do that we need one of these optimizers now optimizers"}, {"start": 537.32, "end": 542.64, "text": " are kind of the secret workhorses of AI and people don't talk about them enough"}, {"start": 542.64, "end": 547.12, "text": " I wish there was like a field of research that deals with optimizers like"}, {"start": 547.12, "end": 552.04, "text": " could be called optimization or something like this I'm not sure I just"}, {"start": 552.04, "end": 557.88, "text": " I just think it would make a lot of sense so my favorite learning rate is 3e"}, {"start": 557.88, "end": 564.4, "text": " minus 4 just because contains all of the different things like a letter and the"}, {"start": 564.4, "end": 569.76, "text": " dash and that seems like a pretty good thing to do so we're going to use Adam"}, {"start": 569.76, "end": 575.6800000000001, "text": " here as an optimizer Adam I know I don't know Adam personally but I know a couple"}, {"start": 575.68, "end": 581.4, "text": " of his friends and they tell me he's pretty good so you know it's going to go"}, {"start": 581.4, "end": 587.8, "text": " zero grad and I'm dumb so I need to look up how to use an optimizer and boom okay"}, {"start": 587.8, "end": 592.68, "text": " okay so it's again a four don't don't worry about this I think this is it this"}, {"start": 592.68, "end": 601.0799999999999, "text": " is it this is AI history right here right now for five steps ten steps all"}, {"start": 601.08, "end": 607.48, "text": " right I have waited and waited and waited and it's finally done we have now"}, {"start": 607.48, "end": 613.4000000000001, "text": " trained the generator to calculate what two plus two equals from the training"}, {"start": 613.4000000000001, "end": 617.5600000000001, "text": " data set so now we actually need to ask it what is two plus two and of course we"}, {"start": 617.5600000000001, "end": 623.24, "text": " can't ask it a sample that it is already seen we need to take a new sample from"}, {"start": 623.24, "end": 628.36, "text": " the test set as is customary in machine learning so let's get the MNIST test set"}, {"start": 628.36, "end": 634.44, "text": " now the test data set consists of images as does the train data set but the model"}, {"start": 634.44, "end": 638.72, "text": " has never seen the test data set before this is a property we call"}, {"start": 638.72, "end": 645.04, "text": " generalization so let's find two nice twos all right that's the first one okay"}, {"start": 645.04, "end": 649.72, "text": " these are two nice twos let's put them together okay so this is gonna be our"}, {"start": 649.72, "end": 655.86, "text": " input to the generator okay so I'm putting the test sample here into the"}, {"start": 655.86, "end": 661.44, "text": " generator that is trained and I've labeled the output in all caps just to"}, {"start": 661.44, "end": 665.5600000000001, "text": " tell the model that this is really important computation I'm just gonna run"}, {"start": 665.5600000000001, "end": 673.08, "text": " this cell for a couple of times just to make sure that generator is in fact very"}, {"start": 673.08, "end": 678.08, "text": " sure about how important that is all right I think that's enough let's have a"}, {"start": 678.08, "end": 688.9200000000001, "text": " look at that final output I'm shaking are you ready for AI history"}]
Yannic Kilchner
https://www.youtube.com/watch?v=ml3Y1ljVSQ8
PCGRL: Procedural Content Generation via Reinforcement Learning (Paper Explained)
#ai #research #gaming Deep RL is usually used to solve games, but this paper turns the process on its head and applies RL to game level creation. Compared to traditional approaches, it frames level design as a sequential decision making progress and ends up with a fast and diverse level generator. OUTLINE: 0:00 - Intro & Overview 1:30 - Level Design via Reinforcement Learning 3:00 - Reinforcement Learning 4:45 - Observation Space 5:40 - Action Space 15:40 - Change Percentage Limit 20:50 - Quantitative Results 22:10 - Conclusion & Outlook Paper: https://arxiv.org/abs/2001.09212 Code: https://github.com/amidos2006/gym-pcgrl Abstract: We investigate how reinforcement learning can be used to train level-designing agents. This represents a new approach to procedural content generation in games, where level design is framed as a game, and the content generator itself is learned. By seeing the design problem as a sequential task, we can use reinforcement learning to learn how to take the next action so that the expected final level quality is maximized. This approach can be used when few or no examples exist to train from, and the trained generator is very fast. We investigate three different ways of transforming two-dimensional level design problems into Markov decision processes and apply these to three game environments. Authors: Ahmed Khalifa, Philip Bontrager, Sam Earle, Julian Togelius ERRATA: - The reward is given after each step. Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, have you ever wondered how video game levels are made? Yeah, me neither. But this paper has. And in this paper, you can see a reinforcement learning agent that has learned how to make video game levels in various ways. So this is implemented for this game here where the goal is simply to make the longest maze. This game here is an adaptation to the legend of Zelda, where you have to get a key to the door. And this game here is called Sobocon, where you have to put all of the crates onto the green squares in order to solve it. So it's a puzzle game. Alright, and this is done via reinforcement learning. So the paper we're going to look at is called PCGRL procedural content generation via reinforcement learning by Ahmed Khalifa, Philip Bontrager, Sam Early and Julian Togelius. Now this paper is basically just a fun paper, and I feel and it shows how to frame a problem in terms of reinforcement learning, and then how to solve it. It's pretty straightforward, it's fairly short. And I you know, the codes available and all so you can go check it out yourself. They say we investigate how reinforcement learning can be used to train level designing agents. Okay, so usually, usually, you we do reinforcement learning for playing games in themselves. And now we use reinforcement learning to train an agent that can design a level. So we don't design the level itself. straightforward, we design the agent that designs the level. And what's the advantage here? The advantages, of course, the agent could then potentially generate multiple different levels once we have trained it. I say this represents a new approach to procedural content generation in games, where level design is framed as a game itself. So the design of the level is now the game. And the content generator itself is learned. By seeing the design problem as a sequential task, we can use reinforcement learning to learn how to take the next action, so that the expected final level quality is maximized. This approach can be used when few or no examples exist to train from, and the train generator is very, very fast. Okay, so this is the outset of the of the problem formulation. Now, we're going to go through the steps you have to do in order to make this work. There are a few things that I think this paper does quite well. And so the first thing is you actually have to frame the problem in terms of reinforcement learning. So what is reinforcement learning is pretty simple. In reinforcement learning, you have this agent environment split, okay, so at each step, the environment is going to send the agent an observation. So the environment is going to send an observation to the agent. And the agent needs to take an action in response to that. Now, something happens in here, we don't we don't worry about that. And the environment is going to send the next observation, okay, that is a result from taking this action. And it is also going to send the reward for this action. So at each step, the agent gets an observation, and the reward for the last action took and it has the output the next action. Now, the environment, of course, has to somehow decide how do I represent the observation, this is the representation, how do I transform one observation to the next observation given an action, okay, the action comes in and transforms the last state to the next state. And then how do I give the reward? How do I calculate the reward? So these things are the things you have to decide on the observation space, the how the reward is calculated, the action space, and how an action transforms one representation into the next representation. So this is what we're going to look at the different variants, we're not going to look at specifically how reinforcement learning is done. Because once you have an environment like this, you can just plug it into a standard reinforcement learning algorithm, and it will solve it for you. Okay, so that's the power of basically having standardized or representations. So the observation space of this problem is going to be pretty simple. All the games we're dealing with here are in this, oh, I already did some drawings are in this, in this framework of this grid world game, okay, so you have this, you have this grid, this level is subdivided into this grid. And that naturally corresponds, of course, to a 2d matrix. Now, each point in this matrix has a number, and the number describes what type of tile this tile is. So as you can see, right here, the one is going to be a wall, while the zero is going to be empty space. Three here is one of these crates, and two is the player. So you get the point, right, each number corresponds to a type of tile. So far, so good. That's the observation space. Now, what is the action space? What is the what the agent can do? At each step, they say the agent can change one of these tiles, okay, so you can change one of these tiles, let's say this one right here, it can change it to a different one, or you can just leave it. So this is a wall right now. And it makes the problem fairly interesting to have a wall right here in the middle. So we're since we're looking at this tile, we might just want to leave this right there. We could also change it, we could actually change it such that to a to a two such that there is another player right here. Right, let me Can I even draw this? This yellow isn't such that there is now two player tiles in the game. So would of course be an invalid level. And the reinforcement learning agent ultimately should learn to produce valid and good levels. Okay, so at each step, you can change one tile. And of course, the goal is to make a better and better and better level over time. Now how how do you choose which tile to to change? That's a thing you have to define. And they define three different ways where in which the agent can choose which tile to change. In the narrow formulation, they themselves so the environment chooses the frame the the tile to change. So the environment will say now you can change this tile if you want. And then the next step it will say now you can change this one if you want. Now you can change this one if you want. Now this is completely random, okay? How the environment actually doesn't have to be but the environment chooses and that is problematic for the agent because the agent cannot kind of predict which tile it can change next. And therefore, it cannot really plan ahead how it wants to change the level it can only make very, very local, very greedy choices. It can be like, Oh, I'm, I'm right here. I might I'm actually build a wall right here. Yes, that sounds good. But it can't. So an example is maybe you want to make the level more interesting. Maybe you think that the crate up here is a bit close to this field here, you have to push it onto this field. And that's fairly easy, right? So you just push it like up and then to the left. Actually, it's not that easy, because there's the wall right here. And you have to go around. Actually, you probably have to push this down. But let's say the level is too easy. And you want to move the move the crate to a bit, like let's say here, in this, in this framework where the environment tells you which which, which tiles to change, you can basically, once you come across this tile, you can delete it, okay, but then you kind of have to wait and wait and wait and wait until at random, this tile where you want to put it is selected. And this might actually never happen because the episode might be over. And if it never happens, you are in an invalid level, right? So the the the agent here is basically forced to greedily make the level valid before it can make it interesting and then it can only make it interesting in sort of local ways. So the second way that the second formulation here is the turtle formulation. Now, you might know this from the turtle graphics, where basically, you have this, you have this little turtle thing, and you can always move it either like, you know, down, up, left or right. And then you can always put a dot or not put a dot and thereby you can like trace out things. This is like intro to programming. Same here. So now the agent is given a starting square, and it can choose to change it or not, but it can also choose how to move to the next square. So to the right, up, left or down, it can so it can choose so you can go along and say, Okay, now I'm here, I want to change it to a two. Now I'm here, I want to change it to a two. Now I'm here, and so on. So it can basically do things like build long walls and things like this. So you can plan ahead more considerably. But still, if you regard the problem from before, if it wants to place the misplaced place to create to a different location, it can like if maybe it's here, okay, the agent is here. And then it can say, Okay, I want to not change but move not change and move not change, move and then it can delete and then it has to move over here step by step until it can place it again. It's so it can plan ahead considerably longer, actually, it could just move straight over because the agent itself is not constrained by walls. So it can move ahead quite a bit. But it's still kind of localized changes because it can move one tile at a time, right? And if in between the episode ends, it's again, an invalid level. So the third formulation is the most powerful formulation. It's called the wide formulation. And this is where the agent at each time step cannot only choose how to change the tile but can freely choose the next tile to change. So it can it could say, in one step, it could say, I want to delete this tile. And then in the next step, it could say, I want to place it right here. Okay, so this is so it can plan ahead considerably. So how you design the action space is very important for how your agent or for what your agent can possibly learn, and how easy it is for the agent to learn because it's going to be pretty easy for this agent to learn to move crates like this, where even though the other agent that moves one tile at a time can also do it, it has to plan ahead for longer. So it has to sort of invest more of the reinforcement learning power into doing these sorts of things. But of course, it's being more constrained also means you have less actions at your disposal. Like this last agent, it has a lot of actions it can do, it can choose any tile at once, right. So that can also introduce considerable exploration dilemma. And you have to trade these things off when you design things like that. Alright, so this is the action space. Now, how the observation involves evolves into the next observation should be fairly clear. I mean, that's already given by the action space. If you ask yourself, if you're in this in this situation right here, and the agent deletes the crate, then the crate is no longer there. Then, so if it changes this to a zero, then it's just empty space now. Okay, so that's, that's fairly obvious here. Now the last thing we need to do is the reward calculation. What reward do you give the agent? And you can here you can give the agent the reward either, let's say at the very end, you cannot give it a reward for the entire episode and give it a reward at the very end. reinforcement learning algorithms are able to deal with this to a certain degree. You can also decide to give it at each step. Now the way they do it here, I believe is they give it at the end, and they have multiple components to the reward. So the reward in this case is how well the level fulfills certain goals that the programmer sets. So the goals in SoboCon are basically the rules of the game. And that means there is only one player, if there are two or none, then the reward is less. There are at least one crate, and there are as many crates as green fields. Okay, so here you can see there are only two crates, but three green fields. So the agent will get a penalty for producing a level like this. And then the last thing is the level has to be solvable. And for checking solvability, the the authors of this paper simply employ a SoboCon solver, they have a SoboCon solver, that is like a tree search algorithm that tries to solve the level if it can't solve the level, then the level is invalid and the agent gets a worse reward than whenever the level is solvable. Okay, so how you design the reward is also very important if you only give give like a one reward when all the goals are fulfilled and give a zero reward as soon as one of the goals is not fulfilled, a reinforcement learning agent is going to have a very, very much difficult time to learn that. So you have to kind of design the reward such that you help the agent realize what's important. So maybe if there's only one crate missing, but you know, in fact, the level is solvable. Except for that, you know that maybe one green field is going to be empty, then you could still give a fairly high reward, but you could just give a higher reward when the level is actually solvable, like or all the rules are fulfilled, fulfilled, and there is a crate here. Okay. The other thing to notice here is that in this case, you actually do need a solver for the level since it's a puzzle game. And that means your level your agent is only going to produce levels that are as difficult as your solver can solve. So that's going to be a considerable problem. But that's, you know, a limitation here. But all of their rewards are hard coded, so to say. So there's the reward is given by the environment. So now that we have observations, which are these matrices right here, we have actions, which and we actually have three different ways of formulating actions, and we have reward, they can simply plug this into a standard reinforcement learning algorithm. Now they have one last thing that they have, which is this change percentage parameter. So what they say is they give the agent an initial state, and then the agent is allowed to change it around, like here. So on the left, you have this initial state, okay, this is sort of a random initial state, and you allow the agent now to change it in this stepwise fashion, and you always update the agent. By the way, the agent, as you might imagine, the agent takes this matrix right here, and puts it shoves it through like a few convolutional layers and then decides on an action. I almost forgetting that this this is so obvious by now that yeah, the agent is like a standard deep learning, taking in a 2d doing some convolutions and then having like a policy output. Yeah, so you shove this into a proximal policy optimization algorithm, which is a standard reinforcement learning algorithm, and you allow it to change these things. Now, what they do is they only allow the agent to change the levels by so much because what they say is, if we start out from these different states, we would, you can decide on two things, either the you can train the agent to find you the best possible level ever, right, but then it would sort of ignore the starting state, it would just learn which level gives me the highest reward. And it would just change all the tiles always to that, right, it would just try to change the to always reach that best possible state and forget the start state. So they say, okay, the the last constraint is the agent can only change like 20% of the tiles at most. And after after that, we end the episode, or we just don't allow the agent to change anything anymore. It needs to first. So if it changed this here to empty space, and wants to change something else first needs to change this back, and then it can change something else. So you can do that. So this constrains the agent and kind of teaches it that in order to get a high reward, it must sort of adjust the starting state to something that gets higher reward. And that's one way of making the levels that you generate more diverse. It's sort of a unique problem to this particular kind of reinforcement learning problem. Because all sometimes, like most of the time, you just want to find the highest reward, whatever. But here, you also want to, you know, maximize diversity of the levels you generate. And therefore, you could say that's, that's a pretty good, you know, that's a pretty good constraint to put into that. So that's a thing I like here about this paper. This, this change percentage constraint. Now at inference time, you can change that. So at training time, you only change whatever 20%. But at inference time, you can technically let the agent run for longer, as you can see, I think here, they just let it run until it, you know, find something good, like this one right here, fairly good from the starting state. And you can see it sort of still adjusts to the starting state right here. So you can see that these, it connects the two dots on the top. So the goal is to make the longest possible maze or a long maze. So it connects these two, you can see here, also, this one connects them. So, and then it goes out here and connects to this one. So it's fairly good at relying on this starting state. Now, you can see that these turtle and wide representations that can actually choose where to go and where to change something are considerably, or, you know, more more powerful than this narrow thing, especially if you look at this level right here, which again, is the importance of designing the action space well, is going to directly affect the outcome that you're going to have. All right, and you see the same thing here for this Zelda game. Now, here you can see the starting state often involves, let's say, here you have two players, and you have three keys, and that's an invalid starting state. And sometimes the the door cannot be reached, sometimes the door is actually not even there, like here. And you can see that the agent, all of the agents sort of learn to make at least valid levels, where you have the player and the door and the key right here, being able to reach everything. So that's, you know, fairly, fairly cool, because counting is one of these things that the neural networks aren't necessarily super good at. So it's nice to see that, you know, they can, they can, here they have two players, and they they're deleting one of them. Here, they have three crates, and they actually make it such that the number of crates and the number of green tiles agree. So, you know, that's that's fairly cool that this comes out. And here, you can see the different power of the algorithms. So in this binary problem, and this is the Zelda problem, this is Sobocon problem, you can see that as you allow the agent at inference time to change more and more of the level, the percentage of levels where the agent gets a good gets a good level, like succeeds in building a valid level, goes up and up. And now this, as I already said, this narrow representation here appears to be a bit less powerful than the others. Interestingly, in Sobocon, the best one is this turtle representation where you can only change one tile at a time, and not the more powerful wide representation. That's probably because I'm going to guess that's because the either the reinforcement learning algorithm was isn't, you know, powerful enough or their representation like the CNN is maybe miss architecture a bit. You know, technically, this representation should be able to achieve higher scores, but not as easily because as I said, the action space is so much higher. So it's more difficult to learn, but ultimately, it should learn it better. Alright, so this is this was this paper. It's, I think it's fairly cool and fairly fun to view it from this particular perspective. And they discussed that the future could be that humans solve this together. Because usually, when you have assisted level design, you would have something some sort of like an optimizer running to optimize the level you're working on directly, like it say, okay, make something here and it would sort of run for a while. And that takes, you know, takes time. Now this here, this agent at inference time is very, very fast. So it can, you know, work together with humans. So the human would say, for example, Oh, here, please make a wall right here, because that's going to make the level more interesting, but make it such that the level is still, you know, interesting and solvable. And then the agent can, you know, go across do some things that's going to be super fast. And agents and humans could work together at this. Now one drawback, of course, is that in a puzzle game like Sobocon, you know, you have to make sure the level is solvable. And here, luckily, you can employ a solver, but as the puzzles get more difficult, that's not, not super like, that's not going to be the case that much. And also, they remark that most of the levels generated are fairly easy, because their reward only depends on whether or not the level is solvable by an easy solver, right. So you could give some reward for how difficult the level is. But then again, that depends on your solver. So an interesting next step would be to evolve these, or to train these. As you train reinforcement learning agents to solve these kinds of games. So kind of do a curriculum learning sort of a GAN setting between level generator and reinforcement learning algorithm, like reinforcement learning game player to to sort of evolve levels and agents at the same time. I think it's sort of like this poet approaches, except you would directly learn. I think that would be next nice direction for this work. In any case, the code is available, you can even plug in your own games and make your own levels. So check this out. And with that, I'll see you next time. Bye bye.
[{"start": 0.0, "end": 6.84, "text": " Hi there, have you ever wondered how video game levels are made? Yeah, me neither. But"}, {"start": 6.84, "end": 12.76, "text": " this paper has. And in this paper, you can see a reinforcement learning agent that has"}, {"start": 12.76, "end": 21.2, "text": " learned how to make video game levels in various ways. So this is implemented for this game"}, {"start": 21.2, "end": 26.44, "text": " here where the goal is simply to make the longest maze. This game here is an adaptation"}, {"start": 26.44, "end": 31.8, "text": " to the legend of Zelda, where you have to get a key to the door. And this game here"}, {"start": 31.8, "end": 39.0, "text": " is called Sobocon, where you have to put all of the crates onto the green squares in order"}, {"start": 39.0, "end": 47.02, "text": " to solve it. So it's a puzzle game. Alright, and this is done via reinforcement learning."}, {"start": 47.02, "end": 52.96, "text": " So the paper we're going to look at is called PCGRL procedural content generation via reinforcement"}, {"start": 52.96, "end": 60.08, "text": " learning by Ahmed Khalifa, Philip Bontrager, Sam Early and Julian Togelius. Now this paper"}, {"start": 60.08, "end": 68.24000000000001, "text": " is basically just a fun paper, and I feel and it shows how to frame a problem in terms"}, {"start": 68.24000000000001, "end": 72.56, "text": " of reinforcement learning, and then how to solve it. It's pretty straightforward, it's"}, {"start": 72.56, "end": 82.12, "text": " fairly short. And I you know, the codes available and all so you can go check it out yourself."}, {"start": 82.12, "end": 88.82000000000001, "text": " They say we investigate how reinforcement learning can be used to train level designing"}, {"start": 88.82000000000001, "end": 96.86, "text": " agents. Okay, so usually, usually, you we do reinforcement learning for playing games"}, {"start": 96.86, "end": 103.64, "text": " in themselves. And now we use reinforcement learning to train an agent that can design"}, {"start": 103.64, "end": 110.80000000000001, "text": " a level. So we don't design the level itself. straightforward, we design the agent that"}, {"start": 110.8, "end": 116.36, "text": " designs the level. And what's the advantage here? The advantages, of course, the agent"}, {"start": 116.36, "end": 123.58, "text": " could then potentially generate multiple different levels once we have trained it. I say this"}, {"start": 123.58, "end": 129.4, "text": " represents a new approach to procedural content generation in games, where level design is"}, {"start": 129.4, "end": 136.16, "text": " framed as a game itself. So the design of the level is now the game. And the content"}, {"start": 136.16, "end": 141.24, "text": " generator itself is learned. By seeing the design problem as a sequential task, we can"}, {"start": 141.24, "end": 146.64, "text": " use reinforcement learning to learn how to take the next action, so that the expected"}, {"start": 146.64, "end": 153.64, "text": " final level quality is maximized. This approach can be used when few or no examples exist"}, {"start": 153.64, "end": 160.07999999999998, "text": " to train from, and the train generator is very, very fast. Okay, so this is the outset"}, {"start": 160.07999999999998, "end": 165.4, "text": " of the of the problem formulation. Now, we're going to go through the steps you have to"}, {"start": 165.4, "end": 170.6, "text": " do in order to make this work. There are a few things that I think this paper does quite"}, {"start": 170.6, "end": 177.44, "text": " well. And so the first thing is you actually have to frame the problem in terms of reinforcement"}, {"start": 177.44, "end": 182.20000000000002, "text": " learning. So what is reinforcement learning is pretty simple. In reinforcement learning,"}, {"start": 182.20000000000002, "end": 187.72, "text": " you have this agent environment split, okay, so at each step, the environment is going"}, {"start": 187.72, "end": 194.24, "text": " to send the agent an observation. So the environment is going to send an observation to the agent."}, {"start": 194.24, "end": 202.12, "text": " And the agent needs to take an action in response to that. Now, something happens in here, we"}, {"start": 202.12, "end": 208.92000000000002, "text": " don't we don't worry about that. And the environment is going to send the next observation, okay,"}, {"start": 208.92000000000002, "end": 215.12, "text": " that is a result from taking this action. And it is also going to send the reward for"}, {"start": 215.12, "end": 221.56, "text": " this action. So at each step, the agent gets an observation, and the reward for the last"}, {"start": 221.56, "end": 226.28, "text": " action took and it has the output the next action. Now, the environment, of course, has"}, {"start": 226.28, "end": 234.76, "text": " to somehow decide how do I represent the observation, this is the representation, how do I transform"}, {"start": 234.76, "end": 241.36, "text": " one observation to the next observation given an action, okay, the action comes in and transforms"}, {"start": 241.36, "end": 246.58, "text": " the last state to the next state. And then how do I give the reward? How do I calculate"}, {"start": 246.58, "end": 252.96, "text": " the reward? So these things are the things you have to decide on the observation space,"}, {"start": 252.96, "end": 260.98, "text": " the how the reward is calculated, the action space, and how an action transforms one representation"}, {"start": 260.98, "end": 267.56, "text": " into the next representation. So this is what we're going to look at the different variants,"}, {"start": 267.56, "end": 271.3, "text": " we're not going to look at specifically how reinforcement learning is done. Because once"}, {"start": 271.3, "end": 276.1, "text": " you have an environment like this, you can just plug it into a standard reinforcement"}, {"start": 276.1, "end": 282.32000000000005, "text": " learning algorithm, and it will solve it for you. Okay, so that's the power of basically"}, {"start": 282.32000000000005, "end": 290.48, "text": " having standardized or representations. So the observation space of this problem is going"}, {"start": 290.48, "end": 295.32000000000005, "text": " to be pretty simple. All the games we're dealing with here are in this, oh, I already did some"}, {"start": 295.32000000000005, "end": 304.24, "text": " drawings are in this, in this framework of this grid world game, okay, so you have this,"}, {"start": 304.24, "end": 309.64, "text": " you have this grid, this level is subdivided into this grid. And that naturally corresponds,"}, {"start": 309.64, "end": 315.24, "text": " of course, to a 2d matrix. Now, each point in this matrix has a number, and the number"}, {"start": 315.24, "end": 321.0, "text": " describes what type of tile this tile is. So as you can see, right here, the one is"}, {"start": 321.0, "end": 328.28000000000003, "text": " going to be a wall, while the zero is going to be empty space. Three here is one of these"}, {"start": 328.28000000000003, "end": 333.06, "text": " crates, and two is the player. So you get the point, right, each number corresponds"}, {"start": 333.06, "end": 341.4, "text": " to a type of tile. So far, so good. That's the observation space. Now, what is the action"}, {"start": 341.4, "end": 347.32, "text": " space? What is the what the agent can do? At each step, they say the agent can change"}, {"start": 347.32, "end": 352.88, "text": " one of these tiles, okay, so you can change one of these tiles, let's say this one right"}, {"start": 352.88, "end": 357.24, "text": " here, it can change it to a different one, or you can just leave it. So this is a wall"}, {"start": 357.24, "end": 361.16, "text": " right now. And it makes the problem fairly interesting to have a wall right here in the"}, {"start": 361.16, "end": 366.08000000000004, "text": " middle. So we're since we're looking at this tile, we might just want to leave this right"}, {"start": 366.08000000000004, "end": 371.40000000000003, "text": " there. We could also change it, we could actually change it such that to a to a two such that"}, {"start": 371.40000000000003, "end": 377.96000000000004, "text": " there is another player right here. Right, let me Can I even draw this? This yellow isn't"}, {"start": 377.96000000000004, "end": 383.40000000000003, "text": " such that there is now two player tiles in the game. So would of course be an invalid"}, {"start": 383.40000000000003, "end": 387.88, "text": " level. And the reinforcement learning agent ultimately should learn to produce valid and"}, {"start": 387.88, "end": 394.6, "text": " good levels. Okay, so at each step, you can change one tile. And of course, the goal is"}, {"start": 394.6, "end": 400.54, "text": " to make a better and better and better level over time. Now how how do you choose which"}, {"start": 400.54, "end": 406.2, "text": " tile to to change? That's a thing you have to define. And they define three different"}, {"start": 406.2, "end": 414.56, "text": " ways where in which the agent can choose which tile to change. In the narrow formulation,"}, {"start": 414.56, "end": 420.76, "text": " they themselves so the environment chooses the frame the the tile to change. So the environment"}, {"start": 420.76, "end": 426.04, "text": " will say now you can change this tile if you want. And then the next step it will say now"}, {"start": 426.04, "end": 430.12, "text": " you can change this one if you want. Now you can change this one if you want. Now this"}, {"start": 430.12, "end": 435.76, "text": " is completely random, okay? How the environment actually doesn't have to be but the environment"}, {"start": 435.76, "end": 442.6, "text": " chooses and that is problematic for the agent because the agent cannot kind of predict which"}, {"start": 442.6, "end": 448.48, "text": " tile it can change next. And therefore, it cannot really plan ahead how it wants to change"}, {"start": 448.48, "end": 456.0, "text": " the level it can only make very, very local, very greedy choices. It can be like, Oh, I'm,"}, {"start": 456.0, "end": 461.92, "text": " I'm right here. I might I'm actually build a wall right here. Yes, that sounds good."}, {"start": 461.92, "end": 469.0, "text": " But it can't. So an example is maybe you want to make the level more interesting. Maybe"}, {"start": 469.0, "end": 474.56, "text": " you think that the crate up here is a bit close to this field here, you have to push"}, {"start": 474.56, "end": 479.28, "text": " it onto this field. And that's fairly easy, right? So you just push it like up and then"}, {"start": 479.28, "end": 483.4, "text": " to the left. Actually, it's not that easy, because there's the wall right here. And you"}, {"start": 483.4, "end": 489.64, "text": " have to go around. Actually, you probably have to push this down. But let's say the"}, {"start": 489.64, "end": 496.92, "text": " level is too easy. And you want to move the move the crate to a bit, like let's say here,"}, {"start": 496.92, "end": 503.40000000000003, "text": " in this, in this framework where the environment tells you which which, which tiles to change,"}, {"start": 503.40000000000003, "end": 509.36, "text": " you can basically, once you come across this tile, you can delete it, okay, but then you"}, {"start": 509.36, "end": 516.44, "text": " kind of have to wait and wait and wait and wait until at random, this tile where you"}, {"start": 516.44, "end": 520.76, "text": " want to put it is selected. And this might actually never happen because the episode"}, {"start": 520.76, "end": 528.8, "text": " might be over. And if it never happens, you are in an invalid level, right? So the the"}, {"start": 528.8, "end": 534.16, "text": " the agent here is basically forced to greedily make the level valid before it can make it"}, {"start": 534.16, "end": 540.68, "text": " interesting and then it can only make it interesting in sort of local ways. So the second way that"}, {"start": 540.68, "end": 546.88, "text": " the second formulation here is the turtle formulation. Now, you might know this from"}, {"start": 546.88, "end": 553.8, "text": " the turtle graphics, where basically, you have this, you have this little turtle thing,"}, {"start": 553.8, "end": 559.76, "text": " and you can always move it either like, you know, down, up, left or right. And then you"}, {"start": 559.76, "end": 567.12, "text": " can always put a dot or not put a dot and thereby you can like trace out things. This"}, {"start": 567.12, "end": 574.08, "text": " is like intro to programming. Same here. So now the agent is given a starting square,"}, {"start": 574.08, "end": 578.5600000000001, "text": " and it can choose to change it or not, but it can also choose how to move to the next"}, {"start": 578.5600000000001, "end": 584.1600000000001, "text": " square. So to the right, up, left or down, it can so it can choose so you can go along"}, {"start": 584.1600000000001, "end": 588.6800000000001, "text": " and say, Okay, now I'm here, I want to change it to a two. Now I'm here, I want to change"}, {"start": 588.6800000000001, "end": 596.5600000000001, "text": " it to a two. Now I'm here, and so on. So it can basically do things like build long walls"}, {"start": 596.5600000000001, "end": 603.1600000000001, "text": " and things like this. So you can plan ahead more considerably. But still, if you regard"}, {"start": 603.16, "end": 607.92, "text": " the problem from before, if it wants to place the misplaced place to create to a different"}, {"start": 607.92, "end": 615.4, "text": " location, it can like if maybe it's here, okay, the agent is here. And then it can say,"}, {"start": 615.4, "end": 619.4, "text": " Okay, I want to not change but move not change and move not change, move and then it can"}, {"start": 619.4, "end": 625.8, "text": " delete and then it has to move over here step by step until it can place it again. It's"}, {"start": 625.8, "end": 630.0, "text": " so it can plan ahead considerably longer, actually, it could just move straight over"}, {"start": 630.0, "end": 637.24, "text": " because the agent itself is not constrained by walls. So it can move ahead quite a bit."}, {"start": 637.24, "end": 642.56, "text": " But it's still kind of localized changes because it can move one tile at a time, right? And"}, {"start": 642.56, "end": 649.1, "text": " if in between the episode ends, it's again, an invalid level. So the third formulation"}, {"start": 649.1, "end": 654.0, "text": " is the most powerful formulation. It's called the wide formulation. And this is where the"}, {"start": 654.0, "end": 659.34, "text": " agent at each time step cannot only choose how to change the tile but can freely choose"}, {"start": 659.34, "end": 665.82, "text": " the next tile to change. So it can it could say, in one step, it could say, I want to"}, {"start": 665.82, "end": 671.88, "text": " delete this tile. And then in the next step, it could say, I want to place it right here."}, {"start": 671.88, "end": 679.0400000000001, "text": " Okay, so this is so it can plan ahead considerably. So how you design the action space is very"}, {"start": 679.0400000000001, "end": 686.32, "text": " important for how your agent or for what your agent can possibly learn, and how easy it"}, {"start": 686.32, "end": 690.32, "text": " is for the agent to learn because it's going to be pretty easy for this agent to learn"}, {"start": 690.32, "end": 696.08, "text": " to move crates like this, where even though the other agent that moves one tile at a time"}, {"start": 696.08, "end": 702.0400000000001, "text": " can also do it, it has to plan ahead for longer. So it has to sort of invest more of the reinforcement"}, {"start": 702.0400000000001, "end": 709.08, "text": " learning power into doing these sorts of things. But of course, it's being more constrained"}, {"start": 709.08, "end": 715.6400000000001, "text": " also means you have less actions at your disposal. Like this last agent, it has a lot of actions"}, {"start": 715.64, "end": 720.56, "text": " it can do, it can choose any tile at once, right. So that can also introduce considerable"}, {"start": 720.56, "end": 726.3, "text": " exploration dilemma. And you have to trade these things off when you design things like"}, {"start": 726.3, "end": 734.04, "text": " that. Alright, so this is the action space. Now, how the observation involves evolves"}, {"start": 734.04, "end": 737.8, "text": " into the next observation should be fairly clear. I mean, that's already given by the"}, {"start": 737.8, "end": 743.38, "text": " action space. If you ask yourself, if you're in this in this situation right here, and"}, {"start": 743.38, "end": 750.32, "text": " the agent deletes the crate, then the crate is no longer there. Then, so if it changes"}, {"start": 750.32, "end": 757.12, "text": " this to a zero, then it's just empty space now. Okay, so that's, that's fairly obvious"}, {"start": 757.12, "end": 761.9399999999999, "text": " here. Now the last thing we need to do is the reward calculation. What reward do you"}, {"start": 761.9399999999999, "end": 767.44, "text": " give the agent? And you can here you can give the agent the reward either, let's say at"}, {"start": 767.44, "end": 771.94, "text": " the very end, you cannot give it a reward for the entire episode and give it a reward"}, {"start": 771.94, "end": 778.48, "text": " at the very end. reinforcement learning algorithms are able to deal with this to a certain degree."}, {"start": 778.48, "end": 784.48, "text": " You can also decide to give it at each step. Now the way they do it here, I believe is"}, {"start": 784.48, "end": 792.2600000000001, "text": " they give it at the end, and they have multiple components to the reward. So the reward in"}, {"start": 792.2600000000001, "end": 799.6600000000001, "text": " this case is how well the level fulfills certain goals that the programmer sets. So the goals"}, {"start": 799.66, "end": 807.3399999999999, "text": " in SoboCon are basically the rules of the game. And that means there is only one player,"}, {"start": 807.3399999999999, "end": 814.9, "text": " if there are two or none, then the reward is less. There are at least one crate, and"}, {"start": 814.9, "end": 819.4599999999999, "text": " there are as many crates as green fields. Okay, so here you can see there are only two"}, {"start": 819.4599999999999, "end": 824.6999999999999, "text": " crates, but three green fields. So the agent will get a penalty for producing a level like"}, {"start": 824.7, "end": 832.22, "text": " this. And then the last thing is the level has to be solvable. And for checking solvability,"}, {"start": 832.22, "end": 840.46, "text": " the the authors of this paper simply employ a SoboCon solver, they have a SoboCon solver,"}, {"start": 840.46, "end": 844.7800000000001, "text": " that is like a tree search algorithm that tries to solve the level if it can't solve"}, {"start": 844.7800000000001, "end": 851.5400000000001, "text": " the level, then the level is invalid and the agent gets a worse reward than whenever the"}, {"start": 851.54, "end": 858.26, "text": " level is solvable. Okay, so how you design the reward is also very important if you only"}, {"start": 858.26, "end": 863.8199999999999, "text": " give give like a one reward when all the goals are fulfilled and give a zero reward as soon"}, {"start": 863.8199999999999, "end": 868.9399999999999, "text": " as one of the goals is not fulfilled, a reinforcement learning agent is going to have a very, very"}, {"start": 868.9399999999999, "end": 873.86, "text": " much difficult time to learn that. So you have to kind of design the reward such that"}, {"start": 873.86, "end": 879.02, "text": " you help the agent realize what's important. So maybe if there's only one crate missing,"}, {"start": 879.02, "end": 885.54, "text": " but you know, in fact, the level is solvable. Except for that, you know that maybe one green"}, {"start": 885.54, "end": 889.78, "text": " field is going to be empty, then you could still give a fairly high reward, but you could"}, {"start": 889.78, "end": 894.78, "text": " just give a higher reward when the level is actually solvable, like or all the rules are"}, {"start": 894.78, "end": 900.38, "text": " fulfilled, fulfilled, and there is a crate here. Okay. The other thing to notice here"}, {"start": 900.38, "end": 905.14, "text": " is that in this case, you actually do need a solver for the level since it's a puzzle"}, {"start": 905.14, "end": 911.58, "text": " game. And that means your level your agent is only going to produce levels that are as"}, {"start": 911.58, "end": 917.54, "text": " difficult as your solver can solve. So that's going to be a considerable problem. But that's,"}, {"start": 917.54, "end": 923.34, "text": " you know, a limitation here. But all of their rewards are hard coded, so to say. So there's"}, {"start": 923.34, "end": 930.06, "text": " the reward is given by the environment. So now that we have observations, which are these"}, {"start": 930.06, "end": 934.54, "text": " matrices right here, we have actions, which and we actually have three different ways"}, {"start": 934.54, "end": 940.3, "text": " of formulating actions, and we have reward, they can simply plug this into a standard"}, {"start": 940.3, "end": 945.0799999999999, "text": " reinforcement learning algorithm. Now they have one last thing that they have, which"}, {"start": 945.0799999999999, "end": 951.3399999999999, "text": " is this change percentage parameter. So what they say is they give the agent an initial"}, {"start": 951.3399999999999, "end": 957.26, "text": " state, and then the agent is allowed to change it around, like here. So on the left, you"}, {"start": 957.26, "end": 962.14, "text": " have this initial state, okay, this is sort of a random initial state, and you allow the"}, {"start": 962.14, "end": 966.86, "text": " agent now to change it in this stepwise fashion, and you always update the agent. By the way,"}, {"start": 966.86, "end": 972.6999999999999, "text": " the agent, as you might imagine, the agent takes this matrix right here, and puts it"}, {"start": 972.6999999999999, "end": 979.64, "text": " shoves it through like a few convolutional layers and then decides on an action. I almost"}, {"start": 979.64, "end": 985.98, "text": " forgetting that this this is so obvious by now that yeah, the agent is like a standard"}, {"start": 985.98, "end": 995.1, "text": " deep learning, taking in a 2d doing some convolutions and then having like a policy output. Yeah,"}, {"start": 995.1, "end": 1000.5, "text": " so you shove this into a proximal policy optimization algorithm, which is a standard reinforcement"}, {"start": 1000.5, "end": 1005.5, "text": " learning algorithm, and you allow it to change these things. Now, what they do is they only"}, {"start": 1005.5, "end": 1011.46, "text": " allow the agent to change the levels by so much because what they say is, if we start"}, {"start": 1011.46, "end": 1017.58, "text": " out from these different states, we would, you can decide on two things, either the you"}, {"start": 1017.58, "end": 1023.72, "text": " can train the agent to find you the best possible level ever, right, but then it would sort"}, {"start": 1023.72, "end": 1028.68, "text": " of ignore the starting state, it would just learn which level gives me the highest reward."}, {"start": 1028.68, "end": 1033.9, "text": " And it would just change all the tiles always to that, right, it would just try to change"}, {"start": 1033.9, "end": 1040.54, "text": " the to always reach that best possible state and forget the start state. So they say, okay,"}, {"start": 1040.54, "end": 1047.58, "text": " the the last constraint is the agent can only change like 20% of the tiles at most. And"}, {"start": 1047.58, "end": 1051.98, "text": " after after that, we end the episode, or we just don't allow the agent to change anything"}, {"start": 1051.98, "end": 1058.54, "text": " anymore. It needs to first. So if it changed this here to empty space, and wants to change"}, {"start": 1058.54, "end": 1062.54, "text": " something else first needs to change this back, and then it can change something else."}, {"start": 1062.54, "end": 1067.22, "text": " So you can do that. So this constrains the agent and kind of teaches it that in order"}, {"start": 1067.22, "end": 1073.3600000000001, "text": " to get a high reward, it must sort of adjust the starting state to something that gets"}, {"start": 1073.3600000000001, "end": 1080.18, "text": " higher reward. And that's one way of making the levels that you generate more diverse."}, {"start": 1080.18, "end": 1086.4, "text": " It's sort of a unique problem to this particular kind of reinforcement learning problem. Because"}, {"start": 1086.4, "end": 1092.66, "text": " all sometimes, like most of the time, you just want to find the highest reward, whatever."}, {"start": 1092.66, "end": 1097.6200000000001, "text": " But here, you also want to, you know, maximize diversity of the levels you generate. And"}, {"start": 1097.6200000000001, "end": 1101.42, "text": " therefore, you could say that's, that's a pretty good, you know, that's a pretty good"}, {"start": 1101.42, "end": 1109.3000000000002, "text": " constraint to put into that. So that's a thing I like here about this paper. This, this change"}, {"start": 1109.3000000000002, "end": 1114.22, "text": " percentage constraint. Now at inference time, you can change that. So at training time,"}, {"start": 1114.22, "end": 1119.3000000000002, "text": " you only change whatever 20%. But at inference time, you can technically let the agent run"}, {"start": 1119.3, "end": 1123.86, "text": " for longer, as you can see, I think here, they just let it run until it, you know, find"}, {"start": 1123.86, "end": 1128.74, "text": " something good, like this one right here, fairly good from the starting state. And you"}, {"start": 1128.74, "end": 1134.74, "text": " can see it sort of still adjusts to the starting state right here. So you can see that these,"}, {"start": 1134.74, "end": 1141.84, "text": " it connects the two dots on the top. So the goal is to make the longest possible maze"}, {"start": 1141.84, "end": 1147.1, "text": " or a long maze. So it connects these two, you can see here, also, this one connects"}, {"start": 1147.1, "end": 1155.58, "text": " them. So, and then it goes out here and connects to this one. So it's fairly good at relying"}, {"start": 1155.58, "end": 1160.6999999999998, "text": " on this starting state. Now, you can see that these turtle and wide representations that"}, {"start": 1160.6999999999998, "end": 1165.82, "text": " can actually choose where to go and where to change something are considerably, or,"}, {"start": 1165.82, "end": 1171.9399999999998, "text": " you know, more more powerful than this narrow thing, especially if you look at this level"}, {"start": 1171.94, "end": 1178.8200000000002, "text": " right here, which again, is the importance of designing the action space well, is going"}, {"start": 1178.8200000000002, "end": 1186.74, "text": " to directly affect the outcome that you're going to have. All right, and you see the"}, {"start": 1186.74, "end": 1192.6200000000001, "text": " same thing here for this Zelda game. Now, here you can see the starting state often"}, {"start": 1192.6200000000001, "end": 1198.5, "text": " involves, let's say, here you have two players, and you have three keys, and that's an invalid"}, {"start": 1198.5, "end": 1203.98, "text": " starting state. And sometimes the the door cannot be reached, sometimes the door is actually"}, {"start": 1203.98, "end": 1208.3, "text": " not even there, like here. And you can see that the agent, all of the agents sort of"}, {"start": 1208.3, "end": 1214.96, "text": " learn to make at least valid levels, where you have the player and the door and the key"}, {"start": 1214.96, "end": 1222.62, "text": " right here, being able to reach everything. So that's, you know, fairly, fairly cool,"}, {"start": 1222.62, "end": 1227.34, "text": " because counting is one of these things that the neural networks aren't necessarily super"}, {"start": 1227.34, "end": 1236.4199999999998, "text": " good at. So it's nice to see that, you know, they can, they can, here they have two players,"}, {"start": 1236.4199999999998, "end": 1241.3, "text": " and they they're deleting one of them. Here, they have three crates, and they actually"}, {"start": 1241.3, "end": 1250.26, "text": " make it such that the number of crates and the number of green tiles agree. So, you know,"}, {"start": 1250.26, "end": 1255.1399999999999, "text": " that's that's fairly cool that this comes out. And here, you can see the different power"}, {"start": 1255.14, "end": 1261.66, "text": " of the algorithms. So in this binary problem, and this is the Zelda problem, this is Sobocon"}, {"start": 1261.66, "end": 1267.18, "text": " problem, you can see that as you allow the agent at inference time to change more and"}, {"start": 1267.18, "end": 1275.9, "text": " more of the level, the percentage of levels where the agent gets a good gets a good level,"}, {"start": 1275.9, "end": 1282.26, "text": " like succeeds in building a valid level, goes up and up. And now this, as I already said,"}, {"start": 1282.26, "end": 1288.82, "text": " this narrow representation here appears to be a bit less powerful than the others. Interestingly,"}, {"start": 1288.82, "end": 1295.18, "text": " in Sobocon, the best one is this turtle representation where you can only change one tile at a time,"}, {"start": 1295.18, "end": 1301.22, "text": " and not the more powerful wide representation. That's probably because I'm going to guess"}, {"start": 1301.22, "end": 1306.48, "text": " that's because the either the reinforcement learning algorithm was isn't, you know, powerful"}, {"start": 1306.48, "end": 1315.18, "text": " enough or their representation like the CNN is maybe miss architecture a bit. You know,"}, {"start": 1315.18, "end": 1321.18, "text": " technically, this representation should be able to achieve higher scores, but not as"}, {"start": 1321.18, "end": 1328.02, "text": " easily because as I said, the action space is so much higher. So it's more difficult"}, {"start": 1328.02, "end": 1337.06, "text": " to learn, but ultimately, it should learn it better. Alright, so this is this was this"}, {"start": 1337.06, "end": 1343.18, "text": " paper. It's, I think it's fairly cool and fairly fun to view it from this particular"}, {"start": 1343.18, "end": 1348.8, "text": " perspective. And they discussed that the future could be that humans solve this together."}, {"start": 1348.8, "end": 1353.52, "text": " Because usually, when you have assisted level design, you would have something some sort"}, {"start": 1353.52, "end": 1358.26, "text": " of like an optimizer running to optimize the level you're working on directly, like it"}, {"start": 1358.26, "end": 1363.18, "text": " say, okay, make something here and it would sort of run for a while. And that takes, you"}, {"start": 1363.18, "end": 1368.98, "text": " know, takes time. Now this here, this agent at inference time is very, very fast. So it"}, {"start": 1368.98, "end": 1375.22, "text": " can, you know, work together with humans. So the human would say, for example, Oh, here,"}, {"start": 1375.22, "end": 1378.54, "text": " please make a wall right here, because that's going to make the level more interesting,"}, {"start": 1378.54, "end": 1382.5, "text": " but make it such that the level is still, you know, interesting and solvable. And then"}, {"start": 1382.5, "end": 1388.66, "text": " the agent can, you know, go across do some things that's going to be super fast. And"}, {"start": 1388.66, "end": 1394.86, "text": " agents and humans could work together at this. Now one drawback, of course, is that in a"}, {"start": 1394.86, "end": 1401.3, "text": " puzzle game like Sobocon, you know, you have to make sure the level is solvable. And here,"}, {"start": 1401.3, "end": 1408.58, "text": " luckily, you can employ a solver, but as the puzzles get more difficult, that's not, not"}, {"start": 1408.58, "end": 1413.02, "text": " super like, that's not going to be the case that much. And also, they remark that most"}, {"start": 1413.02, "end": 1417.9399999999998, "text": " of the levels generated are fairly easy, because their reward only depends on whether or not"}, {"start": 1417.9399999999998, "end": 1425.5, "text": " the level is solvable by an easy solver, right. So you could give some reward for how difficult"}, {"start": 1425.5, "end": 1429.9399999999998, "text": " the level is. But then again, that depends on your solver. So an interesting next step"}, {"start": 1429.9399999999998, "end": 1436.96, "text": " would be to evolve these, or to train these. As you train reinforcement learning agents"}, {"start": 1436.96, "end": 1442.26, "text": " to solve these kinds of games. So kind of do a curriculum learning sort of a GAN setting"}, {"start": 1442.26, "end": 1449.1000000000001, "text": " between level generator and reinforcement learning algorithm, like reinforcement learning"}, {"start": 1449.1000000000001, "end": 1456.4, "text": " game player to to sort of evolve levels and agents at the same time. I think it's sort"}, {"start": 1456.4, "end": 1462.3600000000001, "text": " of like this poet approaches, except you would directly learn. I think that would be next"}, {"start": 1462.36, "end": 1468.6, "text": " nice direction for this work. In any case, the code is available, you can even plug in"}, {"start": 1468.6, "end": 1474.6999999999998, "text": " your own games and make your own levels. So check this out. And with that, I'll see you"}, {"start": 1474.7, "end": 1493.8600000000001, "text": " next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=WVPE62Gk3EM
Big Bird: Transformers for Longer Sequences (Paper Explained)
#ai #nlp #attention The quadratic resource requirements of the attention mechanism are the main roadblock in scaling up transformers to long sequences. This paper replaces the full quadratic attention mechanism by a combination of random attention, window attention, and global attention. Not only does this allow the processing of longer sequences, translating to state-of-the-art experimental results, but also the paper shows that BigBird comes with theoretical guarantees of universal approximation and turing completeness. OUTLINE: 0:00 - Intro & Overview 1:50 - Quadratic Memory in Full Attention 4:55 - Architecture Overview 6:35 - Random Attention 10:10 - Window Attention 13:45 - Global Attention 15:40 - Architecture Summary 17:10 - Theoretical Result 22:00 - Experimental Parameters 25:35 - Structured Block Computations 29:30 - Recap 31:50 - Experimental Results 34:05 - Conclusion Paper: https://arxiv.org/abs/2007.14062 My Video on Attention: https://youtu.be/iDulhoQ2pro My Video on BERT: https://youtu.be/-9evrZnBorM My Video on Longformer: https://youtu.be/_8KNb5iqblE ... and its memory requirements: https://youtu.be/gJR28onlqzs Abstract: Transformers-based models, such as BERT, have been one of the most successful deep learning models for NLP. Unfortunately, one of their core limitations is the quadratic dependency (mainly in terms of memory) on the sequence length due to their full attention mechanism. To remedy this, we propose, BigBird, a sparse attention mechanism that reduces this quadratic dependency to linear. We show that BigBird is a universal approximator of sequence functions and is Turing complete, thereby preserving these properties of the quadratic, full attention model. Along the way, our theoretical analysis reveals some of the benefits of having O(1) global tokens (such as CLS), that attend to the entire sequence as part of the sparse attention mechanism. The proposed sparse attention can handle sequences of length up to 8x of what was previously possible using similar hardware. As a consequence of the capability to handle longer context, BigBird drastically improves performance on various NLP tasks such as question answering and summarization. We also propose novel applications to genomics data. Authors: Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, today we'll look at Big Bird transformers for longer sequences by Manil Zahir and Gurugra Rugganesh et al of Google Research. So this paper on a high level proposes to replace the quadratic attention mechanism in transformers by a mix of random attention, windowed attention and selective global attention, therefore achieving a complexity of linear memory requirement instead of quadratic memory requirement. And as a result of that they can process longer sequences than traditional transformers like BERT and achieve better results in some NLP tasks and they also evaluate on genomics tasks. So we'll go through this paper a bit, look a bit at the proof because they give a theoretical kind of guarantee that their random attention mechanism can still be Turing complete and still achieve the same things as a full attention mechanism but we'll also look at the drawbacks. I sort of have mixed feelings about this paper and I think I'll voice my concerns as we go through here but first let's look at the paper, let's look at the architecture and I think this is actually a pretty cool paper for the empirical progression of the field to process longer sequences with transformers. As always if you like content like this feel free to share it around, leave a like and tell me in the comments what you think about the paper and about what I think, whatever, you just go nuts. Alright so the basic premise right here is that the transformers they've been pretty impactful especially in NLP. So they say transformer based models such as BERT have been one of the most successful deep learning models for NLP. Unfortunately one of their core limitations is the quadratic dependency mainly in terms of memory on the sequence length due to their full attention mechanism. So really briefly the full attention mechanism and I've done numerous videos about attention mechanism BERT, attention is all you need and so on so if you want a detailed explanation of what that is just go look up the corresponding videos but briefly what you'll have in NLP is a set of tokens, a sequence of tokens as an input and you want to transform them layer after layer into sort of a higher order representation of that same sequence and for that you build these layers out of nodes and you have as many nodes usually as you have tokens in the sequence and the next set of, so each token is represented by a vector at the beginning and each layer transforms this sequence as I said into sort of a higher level representation. So you want the vector of this token right here to be a better representation than the vector was right here and you do that by incorporating information from all the other tokens into that particular vector. Now as I said this is called an attention mechanism and we don't actually have to go into how it works right here but you can see pretty clearly that if you want to do this for every token you need to have information routed from every token to every token like from here to here, from here to here and so on and this is just one token and then you need to do it for this token and for this token and for this token. So what you'll ultimately get if n is your sequence length you'll get some n squared amount of computation and memory requirements for this. So this is a problem and usually this means that you know this sequence length in BERT this is limited to something like 512 tokens which is okay for some applications but if you want to summarize you know entire articles, entire books even or do question answering with lots of context it's not really enough. So people have been thinking about how to scale this input, how to scale this and of course the main culprit is this quadratic attention mechanism because if you you know double the 512 you need you know four times the amount of compute and memory. So how does this paper go about reducing that quadratic dependency? The goal right here is of course to get this to some O of n right because then as we double the input length we simply need to double the compute requirements and that would be fantastic and that's what this paper does and it does so without you know sacrificing the properties of the transformer. So here's the architecture that BigBERT proposes. By the way BigBERT another character from Sesame Street I guess will continue the naming here after Elmo and BERT. I'm waiting for the model that's the count. Yeah that's going to be a fun model but so BigBERT basically has three different types of attention here. These are adjacency matrices in this attention mechanism. So here is the input layer and the output layer is right here. So that basically means that node i right here would be connected, sorry that's not a straight line, would be connected to this particular node and also to this particular node. So we're now trying if we have node i right here we're now trying to not connect it to all of these nodes but we'll say we'll just select some at random and then connect it to that. Okay this is what we call random attention and you can pretty clearly see if you connect each of the i nodes to r equals 2 to two random nodes then you don't have an n squared anymore but you'll have an like an O of r times n which you know if r is a constant is an O of n attention mechanism. Okay so the main goal between the random attention mechanism is that for each query basically you select random tokens that you attend to and that random number is a fixed number that's not dependent on the sequence length. And the paper is a little bit unclear about whether or not those random ones are the same for every sequence or are switched up or are the same for every layer or are switched up but they formulate all of this as sort of in sort of a graph in sort of a random graph. So they formulate the attention mechanism in form of a graph. So if we transform all of these nodes into a graph a full attention mechanism would mean that each graph each node is connected to each of the other nodes right fully connected graph I don't maybe that's it. So that would be a full attention mechanism and then they say well if we just have random connections between these things then there are some theorems from graph theory that say that each random walk in this graph is going to so this graph is going to mix pretty quickly so I can get from each node to each other node by a random walk in a logarithmic time and this random walk which basically means that you go from here to here this would be one layer of the transformer and then if you want to go from here to here that you would have to do that in the next layer so this formulation as a random graph leads me to believe that layer after layer the random attention pattern is going to be the same but also the formulation of the paper leads me to believe that this random attention differs from sequence to sequence so I believe what's happening is that they you know get a new sequence then they decide on this pattern right here once and then they use this layer after layer the same pattern again so you can see that in the traditional attention information can basically flow from each of the nodes to each other node in one single step right because each node is connected to each other node you see this in the graph right here however if we only select a subset then you know it needs to if I want to go from as I said from here to here then I need to do it in two steps and therefore I need two layers and that's going to be the culprit of this method here and you know while it is mentioned in the paper it's sort of I feel at least that's my my assessment of this paper it's kind of swept under the rug a little bit I mean they do have a theorem that clearly says we can construct an example of a task that in the full attention setting can be solved with a single step so a single layer that in our random attention setting needs a lot of layers so a lot of steps but you know the rest of the paper is sort of shaky on on this thing but nevertheless you can see how the random attention can if you have enough layers do the same information routing as the full attention okay however this is not a property of the random attention and we'll see this in the next thing right here so the next ingredient that this paper uses is window attention and you can see over here that Big Bird is ultimately going to be a combination of the three types of attention which will which we are looking at here so window attention basically means that each each eye each token at the eye of position is going to attend to itself of course so here is I but it is also going to attend to its neighbors so here is I minus one and here is I plus one and this is a you know this is a window size W that you can that is a parameter but also it is a constant and therefore you again go from n squared to W times n which you know is O of n if W is a constant and this might be familiar to you because we've already seen this in the long former papers I've made a video or I think even two videos on the long former which used exactly the window attention in combination with the global attention and if you want to know more about that go watch these videos but the new thing in Big Bird right here is this edition of the random attention again the the window here is is has exactly the same properties as the random attention so you have instead of a fully connected graph you have a sparsely connected graph now if you have random attention the sparsely connected graph is like like the one on the right but if you have a windowed attention you can it is kind of not randomly connected but each node is connected to its neighbors like this and you can also see that if I want to go from this node to this node right here I can't do it in one step but I can do it in two steps I go here and I go here so in the terms of the attention layers if I want to go from node one to node three I have to do it in two steps because each node is only connected to its neighbors so the connection patterns would sort of look like this so I have to go from one to two and then in the next layer from two to three so the paper basically makes up for the lack of full attention by adding layers and you all also might recognize this from a convolution operation like this basically because it is a convolution operation right in a convolution each node a only aggregates input from its neighbors for the next layer and then we know that as we go up the layers the de facto window that each node looks at is going to be like a cone kind of like this so this is very similar to how a convolutional neural network works and the reasoning is very similar because the reasoning is well in a sentence the most important words for any given word are probably going to be its neighbors like the words around it and as you go up the layers you branch out more and more but ultimately the this neighborhood principle holds in NLP as well so again we already saw this in the long former but that's the reason behind the window attention and that's the second ingredient and then the third ingredient is this global attention now the global attention is selected tokens that are so important and that's you know fixed by the developers that are so important that they are they are connected to everything else so for example in these transformers you often have what's you know this kind of CLS token so this is a special token that you prepend to some piece of text and the output of this token is going to be your classification output because you don't want to bind your classification if you need to classify the entire sequence you don't want to bind that decision to one particular word what you want to do is you will have an extra token and that's this CLS token that kind of aggregates information from all of this so layer after layer layer after layer you'll have so if we go here layer after layer we have this one special node and in each step every single other node is able to send information right here to this node and receive information from this node okay so now as a result of this as you as you may be able to see every single every single path is kind of maximum length of two because if I want to go from any node to any other node I can simply you know send information to this global node and then the global node in the next step can send information to whatever other node and that is a property that they use in their proof that this attention mechanism is as sort of as powerful as the classic fool attention mechanism and we'll go through that in one second but first I hope this was clear that this combination of random attention window attention and global attention is what is called Big Bird okay they have some engineering tricks that go along with this but in concept you can imagine Big Bird being long former plus these random attention right here and you know as an engineer as an NLP engineer that makes kind of total sense I you know I totally believe that a the introduction the addition of these random attention of these random attention patterns can absolutely help your classification or whatever your NLP tasks because you know more attention better and I also am completely willing to believe that you know using the full attention matrix while it is of course more accurate it won't hurt too much to leave some of that attention away because essentially all the path lengths are just becoming two or even with the random attention are really short or logarithmic to route information from a node to some other node so the loss that you incur is kind of in a logarithmic scale in terms of performance while the gain that you make is sort of in a in a quadratic or like a linear scale you go from quadratic to linear and that seems to me like a good empirical trade-off all right however the the proofs here the proof of of how how these how these things are constructed are a little bit I don't know so what they do in the proof that this function can sort of appropriate is a universal approximator people have already shown that full attention mechanisms are universal approximators so they show here that this sparse attention mechanism is also a universal approximator they make big use of star graphs what they say is okay if we have a star graph which is one node connected right here to every other node this is a star graph if we have a star graph we can achieve the same thing then with a full graph a full graph is where every node is connected to every other node but as I already said what they need for this is multiple layers of this star graph so and that has to do with the fact that if I want to route information I basically have to go via this middle node right here and there is an additional complication because this middle node in our case right here is only one node I can't route information at the same like I can't have this routing right here at the same time that I have this routing right here like going from here to here because I only have one middle node and I kind of this is not how that like this is very dumb math but maybe you have to imagine that there is one memory slot and you can only use that one memory slot at the same time for one of these things so essentially what you'll have to do is you'll have to do the green thing first and then in the next step you'll have to do the blue thing second and then so these are now pairwise routing between nodes but ultimately what an attention mechanism does is it does everything to everything right in a single layer it routes information from all the nodes to all the other nodes and to achieve that you need multiple rounds of this and it turns out that in the worst case you actually need n rounds of this so you know you trade off your you go from n squared to n memory and compute requirements in a single layer but in the worst case you need n layers to recover the power of the full of the full transformer and that is the last one of their theoretical results right here so first they prove universal approximations and second they prove Turing completeness these two properties have been proven for full attention mechanisms and third they prove that there are tasks where we actually do need n layers to solve them with their limited attention so you know I'm not sure but I feel you can make any sort of polynomial algorithm into a linear algorithm like this like I have a like a cool sorting algorithm right so if this is my sequence that I want to sort what I can do is I can simply you know take a random subset of them like this this and this and then kind of go and sort them and then put them like I sent them to the to the global memory like this I sort them and then I put them back right and if I do this for enough if I do this for enough rounds okay you know if I do this for enough rounds you know at the worst case I need n rounds to sort my or log n rounds if I do it smartly but you know in you know the single step here is the single step is just O of n so I have now an O of n sorting algorithm I you know I have my sort of a bit of wary to express things like that and yeah but you know it is from an empirical standpoint I absolutely believe that this this is enough now my second coral right here is that if you look at the proof first of all what it makes use is this star graph and the star graph corresponds to the global attention so that's not much to do with the random attention though they use the random attention in their proof but I at least believe that it would be possible with the global attention only and then the second thing is if you look at the parameters that they use for the for the experiments and I've already set this in the long former video so in the long form of video it turned out that if you look at how big this window attention is it turns out that it you're still well you know the original BERT attended to 512 tokens and then you look at the window and the window was still 512 tokens it's just that the global attention was even more so ultimately they ended up using more memory than the original BERT and here if I look at the parameters of their thing and they have multiple experiments right here and I believe this is the base version so that this is the base version they also have this large version but here this is the 12 layer version and you can see they have this block length and we'll get into the block length in one second but then you can see that their window size is three times the block length the number of random tokens is three times the block length and the number of global tokens is two times the block length so that results in eight times B so eight times 64 is you know can I calculate this or am I stupid it's 512 yes I actually calculated this before so this is 512 tokens so you know you you go from from BERT that has 512 tokens and attends to 512 tokens to also attending to 512 tokens of course the advantage here is that they now have 4096 sequence length so they have the freedom to not attend to as many tokens as they have in the input length but you know to put it in perspective this here uses more memory and more compute on it on its face than BERT because BERT attends to as many tokens but has a smaller input sequence and you know I there's sort of a thing where in order to make these sparse attention things work you have to go pretty pretty you know high in the number of things you attend to you can leave away some but it's not like you can scale up orders of magnitude of your input sequence length so that's the this promise of linear attention is sort of it's kind of fulfilled but not there yet the second thing I would like to point out is that in a lot of cases the number of random tokens is actually set to zero so really making use I believe of these of the of the global of the number of global tokens so it that seems a bit strange in that they continuously refer to their random attention mechanism but then in a lot of experiments they don't actually have a random attention mechanism I believe they have to do that because that's kind of what makes them different from the long former in principle but still yeah so the last novelty let's say is an engineering novelty in that they now always consider not single for example they don't consider single random attention they always consider these in blocks and that's because our current hardware is really bad at sparse stuff really bad at single indexing gathering single things so if you can do everything in blocks you basically get you get these blocks almost for free so it takes only marginally longer to retrieve this full two by two block right here than it would to retrieve the single instance right here of course that means you have you know four times you still use four times more memory but it is not four times slower than the original thing so you can use these blocks right here you can do it for the random attention you can do it for the window attention as you can see here so you break this window pattern a little bit into blocks and that makes it a lot faster so that speeds up and get the speed up almost for free and then they make another approximation in that the way they do this windowing is and let's just go really briefly so you can see right here that it would be very cumbersome to gather so what we need we're just going to focus at this this dotted thing right here is a bit confusing so you want to attend to these things and these you can just get out with a matrix slice really easy but then you want to attend to this kind of blocky thing right here from the window attention right like this thing and this is hard to get out because you'd have to kind of index each row individually and that's very slow so what they do there is this matrix role operation where you can sort of roll the axis around so what you'll do is you'll take this thing right here and you put it to the left right here and you'll take for example this thing right here and you'll put it to the right or no like it's up and down but in essence that's what you do and you can you can fold all of this blue stuff into a rectangular matrix if you know if you can see right here so you kind of roll this back roll this back roll this forward and you replace whatever is missing by these now this again gives you some inaccuracies because this block right here was never intended to be attended to and all of a sudden you see you have the k6 in here so it gives you a bit of inaccuracies at the edges of the sequence but you can take that you know you can take that hit for the increased performance that you gain by now having a rectangular matrix tpus are really efficient at this not as efficient at this and then the only thing that's really slow is gathering these random blocks right here but also by having the same amount of random blocks per input token what you'll do is you'll end up with just one of these columns right here or you know are of these columns and that again gives you a rectangular matrix so this thing right here you can process very very efficiently using a tpu and you know the mistakes you make are basically this thing right here and this thing right here because those weren't intended and are at the edges of the sequence so these were the tricks of big bird to quickly summarize big bird is basically taking a transformer saying well why do we need all of this attention all of this full attention maybe we only need some of that and can already do a big job a good job especially now considering the attention mechanism goes over multiple layers so we don't need a routing from each token to each token we we can make up for not having a fully connected graph by simply running multiple layers so their sparsity is first of all you have this random attention which i believe changes from sequence to sequence but stays within or among the layers of the same sequence then you have the window attention with the reasoning so the reasoning behind the random attention is that if you have a randomly connected graph the path lengths are on average logarithmic so you can route information efficiently the reasoning behind the window attention is that probably neighbor information is very important and that has been shown empirically and then the global attention the reasoning behind this is that some of the tokens that are fixed by the developers are so important that it it's very beneficial that each other node is connected to them and that they are connected to each other node the result of that is the big bird attention mechanism which is basically long former which already had these two plus the random attention this achieves a linear linear complexity in terms of of memory and compute though linear has to be qualified a bit because it's modified by the window size by the number of random attention tokens by the number of global tokens and in practice often ends up being you know fairly large ish and also the the the theoretical guarantees now come with the fact that you need multiple layers in the worst case you need sequence length amount of layers which you know in the worst case would result right back into a quadratic requirement for memory and compute they do some engineering some engineering tricks right here and their results are pretty good so the results in various tasks and we'll we'll look at some of the tasks right here so these are def set results using base size models for example where you can see they do outperform basic roberta models they outperform long former which may mean that the random attention is useful but you know in these things it's all also always may just mean that you've thrown more compute at it at least I'm not really looking that they outperform the models because as you can see right here if they compare to state-of-the-art and you know granted these are models that have been trained specifically for these tasks and are you know crafted and engineered and big bird manages to big bird manages to hold itself against them in a lot of tasks and even get state-of-the-art on some what I'm more interested in is that it you know it can reach good numbers it doesn't necessarily have to be state-of-the-art but it can reach good numbers which tells me that okay probably the the empirical hit that I take by not having the full attention is you know it's justifiable by the speed up and memory savings I do get yeah especially when result when you see results mixed like this you know sometimes the other model is good and sometimes the big bird is good on different variations and so on I would not you know I would not make a big deal out of the fact that it is state-of-the-art I get that the authors have to do that I would do so as well but you know you don't don't think that this is the like the best thing now it's very probable they just thrown also a lot of compute at it what is cool is they do some genomics experiments so not only do they have NLP state-of-the-art but also they go into genomics and experiment with data there don't want to go into that because you know ultimately it's another task and I believe the paper is about the architecture alright so that was big bird I hope you enjoyed this video and learned I learned something certainly if you want to check out the proofs they're actually pretty entertaining to read and yeah I will see you next time bye bye
[{"start": 0.0, "end": 6.88, "text": " Hi there, today we'll look at Big Bird transformers for longer sequences by Manil Zahir and Gurugra"}, {"start": 6.88, "end": 9.92, "text": " Rugganesh et al of Google Research."}, {"start": 9.92, "end": 14.6, "text": " So this paper on a high level proposes to replace the quadratic attention mechanism"}, {"start": 14.6, "end": 23.44, "text": " in transformers by a mix of random attention, windowed attention and selective global attention,"}, {"start": 23.44, "end": 29.64, "text": " therefore achieving a complexity of linear memory requirement instead of quadratic memory"}, {"start": 29.64, "end": 31.28, "text": " requirement."}, {"start": 31.28, "end": 36.6, "text": " And as a result of that they can process longer sequences than traditional transformers like"}, {"start": 36.6, "end": 44.16, "text": " BERT and achieve better results in some NLP tasks and they also evaluate on genomics tasks."}, {"start": 44.16, "end": 49.56, "text": " So we'll go through this paper a bit, look a bit at the proof because they give a theoretical"}, {"start": 49.56, "end": 57.32, "text": " kind of guarantee that their random attention mechanism can still be Turing complete and"}, {"start": 57.32, "end": 64.32, "text": " still achieve the same things as a full attention mechanism but we'll also look at the drawbacks."}, {"start": 64.32, "end": 70.28, "text": " I sort of have mixed feelings about this paper and I think I'll voice my concerns as we go"}, {"start": 70.28, "end": 75.44, "text": " through here but first let's look at the paper, let's look at the architecture and I think"}, {"start": 75.44, "end": 82.0, "text": " this is actually a pretty cool paper for the empirical progression of the field to process"}, {"start": 82.0, "end": 85.12, "text": " longer sequences with transformers."}, {"start": 85.12, "end": 90.32000000000001, "text": " As always if you like content like this feel free to share it around, leave a like and"}, {"start": 90.32000000000001, "end": 96.48, "text": " tell me in the comments what you think about the paper and about what I think, whatever,"}, {"start": 96.48, "end": 100.32000000000001, "text": " you just go nuts."}, {"start": 100.32000000000001, "end": 108.48, "text": " Alright so the basic premise right here is that the transformers they've been pretty"}, {"start": 108.48, "end": 111.08000000000001, "text": " impactful especially in NLP."}, {"start": 111.08, "end": 115.24, "text": " So they say transformer based models such as BERT have been one of the most successful"}, {"start": 115.24, "end": 118.12, "text": " deep learning models for NLP."}, {"start": 118.12, "end": 123.32, "text": " Unfortunately one of their core limitations is the quadratic dependency mainly in terms"}, {"start": 123.32, "end": 127.97999999999999, "text": " of memory on the sequence length due to their full attention mechanism."}, {"start": 127.97999999999999, "end": 133.5, "text": " So really briefly the full attention mechanism and I've done numerous videos about attention"}, {"start": 133.5, "end": 138.4, "text": " mechanism BERT, attention is all you need and so on so if you want a detailed explanation"}, {"start": 138.4, "end": 145.04000000000002, "text": " of what that is just go look up the corresponding videos but briefly what you'll have in NLP"}, {"start": 145.04000000000002, "end": 151.86, "text": " is a set of tokens, a sequence of tokens as an input and you want to transform them layer"}, {"start": 151.86, "end": 160.84, "text": " after layer into sort of a higher order representation of that same sequence and for that you build"}, {"start": 160.84, "end": 165.88, "text": " these layers out of nodes and you have as many nodes usually as you have tokens in the"}, {"start": 165.88, "end": 173.16, "text": " sequence and the next set of, so each token is represented by a vector at the beginning"}, {"start": 173.16, "end": 179.12, "text": " and each layer transforms this sequence as I said into sort of a higher level representation."}, {"start": 179.12, "end": 186.3, "text": " So you want the vector of this token right here to be a better representation than the"}, {"start": 186.3, "end": 193.66, "text": " vector was right here and you do that by incorporating information from all the other tokens into"}, {"start": 193.66, "end": 196.35999999999999, "text": " that particular vector."}, {"start": 196.35999999999999, "end": 200.8, "text": " Now as I said this is called an attention mechanism and we don't actually have to go"}, {"start": 200.8, "end": 206.12, "text": " into how it works right here but you can see pretty clearly that if you want to do this"}, {"start": 206.12, "end": 213.0, "text": " for every token you need to have information routed from every token to every token like"}, {"start": 213.0, "end": 218.72, "text": " from here to here, from here to here and so on and this is just one token and then you"}, {"start": 218.72, "end": 222.16, "text": " need to do it for this token and for this token and for this token."}, {"start": 222.16, "end": 226.76, "text": " So what you'll ultimately get if n is your sequence length you'll get some n squared"}, {"start": 226.76, "end": 231.24, "text": " amount of computation and memory requirements for this."}, {"start": 231.24, "end": 236.28, "text": " So this is a problem and usually this means that you know this sequence length in BERT"}, {"start": 236.28, "end": 243.92, "text": " this is limited to something like 512 tokens which is okay for some applications but if"}, {"start": 243.92, "end": 249.88, "text": " you want to summarize you know entire articles, entire books even or do question answering"}, {"start": 249.88, "end": 253.4, "text": " with lots of context it's not really enough."}, {"start": 253.4, "end": 259.71999999999997, "text": " So people have been thinking about how to scale this input, how to scale this and of"}, {"start": 259.71999999999997, "end": 264.71999999999997, "text": " course the main culprit is this quadratic attention mechanism because if you you know"}, {"start": 264.71999999999997, "end": 270.88, "text": " double the 512 you need you know four times the amount of compute and memory."}, {"start": 270.88, "end": 275.84, "text": " So how does this paper go about reducing that quadratic dependency?"}, {"start": 275.84, "end": 283.23999999999995, "text": " The goal right here is of course to get this to some O of n right because then as we double"}, {"start": 283.23999999999995, "end": 287.76, "text": " the input length we simply need to double the compute requirements and that would be"}, {"start": 287.76, "end": 293.15999999999997, "text": " fantastic and that's what this paper does and it does so without you know sacrificing"}, {"start": 293.15999999999997, "end": 296.28, "text": " the properties of the transformer."}, {"start": 296.28, "end": 300.96, "text": " So here's the architecture that BigBERT proposes."}, {"start": 300.96, "end": 307.32, "text": " By the way BigBERT another character from Sesame Street I guess will continue the naming"}, {"start": 307.32, "end": 311.2, "text": " here after Elmo and BERT."}, {"start": 311.2, "end": 316.64, "text": " I'm waiting for the model that's the count."}, {"start": 316.64, "end": 323.4, "text": " Yeah that's going to be a fun model but so BigBERT basically has three different types"}, {"start": 323.4, "end": 324.79999999999995, "text": " of attention here."}, {"start": 324.79999999999995, "end": 327.84, "text": " These are adjacency matrices in this attention mechanism."}, {"start": 327.84, "end": 333.64, "text": " So here is the input layer and the output layer is right here."}, {"start": 333.64, "end": 339.2, "text": " So that basically means that node i right here would be connected, sorry that's not"}, {"start": 339.2, "end": 344.67999999999995, "text": " a straight line, would be connected to this particular node and also to this particular"}, {"start": 344.67999999999995, "end": 345.67999999999995, "text": " node."}, {"start": 345.67999999999995, "end": 353.52, "text": " So we're now trying if we have node i right here we're now trying to not connect it to"}, {"start": 353.52, "end": 359.91999999999996, "text": " all of these nodes but we'll say we'll just select some at random and then connect it"}, {"start": 359.91999999999996, "end": 360.91999999999996, "text": " to that."}, {"start": 360.91999999999996, "end": 366.65999999999997, "text": " Okay this is what we call random attention and you can pretty clearly see if you connect"}, {"start": 366.65999999999997, "end": 376.2, "text": " each of the i nodes to r equals 2 to two random nodes then you don't have an n squared anymore"}, {"start": 376.2, "end": 383.64, "text": " but you'll have an like an O of r times n which you know if r is a constant is an O"}, {"start": 383.64, "end": 386.76, "text": " of n attention mechanism."}, {"start": 386.76, "end": 394.76, "text": " Okay so the main goal between the random attention mechanism is that for each query basically"}, {"start": 394.76, "end": 402.08, "text": " you select random tokens that you attend to and that random number is a fixed number that's"}, {"start": 402.08, "end": 405.28, "text": " not dependent on the sequence length."}, {"start": 405.28, "end": 412.4, "text": " And the paper is a little bit unclear about whether or not those random ones are the same"}, {"start": 412.4, "end": 418.0, "text": " for every sequence or are switched up or are the same for every layer or are switched up"}, {"start": 418.0, "end": 423.91999999999996, "text": " but they formulate all of this as sort of in sort of a graph in sort of a random graph."}, {"start": 423.91999999999996, "end": 429.03999999999996, "text": " So they formulate the attention mechanism in form of a graph."}, {"start": 429.04, "end": 435.28000000000003, "text": " So if we transform all of these nodes into a graph a full attention mechanism would mean"}, {"start": 435.28000000000003, "end": 441.88, "text": " that each graph each node is connected to each of the other nodes right fully connected"}, {"start": 441.88, "end": 447.12, "text": " graph I don't maybe that's it."}, {"start": 447.12, "end": 453.48, "text": " So that would be a full attention mechanism and then they say well if we just have random"}, {"start": 453.48, "end": 459.68, "text": " connections between these things then there are some theorems from graph theory that say"}, {"start": 459.68, "end": 466.12, "text": " that each random walk in this graph is going to so this graph is going to mix pretty quickly"}, {"start": 466.12, "end": 473.28000000000003, "text": " so I can get from each node to each other node by a random walk in a logarithmic time"}, {"start": 473.28000000000003, "end": 478.70000000000005, "text": " and this random walk which basically means that you go from here to here this would be"}, {"start": 478.7, "end": 484.7, "text": " one layer of the transformer and then if you want to go from here to here that you would"}, {"start": 484.7, "end": 489.65999999999997, "text": " have to do that in the next layer so this formulation as a random graph leads me to"}, {"start": 489.65999999999997, "end": 496.8, "text": " believe that layer after layer the random attention pattern is going to be the same"}, {"start": 496.8, "end": 504.48, "text": " but also the formulation of the paper leads me to believe that this random attention differs"}, {"start": 504.48, "end": 510.04, "text": " from sequence to sequence so I believe what's happening is that they you know get a new"}, {"start": 510.04, "end": 516.16, "text": " sequence then they decide on this pattern right here once and then they use this layer"}, {"start": 516.16, "end": 524.32, "text": " after layer the same pattern again so you can see that in the traditional attention"}, {"start": 524.32, "end": 531.2, "text": " information can basically flow from each of the nodes to each other node in one single"}, {"start": 531.2, "end": 535.72, "text": " step right because each node is connected to each other node you see this in the graph"}, {"start": 535.72, "end": 544.6800000000001, "text": " right here however if we only select a subset then you know it needs to if I want to go"}, {"start": 544.6800000000001, "end": 551.2, "text": " from as I said from here to here then I need to do it in two steps and therefore I need"}, {"start": 551.2, "end": 556.38, "text": " two layers and that's going to be the culprit of this method here and you know while it"}, {"start": 556.38, "end": 563.16, "text": " is mentioned in the paper it's sort of I feel at least that's my my assessment of this paper"}, {"start": 563.16, "end": 568.22, "text": " it's kind of swept under the rug a little bit I mean they do have a theorem that clearly"}, {"start": 568.22, "end": 575.52, "text": " says we can construct an example of a task that in the full attention setting can be"}, {"start": 575.52, "end": 582.56, "text": " solved with a single step so a single layer that in our random attention setting needs"}, {"start": 582.56, "end": 589.52, "text": " a lot of layers so a lot of steps but you know the rest of the paper is sort of shaky"}, {"start": 589.52, "end": 596.92, "text": " on on this thing but nevertheless you can see how the random attention can if you have"}, {"start": 596.92, "end": 603.9599999999999, "text": " enough layers do the same information routing as the full attention okay however this is"}, {"start": 603.9599999999999, "end": 609.8, "text": " not a property of the random attention and we'll see this in the next thing right here"}, {"start": 609.8, "end": 615.76, "text": " so the next ingredient that this paper uses is window attention and you can see over here"}, {"start": 615.76, "end": 620.64, "text": " that Big Bird is ultimately going to be a combination of the three types of attention"}, {"start": 620.64, "end": 627.0799999999999, "text": " which will which we are looking at here so window attention basically means that each"}, {"start": 627.0799999999999, "end": 633.68, "text": " each eye each token at the eye of position is going to attend to itself of course so"}, {"start": 633.68, "end": 640.92, "text": " here is I but it is also going to attend to its neighbors so here is I minus one and here"}, {"start": 640.92, "end": 647.52, "text": " is I plus one and this is a you know this is a window size W that you can that is a"}, {"start": 647.52, "end": 656.8399999999999, "text": " parameter but also it is a constant and therefore you again go from n squared to W times n which"}, {"start": 656.84, "end": 663.72, "text": " you know is O of n if W is a constant and this might be familiar to you because we've"}, {"start": 663.72, "end": 670.32, "text": " already seen this in the long former papers I've made a video or I think even two videos"}, {"start": 670.32, "end": 677.0, "text": " on the long former which used exactly the window attention in combination with the global"}, {"start": 677.0, "end": 683.0, "text": " attention and if you want to know more about that go watch these videos but the new thing"}, {"start": 683.0, "end": 692.6, "text": " in Big Bird right here is this edition of the random attention again the the window"}, {"start": 692.6, "end": 699.82, "text": " here is is has exactly the same properties as the random attention so you have instead"}, {"start": 699.82, "end": 706.92, "text": " of a fully connected graph you have a sparsely connected graph now if you have random attention"}, {"start": 706.92, "end": 712.72, "text": " the sparsely connected graph is like like the one on the right but if you have a windowed"}, {"start": 712.72, "end": 719.32, "text": " attention you can it is kind of not randomly connected but each node is connected to its"}, {"start": 719.32, "end": 725.5600000000001, "text": " neighbors like this and you can also see that if I want to go from this node to this node"}, {"start": 725.5600000000001, "end": 731.64, "text": " right here I can't do it in one step but I can do it in two steps I go here and I go"}, {"start": 731.64, "end": 741.5600000000001, "text": " here so in the terms of the attention layers if I want to go from node one to node three"}, {"start": 741.56, "end": 746.16, "text": " I have to do it in two steps because each node is only connected to its neighbors so"}, {"start": 746.16, "end": 754.0, "text": " the connection patterns would sort of look like this so I have to go from one to two"}, {"start": 754.0, "end": 760.92, "text": " and then in the next layer from two to three so the paper basically makes up for the lack"}, {"start": 760.92, "end": 768.1999999999999, "text": " of full attention by adding layers and you all also might recognize this from a convolution"}, {"start": 768.2, "end": 774.5200000000001, "text": " operation like this basically because it is a convolution operation right in a convolution"}, {"start": 774.5200000000001, "end": 781.4000000000001, "text": " each node a only aggregates input from its neighbors for the next layer and then we know"}, {"start": 781.4000000000001, "end": 787.5, "text": " that as we go up the layers the de facto window that each node looks at is going to be like"}, {"start": 787.5, "end": 794.3000000000001, "text": " a cone kind of like this so this is very similar to how a convolutional neural network works"}, {"start": 794.3, "end": 799.7199999999999, "text": " and the reasoning is very similar because the reasoning is well in a sentence the most"}, {"start": 799.7199999999999, "end": 805.56, "text": " important words for any given word are probably going to be its neighbors like the words around"}, {"start": 805.56, "end": 811.5999999999999, "text": " it and as you go up the layers you branch out more and more but ultimately the this"}, {"start": 811.5999999999999, "end": 819.76, "text": " neighborhood principle holds in NLP as well so again we already saw this in the long former"}, {"start": 819.76, "end": 824.0799999999999, "text": " but that's the reason behind the window attention and that's the second ingredient and then"}, {"start": 824.08, "end": 832.1600000000001, "text": " the third ingredient is this global attention now the global attention is selected tokens"}, {"start": 832.1600000000001, "end": 838.88, "text": " that are so important and that's you know fixed by the developers that are so important"}, {"start": 838.88, "end": 846.3000000000001, "text": " that they are they are connected to everything else so for example in these transformers"}, {"start": 846.3000000000001, "end": 853.08, "text": " you often have what's you know this kind of CLS token so this is a special token that"}, {"start": 853.08, "end": 860.1600000000001, "text": " you prepend to some piece of text and the output of this token is going to be your classification"}, {"start": 860.1600000000001, "end": 865.34, "text": " output because you don't want to bind your classification if you need to classify the"}, {"start": 865.34, "end": 871.0400000000001, "text": " entire sequence you don't want to bind that decision to one particular word what you want"}, {"start": 871.0400000000001, "end": 876.48, "text": " to do is you will have an extra token and that's this CLS token that kind of aggregates"}, {"start": 876.48, "end": 883.48, "text": " information from all of this so layer after layer layer after layer you'll have so if"}, {"start": 883.48, "end": 890.94, "text": " we go here layer after layer we have this one special node and in each step every single"}, {"start": 890.94, "end": 898.48, "text": " other node is able to send information right here to this node and receive information"}, {"start": 898.48, "end": 908.44, "text": " from this node okay so now as a result of this as you as you may be able to see every"}, {"start": 908.44, "end": 914.8000000000001, "text": " single every single path is kind of maximum length of two because if I want to go from"}, {"start": 914.8000000000001, "end": 920.28, "text": " any node to any other node I can simply you know send information to this global node"}, {"start": 920.28, "end": 926.36, "text": " and then the global node in the next step can send information to whatever other node"}, {"start": 926.36, "end": 933.6800000000001, "text": " and that is a property that they use in their proof that this attention mechanism is as"}, {"start": 933.6800000000001, "end": 939.0, "text": " sort of as powerful as the classic fool attention mechanism and we'll go through that in one"}, {"start": 939.0, "end": 944.52, "text": " second but first I hope this was clear that this combination of random attention window"}, {"start": 944.52, "end": 954.08, "text": " attention and global attention is what is called Big Bird okay they have some engineering"}, {"start": 954.08, "end": 959.5600000000001, "text": " tricks that go along with this but in concept you can imagine Big Bird being long former"}, {"start": 959.5600000000001, "end": 966.14, "text": " plus these random attention right here and you know as an engineer as an NLP engineer"}, {"start": 966.14, "end": 972.7, "text": " that makes kind of total sense I you know I totally believe that a the introduction"}, {"start": 972.7, "end": 979.36, "text": " the addition of these random attention of these random attention patterns can absolutely"}, {"start": 979.36, "end": 986.1800000000001, "text": " help your classification or whatever your NLP tasks because you know more attention"}, {"start": 986.1800000000001, "end": 992.36, "text": " better and I also am completely willing to believe that you know using the full attention"}, {"start": 992.36, "end": 999.16, "text": " matrix while it is of course more accurate it won't hurt too much to leave some of that"}, {"start": 999.16, "end": 1004.96, "text": " attention away because essentially all the path lengths are just becoming two or even"}, {"start": 1004.96, "end": 1010.36, "text": " with the random attention are really short or logarithmic to route information from a"}, {"start": 1010.36, "end": 1018.24, "text": " node to some other node so the loss that you incur is kind of in a logarithmic scale in"}, {"start": 1018.24, "end": 1024.1200000000001, "text": " terms of performance while the gain that you make is sort of in a in a quadratic or like"}, {"start": 1024.1200000000001, "end": 1030.32, "text": " a linear scale you go from quadratic to linear and that seems to me like a good empirical"}, {"start": 1030.32, "end": 1042.76, "text": " trade-off all right however the the proofs here the proof of of how how these how these"}, {"start": 1042.76, "end": 1050.1599999999999, "text": " things are constructed are a little bit I don't know so what they do in the proof that"}, {"start": 1050.1599999999999, "end": 1055.4399999999998, "text": " this function can sort of appropriate is a universal approximator people have already"}, {"start": 1055.44, "end": 1062.44, "text": " shown that full attention mechanisms are universal approximators so they show here that this"}, {"start": 1062.44, "end": 1068.3600000000001, "text": " sparse attention mechanism is also a universal approximator they make big use of star graphs"}, {"start": 1068.3600000000001, "end": 1074.0, "text": " what they say is okay if we have a star graph which is one node connected right here to"}, {"start": 1074.0, "end": 1082.0, "text": " every other node this is a star graph if we have a star graph we can achieve the same"}, {"start": 1082.0, "end": 1086.76, "text": " thing then with a full graph a full graph is where every node is connected to every"}, {"start": 1086.76, "end": 1093.04, "text": " other node but as I already said what they need for this is multiple layers of this star"}, {"start": 1093.04, "end": 1099.4, "text": " graph so and that has to do with the fact that if I want to route information I basically"}, {"start": 1099.4, "end": 1105.24, "text": " have to go via this middle node right here and there is an additional complication because"}, {"start": 1105.24, "end": 1112.36, "text": " this middle node in our case right here is only one node I can't route information at"}, {"start": 1112.36, "end": 1120.88, "text": " the same like I can't have this routing right here at the same time that I have this routing"}, {"start": 1120.88, "end": 1126.0, "text": " right here like going from here to here because I only have one middle node and I kind of"}, {"start": 1126.0, "end": 1132.96, "text": " this is not how that like this is very dumb math but maybe you have to imagine that there"}, {"start": 1132.96, "end": 1140.4, "text": " is one memory slot and you can only use that one memory slot at the same time for one of"}, {"start": 1140.4, "end": 1145.24, "text": " these things so essentially what you'll have to do is you'll have to do the green thing"}, {"start": 1145.24, "end": 1151.8, "text": " first and then in the next step you'll have to do the blue thing second and then so these"}, {"start": 1151.8, "end": 1156.8, "text": " are now pairwise routing between nodes but ultimately what an attention mechanism does"}, {"start": 1156.8, "end": 1161.66, "text": " is it does everything to everything right in a single layer it routes information from"}, {"start": 1161.66, "end": 1168.6200000000001, "text": " all the nodes to all the other nodes and to achieve that you need multiple rounds of this"}, {"start": 1168.6200000000001, "end": 1175.28, "text": " and it turns out that in the worst case you actually need n rounds of this so you know"}, {"start": 1175.28, "end": 1182.6000000000001, "text": " you trade off your you go from n squared to n memory and compute requirements in a single"}, {"start": 1182.6000000000001, "end": 1190.6000000000001, "text": " layer but in the worst case you need n layers to recover the power of the full of the full"}, {"start": 1190.6, "end": 1196.9599999999998, "text": " transformer and that is the last one of their theoretical results right here so first they"}, {"start": 1196.9599999999998, "end": 1203.9599999999998, "text": " prove universal approximations and second they prove Turing completeness these two properties"}, {"start": 1203.9599999999998, "end": 1209.9599999999998, "text": " have been proven for full attention mechanisms and third they prove that there are tasks"}, {"start": 1209.96, "end": 1221.0, "text": " where we actually do need n layers to solve them with their limited attention so you know"}, {"start": 1221.0, "end": 1229.1200000000001, "text": " I'm not sure but I feel you can make any sort of polynomial algorithm into a linear algorithm"}, {"start": 1229.1200000000001, "end": 1234.4, "text": " like this like I have a like a cool sorting algorithm right so if this is my sequence"}, {"start": 1234.4, "end": 1241.2800000000002, "text": " that I want to sort what I can do is I can simply you know take a random subset of them"}, {"start": 1241.2800000000002, "end": 1247.6000000000001, "text": " like this this and this and then kind of go and sort them and then put them like I sent"}, {"start": 1247.6000000000001, "end": 1255.3600000000001, "text": " them to the to the global memory like this I sort them and then I put them back right"}, {"start": 1255.3600000000001, "end": 1262.8000000000002, "text": " and if I do this for enough if I do this for enough rounds okay you know if I do this for"}, {"start": 1262.8, "end": 1268.12, "text": " enough rounds you know at the worst case I need n rounds to sort my or log n rounds"}, {"start": 1268.12, "end": 1275.52, "text": " if I do it smartly but you know in you know the single step here is the single step is"}, {"start": 1275.52, "end": 1283.74, "text": " just O of n so I have now an O of n sorting algorithm I you know I have my sort of a bit"}, {"start": 1283.74, "end": 1293.68, "text": " of wary to express things like that and yeah but you know it is from an empirical standpoint"}, {"start": 1293.68, "end": 1301.52, "text": " I absolutely believe that this this is enough now my second coral right here is that if"}, {"start": 1301.52, "end": 1307.6, "text": " you look at the proof first of all what it makes use is this star graph and the star"}, {"start": 1307.6, "end": 1312.84, "text": " graph corresponds to the global attention so that's not much to do with the random attention"}, {"start": 1312.84, "end": 1318.52, "text": " though they use the random attention in their proof but I at least believe that it would"}, {"start": 1318.52, "end": 1325.9199999999998, "text": " be possible with the global attention only and then the second thing is if you look at"}, {"start": 1325.9199999999998, "end": 1332.84, "text": " the parameters that they use for the for the experiments and I've already set this in the"}, {"start": 1332.84, "end": 1338.84, "text": " long former video so in the long form of video it turned out that if you look at how big"}, {"start": 1338.84, "end": 1345.6799999999998, "text": " this window attention is it turns out that it you're still well you know the original"}, {"start": 1345.6799999999998, "end": 1352.8799999999999, "text": " BERT attended to 512 tokens and then you look at the window and the window was still 512"}, {"start": 1352.8799999999999, "end": 1356.8799999999999, "text": " tokens it's just that the global attention was even more so ultimately they ended up"}, {"start": 1356.8799999999999, "end": 1365.36, "text": " using more memory than the original BERT and here if I look at the parameters of their"}, {"start": 1365.36, "end": 1371.1599999999999, "text": " thing and they have multiple experiments right here and I believe this is the base version"}, {"start": 1371.1599999999999, "end": 1377.4399999999998, "text": " so that this is the base version they also have this large version but here this is the"}, {"start": 1377.4399999999998, "end": 1385.78, "text": " 12 layer version and you can see they have this block length and we'll get into the block"}, {"start": 1385.78, "end": 1391.9199999999998, "text": " length in one second but then you can see that their window size is three times the"}, {"start": 1391.92, "end": 1397.16, "text": " block length the number of random tokens is three times the block length and the number"}, {"start": 1397.16, "end": 1403.48, "text": " of global tokens is two times the block length so that results in eight times B so eight"}, {"start": 1403.48, "end": 1418.88, "text": " times 64 is you know can I calculate this or am I stupid it's 512 yes I actually calculated"}, {"start": 1418.88, "end": 1429.16, "text": " this before so this is 512 tokens so you know you you go from from BERT that has 512 tokens"}, {"start": 1429.16, "end": 1436.2800000000002, "text": " and attends to 512 tokens to also attending to 512 tokens of course the advantage here"}, {"start": 1436.2800000000002, "end": 1447.4, "text": " is that they now have 4096 sequence length so they have the freedom to not attend to"}, {"start": 1447.4, "end": 1454.44, "text": " as many tokens as they have in the input length but you know to put it in perspective this"}, {"start": 1454.44, "end": 1463.5600000000002, "text": " here uses more memory and more compute on it on its face than BERT because BERT attends"}, {"start": 1463.5600000000002, "end": 1472.4, "text": " to as many tokens but has a smaller input sequence and you know I there's sort of a"}, {"start": 1472.4, "end": 1478.2, "text": " thing where in order to make these sparse attention things work you have to go pretty"}, {"start": 1478.2, "end": 1483.3200000000002, "text": " pretty you know high in the number of things you attend to you can leave away some but"}, {"start": 1483.3200000000002, "end": 1490.92, "text": " it's not like you can scale up orders of magnitude of your input sequence length so that's the"}, {"start": 1490.92, "end": 1496.2800000000002, "text": " this promise of linear attention is sort of it's kind of fulfilled but not there yet the"}, {"start": 1496.28, "end": 1502.44, "text": " second thing I would like to point out is that in a lot of cases the number of random"}, {"start": 1502.44, "end": 1509.8799999999999, "text": " tokens is actually set to zero so really making use I believe of these of the of the global"}, {"start": 1509.8799999999999, "end": 1517.84, "text": " of the number of global tokens so it that seems a bit strange in that they continuously"}, {"start": 1517.84, "end": 1523.6399999999999, "text": " refer to their random attention mechanism but then in a lot of experiments they don't"}, {"start": 1523.64, "end": 1529.3200000000002, "text": " actually have a random attention mechanism I believe they have to do that because that's"}, {"start": 1529.3200000000002, "end": 1537.88, "text": " kind of what makes them different from the long former in principle but still yeah so"}, {"start": 1537.88, "end": 1545.18, "text": " the last novelty let's say is an engineering novelty in that they now always consider not"}, {"start": 1545.18, "end": 1549.72, "text": " single for example they don't consider single random attention they always consider these"}, {"start": 1549.72, "end": 1557.06, "text": " in blocks and that's because our current hardware is really bad at sparse stuff really bad at"}, {"start": 1557.06, "end": 1563.76, "text": " single indexing gathering single things so if you can do everything in blocks you basically"}, {"start": 1563.76, "end": 1570.4, "text": " get you get these blocks almost for free so it takes only marginally longer to retrieve"}, {"start": 1570.4, "end": 1575.9, "text": " this full two by two block right here than it would to retrieve the single instance right"}, {"start": 1575.9, "end": 1582.16, "text": " here of course that means you have you know four times you still use four times more memory"}, {"start": 1582.16, "end": 1589.96, "text": " but it is not four times slower than the original thing so you can use these blocks right here"}, {"start": 1589.96, "end": 1593.3200000000002, "text": " you can do it for the random attention you can do it for the window attention as you"}, {"start": 1593.3200000000002, "end": 1599.88, "text": " can see here so you break this window pattern a little bit into blocks and that makes it"}, {"start": 1599.88, "end": 1606.4, "text": " a lot faster so that speeds up and get the speed up almost for free and then they make"}, {"start": 1606.4, "end": 1614.7, "text": " another approximation in that the way they do this windowing is and let's just go really"}, {"start": 1614.7, "end": 1624.8400000000001, "text": " briefly so you can see right here that it would be very cumbersome to gather so what"}, {"start": 1624.84, "end": 1630.32, "text": " we need we're just going to focus at this this dotted thing right here is a bit confusing"}, {"start": 1630.32, "end": 1637.8799999999999, "text": " so you want to attend to these things and these you can just get out with a matrix slice"}, {"start": 1637.8799999999999, "end": 1643.72, "text": " really easy but then you want to attend to this kind of blocky thing right here from"}, {"start": 1643.72, "end": 1649.6399999999999, "text": " the window attention right like this thing and this is hard to get out because you'd"}, {"start": 1649.64, "end": 1655.8200000000002, "text": " have to kind of index each row individually and that's very slow so what they do there"}, {"start": 1655.8200000000002, "end": 1661.5600000000002, "text": " is this matrix role operation where you can sort of roll the axis around so what you'll"}, {"start": 1661.5600000000002, "end": 1667.26, "text": " do is you'll take this thing right here and you put it to the left right here and you'll"}, {"start": 1667.26, "end": 1674.0800000000002, "text": " take for example this thing right here and you'll put it to the right or no like it's"}, {"start": 1674.08, "end": 1679.6799999999998, "text": " up and down but in essence that's what you do and you can you can fold all of this blue"}, {"start": 1679.6799999999998, "end": 1688.36, "text": " stuff into a rectangular matrix if you know if you can see right here so you kind of roll"}, {"start": 1688.36, "end": 1695.56, "text": " this back roll this back roll this forward and you replace whatever is missing by these"}, {"start": 1695.56, "end": 1702.52, "text": " now this again gives you some inaccuracies because this block right here was never intended"}, {"start": 1702.52, "end": 1709.6399999999999, "text": " to be attended to and all of a sudden you see you have the k6 in here so it gives you"}, {"start": 1709.6399999999999, "end": 1716.0, "text": " a bit of inaccuracies at the edges of the sequence but you can take that you know you"}, {"start": 1716.0, "end": 1720.96, "text": " can take that hit for the increased performance that you gain by now having a rectangular"}, {"start": 1720.96, "end": 1728.56, "text": " matrix tpus are really efficient at this not as efficient at this and then the only thing"}, {"start": 1728.56, "end": 1734.76, "text": " that's really slow is gathering these random blocks right here but also by having the same"}, {"start": 1734.76, "end": 1741.36, "text": " amount of random blocks per input token what you'll do is you'll end up with just one of"}, {"start": 1741.36, "end": 1747.04, "text": " these columns right here or you know are of these columns and that again gives you a rectangular"}, {"start": 1747.04, "end": 1753.72, "text": " matrix so this thing right here you can process very very efficiently using a tpu and you"}, {"start": 1753.72, "end": 1760.4, "text": " know the mistakes you make are basically this thing right here and this thing right here"}, {"start": 1760.4, "end": 1766.64, "text": " because those weren't intended and are at the edges of the sequence so these were the"}, {"start": 1766.64, "end": 1776.24, "text": " tricks of big bird to quickly summarize big bird is basically taking a transformer saying"}, {"start": 1776.24, "end": 1782.48, "text": " well why do we need all of this attention all of this full attention maybe we only need"}, {"start": 1782.48, "end": 1787.6, "text": " some of that and can already do a big job a good job especially now considering the"}, {"start": 1787.6, "end": 1794.22, "text": " attention mechanism goes over multiple layers so we don't need a routing from each token"}, {"start": 1794.22, "end": 1800.3, "text": " to each token we we can make up for not having a fully connected graph by simply running"}, {"start": 1800.3, "end": 1808.3600000000001, "text": " multiple layers so their sparsity is first of all you have this random attention which"}, {"start": 1808.36, "end": 1814.08, "text": " i believe changes from sequence to sequence but stays within or among the layers of the"}, {"start": 1814.08, "end": 1819.6399999999999, "text": " same sequence then you have the window attention with the reasoning so the reasoning behind"}, {"start": 1819.6399999999999, "end": 1824.12, "text": " the random attention is that if you have a randomly connected graph the path lengths"}, {"start": 1824.12, "end": 1829.32, "text": " are on average logarithmic so you can route information efficiently the reasoning behind"}, {"start": 1829.32, "end": 1835.6799999999998, "text": " the window attention is that probably neighbor information is very important and that has"}, {"start": 1835.68, "end": 1840.5600000000002, "text": " been shown empirically and then the global attention the reasoning behind this is that"}, {"start": 1840.5600000000002, "end": 1847.72, "text": " some of the tokens that are fixed by the developers are so important that it it's very beneficial"}, {"start": 1847.72, "end": 1852.44, "text": " that each other node is connected to them and that they are connected to each other"}, {"start": 1852.44, "end": 1859.66, "text": " node the result of that is the big bird attention mechanism which is basically long former which"}, {"start": 1859.66, "end": 1869.4, "text": " already had these two plus the random attention this achieves a linear linear complexity in"}, {"start": 1869.4, "end": 1875.24, "text": " terms of of memory and compute though linear has to be qualified a bit because it's modified"}, {"start": 1875.24, "end": 1881.8000000000002, "text": " by the window size by the number of random attention tokens by the number of global tokens"}, {"start": 1881.8, "end": 1892.6, "text": " and in practice often ends up being you know fairly large ish and also the the the theoretical"}, {"start": 1892.6, "end": 1897.84, "text": " guarantees now come with the fact that you need multiple layers in the worst case you"}, {"start": 1897.84, "end": 1903.32, "text": " need sequence length amount of layers which you know in the worst case would result right"}, {"start": 1903.32, "end": 1911.48, "text": " back into a quadratic requirement for memory and compute they do some engineering some"}, {"start": 1911.48, "end": 1919.4, "text": " engineering tricks right here and their results are pretty good so the results in various"}, {"start": 1919.4, "end": 1926.76, "text": " tasks and we'll we'll look at some of the tasks right here so these are def set results"}, {"start": 1926.76, "end": 1934.08, "text": " using base size models for example where you can see they do outperform basic roberta models"}, {"start": 1934.08, "end": 1939.72, "text": " they outperform long former which may mean that the random attention is useful but you"}, {"start": 1939.72, "end": 1945.04, "text": " know in these things it's all also always may just mean that you've thrown more compute"}, {"start": 1945.04, "end": 1951.3600000000001, "text": " at it at least I'm not really looking that they outperform the models because as you"}, {"start": 1951.3600000000001, "end": 1955.96, "text": " can see right here if they compare to state-of-the-art and you know granted these are models that"}, {"start": 1955.96, "end": 1962.32, "text": " have been trained specifically for these tasks and are you know crafted and engineered and"}, {"start": 1962.32, "end": 1968.98, "text": " big bird manages to big bird manages to hold itself against them in a lot of tasks and"}, {"start": 1968.98, "end": 1974.4, "text": " even get state-of-the-art on some what I'm more interested in is that it you know it"}, {"start": 1974.4, "end": 1979.92, "text": " can reach good numbers it doesn't necessarily have to be state-of-the-art but it can reach"}, {"start": 1979.92, "end": 1988.1200000000001, "text": " good numbers which tells me that okay probably the the empirical hit that I take by not having"}, {"start": 1988.1200000000001, "end": 1995.04, "text": " the full attention is you know it's justifiable by the speed up and memory savings I do get"}, {"start": 1995.04, "end": 2002.3999999999999, "text": " yeah especially when result when you see results mixed like this you know sometimes the other"}, {"start": 2002.3999999999999, "end": 2008.84, "text": " model is good and sometimes the big bird is good on different variations and so on I would"}, {"start": 2008.84, "end": 2013.12, "text": " not you know I would not make a big deal out of the fact that it is state-of-the-art I"}, {"start": 2013.12, "end": 2020.12, "text": " get that the authors have to do that I would do so as well but you know you don't don't"}, {"start": 2020.12, "end": 2026.84, "text": " think that this is the like the best thing now it's very probable they just thrown also"}, {"start": 2026.84, "end": 2033.4599999999998, "text": " a lot of compute at it what is cool is they do some genomics experiments so not only do"}, {"start": 2033.4599999999998, "end": 2039.9599999999998, "text": " they have NLP state-of-the-art but also they go into genomics and experiment with data"}, {"start": 2039.9599999999998, "end": 2045.08, "text": " there don't want to go into that because you know ultimately it's another task and I believe"}, {"start": 2045.08, "end": 2052.56, "text": " the paper is about the architecture alright so that was big bird I hope you enjoyed this"}, {"start": 2052.56, "end": 2059.62, "text": " video and learned I learned something certainly if you want to check out the proofs they're"}, {"start": 2059.62, "end": 2079.16, "text": " actually pretty entertaining to read and yeah I will see you next time bye bye"}]
Yannic Kilchner
https://www.youtube.com/watch?v=q7PjrmGNx5A
Self-training with Noisy Student improves ImageNet classification (Paper Explained)
The abundance of data on the internet is vast. Especially unlabeled images are plentiful and can be collected with ease. This model investigates a new method for incorporating unlabeled data into a supervised learning pipeline. First, a teacher model is trained in a supervised fashion. Then, that teacher is used to label the unlabeled data. Next, a larger student model is trained on the combination of all data and achieves better performance than the teacher by itself. OUTLINE: 0:00 - Intro & Overview 1:05 - Semi-Supervised & Transfer Learning 5:45 - Self-Training & Knowledge Distillation 10:00 - Noisy Student Algorithm Overview 20:20 - Noise Methods 22:30 - Dataset Balancing 25:20 - Results 30:15 - Perturbation Robustness 34:35 - Ablation Studies 39:30 - Conclusion & Comments Paper: https://arxiv.org/abs/1911.04252 Code: https://github.com/google-research/noisystudent Models: https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet Abstract: We present Noisy Student Training, a semi-supervised learning approach that works well even when labeled data is abundant. Noisy Student Training achieves 88.4% top-1 accuracy on ImageNet, which is 2.0% better than the state-of-the-art model that requires 3.5B weakly labeled Instagram images. On robustness test sets, it improves ImageNet-A top-1 accuracy from 61.0% to 83.7%, reduces ImageNet-C mean corruption error from 45.7 to 28.3, and reduces ImageNet-P mean flip rate from 27.8 to 12.2. Noisy Student Training extends the idea of self-training and distillation with the use of equal-or-larger student models and noise added to the student during learning. On ImageNet, we first train an EfficientNet model on labeled images and use it as a teacher to generate pseudo labels for 300M unlabeled images. We then train a larger EfficientNet as a student model on the combination of labeled and pseudo labeled images. We iterate this process by putting back the student as the teacher. During the learning of the student, we inject noise such as dropout, stochastic depth, and data augmentation via RandAugment to the student so that the student generalizes better than the teacher. Models are available at this https URL. Code is available at this https URL. Authors: Qizhe Xie, Minh-Thang Luong, Eduard Hovy, Quoc V. Le Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar (preferred to Patreon): https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, today we'll look at self training with noisy student improves ImageNet classification by Qi Zixie, Min Tan Luong, Edward Havi and Kwok Wile. So this paper takes an ImageNet classifier that's been trained on the ImageNet data set and uses that classifier as a teacher model to label a whole bunch of unlabeled images. And then it trains a student model that is larger than the original teacher model on those teacher labeled images. And that turns out to improve the classification on the ImageNet validation set. Now that there is a couple of things that make this all work. And today, we're going to explore how this paper does it, and what they say is important. If you enjoy content like this, as always, don't hesitate to share it out or tell your friends about it. And if you're not subscribed yet, then do so. I would appreciate that and you'll get more content. So win win. So this this paper is about semi supervised learning in in effect, so it's at the intersection actually of semi supervised learning, knowledge distillation and transfer learning. So what do we mean by semi semi supervised learning, usually in supervised learning, you'll have some sort of data set. And the data set will contain, let's say it's an ImageNet, it's image data set. So the data set will contain images. This is an image with like some sort of cat on it. And it will contain the labels according to that. So cat. Now, in semi supervised learning, you you assume that so this is supervised learning in semi supervised learning, you assume that only part of your data set has the labels. So like only this part down here has the labels, and the upper part does not have the labels. So that's semi supervised learning, it's often the case when it's very expensive to get labels. So you can only get labels for a couple of images in your data set. But very often in semi supervised learning, you still assume it's the same data set. There is a slightly different setup here that's called transfer learning. So in transfer learning, what you'll have is you'll have your data set that has the labels, but it's very small. So you'll notice I've drawn it smaller, that means you have very little. That is also the case when it's very expensive to get labels, but also it's expensive to get the data itself. This is often the case, let's say in medical data, where not only is it expensive to get labels for like a CT scan, it's actually expensive to get the CT scan. So what the goal in transfer learning is, is to say, well, I do I do have only this small data set, but I do have this giant other data set over here. Now, can't I, it's not the same, it's maybe they're not CT, these are CT scans, maybe these are x rays, right? They're fairly similar, similar technology. If you slice the CT, it will give you sort of an x ray. Can I, you know, train my model, pre train my model on x ray data, and then fine tune it on the CT data. So that's called transfer learning usually. Now, this can be done with or without labels. So it can be that for the x ray data set, you do have the labels or you don't have the labels, there are techniques for all of those. Now, what we're going to look at today is kind of the situation right here. It's the transfer learning situation where you do not have the labels for this x ray data set. But other than in this x ray example, what we're going to look at is the small data set is going to be our image net database. So our original picture with label database. So you'll see immediately the difference here is that in the transfer learning setting, we usually assume that the data set we want to train on is fairly small. Here, you know, image net is already sizable. But what we have is we have a much larger database of unlabeled images that we can just get from the internet. So we can scrape the internet for any kind of pictures. And that will be our unlabeled data set. And what we'll try to do is somehow incorporate this unlabeled data set here into the training process to get better on the image net data set. Okay, so this is the problem statement is you have the image net data set, and you have a second much larger data set of unlabeled images, and you somehow want to make use of them. So I hope you see how this is sort of connected to the others is it's essentially so sort of a transfer semi supervised learning setting. But with the exception that usually in transfer learning, you assume that the the labeled data set is like super small, which is not the case here. And that's going to result in us being able to apply a different technique. So this different technique is called the noisy student. Now, usually, what you might do in a transfer learning setting is you might want to start with that big data set, right? Because that's the data set that's sizable enough to allow you to train a really big model on it. And then you fine tune, and you you sort of hope that the information transfers over here. On the other hand, what we want to do is we start with the image net data set. So first, we train this in a supervised learning fashion into our model. Now this model is going to be called the teacher model. We know how to do this, we know how to train image net models, right? So we can train this into a teacher model that has a reasonable accuracy on the image net data set. Step two, we're going to take that big data set over here, and use the teacher model to label the unlabeled images. So for each image, for each image coming in here, the teacher, so maybe this is again, another cat, the teacher will say, that's a cat. Okay, so that gives you the big data set, where now you have images along with labels, just the labels aren't true labels, they're generated by the teacher. And then in the third step, you train this big data set, you train on this big data set. And that's what you call your student model. And then the student model in this paper, we'll see how can we make it such that the student is then better at the original image net task than the teacher ever was, which seems counterintuitive at first, because all of the information that the student is trained from is basically what the teacher already knows, right, all the labels here come from the teacher. Therefore, the student shouldn't be able to outperform the teacher. But in this case, the student will be able to outperform the teacher. And their argument here is that this is mainly due to the fact that you use noise in this training procedure. So when you train the student, what you'll do is you'll use noise. And one of the types of noise is that you severely augment this data right here, in order to train the student. Now, we've known for a long time that data augmentation, for example, in the frameworks of self supervised learning and so on, can have a very large benefit to training. And here, the fact that we incorporate this extra data, and we use noise and augmentations on it, is going to result in a student that can sort of learn more about the data than than the teacher did know. Okay, this this is basically it. And as you can see, this is kind of their main final results, where they say, on ImageNet, our top one accuracy sort of increases right here. And even on these kind of subsets of ImageNet, or these are sort of corrupted sets of ImageNet, they make even more substantial improvements, as you can see here. Now, we'll go into what these corrupted subsets are. But, you know, just for now, these here are very difficult variants of ImageNet, they can be severely corrupted or, or distorted, and so on. And you can see that the model improves severely over the previous state of the art, which basically means that this model is more robust, and that's a direct consequence of the noise. Now, one last thing I should say is that the student here is also larger than the teacher. So that's also one thing that makes the student better. So what you will make is the student model is larger than the teacher model as a model as the architecture. So in combination with the noise right here, with the noise, in combination, that means the student model is probably able to capture more of the variance of the data, it's larger, it has more parameters, it can learn more about the data, together with the noise, it can probably be a more robust, and that's what makes it generalize better. And we'll also see, as we see here, it's more robust to these transformations, and it's also going to be more robust to adversarial perturbations. So the the technique again is illustrated here, as we said, it's pretty simple. First, so step one, step one, train the teacher model with labeled data, as you would step two, you infer the pseudo labels on unlabeled data. Step three, you make a student you make, sorry, we'll step three over here, train an equal or larger student model with combined data and noise injected. So they don't, they use the original labeled data here and the pseudo labeled data right here in order to train the student. But still, this student doesn't have more information, more label information than the teacher had, it simply has this teacher labeled, teacher labeled unlabeled data also to train on. Now, the crucial part here is, well, first of all, that the student can be larger. And second of all, that there can be noise. And the noise comes in three different forms. So first of all, you use data augmentation, which we've already seen this is sort of like random cropping, or mild rotations, color, jitter, whatever they use a rand augment here, which is a specific technique to apply these augmentations. They use dropout, which is a fairly old technique where you in the student model that you train, you randomly drop out connections, which makes it more robust and more generalizing. And then you also use stochastic depth. Now stochastic depth is a technique when you train a model, what you'll do during training, instead of always passing your data forward through the layers like this, you use some sort of a dropout, but with entire layers. So what you'll do is you'll pass your data forward, and then randomly, you'll skip a layer, and then pass it forward again. Now these, these might seem weird first, because, yeah, it might seem weird. But in if you know that most models, especially computer vision models nowadays are residual networks, which means that their layers look like so you have the input, and you have some computation, and then you have the output. And then there is already a residual connection that basically adds the original signal together to the result of the computation. So all you do in this stochastic layer dropout, or this stochastic depth right here, is you basically disable use, you disable this connection right here, and all the signal has to flow through here. If you read the residual, the resonant original resonant paper, they make it pretty clear why the residual connection is a good idea. Basically, they say, these computations here, they, if you have a very deep network, each layer only has to basically do very a little bit of computation that that can be bypassed fairly efficiently for a lot of data points. So it's not that hurtful to bypass a layer. So it's not that hurtful to bypass a layer. And in this case, they actually use it to just bypass some of these small computations and inject some more robustness into the student model. So with these three strategies to bring noise into the training process, one is on the data and two is on the student model itself, they train the student model, and then fourth, and this is what we didn't have before four, or maybe we put four here, make the student a new teacher. So now you can iterate, you can use the student model that you just trained to again, label the unlabeled data. And then you can use another student model, again, under the influence of noise to train from that student model, and so on. And you can go on. And they do up to like three iterations of this, where they always take the new the student as the new teacher, and then use a new student model to train from that teacher. And they get better and better as they do this. Of course, there's like a diminishing returns, but it's pretty impressive that this even works, right? The new students, in fact, aren't even larger than the old students. It's just that the students are larger than the original teacher model in most of these cases. So here's the algorithm written down. You'll require labeled images right here, and unlabeled images, which are the ones with the tilde. So first, you learn the teacher model, which minimizes the cross entropy on labeled images, this we already know this, right? This is the label, this is the image according to the label. And you train the teacher model, which is this thing here. And you can see here, noised. So already in the teacher training process, you want to introduce this noise, you want to introduce these data augmentations, these are, as I said, these are standard techniques to make models more robust, and therefore, more generalizable. Yeah, we know from these from the self supervised papers that these augmentations are very powerful. And the way you design them, basically, if you one of these augmentations is a random crop, which means if you have an image, you randomly crop out, like part of that image, and then that's your training sample and not the entire thing. So by doing this, you basically teaching the model to ignore the exact location and scale of things on an image. And you can do this because you as a human know that, you know, I can zoom in, I can zoom out into something and it won't change what's on the picture. And so that's you use these augmentations to kind of heuristically tell the model of what it should be invariant to. And that is that is a very powerful technique to regularize basically to to robustify these deep methods. And this is used the same here. So already in the teacher model, we train with this noise. And then step two, use a normal i.e. not noise teacher model to generate soft or hard pseudo labels for the clean i.e. not distorted, unlabeled images. And this is important, they stress this here, that when you when you label the unlabeled images, you want to use the model that is without the noise, and you do it on the not distorted unlabeled images. So when you infer the labels, it's very important that you have clean, accurate labels without any sort of noise in them. So label noise is not something that they have found to help in this case. So not label noise on the teacher, that is. So you can see right here on the unlabeled images, we'll use that teacher model without the noise to infer the labels. Now, they say these can be hard model hard labels or soft labels. So what does that mean? If we generate hard pseudo labels, that means that the y here is simply going to be either zero or one or two or three, and so on. So just the index of the class, whichever class is most likely, that's going to be our label. This is exactly how the supervised data sets come, right? So this is what you'll think first when you see that. However, soft pseudo labels means that the y will be a distribution. So instead of being of class zero, it will be sort of, let's say 90% of class zero, but also 5% class one and 5% class two, right? So you'll output the distribution instead of the just the label. And they have found that the soft pseudo labels work slightly, slightly better than the hard pseudo labels. Okay, thanks. So that they use the soft pseudo labels here because they work slightly better, but you can do it with hard or soft labels. The important thing is that you use the teacher to generate as accurate as possible labels for your unlabeled data. Then third, we've already seen this, learn an equal or larger student model which minimizes the cross entropy loss on labeled images and unlabeled images with noise added to the student model. So as you can see, labeled images and unlabeled images. So we're in this semi, semi supervised learning setting right now you take in both together with noise and noise here is in bold, which means they stress it again, this is important. So you can see that the loss is composed of two different things. These are the true images of your original model. And you use that. And this means you noise the student model, and that noise can be on the data or in the model itself. And here, also the unlabeled images that you have labeled with the teacher, you do the exact same thing. So you train on both of these data sets. And step four is if you want to do iterative training, use the student as a teacher and go back to step two. Now they have some more tricks when they do this iterative training, they also up the batch size during the iterative training and so on. So they do a lot of things to make the student learn something more something better than the teacher. And I think this, the whole paper, it doesn't, it doesn't state it explicitly, but I think the whole paper, everything they do here is to kind of force or allow the student to become better than the teacher by by giving more noise by making the student larger by making the batch size for the student larger and so on. So you want to sort of inject as much invariance as you can. And that will make the student learn more. So they say here, noising student, when the student is deliberately noised in its, it is trained to be consistent to the teacher that is not noised when it generates the pseudo labels. In our experiments, we use two types of noise input noise and model noise. All right. First, data augmentation is an important noising method in noising student training because it forces the student to ensure prediction consistency across augmented versions of an image. Specifically in our method, the teacher produces high quality pseudo labels by reading in clean images, while the student is required to reproduce those labels with augmented images as an input. Second, when dropout and stochastic depth function are used as noise, the teacher behaves like an ensemble at infernal ensemble at inference time when it generates pseudo labels, whereas the student behaves like a single model. In other words, the student is forced to mimic a more powerful ensemble model, we present an ablation study. So this, it's a bit weird what they say here. Don't be confused, you use the dropout and the stochastic depth on the student model. And they say here, if you do this, the teacher behaves like an ensemble at inference time, whereas the student behaves like a single model. And yeah, it's it's a bit of a weird formulation. But it's it's true that the teacher, the teacher will produce these same the label for different pathways through the students if you use dropout and kind of stochastic depth. And therefore, the student is kind of required to approximate each time each forward pass has a different forward pass through the layers through the connections with dropout. And it's forced to approximate that teacher label with all of these different things. So you see that you you put in a lot of a lot of techniques, so they have even other techniques. There is one additional trick. And it's not and it's not one actually, they have so many tricks. And if you look at their experimental setup, that it's crazy, like they describe exactly we reduce the learning rate like this and the batch size like this, and so on. So to get state of the art on ImageNet, it's not enough to just have a good idea of a new thing to do what you you have to have the good idea and then execute it almost like really well. Because you have to regard all of these additional tricks that people have figured out over the years. In any case, they say it works better with an additional trick, data filtering and balancing. Specifically, we filter images that the teacher model has low confidence on, since they are usually out of domain images. So that goes to a point where if you see we have this ImageNet label data set, right, and we have the larger data set. Now, the larger data set simply contains images and there is no guarantee that the images are actually of the classes that we have in the ImageNet data set right here, we have 1000 classes here, there's no guarantee that these images fit into any of those classes. Yet we still ask the teacher model to put them in some of these classes. Now, you can filter out part of those images. If you can look at the teacher model, and you look at its confidence. So when it outputs a distribution, if there's just two labels, let's say, if it outputs a distribution like this, that's wildly different than if it outputs a distribution like this. Both are class one labels, but one is much more confident than the other. So what you want to do is you want to filter out these low confidence labels, because, you know, the model isn't really sure, but it has to assign a class. But that's usually an indication that it is an out of domain image. So if they filter this, it works better. And then also to ensure that the distribution of the unlabeled images match that of the training set, we also need to balance the number of unlabeled images for each class as all classes in ImageNet have a similar number of labeled images. For this purpose, we duplicate images in classes where there are not enough images. For classes where we have too many images, we take the images with the highest confidence. Okay, so this is just another technique. This has basically nothing to do with their core idea. But this is just another thing where they say, okay, we can treat this big thing that we scrape from the internet, you know, we can somehow filter and balance it smartly, and that will work even better. Alright, so let's go into the experiments. Of course, they're, so what they do, I think, where is the graphic? What they do is they take an ImageNet, sorry, they take an efficient net right here. And they train, they first train an efficient net, a smaller efficient net, as we said, for to be the teacher, and then they train a larger efficient net for the student. The best model in our experiments is a result of three iterations of putting back the student as a new teacher, we first train an efficient net b seven on ImageNet as the teacher model. So you can see in the table right here what the b seven achieves, the efficient net b seven here, you can see it has 66 million parameters, which is fairly small compared to these other kind of previous state of the art methods on ImageNet, right. So they first train this, and that will achieve something like an 85% accuracy. Now, if you just train a larger model, this efficient net l two right here that has you can see 480 million parameters, so a lot of more million parameters, but you just train it on the same data set on ImageNet, you will get a point 5% improvement. And you can see that here, with noisy student training with the exact same model, so it has the same amount of parameters, you'll actually get an 88.4. So I like a more than a 3% improvement. And that's what the same model just with this different training procedure, and inputting these 300 million unlabeled images that you have laying around. But the all the information about all the label information comes from the ImageNet data set, and comes from this efficient net b seven teacher model. So that's basically you can, it's a testament that out of this, out of this 85, you can make this 88 just by smartly using the information that the model that this model has learned about the data and transferring it to new data. So they train an efficient net b seven, that's the small model as a teacher model, then by using the b seven model as the teacher, we trained an efficient net l two model with the unlabeled batch size set to 14 times the labeled batch size. And they stress that it's important that you up the batch size. That's another thing that makes the student learn more than the teacher. Then we trained a new efficient net. So by the way, these 14 times, it's also it can be done because now you have more data, right? So you can also up the batch size. Then we trained a new efficient net l two model with the efficient net l two model as the teacher. Lastly, we iterate it again and use an unlabeled batch size of 28 times the label batch size, the detailed result of the three iterations and so on. Okay, so you can see that it's a fairly complicated procedure, but you can gain and gain and gain by simply up upping the by simply upping the or iterating on this procedure. And I think they have it somewhere here. Yes. So as you can see, if iteration one, you train the efficient net l two, you start it with the b seven, you train the efficient at a two with a batch size 14 times larger, and you gain significantly, right, this gains about 2% over the original efficient net, then you iterate again, with the same batch size, and you get like a 5.5% improvement, and you iterate again with an even larger batch size, and you get a point 3% improvement. So there's diminishing returns. But still, you can see that, you know, the more with the introduction of noise with the introduction of the larger model with the introduction of the larger batch size, these are all things that help the student basically become better than the teacher. Alright, so they do a bunch of other experiments. So their main comparison is right here, where they say, look, if we, if even if we train the same model with this noisy student training, we can make, you know, pretty large gains over the model over the same model where we do not train it with this noisy student training. So this really seems to help, you know, due to the noise due to the additional data. They do a lot of ablation studies. So that's pretty interesting. And they also do these studies on this special ImageNet data set, for example, ImageNet C, you can see that there are quite a bit of distortions right here, I don't even see if you can see it on this video. But this is a swing. So the swing right here is like something like this. But you almost can't see it. And you see that the bold on the left is always the prediction of their model, while the thing on the right is the prediction of the original model. So this model they claim is significantly more robust to these kinds of perturbations. And they do an analysis of this where they show yes, in fact, it is. So I think we've already seen this at the beginning that the noisy student is significantly more robust to these perturbations. And they also test this to adversarial perturbations. So right here, you can see that the original model drops pretty quickly, as you increase the epsilon, the epsilon is kind of the strength of the adversarial perturbation. And the noisy, the original model drops very quickly to, you know, fairly low accuracy, while as the noisy student training drops much, much less quickly. Now, this is another testament to the fact that what you do, I think what's happening is you have your data space, right, and you have your data points in it. Now, when you do the like normal data augmentation, what you'll do is you not only force the model to predict those points correctly, but you'll sort of make a bit of a cloud around them, and you force the model to predict that cloud correctly. Now, if you introduce more data, and you do even more noise, what you do is you'll make these clouds kind of larger. And that means the model is more robust to any sort of perturbations in these clouds, right. And, and that means it's probably also going to be more robust to adversarial perturbations. So that's sort of how you can think of this, this introduction of noise, to make it more generalizable. How does this generalize better? So if you think of this data point right here, if I'm looking to generalize, that means, you know, I have this iid data set, so probably my test data is going to be related to the training data. So I might get a data point that's fairly close to that data point. And generalizing means I classify it correctly. Now, if this cloud is very small, like it is here, my decision boundary could be like here, right. And even though the test data set is fairly close to the original training data point, it won't be classified incorrectly. However, if my original cloud during training is larger, you can see if I train a model, it can maybe put the decision boundary here, and then my test data point will be included in on that same side. So that's kind of the idea behind generalizing better. Of course, that's a vast simplification. And also to say that this here is an FGSM attack. So this is kind of the weakest attack in the adversarial perturbation spectrum. They do say under a stronger attack, PGD, which is a fairly strong attack with 10 iterations at epsilon equals 16, noisy student training improves efficient net L2 accuracy from 1.1% to 4.4%. And this, I'm like, you know, 1.1% really means the model is almost like dead. This is lower. This is like random performance. And 4.4% is still a bit above random performance. But yeah, you could probably you could probably get there by simply using any sort of noise in that in that case. But still, you can see that it is more robust to especially to natural distortions, and therefore it generalizes better. As I said, they do quite a bit of drop, sorry, not dropout ablation studies to figure out where exactly the performance comes from. And the answer is, it pretty much comes from all the things that they've described. So here you can see the effect of that extra data set. And you can see pretty much with that extra data set, all the all the situations improve. Here you can see what do you what is happening when you do not augment the student. When you do not data augment, you can immediately see that the accuracy drops. And then when you do not augment and also don't use these model noises, then the performance drops again. And lastly, when you use the teacher, but you noise the teacher, you can see also here the performance is dropping from the original quite a bit. So all of these things kind of contribute, and they do much more ablations. And they have listed their findings here. So using a large teacher model with better performance leads to better result. So you know, as the original teacher, you should use as good as possible a teacher model you can find. Second, a large amount of unlabeled data is necessary for better performance. Okay, so if you want to do this, you better get a large, large amount of extra data, because that's one thing that makes the student perform better. Soft pseudo labels work better than hard pseudo labels for out of the main data in certain cases. Fourth, a large student model is important to enable the student to learn a more powerful model. Okay, so because usually this knowledge distillation is what it this is usually called knowledge distillation. If you use a teacher model to train a student model, and it is often used when the student model is smaller than the teacher because you want to kind of become more efficient to you from so the teacher is large, you make the student small. And you usually sacrifice some accuracy. And here they say if you want to gain some accuracy, you need a large student model, it can't be like a small one. Number five, data balancing is useful for small models. Number six, joint training on labeled data and unlabeled data outperforms the pipeline at first pre trains with unlabeled data, and then fine tunes on labeled data. So this is in contrast to like what people have done before in the self supervised learning and so on, where it's always kind of pre training then fine tuning or in the in the transfer learning setting. Seven, using a large ratio between unlabeled batch size and label batch size enables models to train longer unlabeled data to it to achieve a higher accuracy. Okay, we've already seen that they have used that. And number eight, training the student from scratch is sometimes better than initializing the student with the teacher. And the student initialized with the teacher still requires a large number of training epochs to perform well. This is fairly interesting because it kind of alludes to the fact that the minima in weight space if so if this is of course the case if the student model is the same as the teacher model, so in like iteration two or three or whatnot. It means that, you know, in weight space, if we look at, you know, you might want to start the student here and the minimum is right here. And you might want to think that if I learn the same thing, then the minima are fairly close together, right? So the teacher's minima might be here, and the student minima might be fairly close. So it might be beneficial if I if I start not over here, but actually start at the teacher's minimum. But this doesn't always seem to be the case. And that is a fairly interesting observation because it kind of means that we're talking about different minima here, we're talking about the student model learning different things. And that's what we've discussed already, the student model kind of learns to be robust. And that's probably a minimum that's fairly far away in weight space, at least in in a sort of energy landscape, weight space might be the case that it needs to actually overcome kind of a hill here, even though the minimum might be close. There's lots of research in like how minima are distributed in these weight spaces, which I don't want to go into right here. But it is a fairly interesting observation that it's not always helpful to initialize the teacher sorry, the student at the teacher's optimum. Okay, so this was the paper. And, you know, this is this is the type of research where I do appreciate kind of the these large labs taking it on because they have the resources to do all of these ablations all of these different models, cross them with these giant data sets and so on, which I guess university labs just would not have. And this is a fairly thorough paper really investigating which parts of the pipeline, you know, do something and which ones don't. And usually I I'm fairly critical of pipelines that have like 50 billion tricks, because you never know where the improvement exactly is coming from. But you can sort of mitigate that criticism by doing all of these kind of ablations on the different parts and really showing look, this is important, but this is also important, but this is also important, but this is also important. So yeah, that was my two cents to this paper. I hope you enjoyed this and I'll see you next time. Bye bye.
[{"start": 0.0, "end": 5.84, "text": " Hi there, today we'll look at self training with noisy student improves ImageNet classification"}, {"start": 5.84, "end": 11.84, "text": " by Qi Zixie, Min Tan Luong, Edward Havi and Kwok Wile."}, {"start": 11.84, "end": 17.44, "text": " So this paper takes an ImageNet classifier that's been trained on the ImageNet data set"}, {"start": 17.44, "end": 25.04, "text": " and uses that classifier as a teacher model to label a whole bunch of unlabeled images."}, {"start": 25.04, "end": 29.6, "text": " And then it trains a student model that is larger than the original teacher model on"}, {"start": 29.6, "end": 36.160000000000004, "text": " those teacher labeled images. And that turns out to improve the classification on the ImageNet"}, {"start": 36.160000000000004, "end": 44.32, "text": " validation set. Now that there is a couple of things that make this all work. And today,"}, {"start": 44.32, "end": 50.08, "text": " we're going to explore how this paper does it, and what they say is important."}, {"start": 51.040000000000006, "end": 57.040000000000006, "text": " If you enjoy content like this, as always, don't hesitate to share it out or tell your friends"}, {"start": 57.04, "end": 64.16, "text": " about it. And if you're not subscribed yet, then do so. I would appreciate that and you'll get more"}, {"start": 64.16, "end": 74.08, "text": " content. So win win. So this this paper is about semi supervised learning in in effect, so it's at"}, {"start": 74.08, "end": 79.12, "text": " the intersection actually of semi supervised learning, knowledge distillation and transfer"}, {"start": 79.12, "end": 83.68, "text": " learning. So what do we mean by semi semi supervised learning, usually in supervised"}, {"start": 83.68, "end": 89.2, "text": " learning, you'll have some sort of data set. And the data set will contain, let's say it's an"}, {"start": 89.2, "end": 95.68, "text": " ImageNet, it's image data set. So the data set will contain images. This is an image with like"}, {"start": 95.68, "end": 104.16000000000001, "text": " some sort of cat on it. And it will contain the labels according to that. So cat. Now,"}, {"start": 104.16000000000001, "end": 111.52000000000001, "text": " in semi supervised learning, you you assume that so this is supervised learning in semi supervised"}, {"start": 111.52, "end": 118.08, "text": " learning, you assume that only part of your data set has the labels. So like only this part down"}, {"start": 118.08, "end": 125.19999999999999, "text": " here has the labels, and the upper part does not have the labels. So that's semi supervised learning,"}, {"start": 125.19999999999999, "end": 130.32, "text": " it's often the case when it's very expensive to get labels. So you can only get labels for a couple"}, {"start": 130.32, "end": 136.0, "text": " of images in your data set. But very often in semi supervised learning, you still assume it's the"}, {"start": 136.0, "end": 142.48, "text": " same data set. There is a slightly different setup here that's called transfer learning. So in"}, {"start": 142.48, "end": 148.4, "text": " transfer learning, what you'll have is you'll have your data set that has the labels, but it's very"}, {"start": 148.4, "end": 154.48, "text": " small. So you'll notice I've drawn it smaller, that means you have very little. That is also the case"}, {"start": 154.48, "end": 161.04, "text": " when it's very expensive to get labels, but also it's expensive to get the data itself. This is"}, {"start": 161.04, "end": 167.12, "text": " often the case, let's say in medical data, where not only is it expensive to get labels for like"}, {"start": 167.12, "end": 175.04, "text": " a CT scan, it's actually expensive to get the CT scan. So what the goal in transfer learning is,"}, {"start": 175.04, "end": 181.92, "text": " is to say, well, I do I do have only this small data set, but I do have this giant other data"}, {"start": 181.92, "end": 189.2, "text": " set over here. Now, can't I, it's not the same, it's maybe they're not CT, these are CT scans,"}, {"start": 189.2, "end": 197.44, "text": " maybe these are x rays, right? They're fairly similar, similar technology. If you slice the CT,"}, {"start": 197.44, "end": 203.35999999999999, "text": " it will give you sort of an x ray. Can I, you know, train my model, pre train my model on x"}, {"start": 203.35999999999999, "end": 212.72, "text": " ray data, and then fine tune it on the CT data. So that's called transfer learning usually. Now,"}, {"start": 212.72, "end": 218.64, "text": " this can be done with or without labels. So it can be that for the x ray data set, you do have the"}, {"start": 218.64, "end": 226.23999999999998, "text": " labels or you don't have the labels, there are techniques for all of those. Now, what we're"}, {"start": 226.23999999999998, "end": 232.16, "text": " going to look at today is kind of the situation right here. It's the transfer learning situation"}, {"start": 232.16, "end": 240.79999999999998, "text": " where you do not have the labels for this x ray data set. But other than in this x ray example,"}, {"start": 240.79999999999998, "end": 246.88, "text": " what we're going to look at is the small data set is going to be our image net database. So our"}, {"start": 246.88, "end": 254.16, "text": " original picture with label database. So you'll see immediately the difference here is that"}, {"start": 254.16, "end": 259.44, "text": " in the transfer learning setting, we usually assume that the data set we want to train on is"}, {"start": 259.44, "end": 269.36, "text": " fairly small. Here, you know, image net is already sizable. But what we have is we have a much larger"}, {"start": 269.36, "end": 275.52, "text": " database of unlabeled images that we can just get from the internet. So we can scrape the internet"}, {"start": 275.52, "end": 281.28, "text": " for any kind of pictures. And that will be our unlabeled data set. And what we'll try to do is"}, {"start": 281.28, "end": 287.2, "text": " somehow incorporate this unlabeled data set here into the training process to get better on the"}, {"start": 287.2, "end": 293.28, "text": " image net data set. Okay, so this is the problem statement is you have the image net data set,"}, {"start": 293.28, "end": 298.64, "text": " and you have a second much larger data set of unlabeled images, and you somehow want to make"}, {"start": 298.64, "end": 304.4, "text": " use of them. So I hope you see how this is sort of connected to the others is it's essentially"}, {"start": 304.4, "end": 310.88, "text": " so sort of a transfer semi supervised learning setting. But with the exception that usually in"}, {"start": 310.88, "end": 317.59999999999997, "text": " transfer learning, you assume that the the labeled data set is like super small, which is not the"}, {"start": 317.59999999999997, "end": 323.03999999999996, "text": " case here. And that's going to result in us being able to apply a different technique. So this"}, {"start": 323.03999999999996, "end": 329.2, "text": " different technique is called the noisy student. Now, usually, what you might do in a transfer"}, {"start": 329.2, "end": 335.12, "text": " learning setting is you might want to start with that big data set, right? Because that's the data"}, {"start": 335.12, "end": 340.24, "text": " set that's sizable enough to allow you to train a really big model on it. And then you fine tune,"}, {"start": 340.24, "end": 345.59999999999997, "text": " and you you sort of hope that the information transfers over here. On the other hand, what we"}, {"start": 345.59999999999997, "end": 352.71999999999997, "text": " want to do is we start with the image net data set. So first, we train this in a supervised learning"}, {"start": 352.72, "end": 359.28000000000003, "text": " fashion into our model. Now this model is going to be called the teacher model. We know how to do"}, {"start": 359.28000000000003, "end": 365.44000000000005, "text": " this, we know how to train image net models, right? So we can train this into a teacher model"}, {"start": 365.44000000000005, "end": 372.08000000000004, "text": " that has a reasonable accuracy on the image net data set. Step two, we're going to take that big"}, {"start": 372.08000000000004, "end": 380.56, "text": " data set over here, and use the teacher model to label the unlabeled images. So for each image,"}, {"start": 380.56, "end": 387.2, "text": " for each image coming in here, the teacher, so maybe this is again, another cat, the teacher"}, {"start": 387.2, "end": 397.04, "text": " will say, that's a cat. Okay, so that gives you the big data set, where now you have images along"}, {"start": 397.04, "end": 403.36, "text": " with labels, just the labels aren't true labels, they're generated by the teacher. And then in the"}, {"start": 403.36, "end": 414.40000000000003, "text": " third step, you train this big data set, you train on this big data set. And that's what you call your"}, {"start": 414.40000000000003, "end": 420.96000000000004, "text": " student model. And then the student model in this paper, we'll see how can we make it such that the"}, {"start": 420.96000000000004, "end": 427.44, "text": " student is then better at the original image net task than the teacher ever was, which seems"}, {"start": 427.44, "end": 431.92, "text": " counterintuitive at first, because all of the information that the student is trained from is"}, {"start": 431.92, "end": 436.96000000000004, "text": " basically what the teacher already knows, right, all the labels here come from the teacher."}, {"start": 436.96000000000004, "end": 444.96000000000004, "text": " Therefore, the student shouldn't be able to outperform the teacher. But in this case, the"}, {"start": 444.96000000000004, "end": 450.48, "text": " student will be able to outperform the teacher. And their argument here is that this is mainly"}, {"start": 450.48, "end": 457.76, "text": " due to the fact that you use noise in this training procedure. So when you train the student,"}, {"start": 457.76, "end": 464.15999999999997, "text": " what you'll do is you'll use noise. And one of the types of noise is that you severely augment this"}, {"start": 464.15999999999997, "end": 470.24, "text": " data right here, in order to train the student. Now, we've known for a long time that data"}, {"start": 470.24, "end": 476.15999999999997, "text": " augmentation, for example, in the frameworks of self supervised learning and so on, can have a"}, {"start": 476.15999999999997, "end": 484.08, "text": " very large benefit to training. And here, the fact that we incorporate this extra data, and we use"}, {"start": 484.08, "end": 490.56, "text": " noise and augmentations on it, is going to result in a student that can sort of learn more about"}, {"start": 490.56, "end": 500.96, "text": " the data than than the teacher did know. Okay, this this is basically it. And as you can see,"}, {"start": 500.96, "end": 507.52, "text": " this is kind of their main final results, where they say, on ImageNet, our top one accuracy sort"}, {"start": 507.52, "end": 514.88, "text": " of increases right here. And even on these kind of subsets of ImageNet, or these are sort of"}, {"start": 514.88, "end": 521.36, "text": " corrupted sets of ImageNet, they make even more substantial improvements, as you can see here."}, {"start": 521.36, "end": 528.64, "text": " Now, we'll go into what these corrupted subsets are. But, you know, just for now, these here are"}, {"start": 528.64, "end": 535.92, "text": " very difficult variants of ImageNet, they can be severely corrupted or, or distorted, and so on."}, {"start": 535.92, "end": 541.4399999999999, "text": " And you can see that the model improves severely over the previous state of the art, which basically"}, {"start": 541.4399999999999, "end": 547.68, "text": " means that this model is more robust, and that's a direct consequence of the noise. Now, one last"}, {"start": 547.68, "end": 554.0799999999999, "text": " thing I should say is that the student here is also larger than the teacher. So that's also one"}, {"start": 554.0799999999999, "end": 560.3199999999999, "text": " thing that makes the student better. So what you will make is the student model is larger than the"}, {"start": 560.32, "end": 566.32, "text": " teacher model as a model as the architecture. So in combination with the noise right here,"}, {"start": 567.2800000000001, "end": 574.5600000000001, "text": " with the noise, in combination, that means the student model is probably able to capture more of"}, {"start": 574.5600000000001, "end": 579.2800000000001, "text": " the variance of the data, it's larger, it has more parameters, it can learn more about the data,"}, {"start": 579.2800000000001, "end": 586.72, "text": " together with the noise, it can probably be a more robust, and that's what makes it generalize"}, {"start": 586.72, "end": 592.4, "text": " better. And we'll also see, as we see here, it's more robust to these transformations, and it's"}, {"start": 592.4, "end": 598.96, "text": " also going to be more robust to adversarial perturbations. So the the technique again is"}, {"start": 599.76, "end": 607.44, "text": " illustrated here, as we said, it's pretty simple. First, so step one, step one, train the teacher"}, {"start": 607.44, "end": 616.5600000000001, "text": " model with labeled data, as you would step two, you infer the pseudo labels on unlabeled data."}, {"start": 616.5600000000001, "end": 626.0, "text": " Step three, you make a student you make, sorry, we'll step three over here, train an equal or"}, {"start": 626.0, "end": 633.36, "text": " larger student model with combined data and noise injected. So they don't, they use the original"}, {"start": 633.36, "end": 639.04, "text": " labeled data here and the pseudo labeled data right here in order to train the student. But"}, {"start": 639.04, "end": 644.4, "text": " still, this student doesn't have more information, more label information than the teacher had,"}, {"start": 644.4, "end": 653.76, "text": " it simply has this teacher labeled, teacher labeled unlabeled data also to train on. Now,"}, {"start": 653.76, "end": 658.96, "text": " the crucial part here is, well, first of all, that the student can be larger. And second of all, that"}, {"start": 658.96, "end": 665.6, "text": " there can be noise. And the noise comes in three different forms. So first of all, you use data"}, {"start": 665.6, "end": 671.6, "text": " augmentation, which we've already seen this is sort of like random cropping, or mild rotations,"}, {"start": 671.6, "end": 676.96, "text": " color, jitter, whatever they use a rand augment here, which is a specific technique to apply these"}, {"start": 676.96, "end": 683.84, "text": " augmentations. They use dropout, which is a fairly old technique where you in the student model that"}, {"start": 683.84, "end": 689.52, "text": " you train, you randomly drop out connections, which makes it more robust and more generalizing."}, {"start": 690.48, "end": 694.88, "text": " And then you also use stochastic depth. Now stochastic depth is a technique when you train"}, {"start": 694.88, "end": 701.52, "text": " a model, what you'll do during training, instead of always passing your data forward through the"}, {"start": 701.52, "end": 708.5600000000001, "text": " layers like this, you use some sort of a dropout, but with entire layers. So what you'll do is"}, {"start": 708.56, "end": 714.0799999999999, "text": " you'll pass your data forward, and then randomly, you'll skip a layer, and then pass it forward"}, {"start": 714.0799999999999, "end": 721.68, "text": " again. Now these, these might seem weird first, because, yeah, it might seem weird. But in if you"}, {"start": 721.68, "end": 729.1999999999999, "text": " know that most models, especially computer vision models nowadays are residual networks, which means"}, {"start": 729.1999999999999, "end": 734.88, "text": " that their layers look like so you have the input, and you have some computation, and then you have"}, {"start": 734.88, "end": 742.08, "text": " the output. And then there is already a residual connection that basically adds the original signal"}, {"start": 742.08, "end": 749.04, "text": " together to the result of the computation. So all you do in this stochastic layer dropout,"}, {"start": 749.04, "end": 756.0, "text": " or this stochastic depth right here, is you basically disable use, you disable this connection"}, {"start": 756.0, "end": 762.0, "text": " right here, and all the signal has to flow through here. If you read the residual, the resonant"}, {"start": 762.0, "end": 767.12, "text": " original resonant paper, they make it pretty clear why the residual connection is a good idea."}, {"start": 767.12, "end": 772.88, "text": " Basically, they say, these computations here, they, if you have a very deep network, each layer"}, {"start": 772.88, "end": 780.64, "text": " only has to basically do very a little bit of computation that that can be bypassed"}, {"start": 781.84, "end": 787.52, "text": " fairly efficiently for a lot of data points. So it's not that hurtful to bypass a layer."}, {"start": 787.52, "end": 794.0, "text": " So it's not that hurtful to bypass a layer. And in this case, they actually use it to just bypass"}, {"start": 794.0, "end": 800.56, "text": " some of these small computations and inject some more robustness into the student model. So with"}, {"start": 800.56, "end": 806.64, "text": " these three strategies to bring noise into the training process, one is on the data and two is"}, {"start": 806.64, "end": 813.4399999999999, "text": " on the student model itself, they train the student model, and then fourth, and this is what"}, {"start": 813.44, "end": 821.6800000000001, "text": " we didn't have before four, or maybe we put four here, make the student a new teacher. So now you"}, {"start": 821.6800000000001, "end": 827.9200000000001, "text": " can iterate, you can use the student model that you just trained to again, label the unlabeled"}, {"start": 827.9200000000001, "end": 834.72, "text": " data. And then you can use another student model, again, under the influence of noise to train from"}, {"start": 834.72, "end": 839.9200000000001, "text": " that student model, and so on. And you can go on. And they do up to like three iterations of this,"}, {"start": 839.92, "end": 848.7199999999999, "text": " where they always take the new the student as the new teacher, and then use a new student model to"}, {"start": 848.7199999999999, "end": 854.9599999999999, "text": " train from that teacher. And they get better and better as they do this. Of course, there's like a"}, {"start": 854.9599999999999, "end": 861.28, "text": " diminishing returns, but it's pretty impressive that this even works, right? The new students,"}, {"start": 861.28, "end": 867.1999999999999, "text": " in fact, aren't even larger than the old students. It's just that the students are larger than the"}, {"start": 867.2, "end": 874.5600000000001, "text": " original teacher model in most of these cases. So here's the algorithm written down. You'll require"}, {"start": 874.5600000000001, "end": 881.2, "text": " labeled images right here, and unlabeled images, which are the ones with the tilde. So first,"}, {"start": 881.2, "end": 886.1600000000001, "text": " you learn the teacher model, which minimizes the cross entropy on labeled images, this we already"}, {"start": 886.1600000000001, "end": 894.24, "text": " know this, right? This is the label, this is the image according to the label. And you train the"}, {"start": 894.24, "end": 899.6, "text": " teacher model, which is this thing here. And you can see here, noised. So already in the teacher"}, {"start": 899.6, "end": 904.08, "text": " training process, you want to introduce this noise, you want to introduce these data augmentations,"}, {"start": 904.08, "end": 909.04, "text": " these are, as I said, these are standard techniques to make models more robust, and therefore,"}, {"start": 909.04, "end": 916.72, "text": " more generalizable. Yeah, we know from these from the self supervised papers that these"}, {"start": 916.72, "end": 924.24, "text": " augmentations are very powerful. And the way you design them, basically, if you one of these augmentations"}, {"start": 924.24, "end": 929.84, "text": " is a random crop, which means if you have an image, you randomly crop out, like part of that image,"}, {"start": 929.84, "end": 937.12, "text": " and then that's your training sample and not the entire thing. So by doing this, you basically"}, {"start": 937.76, "end": 943.9200000000001, "text": " teaching the model to ignore the exact location and scale of things on an image. And you can do"}, {"start": 943.92, "end": 948.3199999999999, "text": " this because you as a human know that, you know, I can zoom in, I can zoom out into something and"}, {"start": 948.3199999999999, "end": 955.4399999999999, "text": " it won't change what's on the picture. And so that's you use these augmentations to kind of"}, {"start": 955.4399999999999, "end": 961.5999999999999, "text": " heuristically tell the model of what it should be invariant to. And that is that is a very powerful"}, {"start": 961.5999999999999, "end": 969.92, "text": " technique to regularize basically to to robustify these deep methods. And this is used the same here."}, {"start": 969.92, "end": 978.56, "text": " So already in the teacher model, we train with this noise. And then step two, use a normal i.e."}, {"start": 978.56, "end": 984.0799999999999, "text": " not noise teacher model to generate soft or hard pseudo labels for the clean i.e. not distorted,"}, {"start": 984.0799999999999, "end": 990.64, "text": " unlabeled images. And this is important, they stress this here, that when you when you label"}, {"start": 990.64, "end": 997.8399999999999, "text": " the unlabeled images, you want to use the model that is without the noise, and you do it on the"}, {"start": 997.84, "end": 1003.44, "text": " not distorted unlabeled images. So when you infer the labels, it's very important that you have"}, {"start": 1004.1600000000001, "end": 1010.4, "text": " clean, accurate labels without any sort of noise in them. So label noise is not something that they"}, {"start": 1010.4, "end": 1017.6800000000001, "text": " have found to help in this case. So not label noise on the teacher, that is. So you can see"}, {"start": 1017.6800000000001, "end": 1024.16, "text": " right here on the unlabeled images, we'll use that teacher model without the noise to infer"}, {"start": 1024.16, "end": 1030.8000000000002, "text": " the labels. Now, they say these can be hard model hard labels or soft labels. So what does that mean?"}, {"start": 1031.52, "end": 1038.4, "text": " If we generate hard pseudo labels, that means that the y here is simply going to be either zero or"}, {"start": 1038.4, "end": 1043.92, "text": " one or two or three, and so on. So just the index of the class, whichever class is most likely,"}, {"start": 1043.92, "end": 1050.4, "text": " that's going to be our label. This is exactly how the supervised data sets come, right? So this is"}, {"start": 1050.4, "end": 1056.96, "text": " what you'll think first when you see that. However, soft pseudo labels means that the y will be a"}, {"start": 1056.96, "end": 1067.2800000000002, "text": " distribution. So instead of being of class zero, it will be sort of, let's say 90% of class zero,"}, {"start": 1067.2800000000002, "end": 1074.8000000000002, "text": " but also 5% class one and 5% class two, right? So you'll output the distribution"}, {"start": 1074.8, "end": 1081.36, "text": " instead of the just the label. And they have found that the soft pseudo labels work slightly,"}, {"start": 1081.36, "end": 1087.12, "text": " slightly better than the hard pseudo labels. Okay, thanks."}, {"start": 1090.56, "end": 1095.12, "text": " So that they use the soft pseudo labels here because they work slightly better, but you can"}, {"start": 1095.12, "end": 1101.12, "text": " do it with hard or soft labels. The important thing is that you use the teacher to generate"}, {"start": 1101.12, "end": 1109.04, "text": " as accurate as possible labels for your unlabeled data. Then third, we've already seen this,"}, {"start": 1109.04, "end": 1114.0, "text": " learn an equal or larger student model which minimizes the cross entropy loss on labeled"}, {"start": 1114.0, "end": 1121.52, "text": " images and unlabeled images with noise added to the student model. So as you can see, labeled images"}, {"start": 1121.52, "end": 1127.84, "text": " and unlabeled images. So we're in this semi, semi supervised learning setting right now you take in"}, {"start": 1127.84, "end": 1134.72, "text": " both together with noise and noise here is in bold, which means they stress it again, this is"}, {"start": 1134.72, "end": 1140.6399999999999, "text": " important. So you can see that the loss is composed of two different things. These are the"}, {"start": 1140.6399999999999, "end": 1150.24, "text": " true images of your original model. And you use that. And this means you noise the student model,"}, {"start": 1150.24, "end": 1157.68, "text": " and that noise can be on the data or in the model itself. And here, also the unlabeled images that"}, {"start": 1157.68, "end": 1163.04, "text": " you have labeled with the teacher, you do the exact same thing. So you train on both of these"}, {"start": 1163.04, "end": 1168.4, "text": " data sets. And step four is if you want to do iterative training, use the student as a teacher"}, {"start": 1168.4, "end": 1176.4, "text": " and go back to step two. Now they have some more tricks when they do this iterative training,"}, {"start": 1176.4, "end": 1183.1200000000001, "text": " they also up the batch size during the iterative training and so on. So they do a lot of things to"}, {"start": 1183.1200000000001, "end": 1189.68, "text": " make the student learn something more something better than the teacher. And I think this, the"}, {"start": 1189.68, "end": 1194.96, "text": " whole paper, it doesn't, it doesn't state it explicitly, but I think the whole paper, everything"}, {"start": 1194.96, "end": 1202.0, "text": " they do here is to kind of force or allow the student to become better than the teacher by by"}, {"start": 1202.0, "end": 1207.92, "text": " giving more noise by making the student larger by making the batch size for the student larger and"}, {"start": 1207.92, "end": 1215.28, "text": " so on. So you want to sort of inject as much invariance as you can. And that will make the"}, {"start": 1215.28, "end": 1226.32, "text": " student learn more. So they say here, noising student, when the student is deliberately noised"}, {"start": 1226.32, "end": 1233.04, "text": " in its, it is trained to be consistent to the teacher that is not noised when it generates the"}, {"start": 1233.04, "end": 1239.9199999999998, "text": " pseudo labels. In our experiments, we use two types of noise input noise and model noise. All right."}, {"start": 1244.32, "end": 1249.36, "text": " First, data augmentation is an important noising method in noising student training because it"}, {"start": 1249.36, "end": 1256.56, "text": " forces the student to ensure prediction consistency across augmented versions of an image. Specifically"}, {"start": 1256.56, "end": 1261.84, "text": " in our method, the teacher produces high quality pseudo labels by reading in clean images, while the"}, {"start": 1261.84, "end": 1271.04, "text": " student is required to reproduce those labels with augmented images as an input. Second, when dropout"}, {"start": 1271.04, "end": 1278.56, "text": " and stochastic depth function are used as noise, the teacher behaves like an ensemble at infernal"}, {"start": 1278.56, "end": 1283.9199999999998, "text": " ensemble at inference time when it generates pseudo labels, whereas the student behaves like a single"}, {"start": 1283.9199999999998, "end": 1290.0, "text": " model. In other words, the student is forced to mimic a more powerful ensemble model, we present"}, {"start": 1290.0, "end": 1296.8, "text": " an ablation study. So this, it's a bit weird what they say here. Don't be confused, you use the"}, {"start": 1296.8, "end": 1304.8, "text": " dropout and the stochastic depth on the student model. And they say here, if you do this, the"}, {"start": 1304.8, "end": 1311.36, "text": " teacher behaves like an ensemble at inference time, whereas the student behaves like a single model."}, {"start": 1311.36, "end": 1317.52, "text": " And yeah, it's it's a bit of a weird formulation. But it's it's true that the teacher, the teacher"}, {"start": 1317.52, "end": 1324.96, "text": " will produce these same the label for different pathways through the students if you use dropout"}, {"start": 1324.96, "end": 1332.24, "text": " and kind of stochastic depth. And therefore, the student is kind of required to approximate each"}, {"start": 1332.24, "end": 1336.32, "text": " time each forward pass has a different forward pass through the layers through the connections"}, {"start": 1336.32, "end": 1343.44, "text": " with dropout. And it's forced to approximate that teacher label with all of these different things."}, {"start": 1343.44, "end": 1350.16, "text": " So you see that you you put in a lot of a lot of techniques, so they have even other techniques."}, {"start": 1351.2, "end": 1357.04, "text": " There is one additional trick. And it's not and it's not one actually, they have so many tricks."}, {"start": 1357.04, "end": 1361.68, "text": " And if you look at their experimental setup, that it's crazy, like they describe exactly"}, {"start": 1361.68, "end": 1366.96, "text": " we reduce the learning rate like this and the batch size like this, and so on. So to get state"}, {"start": 1366.96, "end": 1373.44, "text": " of the art on ImageNet, it's not enough to just have a good idea of a new thing to do what you"}, {"start": 1373.44, "end": 1380.8, "text": " you have to have the good idea and then execute it almost like really well. Because you have to"}, {"start": 1380.8, "end": 1385.3600000000001, "text": " regard all of these additional tricks that people have figured out over the years."}, {"start": 1385.36, "end": 1390.8799999999999, "text": " In any case, they say it works better with an additional trick, data filtering and balancing."}, {"start": 1391.6, "end": 1396.8, "text": " Specifically, we filter images that the teacher model has low confidence on, since they are"}, {"start": 1396.8, "end": 1402.8, "text": " usually out of domain images. So that goes to a point where if you see we have this ImageNet"}, {"start": 1402.8, "end": 1409.76, "text": " label data set, right, and we have the larger data set. Now, the larger data set simply contains"}, {"start": 1409.76, "end": 1415.6, "text": " images and there is no guarantee that the images are actually of the classes that we have in the"}, {"start": 1415.6, "end": 1421.92, "text": " ImageNet data set right here, we have 1000 classes here, there's no guarantee that these images fit"}, {"start": 1421.92, "end": 1428.48, "text": " into any of those classes. Yet we still ask the teacher model to put them in some of these classes."}, {"start": 1428.48, "end": 1438.0, "text": " Now, you can filter out part of those images. If you can look at the teacher model, and you look"}, {"start": 1438.0, "end": 1442.96, "text": " at its confidence. So when it outputs a distribution, if there's just two labels,"}, {"start": 1442.96, "end": 1447.52, "text": " let's say, if it outputs a distribution like this, that's wildly different than if it outputs"}, {"start": 1447.52, "end": 1454.8, "text": " a distribution like this. Both are class one labels, but one is much more confident than the"}, {"start": 1454.8, "end": 1460.16, "text": " other. So what you want to do is you want to filter out these low confidence labels, because,"}, {"start": 1460.72, "end": 1465.36, "text": " you know, the model isn't really sure, but it has to assign a class. But that's usually an"}, {"start": 1465.36, "end": 1472.56, "text": " indication that it is an out of domain image. So if they filter this, it works better. And then also"}, {"start": 1473.36, "end": 1479.1999999999998, "text": " to ensure that the distribution of the unlabeled images match that of the training set, we also"}, {"start": 1479.1999999999998, "end": 1484.56, "text": " need to balance the number of unlabeled images for each class as all classes in ImageNet have"}, {"start": 1484.56, "end": 1489.36, "text": " a similar number of labeled images. For this purpose, we duplicate images in classes where"}, {"start": 1489.36, "end": 1494.6399999999999, "text": " there are not enough images. For classes where we have too many images, we take the images with"}, {"start": 1494.64, "end": 1502.5600000000002, "text": " the highest confidence. Okay, so this is just another technique. This has basically nothing to"}, {"start": 1502.5600000000002, "end": 1509.76, "text": " do with their core idea. But this is just another thing where they say, okay, we can treat this big"}, {"start": 1510.4, "end": 1515.44, "text": " thing that we scrape from the internet, you know, we can somehow filter and balance it smartly,"}, {"start": 1515.44, "end": 1527.3600000000001, "text": " and that will work even better. Alright, so let's go into the experiments. Of course, they're,"}, {"start": 1529.2, "end": 1536.4, "text": " so what they do, I think, where is the graphic? What they do is they take an ImageNet, sorry,"}, {"start": 1536.4, "end": 1545.76, "text": " they take an efficient net right here. And they train, they first train an efficient net, a"}, {"start": 1545.76, "end": 1552.0800000000002, "text": " smaller efficient net, as we said, for to be the teacher, and then they train a larger efficient"}, {"start": 1552.0800000000002, "end": 1563.52, "text": " net for the student. The best model in our experiments is a result of three iterations"}, {"start": 1563.52, "end": 1568.96, "text": " of putting back the student as a new teacher, we first train an efficient net b seven on ImageNet"}, {"start": 1568.96, "end": 1574.32, "text": " as the teacher model. So you can see in the table right here what the b seven achieves,"}, {"start": 1575.12, "end": 1580.48, "text": " the efficient net b seven here, you can see it has 66 million parameters, which is fairly small"}, {"start": 1580.48, "end": 1586.32, "text": " compared to these other kind of previous state of the art methods on ImageNet, right. So they first"}, {"start": 1586.32, "end": 1594.1599999999999, "text": " train this, and that will achieve something like an 85% accuracy. Now, if you just train a larger"}, {"start": 1594.1599999999999, "end": 1599.6, "text": " model, this efficient net l two right here that has you can see 480 million parameters, so a lot"}, {"start": 1599.6, "end": 1605.36, "text": " of more million parameters, but you just train it on the same data set on ImageNet, you will get a"}, {"start": 1605.36, "end": 1613.28, "text": " point 5% improvement. And you can see that here, with noisy student training with the exact same"}, {"start": 1613.28, "end": 1620.8, "text": " model, so it has the same amount of parameters, you'll actually get an 88.4. So I like a more than"}, {"start": 1620.8, "end": 1626.48, "text": " a 3% improvement. And that's what the same model just with this different training procedure,"}, {"start": 1626.48, "end": 1634.24, "text": " and inputting these 300 million unlabeled images that you have laying around. But the all the"}, {"start": 1634.24, "end": 1642.48, "text": " information about all the label information comes from the ImageNet data set, and comes from this"}, {"start": 1642.48, "end": 1648.64, "text": " efficient net b seven teacher model. So that's basically you can, it's a testament that out of"}, {"start": 1648.64, "end": 1656.72, "text": " this, out of this 85, you can make this 88 just by smartly using the information that the model"}, {"start": 1656.72, "end": 1664.0, "text": " that this model has learned about the data and transferring it to new data. So they train an"}, {"start": 1664.0, "end": 1669.92, "text": " efficient net b seven, that's the small model as a teacher model, then by using the b seven model"}, {"start": 1669.92, "end": 1676.64, "text": " as the teacher, we trained an efficient net l two model with the unlabeled batch size set to 14"}, {"start": 1676.64, "end": 1682.64, "text": " times the labeled batch size. And they stress that it's important that you up the batch size."}, {"start": 1682.64, "end": 1689.04, "text": " That's another thing that makes the student learn more than the teacher. Then we trained a new"}, {"start": 1689.04, "end": 1694.8000000000002, "text": " efficient net. So by the way, these 14 times, it's also it can be done because now you have"}, {"start": 1694.8, "end": 1701.9199999999998, "text": " more data, right? So you can also up the batch size. Then we trained a new efficient net l two"}, {"start": 1701.9199999999998, "end": 1708.48, "text": " model with the efficient net l two model as the teacher. Lastly, we iterate it again and use an"}, {"start": 1708.48, "end": 1713.68, "text": " unlabeled batch size of 28 times the label batch size, the detailed result of the three iterations"}, {"start": 1713.68, "end": 1719.52, "text": " and so on. Okay, so you can see that it's a fairly complicated procedure, but you can gain and gain"}, {"start": 1719.52, "end": 1729.44, "text": " and gain by simply up upping the by simply upping the or iterating on this procedure. And I think"}, {"start": 1729.44, "end": 1736.72, "text": " they have it somewhere here. Yes. So as you can see, if iteration one, you train the efficient"}, {"start": 1736.72, "end": 1743.6, "text": " net l two, you start it with the b seven, you train the efficient at a two with a batch size 14"}, {"start": 1743.6, "end": 1749.44, "text": " times larger, and you gain significantly, right, this gains about 2% over the original efficient"}, {"start": 1749.44, "end": 1758.56, "text": " net, then you iterate again, with the same batch size, and you get like a 5.5% improvement, and you"}, {"start": 1758.56, "end": 1762.64, "text": " iterate again with an even larger batch size, and you get a point 3% improvement. So there's"}, {"start": 1762.64, "end": 1768.64, "text": " diminishing returns. But still, you can see that, you know, the more with the introduction of noise"}, {"start": 1768.64, "end": 1773.44, "text": " with the introduction of the larger model with the introduction of the larger batch size, these are"}, {"start": 1773.44, "end": 1780.96, "text": " all things that help the student basically become better than the teacher. Alright, so they do a"}, {"start": 1780.96, "end": 1786.72, "text": " bunch of other experiments. So their main comparison is right here, where they say,"}, {"start": 1788.3200000000002, "end": 1795.2, "text": " look, if we, if even if we train the same model with this noisy student training, we can make,"}, {"start": 1795.92, "end": 1802.96, "text": " you know, pretty large gains over the model over the same model where we do not train it with this"}, {"start": 1802.96, "end": 1809.2, "text": " noisy student training. So this really seems to help, you know, due to the noise due to the"}, {"start": 1809.2, "end": 1817.52, "text": " additional data. They do a lot of ablation studies. So that's pretty interesting. And they also do"}, {"start": 1817.52, "end": 1823.3600000000001, "text": " these studies on this special ImageNet data set, for example, ImageNet C, you can see that there"}, {"start": 1823.3600000000001, "end": 1828.0, "text": " are quite a bit of distortions right here, I don't even see if you can see it on this video. But this"}, {"start": 1828.0, "end": 1837.04, "text": " is a swing. So the swing right here is like something like this. But you almost can't see it."}, {"start": 1837.04, "end": 1842.16, "text": " And you see that the bold on the left is always the prediction of their model, while the thing on"}, {"start": 1842.16, "end": 1849.12, "text": " the right is the prediction of the original model. So this model they claim is significantly more"}, {"start": 1849.12, "end": 1857.12, "text": " robust to these kinds of perturbations. And they do an analysis of this where they show yes, in fact,"}, {"start": 1857.12, "end": 1865.9199999999998, "text": " it is. So I think we've already seen this at the beginning that the noisy student is significantly"}, {"start": 1866.6399999999999, "end": 1872.1599999999999, "text": " more robust to these perturbations. And they also test this to adversarial perturbations. So right"}, {"start": 1872.1599999999999, "end": 1877.76, "text": " here, you can see that the original model drops pretty quickly, as you increase the epsilon,"}, {"start": 1877.76, "end": 1883.4399999999998, "text": " the epsilon is kind of the strength of the adversarial perturbation. And the noisy, the"}, {"start": 1883.44, "end": 1891.1200000000001, "text": " original model drops very quickly to, you know, fairly low accuracy, while as the noisy student"}, {"start": 1891.1200000000001, "end": 1900.3200000000002, "text": " training drops much, much less quickly. Now, this is another testament to the fact that what you do,"}, {"start": 1901.04, "end": 1906.96, "text": " I think what's happening is you have your data space, right, and you have your data points in it."}, {"start": 1906.96, "end": 1914.16, "text": " Now, when you do the like normal data augmentation, what you'll do is you not only force the model to"}, {"start": 1914.16, "end": 1919.8400000000001, "text": " predict those points correctly, but you'll sort of make a bit of a cloud around them, and you force"}, {"start": 1919.8400000000001, "end": 1929.8400000000001, "text": " the model to predict that cloud correctly. Now, if you introduce more data, and you do even more"}, {"start": 1929.84, "end": 1936.8799999999999, "text": " noise, what you do is you'll make these clouds kind of larger. And that means the model is more"}, {"start": 1936.8799999999999, "end": 1942.48, "text": " robust to any sort of perturbations in these clouds, right. And, and that means it's probably"}, {"start": 1942.48, "end": 1948.0, "text": " also going to be more robust to adversarial perturbations. So that's sort of how you can"}, {"start": 1948.0, "end": 1953.9199999999998, "text": " think of this, this introduction of noise, to make it more generalizable. How does this generalize"}, {"start": 1953.92, "end": 1960.3200000000002, "text": " better? So if you think of this data point right here, if I'm looking to generalize, that means,"}, {"start": 1960.3200000000002, "end": 1966.88, "text": " you know, I have this iid data set, so probably my test data is going to be related to the training"}, {"start": 1966.88, "end": 1974.0, "text": " data. So I might get a data point that's fairly close to that data point. And generalizing means"}, {"start": 1974.0, "end": 1979.92, "text": " I classify it correctly. Now, if this cloud is very small, like it is here, my decision boundary"}, {"start": 1979.92, "end": 1987.3600000000001, "text": " could be like here, right. And even though the test data set is fairly close to the original"}, {"start": 1987.3600000000001, "end": 1995.2, "text": " training data point, it won't be classified incorrectly. However, if my original cloud during"}, {"start": 1995.2, "end": 2000.64, "text": " training is larger, you can see if I train a model, it can maybe put the decision boundary here,"}, {"start": 2000.64, "end": 2007.76, "text": " and then my test data point will be included in on that same side. So that's kind of the idea"}, {"start": 2007.76, "end": 2013.28, "text": " behind generalizing better. Of course, that's a vast simplification. And also to say that this"}, {"start": 2013.28, "end": 2020.48, "text": " here is an FGSM attack. So this is kind of the weakest attack in the adversarial perturbation"}, {"start": 2020.48, "end": 2028.64, "text": " spectrum. They do say under a stronger attack, PGD, which is a fairly strong attack with 10"}, {"start": 2028.64, "end": 2034.64, "text": " iterations at epsilon equals 16, noisy student training improves efficient net L2 accuracy from"}, {"start": 2034.64, "end": 2046.88, "text": " 1.1% to 4.4%. And this, I'm like, you know, 1.1% really means the model is almost like dead. This"}, {"start": 2046.88, "end": 2054.48, "text": " is lower. This is like random performance. And 4.4% is still a bit above random performance. But"}, {"start": 2056.88, "end": 2062.96, "text": " yeah, you could probably you could probably get there by simply using any sort of noise in that"}, {"start": 2062.96, "end": 2070.56, "text": " in that case. But still, you can see that it is more robust to especially to natural distortions,"}, {"start": 2070.56, "end": 2078.96, "text": " and therefore it generalizes better. As I said, they do quite a bit of drop, sorry, not dropout"}, {"start": 2078.96, "end": 2086.2400000000002, "text": " ablation studies to figure out where exactly the performance comes from. And the answer is,"}, {"start": 2086.24, "end": 2094.08, "text": " it pretty much comes from all the things that they've described. So here you can see the effect"}, {"start": 2094.08, "end": 2099.4399999999996, "text": " of that extra data set. And you can see pretty much with that extra data set, all the all the"}, {"start": 2099.4399999999996, "end": 2105.7599999999998, "text": " situations improve. Here you can see what do you what is happening when you do not augment the"}, {"start": 2105.7599999999998, "end": 2112.4799999999996, "text": " student. When you do not data augment, you can immediately see that the accuracy drops. And then"}, {"start": 2112.48, "end": 2118.72, "text": " when you do not augment and also don't use these model noises, then the performance drops again."}, {"start": 2119.6, "end": 2124.96, "text": " And lastly, when you use the teacher, but you noise the teacher, you can see also here the"}, {"start": 2124.96, "end": 2131.76, "text": " performance is dropping from the original quite a bit. So all of these things kind of contribute,"}, {"start": 2131.76, "end": 2139.12, "text": " and they do much more ablations. And they have listed their findings here. So using a large"}, {"start": 2139.12, "end": 2144.56, "text": " teacher model with better performance leads to better result. So you know, as the original"}, {"start": 2144.56, "end": 2152.48, "text": " teacher, you should use as good as possible a teacher model you can find. Second, a large"}, {"start": 2152.48, "end": 2160.16, "text": " amount of unlabeled data is necessary for better performance. Okay, so if you want to do this,"}, {"start": 2160.7999999999997, "end": 2167.44, "text": " you better get a large, large amount of extra data, because that's one thing that makes the"}, {"start": 2167.44, "end": 2173.2000000000003, "text": " student perform better. Soft pseudo labels work better than hard pseudo labels for out of the"}, {"start": 2173.2000000000003, "end": 2181.2000000000003, "text": " main data in certain cases. Fourth, a large student model is important to enable the student to learn"}, {"start": 2181.2000000000003, "end": 2189.12, "text": " a more powerful model. Okay, so because usually this knowledge distillation is what it this is"}, {"start": 2189.12, "end": 2194.32, "text": " usually called knowledge distillation. If you use a teacher model to train a student model,"}, {"start": 2194.32, "end": 2198.96, "text": " and it is often used when the student model is smaller than the teacher because you want to kind"}, {"start": 2198.96, "end": 2203.6800000000003, "text": " of become more efficient to you from so the teacher is large, you make the student small."}, {"start": 2205.44, "end": 2210.1600000000003, "text": " And you usually sacrifice some accuracy. And here they say if you want to gain some accuracy,"}, {"start": 2210.1600000000003, "end": 2213.6000000000004, "text": " you need a large student model, it can't be like a small one."}, {"start": 2216.6400000000003, "end": 2223.52, "text": " Number five, data balancing is useful for small models. Number six, joint training on labeled"}, {"start": 2223.52, "end": 2229.28, "text": " data and unlabeled data outperforms the pipeline at first pre trains with unlabeled data, and then"}, {"start": 2229.28, "end": 2235.6, "text": " fine tunes on labeled data. So this is in contrast to like what people have done before in the"}, {"start": 2235.6, "end": 2241.2, "text": " self supervised learning and so on, where it's always kind of pre training then fine tuning or"}, {"start": 2241.2, "end": 2247.84, "text": " in the in the transfer learning setting. Seven, using a large ratio between unlabeled batch size"}, {"start": 2247.84, "end": 2254.4, "text": " and label batch size enables models to train longer unlabeled data to it to achieve a higher"}, {"start": 2254.4, "end": 2261.04, "text": " accuracy. Okay, we've already seen that they have used that. And number eight, training the student"}, {"start": 2261.04, "end": 2266.6400000000003, "text": " from scratch is sometimes better than initializing the student with the teacher. And the student"}, {"start": 2266.6400000000003, "end": 2271.76, "text": " initialized with the teacher still requires a large number of training epochs to perform well."}, {"start": 2271.76, "end": 2278.88, "text": " This is fairly interesting because it kind of alludes to the fact that the minima in weight"}, {"start": 2278.88, "end": 2284.6400000000003, "text": " space if so if this is of course the case if the student model is the same as the teacher model,"}, {"start": 2284.6400000000003, "end": 2292.88, "text": " so in like iteration two or three or whatnot. It means that, you know, in weight space, if we look"}, {"start": 2292.88, "end": 2300.32, "text": " at, you know, you might want to start the student here and the minimum is right here. And you might"}, {"start": 2300.32, "end": 2306.56, "text": " want to think that if I learn the same thing, then the minima are fairly close together, right? So"}, {"start": 2306.56, "end": 2311.92, "text": " the teacher's minima might be here, and the student minima might be fairly close. So it might"}, {"start": 2311.92, "end": 2318.7200000000003, "text": " be beneficial if I if I start not over here, but actually start at the teacher's minimum. But this"}, {"start": 2318.7200000000003, "end": 2323.92, "text": " doesn't always seem to be the case. And that is a fairly interesting observation because it kind of"}, {"start": 2323.92, "end": 2328.88, "text": " means that we're talking about different minima here, we're talking about the student model"}, {"start": 2328.88, "end": 2333.76, "text": " learning different things. And that's what we've discussed already, the student model"}, {"start": 2333.76, "end": 2341.12, "text": " kind of learns to be robust. And that's probably a minimum that's fairly far away in weight space,"}, {"start": 2341.12, "end": 2347.04, "text": " at least in in a sort of energy landscape, weight space might be the case that it needs to actually"}, {"start": 2347.04, "end": 2353.76, "text": " overcome kind of a hill here, even though the minimum might be close. There's lots of research"}, {"start": 2353.76, "end": 2360.1600000000003, "text": " in like how minima are distributed in these weight spaces, which I don't want to go into right here."}, {"start": 2360.1600000000003, "end": 2366.32, "text": " But it is a fairly interesting observation that it's not always helpful to initialize the teacher"}, {"start": 2366.32, "end": 2376.0, "text": " sorry, the student at the teacher's optimum. Okay, so this was the paper. And, you know, this is this"}, {"start": 2376.0, "end": 2382.2400000000002, "text": " is the type of research where I do appreciate kind of the these large labs taking it on because they"}, {"start": 2382.24, "end": 2387.4399999999996, "text": " have the resources to do all of these ablations all of these different models, cross them with"}, {"start": 2387.4399999999996, "end": 2394.8799999999997, "text": " these giant data sets and so on, which I guess university labs just would not have. And this is a"}, {"start": 2394.8799999999997, "end": 2401.3599999999997, "text": " fairly thorough paper really investigating which parts of the pipeline, you know, do something and"}, {"start": 2401.3599999999997, "end": 2409.2, "text": " which ones don't. And usually I I'm fairly critical of pipelines that have like 50 billion tricks,"}, {"start": 2409.2, "end": 2414.0, "text": " because you never know where the improvement exactly is coming from. But you can sort of"}, {"start": 2414.0, "end": 2420.24, "text": " mitigate that criticism by doing all of these kind of ablations on the different parts and really"}, {"start": 2420.24, "end": 2424.72, "text": " showing look, this is important, but this is also important, but this is also important, but this is"}, {"start": 2424.72, "end": 2431.3599999999997, "text": " also important. So yeah, that was my two cents to this paper. I hope you enjoyed this and I'll see"}, {"start": 2431.36, "end": 2439.76, "text": " you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=rFwQDDbYTm4
[Classic] Playing Atari with Deep Reinforcement Learning (Paper Explained)
#ai #dqn #deepmind After the initial success of deep neural networks, especially convolutional neural networks on supervised image processing tasks, this paper was the first to demonstrate their applicability to reinforcement learning. Deep Q Networks learn from pixel input to play seven different Atari games and outperform baselines that require hand-crafted features. This paper kicked off the entire field of deep reinforcement learning and positioned DeepMind as one of the leading AI companies in the world. OUTLINE: 0:00 - Intro & Overview 2:50 - Arcade Learning Environment 4:25 - Deep Reinforcement Learning 9:20 - Deep Q-Learning 26:30 - Experience Replay 32:25 - Network Architecture 33:50 - Experiments 37:45 - Conclusion Paper: https://arxiv.org/abs/1312.5602 Abstract: We present the first deep learning model to successfully learn control policies directly from high-dimensional sensory input using reinforcement learning. The model is a convolutional neural network, trained with a variant of Q-learning, whose input is raw pixels and whose output is a value function estimating future rewards. We apply our method to seven Atari 2600 games from the Arcade Learning Environment, with no adjustment of the architecture or learning algorithm. We find that it outperforms all previous approaches on six of the games and surpasses a human expert on three of them. Authors: Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, Martin Riedmiller Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar (preferred to Patreon): https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, today we'll look at playing Atari with deep reinforcement learning by Vladimir Mni et al of DeepMind. So this is another one of our series of impactful past papers. This paper right here kicked off an entire revolution in reinforcement learning specifically, it sort of started the deep reinforcement learning hype. Before that I reinforcement learning was kind of this weird field of Markov decision processes and so on. Now I know there were successes and all and stuff was happening. But this really made a lot of waves because it brought the power of deep neural networks to reinforcement learning and with a pretty simple application of convolutional networks managed to solve these reinforcement learning games where previous algorithms really couldn't either or were heavily reliant on hand engineered features. So we'll take a look here and what people did back then, what was the state of the art and what they are telling us about that, kind of set it in relation to today. Alright, if you do like papers like this, commentary like this, share it out, leave a like and tell me in the comments what you think. So let's dive in. They say we present the first deep learning model to successfully learn control policies directly from high dimensional sensory input using reinforcement learning. The model is a convolutional neural network trained with a variant of Q learning, whose input is raw pixels and whose output is a value value function estimating future rewards. We apply our method to seven Atari 2600 games from the arcade learning environment with no adjustment of the architecture or learning algorithm. We find that it outperforms all approaches on six of the games and surpasses a human expert on three of them. So there's a lot packed into this. First of all, I wanted to recognize the absolute LaTeX savagery right here. Yeah, you know, just just something. I'm not I'm not OCD about that kind of stuff. I think we should ditch LaTeX honestly. But so there's a lot of information packed in this abstract right here. So they say this is the first deep learning model to learn control policies. So that's the task of these reinforcement learning algorithms directly from high dimensional sensory input using using reinforcement learning. So what do they mean this are called learning environment. If you don't know what it is, it's basically these old games right here, you can kind of emulate them and run them. And the inputs are always sort of the same. So you have one joystick, I believe. So you have kind of this joystick and it can go into various directions like left, right, up, down, and then also the intermediate directions. And then you have a I think also a button that you can push. And that gives you a total of some somewhere around 16 or 20 actions in each of the games. So the good thing about this environment is that the actions are always the same. But of course, they mean different things in different games. So the games here, you know, for example, pong or this breakout, the these games are kind of really low pixel games, as you can see, and they come in form of an image, right. So this is an image, this is like 180 pixels, and this is like 150 pixels. And the task here is to learn a policy, which means which buttons and directions you need to push, depending on the observation right here, these pixels and achieve the maximum amount of reward. So reward is given in each game differently as well. For example, in this pong game, the reward is every time you score kind of a goal against your opponent. In breakout, you get a reward every time you manage to hit or kill a one of these blocks and so on. So reward is different, but your objective is always to maximize the reward in in a formal framework, you have an agent and an environment. And the environment would always give you an observation, which in this case, the observation is one of these images. And the agent will give back an action. So the action in this case, would be the which button to press or which direction to move the joystick into. And then the environment would get back give back a reward. So the reward is could be, you know, it could be this, you scored a goal. So that's zero most of the time, and sometimes it's one or, or nine, or it could be like how long you're alive and so on. This is very, very, very variable. So the difficulty of reinforcement learning very often is that these episodes can go for a while. So this whole process here will repeat over time. And the this can go on this can go on for hundreds of steps or 1000s of steps until you're done, you know, playing a game like this, like this right here. And the reward can be very sparse. So you might only get a reward at the very end of the game. Sometimes, most often in these games, you get one in between, but still there can be multiple time steps where you don't have a reward. And your task is to figure out the actions were the good ones. This is known as the credit assignment problem. And to do the credit assignment problem just from pixels alone, that was unheard of at the time this paper came out. That's why they say we are the first deep learning model to successfully learn the directly from high dimensional sensory input. Okay, so the power of deep learning, they argue is that a deep neural network, a convolutional neural network can extract these high level features by itself. However, at this time, people only knew that it could do so for supervised learning, basically, for every input of an image, you had a label. And that's how you train these convolutional neural network. Here, it's very different here, you will get maybe 1000 of those images. And you'll simply say, well, you got a score of 1100. And somehow, you need to figure out which ones of these were the ones that gave you the good score, and how to generalize that. So there are various difficulties here to apply convolutional neural networks to this problem. And they have detail right here, how they did it. So they say the model is a convolutional neural network, which, you know, have been demonstrated. So this is after things like Alex net, though before res net, trained with a variant of Q learning, whose input is raw pixels, and whose output is a value function estimating the future. So we'll get into Q learning, Q learning is a reinforcement learning algorithm that has been around, you know, for a long time, but just not combined with deep neural networks. And yeah, then they say, the last cool thing here is that they apply them to seven games with no adjustment of the architecture or learning algorithm. So that they apply the same algorithm, the same hyper parameters to all of the seven games. And the model learns all of the seven games not as a single model, but as seven different models. However, they all have the same hyper parameters, so they don't need to tune them, which is an additional benefit like this would have been a cool paper, even if they had to sort of tune the algorithm to each of the seven games. But, you know, they didn't, which makes it even more impressive. It's kind of their point here that these that this reinforcement deep reinforcement learning can be some sort of a general learning mechanism. Of course, you know, later, there has been like giant amount of development since this. And people have come up with all kinds of giant architectures and whatever corrections of policy corrections seem to real continuous control. This is, this is most of it is a derivation of this work right here. And this work, it reads surprisingly simple, I have to say, and it's almost like they had little idea what problems were to be tackled later in RL, because it kind of reads like, you know, we have this thing and you can learn general things. So yeah, that was, we're still not done with reinforcement learning, I guess we we've just started. Okay, so in a bit of more formal setting, what you will have in reinforcement learning are these rewards, right? So at each time step, you perform an action, you're in a state. So the, we said you get back an observation, and we call the observation the state. Now these two things aren't a sorry, these two things aren't entirely the same thing. So the observation is what you get back directly from the environment. And then the state it can be something more like if you remember something from the last observation, that can be part of your state, the state is basically what you base your decision on. And the observation is the pure thing you get from the environment. Now, in this case, they do some processing, but essentially, will will regard them as the same thing. So the state is what you see of the environment. Then in each of these steps, you perform an action, we'll call that this a thing right here. And in each step, you also get a reward for the last action that you took. And the reward is going to be lowercase r. Now, what you want to do formally is you want to maximize the the reward that you get in time t. Sorry, you want to, that's the reward you get at time t prime, you what you want to do. If you play an episode, you're here and you perform an action, you go here, you perform an action, you go here, you perform an action, you go here, and then your episode is done. For each action, you'll get a reward reward one reward two reward three, what you want to do is you want to maximize the total the sum of all of these rewards. So over the course of your episode, you want to collect as much reward as you can. There is a discount factor right here, which is sort of saying that rewards that are very far in the future, they're not as important as rewards right now, however, you can set this to one if you want. So you see you want to maximize the future the sum of future rewards, which is this thing right here. Okay. So how do you how do you do this, there are two main methods in reinforcement learning. The first one is called a policy gradient method. And very briefly, a policy we'll call it pi takes in a state s. And it gives you back an action. Okay. And I mean, this is the same for for Q learning. But in a policy gradient method, which is not this paper, but it's like a little bit easier to understand, I believe, will simply say, well, we'll simply train a neural network to do that. Right. And there is this, there's this policy gradient trick where you can back propagate, even though the reward isn't back propagatable, and so on. You simply say we'll learn a neural network to give us the action that's best, right. So we'll have a neural network, the state goes in neural network, and then we'll just have as many outputs as there are actions like action one, action two, action three, action four, and we'll treat it as a classification problem, right. So you simply train the network to pick the action that is best in this case, and you are irregardless of how you know which action is best right now. In Q learning, you do something else. Namely, you train this thing called the Q function. The Q function is a function that takes in a state and an action, and it gives you what the reward is going to be in the future if you are in this state and perform this action. Okay, so you are in a given state, right, and you have three actions at your proposal. Okay, you have action one, action two, and action three, and you are in state s. You what you would do is you would call the Q function if you had a perfect Q function, it could give you the reward, you would call the Q function three times, you would call the Q function first with a one, you say what's Q of s and a one, and the Q function would maybe say that seven. And here you say what's the Q function of s and a two, and it will maybe say that's four. And here, same thing for a three, and it may be say that's one, then you would know aha, if I take action one, my reward from not only the reward for this step, but my reward from here on until the end of the episode is going to be seven. That is if you had a perfect Q function. Now the Q function is always of course conditioned on a policy right here. So there is what it basically says if I take action a one right now, and after that I follow policy pi, then I'm going to get the reward of seven. It's a bit of a multi layered reasoning approach. But ultimately, you don't have to you don't have to worry much about this being this being conditioned on a policy. Ultimately, the Q function says if you take this action right now, what will the reward be for the entire rest of the episode? Okay, so if you had a perfect Q function, you could simply ask it about all the actions as we did here, and then pick the action with the highest number, okay. And then you're guaranteed because, you know, there could be a situation where, you know, your your reward in a single step is going to be very high here, like 100 and here 00. Okay, and you would be tempted to take that action right here. But, but after that, it's just going to be 000. So your total reward is going to be 100. But here, even though it's zero now, it could be that after that, it's 50, and then 40, and then 2000, and so on. So your total reward is going to be much, much more. If you were simply to train a function that tell you what's the reward in the next step, then you would lose because that function would not be able to look ahead sufficiently. What we're trying to do with the Q function is we're trying to predict to train a function that will tell us not only what's the reward in the next step, but what is the reward in all the steps to come from here, right? Of course, conditioned on all the decision we make in the future. But that's this policy pi right here. I hope you found this interesting. I hope it's somewhat clear what a Q function is. Interestingly, we can take the same network architecture for this. So what you would do naively is you would build a neural network where you say, okay, a Q function takes a state and an action. So I'll put those into a neural network. And then out comes this estimation of the reward, which we usually call Q. So that the value is this estimation of the future reward if you take this action in this state. Now, the disadvantage here is that we have to call this neural network once for each action in every state that we're in. So that's like, if there's 10 actions, that's like 10 forward passes. What we could do is we could simply take the same neural network we had for our initial or very initial policy method. And we use that and we simply input state and we'll train it to output the Q for action one and the Q sorry, for the state s and action one, the Q for the state s and action two, and so on. So there is going to be this kind of shared encoder. And then that is basically going to encode the state into a latent space and then classify for each of the actions how valuable this particular action would be in that state. So this here is called a deep Q network. Okay, it's a network that takes in a state and gives you back the Q value. Now the problem right here is we, you know, here we said if we had a perfect Q function, a Q function that was always right, then the problem would be solved because we could just ask the Q function what to do. Of course, we don't have a perfect Q function, we need to train it. So how do we train a Q function? And the answer is surprisingly simple. So what you want to do is you want you are in this, you're in this state. And you want to estimate right what your Q value is, you want to train your Q network, what you can do is you can simply play an episode according to the Q function you have. And you'll maybe play this episode right here, right? Like you go here and you collect all of this reward. So this entire thing now goes into your data set. And then you have a sample, you know, I was here in this state as I took action one, and I got in total 2090 as a reward. So that is going to be your labeled sample, right? Your labeled sample is going to be s, I was in s, I did a one. And now I have I then got 2090 reward. Cool. And in the next episode, so you're going on playing, and you maybe go down here, and then you get the next training example, I was in state s, I so you keep restarting the episodes, so you can get into the same state multiple times, I performed a three, and I got only 100 reward. So that's another training sample. So these training samples right here, you can use to train your Q function. This is called online reinforcement learning, you play the game at the same time as you train your neural network, and you use that improved neural network to play more games. And with time, there is this well known, there is a there are theorems around Q learning that say, if you do that iteratively, then your Q function will converge to the optimal Q functions under some assumptions, which of course not given if this is a deep neural network, but you know, who cares? Yeah, so formally, your Q function, as you can see right here, is going to be there is this Bellman recurrence kind of recurrence property of the Q function. So if I am, if I am in a state s, and I'm wondering, what is my Q of my state s and my an action a. And I said with respect to a policy, which the star policy is going to be the policy where we always select the highest Q function. So we'll basically say, we're in state s, we select action a. And after that, we'll just always select whatever the highest scoring action is, right, like right now, action a might not be the highest scoring, but we'll take a right now. And after that the highest scoring, that's Q star, it's a Q function conditioned on the policy where after we perform the first action, which is a, will take always the best one according to the Q function, right, that's right here. So we're in state s, we perform a, and s prime is going to be the state that we are going to. So we're in s, we perform a, we get to s prime. So in s prime, which is a function of your environment, we're always going to take the maximum action, and R is going to be the reward of the next step. So you can see this recurrence equation right here, that Q star can be framed in terms of Q star. So the Q star of this state is going to depend on the Q star of the next state. And you can use that fact, and you can, you know, prove that pretty, we've already done it basically, you can use that fact to now train your neural network. So your neural network loss function is going to be the following, it's going to say, look, this here is the Q function for state s and action a, that's my, and this is my neural network telling me how much that's worth. And this is the label, right? So here you have to think in terms of back classic supervised learning, this here is going to be your f of x. And this here is going to be your y. And we will take the squared loss between the two, except your input x is going to be which state am I in, and which action am I taking. And your label is going to be bootstrapped by your own Q function. So your label is going to be the reward you got. Remember, this comes from a replay buffer, we already played that game. And we already know what happened after we perform this action, right? And what happened is we got this reward, and we got into this state. So we can simply ask our own Q function again, what's the best action to take in this state? And what reward would we get? And then we have our label, right? So our label y is going to be Yeah, I was I was I was pretty confused when I learned this the first time. So I'm going to assume some of you are confused as well. So your Q function is supposed to tell you what's going to be the reward from here until the end of the episode. Okay, that you can decompose in the reward that you get from this very next action, plus the sum from then to t plus one until the end of the episode, okay, so t prime, so that's t prime equals t plus one. Alright, so it's pretty simple, the total reward from now until the end, you can decompose in the reward now, plus the reward after that until the end. Now, this here, we know we've played the episode, we know what happened. This here, we can simply ask our Q function again, because we also know what state we got into. And this, as you can see, is very much this, but just one step later. So we can simply ask our own Q function, which might be imperfect, right? But it's certainly a good guess. We say, okay, this reward from now should be equal to the reward we got plus whatever we reward we get later. And yes, you might be astounded by the fact that we are using our own neural network, though be it with the parameters one time step ago, in order to produce our label. But that is exactly what these Q learning theorems are about. They basically say under some assumptions, if you do this, and you iterate, then this will converge to the optimal Q function. So as you can see right here, this is the this is the gradient of the loss. It's astounding that back then they still wrote down the gradient of the loss, like almost no one does this. Now you just say, put this into TensorFlow and go. Yeah, so they make some remarks here, namely that this algorithm is model free, right? There's no model of the environment, you simply learn a function that for each state tells you the Q value for each action. That's, that's all everything, everything that the all the logic needs to be within the neural network itself. So that's pretty cool. And they say it's also off policy. It learns about the greedy strategy while following a behavior distribution that ensures adequate exploration of the state space. So while while training, they do this epsilon greedy strategy that follows the greedy strategy, which is where you always take the maximum with one minus epsilon selects a random action with probability epsilon. So while you do your experience, you follow your Q function, you always ask the Q function, what's the best thing to do right here? But you know, that's that gets you into too much of exploitation. So in epsilon amount of time, you want to do a bit of exploration and just take a random action. Alright, so that's basically the algorithm. So the algorithm is right here, and they have some tricks to get it to work. And the biggest trick they got it to work is the so called replay buffer, this experience replay, because what happens if you play a game of Atari, right, of pong specifically, then, you know, you have this, and you're here and your opponent is here, and the ball is here. And then the next frame, you are here, again, your opponent might be a bit up, and the ball is here. Okay, and so on. So these samples here, they are all very, very correlated, right, the ones after another, especially if you now build mini batch, let's say, or mini batch sizes to this mini batch has almost no variability in it. So if we felt something like batch norm or whatnot, this, this will be like terrible, because these data samples are correlated. And we, in supervised learning, we make a pretty big deal out of, you know, shuffling our data set and all of the data points being IID and so on. So what they say is, rather than using the data samples, as we collect them, we put them into a big, big buffer, a big replay buffer. And from that replay buffer, we basically sample at random. Okay, so that means that, you know, some samples can be used multiple times. Other samples can be never sampled, because there is a fixed size and the new ones will always kick out the oldest ones. So some samples might not be used, some samples might be used twice or three times, we can also learn, you know, four times as fast as we sample. And then every sample on average will be used four times. So this, this experience replay proved very, very important for this algorithm to work. That's why they say deep Q learning with experience replay. So they have this replay memory D right here to capacity N. And you initialize your Q function with random weights, as you do with a neural network. And then you play these episodes for each episode, you start out with s1, the state one, and you do pre processing. So in pre process, they have some more tricks where they downscale the image, they concatenate four images in a row. Because sometimes in Atari get these flicker things. And also, if you concatenate four things in a row, you for example, can tell it in which direction the ball is moving and so on. So give a little bit of history. So one sample technically would be four frames, they also do sticky actions, and so on all of these things that you can find today in these emulators that are almost default now like sticky actions, they invented right here. So for the time steps within the episode, we want to, we've probability epsilon select a random action, otherwise, just ask your Q function, what should I do right here, give me the best action in this particular state, then you would execute that action and observe a reward and the next state. So the next image right here, you would set the next state to this transition. Okay, so in the state, there can be more, as I said, there can be more than the image, like the previous state, and the action you took. But right here, I believe it's like purely the current last four frames. And then you store that transition in the replay buffer. After that, you sample a random mini batch of transitions from the replay buffer. So here, you can see this here is where we de correlate the inputs, because if we simply were to use our last transition for learning, then we would run into a problem. But right here, we sample from that replay buffer. So this is going to be your input, this is going to be your x for your supervised learning of the deep neural network, what's going to be your sorry, without the reward, of course, what's going to be your y, your y, if you're at the end of the episode, it's simply the reward that you got, because there's no more reward coming. However, if you're not at the end, it's the reward that you got from this last step, plus all of the reward that you're going to get in the future. Now, you aren't in the future yet. But you can ask yourself, you can ask your Q function, what that reward is most likely going to be. If your Q function gets better, and this estimate gets better, and your labels get better, then your Q function gets better, and so on in a big circle. And then you perform a gradient descent step on this l2 loss between the label and your prediction. Note that there, if you are in a deep learning framework, there is like a stop gradient on this label right here. So the back propagation only happens with respect to this right here, which makes sense, right? So this is your x, this is your input, and f of x is usually what we back propagate into. Okay, there's no notion yet of like a second Q network and so on, which proved very valuable in the future of this paper. This paper simply applied kind of the most basic version of this, and they simply got it to work. They just got deep neural networks to work with reinforcement learning. And yeah, there's a big, a big chance that this was due to this experience replay, which I believe they did not invent. I mean, the, the, this has, of course, around the been around before, but they were the ones to realize and combine and do that. It's also pretty interesting, the neural network that they actually used was like super duper small. The input to the neural network consists of 84 by 84 by four image produced by this. So this is the pre processing at the first hidden layer, convolves 16 eight by eight filters with stride four with the input image and applies the rectifier non linearity. So the relu, the second hidden layer convolves 30 to four by four filters with stride two again followed by rectifier non linearity. The final layer hidden layer is fully connected and consists of 256 rectifier units. The output layer is a fully connected linear layer with single output for each valid action. Number of valid actions is very between four and 18 on the games we considered. Okay, you can see that neural network is pretty small. It's two conv layers. And as was in fashion back then you had like big filters. So you know, big filters from like Alex net. Yeah, big filters, but fewer than today. So today, the trend is more like deeper layers, more filters, but they are not as big. They're like three by three filters today only. Yeah, pretty interesting how they did it back then. Interesting also no max pooling and so on. So pretty cool. And here they go into experiments. So they show that their average reward in these games is kind of noisy, but it improves over time, especially also if you look at the average Q of the max action, it continuously goes up during training. So this is really a successful training, especially this investigative experiment they did right here where you can see one example of how the Q function what the Q function says, remember the Q function gives us the whatever the future reward is going to be, okay. And here we always look at the max action. So in this first frame, you can see this enemy had just appeared. And you can see that from here to here, there's a spike in the Q value because you can shoot enemies. And that gives you reward the a this is already so the enemy isn't shot yet by the simple appearance of the enemy, the Q function also like already jumps in value, because it anticipates a future reward, right, then the the agent shoots. And you can see here the shot is about to land at the enemy. And that's when we're here. So this now the Q function is very sure that in the future, there's going to be a high reward. But then once the once the enemy is shot, then there is no more enemy to be shot. And the Q function drops drastically, because it doesn't see a future reward as being as likely as at the beginning, when there was this new enemy to be shot. So that's, you know, pretty interesting. And you can see pretty directly that there is a correlation between what's happening in the game and this learned Q function. If you compare this to other methods, and they really say that these other methods, most of them have some kind of very special feature engineered like so their method just takes RGB, but the other methods recognize that oh, in these Atari games, most of the time, you know, there are unique colors for the things so you know, the enemies are all like green, like and they make unique channels for those green enemies, or they even have handcrafted object detectors and tell the algorithm where these objects are. So the comparison really isn't fair. Yet, the DQN outperform these others like almost everywhere. And they also evaluated against a against a human. And I don't actually know they just say an expert human. I have no idea, maybe just put David silver in front of computers like okay, David, here you go. And you can you can, like what happened in Pong? Like, come on, David. But you can see there, there were still problems where the humans were vastly superior, and they mainly attribute this to the difficulty of the problem. And it could also be because for example, in breakout them, there's this kind of the most famous example where the agent kind of figured out this strategy of shooting the ball, shooting like a hole in to this wall that you have to break, and then shooting the ball up here. So the ball bounces up and down and basically you win. From then on, you just watch the ball go. And the agent does nothing anymore. So this deep q networks figured out that strategy and you need to pull it off very precisely, which of course the the computer can do very well. So it sometimes achieves these super high scores by pulling something off precisely. But in games where they say where you have to plan ahead for longer, it kind of fails. And we know that this long planning was about to be a problem for years to come. And it's still not solved. So still, Go Explore is highly controversial that can solve these kind of long exploration games. And those are still games, right? So we are basically not, we are very much further than they were in this paper. But also, we are basically no nowhere yet. Yeah, if I'm if I'm allowed to say that. So I enjoyed reading this paper, I this is it's very, it's very well written. If you somehow know how to think about reinforcement learning like this, this q function, what the q function means and why you would learn it in this way. I find this is not super well described, this kind of requires a bit of a knowledge of not of RL, but just have how to think of RL. But apart from this, everything else is written incredibly well, easy, straightforward. And this was just a nice work of its time. And I appreciate it for that. Alright, I'll see you next time. And I appreciate your time too. Bye.
[{"start": 0.56, "end": 6.640000000000001, "text": " Hi there, today we'll look at playing Atari with deep reinforcement learning by Vladimir Mni et al"}, {"start": 6.640000000000001, "end": 14.96, "text": " of DeepMind. So this is another one of our series of impactful past papers. This paper right here"}, {"start": 14.96, "end": 21.68, "text": " kicked off an entire revolution in reinforcement learning specifically, it sort of started the deep"}, {"start": 21.68, "end": 27.76, "text": " reinforcement learning hype. Before that I reinforcement learning was kind of this weird"}, {"start": 27.76, "end": 33.120000000000005, "text": " field of Markov decision processes and so on. Now I know there were successes and all and"}, {"start": 34.160000000000004, "end": 41.6, "text": " stuff was happening. But this really made a lot of waves because it brought the power of deep"}, {"start": 41.6, "end": 48.96, "text": " neural networks to reinforcement learning and with a pretty simple application of convolutional"}, {"start": 48.96, "end": 56.24, "text": " networks managed to solve these reinforcement learning games where previous algorithms really"}, {"start": 56.24, "end": 64.32000000000001, "text": " couldn't either or were heavily reliant on hand engineered features. So we'll take a look here and"}, {"start": 65.12, "end": 71.6, "text": " what people did back then, what was the state of the art and what they are telling us about that,"}, {"start": 71.6, "end": 78.72, "text": " kind of set it in relation to today. Alright, if you do like papers like this, commentary like this,"}, {"start": 79.28, "end": 85.52000000000001, "text": " share it out, leave a like and tell me in the comments what you think. So let's dive in. They"}, {"start": 85.52, "end": 92.32, "text": " say we present the first deep learning model to successfully learn control policies directly"}, {"start": 92.32, "end": 98.16, "text": " from high dimensional sensory input using reinforcement learning. The model is a"}, {"start": 98.16, "end": 104.0, "text": " convolutional neural network trained with a variant of Q learning, whose input is raw pixels"}, {"start": 104.0, "end": 109.84, "text": " and whose output is a value value function estimating future rewards. We apply our method"}, {"start": 109.84, "end": 116.8, "text": " to seven Atari 2600 games from the arcade learning environment with no adjustment of the architecture"}, {"start": 116.8, "end": 123.44, "text": " or learning algorithm. We find that it outperforms all approaches on six of the games and surpasses"}, {"start": 123.44, "end": 129.44, "text": " a human expert on three of them. So there's a lot packed into this. First of all, I wanted to"}, {"start": 129.44, "end": 141.12, "text": " recognize the absolute LaTeX savagery right here. Yeah, you know, just just something. I'm not I'm"}, {"start": 141.12, "end": 147.44, "text": " not OCD about that kind of stuff. I think we should ditch LaTeX honestly. But so there's a"}, {"start": 147.44, "end": 154.48, "text": " lot of information packed in this abstract right here. So they say this is the first deep learning"}, {"start": 154.48, "end": 160.88, "text": " model to learn control policies. So that's the task of these reinforcement learning algorithms"}, {"start": 160.88, "end": 168.56, "text": " directly from high dimensional sensory input using using reinforcement learning. So what do they mean"}, {"start": 168.56, "end": 173.04, "text": " this are called learning environment. If you don't know what it is, it's basically these old games"}, {"start": 173.04, "end": 179.92, "text": " right here, you can kind of emulate them and run them. And the inputs are always sort of the same."}, {"start": 179.92, "end": 185.04, "text": " So you have one joystick, I believe. So you have kind of this joystick and it can go into various"}, {"start": 185.04, "end": 190.64, "text": " directions like left, right, up, down, and then also the intermediate directions. And then you"}, {"start": 190.64, "end": 198.64, "text": " have a I think also a button that you can push. And that gives you a total of some somewhere around"}, {"start": 198.64, "end": 204.72, "text": " 16 or 20 actions in each of the games. So the good thing about this environment is that the actions"}, {"start": 204.72, "end": 209.35999999999999, "text": " are always the same. But of course, they mean different things in different games. So the"}, {"start": 209.36, "end": 218.56, "text": " games here, you know, for example, pong or this breakout, the these games are kind of really low"}, {"start": 218.56, "end": 224.0, "text": " pixel games, as you can see, and they come in form of an image, right. So this is an image, this is"}, {"start": 224.0, "end": 232.56, "text": " like 180 pixels, and this is like 150 pixels. And the task here is to learn a policy, which means"}, {"start": 232.56, "end": 239.44, "text": " which buttons and directions you need to push, depending on the observation right here, these"}, {"start": 239.44, "end": 245.52, "text": " pixels and achieve the maximum amount of reward. So reward is given in each game differently as"}, {"start": 245.52, "end": 253.2, "text": " well. For example, in this pong game, the reward is every time you score kind of a goal against"}, {"start": 253.2, "end": 260.0, "text": " your opponent. In breakout, you get a reward every time you manage to hit or kill a one of these"}, {"start": 260.0, "end": 266.48, "text": " blocks and so on. So reward is different, but your objective is always to maximize the reward"}, {"start": 266.48, "end": 274.4, "text": " in in a formal framework, you have an agent and an environment. And the environment would always"}, {"start": 274.4, "end": 282.72, "text": " give you an observation, which in this case, the observation is one of these images. And the agent"}, {"start": 282.72, "end": 291.44000000000005, "text": " will give back an action. So the action in this case, would be the which button to press or which"}, {"start": 291.44000000000005, "end": 298.88000000000005, "text": " direction to move the joystick into. And then the environment would get back give back a reward. So"}, {"start": 298.88000000000005, "end": 306.48, "text": " the reward is could be, you know, it could be this, you scored a goal. So that's zero most of the"}, {"start": 306.48, "end": 312.88, "text": " time, and sometimes it's one or, or nine, or it could be like how long you're alive and so on. This"}, {"start": 312.88, "end": 322.08000000000004, "text": " is very, very, very variable. So the difficulty of reinforcement learning very often is that these"}, {"start": 322.08000000000004, "end": 330.0, "text": " episodes can go for a while. So this whole process here will repeat over time. And the this can go on"}, {"start": 330.0, "end": 336.48, "text": " this can go on for hundreds of steps or 1000s of steps until you're done, you know, playing a game"}, {"start": 336.48, "end": 344.56, "text": " like this, like this right here. And the reward can be very sparse. So you might only get a reward"}, {"start": 344.56, "end": 350.16, "text": " at the very end of the game. Sometimes, most often in these games, you get one in between, but still"}, {"start": 350.16, "end": 355.12, "text": " there can be multiple time steps where you don't have a reward. And your task is to figure out"}, {"start": 355.12, "end": 362.08, "text": " the actions were the good ones. This is known as the credit assignment problem. And to do the credit"}, {"start": 362.08, "end": 368.72, "text": " assignment problem just from pixels alone, that was unheard of at the time this paper came out."}, {"start": 368.72, "end": 375.84000000000003, "text": " That's why they say we are the first deep learning model to successfully learn the directly from"}, {"start": 375.84000000000003, "end": 382.4, "text": " high dimensional sensory input. Okay, so the power of deep learning, they argue is that a deep neural"}, {"start": 382.4, "end": 388.47999999999996, "text": " network, a convolutional neural network can extract these high level features by itself."}, {"start": 388.47999999999996, "end": 395.28, "text": " However, at this time, people only knew that it could do so for supervised learning, basically,"}, {"start": 395.28, "end": 401.52, "text": " for every input of an image, you had a label. And that's how you train these convolutional neural"}, {"start": 401.52, "end": 408.32, "text": " network. Here, it's very different here, you will get maybe 1000 of those images. And you'll simply"}, {"start": 408.32, "end": 416.08, "text": " say, well, you got a score of 1100. And somehow, you need to figure out which ones of these were"}, {"start": 416.08, "end": 422.64, "text": " the ones that gave you the good score, and how to generalize that. So there are various difficulties"}, {"start": 422.64, "end": 428.96, "text": " here to apply convolutional neural networks to this problem. And they have detail right here,"}, {"start": 428.96, "end": 435.28, "text": " how they did it. So they say the model is a convolutional neural network, which, you know,"}, {"start": 435.28, "end": 440.88, "text": " have been demonstrated. So this is after things like Alex net, though before res net,"}, {"start": 442.0, "end": 448.55999999999995, "text": " trained with a variant of Q learning, whose input is raw pixels, and whose output is a value function"}, {"start": 448.55999999999995, "end": 453.91999999999996, "text": " estimating the future. So we'll get into Q learning, Q learning is a reinforcement learning algorithm"}, {"start": 453.91999999999996, "end": 460.88, "text": " that has been around, you know, for a long time, but just not combined with deep neural networks."}, {"start": 460.88, "end": 468.48, "text": " And yeah, then they say, the last cool thing here is that they apply them to seven games with no"}, {"start": 468.48, "end": 475.04, "text": " adjustment of the architecture or learning algorithm. So that they apply the same algorithm,"}, {"start": 475.04, "end": 480.8, "text": " the same hyper parameters to all of the seven games. And the model learns all of the seven"}, {"start": 480.8, "end": 485.52, "text": " games not as a single model, but as seven different models. However, they all have the"}, {"start": 485.52, "end": 490.71999999999997, "text": " same hyper parameters, so they don't need to tune them, which is an additional benefit like this"}, {"start": 490.71999999999997, "end": 496.88, "text": " would have been a cool paper, even if they had to sort of tune the algorithm to each of the seven"}, {"start": 496.88, "end": 502.79999999999995, "text": " games. But, you know, they didn't, which makes it even more impressive. It's kind of their point"}, {"start": 502.79999999999995, "end": 509.12, "text": " here that these that this reinforcement deep reinforcement learning can be some sort of a"}, {"start": 509.12, "end": 515.92, "text": " general learning mechanism. Of course, you know, later, there has been like giant amount of"}, {"start": 515.92, "end": 521.92, "text": " development since this. And people have come up with all kinds of giant architectures and"}, {"start": 522.48, "end": 530.8, "text": " whatever corrections of policy corrections seem to real continuous control. This is, this is most"}, {"start": 530.8, "end": 539.1999999999999, "text": " of it is a derivation of this work right here. And this work, it reads surprisingly simple, I have to"}, {"start": 539.1999999999999, "end": 547.3599999999999, "text": " say, and it's almost like they had little idea what problems were to be tackled later in RL,"}, {"start": 547.3599999999999, "end": 552.3199999999999, "text": " because it kind of reads like, you know, we have this thing and you can learn general things. So"}, {"start": 552.3199999999999, "end": 557.5999999999999, "text": " yeah, that was, we're still not done with reinforcement learning, I guess we we've just"}, {"start": 557.6, "end": 565.76, "text": " started. Okay, so in a bit of more formal setting, what you will have in reinforcement learning are"}, {"start": 565.76, "end": 571.84, "text": " these rewards, right? So at each time step, you perform an action, you're in a state. So the,"}, {"start": 571.84, "end": 578.96, "text": " we said you get back an observation, and we call the observation the state. Now these two things"}, {"start": 578.96, "end": 584.4, "text": " aren't a sorry, these two things aren't entirely the same thing. So the observation is what you"}, {"start": 584.4, "end": 591.52, "text": " get back directly from the environment. And then the state it can be something more like if you"}, {"start": 591.52, "end": 596.64, "text": " remember something from the last observation, that can be part of your state, the state is"}, {"start": 596.64, "end": 601.1999999999999, "text": " basically what you base your decision on. And the observation is the pure thing you get from the"}, {"start": 601.1999999999999, "end": 608.88, "text": " environment. Now, in this case, they do some processing, but essentially, will will regard"}, {"start": 608.88, "end": 615.52, "text": " them as the same thing. So the state is what you see of the environment. Then in each of these"}, {"start": 615.52, "end": 621.68, "text": " steps, you perform an action, we'll call that this a thing right here. And in each step, you also get"}, {"start": 621.68, "end": 630.0, "text": " a reward for the last action that you took. And the reward is going to be lowercase r. Now, what"}, {"start": 630.0, "end": 639.76, "text": " you want to do formally is you want to maximize the the reward that you get in time t. Sorry,"}, {"start": 639.76, "end": 648.48, "text": " you want to, that's the reward you get at time t prime, you what you want to do. If you play an"}, {"start": 648.48, "end": 653.36, "text": " episode, you're here and you perform an action, you go here, you perform an action, you go here,"}, {"start": 653.36, "end": 658.4, "text": " you perform an action, you go here, and then your episode is done. For each action, you'll get a"}, {"start": 658.4, "end": 664.64, "text": " reward reward one reward two reward three, what you want to do is you want to maximize the total"}, {"start": 664.64, "end": 669.76, "text": " the sum of all of these rewards. So over the course of your episode, you want to collect as"}, {"start": 669.76, "end": 676.16, "text": " much reward as you can. There is a discount factor right here, which is sort of saying that"}, {"start": 676.72, "end": 681.6, "text": " rewards that are very far in the future, they're not as important as rewards right now, however,"}, {"start": 681.6, "end": 689.84, "text": " you can set this to one if you want. So you see you want to maximize the future the sum of future"}, {"start": 689.84, "end": 696.32, "text": " rewards, which is this thing right here. Okay. So how do you how do you do this, there are two"}, {"start": 696.32, "end": 704.88, "text": " main methods in reinforcement learning. The first one is called a policy gradient method. And very"}, {"start": 704.88, "end": 714.32, "text": " briefly, a policy we'll call it pi takes in a state s. And it gives you back an action. Okay."}, {"start": 715.92, "end": 721.12, "text": " And I mean, this is the same for for Q learning. But in a policy gradient method, which is not"}, {"start": 721.12, "end": 726.56, "text": " this paper, but it's like a little bit easier to understand, I believe, will simply say, well,"}, {"start": 726.56, "end": 733.36, "text": " we'll simply train a neural network to do that. Right. And there is this, there's this policy"}, {"start": 733.36, "end": 739.76, "text": " gradient trick where you can back propagate, even though the reward isn't back propagatable, and so"}, {"start": 739.76, "end": 744.96, "text": " on. You simply say we'll learn a neural network to give us the action that's best, right. So we'll"}, {"start": 744.96, "end": 750.96, "text": " have a neural network, the state goes in neural network, and then we'll just have as many outputs"}, {"start": 750.96, "end": 757.76, "text": " as there are actions like action one, action two, action three, action four, and we'll treat it as a"}, {"start": 757.76, "end": 764.56, "text": " classification problem, right. So you simply train the network to pick the action that is best in"}, {"start": 764.56, "end": 771.04, "text": " this case, and you are irregardless of how you know which action is best right now. In Q learning,"}, {"start": 771.6, "end": 779.12, "text": " you do something else. Namely, you train this thing called the Q function. The Q function is a"}, {"start": 779.12, "end": 788.4, "text": " function that takes in a state and an action, and it gives you what the reward is going to be"}, {"start": 789.12, "end": 795.6, "text": " in the future if you are in this state and perform this action. Okay, so you are in a given state,"}, {"start": 795.6, "end": 803.84, "text": " right, and you have three actions at your proposal. Okay, you have action one, action two, and action"}, {"start": 803.84, "end": 810.72, "text": " three, and you are in state s. You what you would do is you would call the Q function if you had a"}, {"start": 810.72, "end": 816.64, "text": " perfect Q function, it could give you the reward, you would call the Q function three times, you"}, {"start": 816.64, "end": 823.6800000000001, "text": " would call the Q function first with a one, you say what's Q of s and a one, and the Q function"}, {"start": 823.6800000000001, "end": 830.8000000000001, "text": " would maybe say that seven. And here you say what's the Q function of s and a two, and it will"}, {"start": 830.8, "end": 836.9599999999999, "text": " maybe say that's four. And here, same thing for a three, and it may be say that's one, then you"}, {"start": 836.9599999999999, "end": 844.9599999999999, "text": " would know aha, if I take action one, my reward from not only the reward for this step, but my"}, {"start": 844.9599999999999, "end": 852.9599999999999, "text": " reward from here on until the end of the episode is going to be seven. That is if you had a perfect"}, {"start": 852.9599999999999, "end": 859.04, "text": " Q function. Now the Q function is always of course conditioned on a policy right here. So there is"}, {"start": 859.04, "end": 866.56, "text": " what it basically says if I take action a one right now, and after that I follow policy pi,"}, {"start": 867.4399999999999, "end": 873.68, "text": " then I'm going to get the reward of seven. It's a bit of a multi layered reasoning approach."}, {"start": 874.48, "end": 880.8, "text": " But ultimately, you don't have to you don't have to worry much about this being this being"}, {"start": 881.8399999999999, "end": 886.88, "text": " conditioned on a policy. Ultimately, the Q function says if you take this action right now,"}, {"start": 886.88, "end": 893.28, "text": " what will the reward be for the entire rest of the episode? Okay, so if you had a perfect Q"}, {"start": 893.28, "end": 899.04, "text": " function, you could simply ask it about all the actions as we did here, and then pick the action"}, {"start": 899.04, "end": 904.16, "text": " with the highest number, okay. And then you're guaranteed because, you know, there could be a"}, {"start": 904.16, "end": 912.08, "text": " situation where, you know, your your reward in a single step is going to be very high here,"}, {"start": 912.08, "end": 918.88, "text": " like 100 and here 00. Okay, and you would be tempted to take that action right here. But,"}, {"start": 918.88, "end": 926.72, "text": " but after that, it's just going to be 000. So your total reward is going to be 100. But here,"}, {"start": 926.72, "end": 934.08, "text": " even though it's zero now, it could be that after that, it's 50, and then 40, and then 2000, and so"}, {"start": 934.08, "end": 939.9200000000001, "text": " on. So your total reward is going to be much, much more. If you were simply to train a function"}, {"start": 939.92, "end": 946.0799999999999, "text": " that tell you what's the reward in the next step, then you would lose because that function would"}, {"start": 946.0799999999999, "end": 951.04, "text": " not be able to look ahead sufficiently. What we're trying to do with the Q function is we're trying"}, {"start": 951.04, "end": 955.76, "text": " to predict to train a function that will tell us not only what's the reward in the next step,"}, {"start": 955.76, "end": 961.68, "text": " but what is the reward in all the steps to come from here, right? Of course, conditioned on all"}, {"start": 961.68, "end": 968.7199999999999, "text": " the decision we make in the future. But that's this policy pi right here. I hope you found this"}, {"start": 968.72, "end": 975.28, "text": " interesting. I hope it's somewhat clear what a Q function is. Interestingly, we can take the same"}, {"start": 975.28, "end": 981.12, "text": " network architecture for this. So what you would do naively is you would build a neural network"}, {"start": 981.12, "end": 985.9200000000001, "text": " where you say, okay, a Q function takes a state and an action. So I'll put those into a neural"}, {"start": 985.9200000000001, "end": 993.76, "text": " network. And then out comes this estimation of the reward, which we usually call Q. So that the value"}, {"start": 993.76, "end": 1001.2, "text": " is this estimation of the future reward if you take this action in this state. Now, the disadvantage"}, {"start": 1001.2, "end": 1006.16, "text": " here is that we have to call this neural network once for each action in every state that we're in."}, {"start": 1006.16, "end": 1011.2, "text": " So that's like, if there's 10 actions, that's like 10 forward passes. What we could do is we could"}, {"start": 1011.2, "end": 1018.48, "text": " simply take the same neural network we had for our initial or very initial policy method. And we use"}, {"start": 1018.48, "end": 1028.4, "text": " that and we simply input state and we'll train it to output the Q for action one and the Q sorry,"}, {"start": 1028.4, "end": 1036.64, "text": " for the state s and action one, the Q for the state s and action two, and so on. So there is"}, {"start": 1036.64, "end": 1044.72, "text": " going to be this kind of shared encoder. And then that is basically going to encode the state into"}, {"start": 1044.72, "end": 1051.04, "text": " a latent space and then classify for each of the actions how valuable this particular action would"}, {"start": 1051.04, "end": 1061.6000000000001, "text": " be in that state. So this here is called a deep Q network. Okay, it's a network that takes in a"}, {"start": 1061.6000000000001, "end": 1069.76, "text": " state and gives you back the Q value. Now the problem right here is we, you know, here we said"}, {"start": 1069.76, "end": 1076.24, "text": " if we had a perfect Q function, a Q function that was always right, then the problem would be solved"}, {"start": 1076.24, "end": 1080.8, "text": " because we could just ask the Q function what to do. Of course, we don't have a perfect Q function,"}, {"start": 1080.8, "end": 1087.36, "text": " we need to train it. So how do we train a Q function? And the answer is surprisingly simple."}, {"start": 1087.36, "end": 1093.84, "text": " So what you want to do is you want you are in this, you're in this state. And you want to"}, {"start": 1093.84, "end": 1099.68, "text": " estimate right what your Q value is, you want to train your Q network, what you can do is you can"}, {"start": 1099.68, "end": 1106.0800000000002, "text": " simply play an episode according to the Q function you have. And you'll maybe play this episode"}, {"start": 1106.0800000000002, "end": 1111.8400000000001, "text": " right here, right? Like you go here and you collect all of this reward. So this entire thing"}, {"start": 1112.5600000000002, "end": 1121.3600000000001, "text": " now goes into your data set. And then you have a sample, you know, I was here in this state as I"}, {"start": 1121.36, "end": 1130.56, "text": " took action one, and I got in total 2090 as a reward. So that is going to be your labeled sample,"}, {"start": 1130.56, "end": 1138.8799999999999, "text": " right? Your labeled sample is going to be s, I was in s, I did a one. And now I have I then got 2090"}, {"start": 1138.8799999999999, "end": 1146.32, "text": " reward. Cool. And in the next episode, so you're going on playing, and you maybe go down here,"}, {"start": 1146.32, "end": 1152.8, "text": " and then you get the next training example, I was in state s, I so you keep restarting the episodes,"}, {"start": 1152.8, "end": 1160.0, "text": " so you can get into the same state multiple times, I performed a three, and I got only 100 reward."}, {"start": 1160.6399999999999, "end": 1165.36, "text": " So that's another training sample. So these training samples right here, you can use to train"}, {"start": 1165.36, "end": 1172.0, "text": " your Q function. This is called online reinforcement learning, you play the game at the same time as you"}, {"start": 1172.0, "end": 1177.52, "text": " train your neural network, and you use that improved neural network to play more games."}, {"start": 1178.08, "end": 1186.56, "text": " And with time, there is this well known, there is a there are theorems around Q learning that say,"}, {"start": 1186.56, "end": 1192.8, "text": " if you do that iteratively, then your Q function will converge to the optimal Q functions under"}, {"start": 1192.8, "end": 1196.48, "text": " some assumptions, which of course not given if this is a deep neural network, but you know,"}, {"start": 1196.48, "end": 1206.56, "text": " who cares? Yeah, so formally, your Q function, as you can see right here, is going to be there is"}, {"start": 1206.56, "end": 1216.8, "text": " this Bellman recurrence kind of recurrence property of the Q function. So if I am, if I am in a state"}, {"start": 1216.8, "end": 1227.12, "text": " s, and I'm wondering, what is my Q of my state s and my an action a. And I said with respect to"}, {"start": 1227.12, "end": 1232.72, "text": " a policy, which the star policy is going to be the policy where we always select the highest Q"}, {"start": 1232.72, "end": 1240.08, "text": " function. So we'll basically say, we're in state s, we select action a. And after that, we'll just"}, {"start": 1240.08, "end": 1245.52, "text": " always select whatever the highest scoring action is, right, like right now, action a might not be"}, {"start": 1245.52, "end": 1251.36, "text": " the highest scoring, but we'll take a right now. And after that the highest scoring, that's Q star,"}, {"start": 1251.36, "end": 1256.96, "text": " it's a Q function conditioned on the policy where after we perform the first action, which is a,"}, {"start": 1257.52, "end": 1263.92, "text": " will take always the best one according to the Q function, right, that's right here. So we're in"}, {"start": 1263.92, "end": 1270.96, "text": " state s, we perform a, and s prime is going to be the state that we are going to. So we're in s,"}, {"start": 1270.96, "end": 1277.28, "text": " we perform a, we get to s prime. So in s prime, which is a function of your environment, we're"}, {"start": 1277.28, "end": 1282.88, "text": " always going to take the maximum action, and R is going to be the reward of the next step. So you can"}, {"start": 1282.88, "end": 1289.8400000000001, "text": " see this recurrence equation right here, that Q star can be framed in terms of Q star. So the Q"}, {"start": 1289.8400000000001, "end": 1296.56, "text": " star of this state is going to depend on the Q star of the next state. And you can use that fact,"}, {"start": 1296.56, "end": 1301.76, "text": " and you can, you know, prove that pretty, we've already done it basically, you can use that fact"}, {"start": 1301.76, "end": 1310.8799999999999, "text": " to now train your neural network. So your neural network loss function is going to be the following,"}, {"start": 1310.8799999999999, "end": 1321.6, "text": " it's going to say, look, this here is the Q function for state s and action a, that's my,"}, {"start": 1321.6, "end": 1327.6799999999998, "text": " and this is my neural network telling me how much that's worth. And this is the label, right? So here"}, {"start": 1327.6799999999998, "end": 1332.8, "text": " you have to think in terms of back classic supervised learning, this here is going to be your"}, {"start": 1332.8, "end": 1341.12, "text": " f of x. And this here is going to be your y. And we will take the squared loss between the two,"}, {"start": 1341.12, "end": 1348.08, "text": " except your input x is going to be which state am I in, and which action am I taking. And your label"}, {"start": 1348.08, "end": 1356.96, "text": " is going to be bootstrapped by your own Q function. So your label is going to be the reward you got."}, {"start": 1356.96, "end": 1363.6799999999998, "text": " Remember, this comes from a replay buffer, we already played that game. And we already know"}, {"start": 1363.6799999999998, "end": 1370.56, "text": " what happened after we perform this action, right? And what happened is we got this reward,"}, {"start": 1370.56, "end": 1376.1599999999999, "text": " and we got into this state. So we can simply ask our own Q function again,"}, {"start": 1376.16, "end": 1382.16, "text": " what's the best action to take in this state? And what reward would we get? And then we have our"}, {"start": 1382.16, "end": 1391.28, "text": " label, right? So our label y is going to be Yeah, I was I was I was pretty confused when I learned"}, {"start": 1391.28, "end": 1397.6000000000001, "text": " this the first time. So I'm going to assume some of you are confused as well. So your Q function"}, {"start": 1397.6, "end": 1407.1999999999998, "text": " is supposed to tell you what's going to be the reward from here until the end of the episode."}, {"start": 1407.1999999999998, "end": 1415.6, "text": " Okay, that you can decompose in the reward that you get from this very next action, plus the sum"}, {"start": 1416.7199999999998, "end": 1423.84, "text": " from then to t plus one until the end of the episode, okay, so t prime, so that's t prime"}, {"start": 1423.84, "end": 1429.52, "text": " equals t plus one. Alright, so it's pretty simple, the total reward from now until the end, you can"}, {"start": 1429.52, "end": 1438.56, "text": " decompose in the reward now, plus the reward after that until the end. Now, this here, we know we've"}, {"start": 1438.56, "end": 1445.12, "text": " played the episode, we know what happened. This here, we can simply ask our Q function again,"}, {"start": 1445.12, "end": 1452.1599999999999, "text": " because we also know what state we got into. And this, as you can see, is very much this, but just"}, {"start": 1452.16, "end": 1459.2, "text": " one step later. So we can simply ask our own Q function, which might be imperfect, right? But"}, {"start": 1459.2, "end": 1467.92, "text": " it's certainly a good guess. We say, okay, this reward from now should be equal to the reward we"}, {"start": 1467.92, "end": 1476.5600000000002, "text": " got plus whatever we reward we get later. And yes, you might be astounded by the fact that we are"}, {"start": 1476.56, "end": 1483.44, "text": " using our own neural network, though be it with the parameters one time step ago, in order to"}, {"start": 1483.44, "end": 1489.44, "text": " produce our label. But that is exactly what these Q learning theorems are about. They basically say"}, {"start": 1489.44, "end": 1496.56, "text": " under some assumptions, if you do this, and you iterate, then this will converge to the optimal"}, {"start": 1496.56, "end": 1504.08, "text": " Q function. So as you can see right here, this is the this is the gradient of the loss. It's"}, {"start": 1504.08, "end": 1508.56, "text": " astounding that back then they still wrote down the gradient of the loss, like almost no one does"}, {"start": 1508.56, "end": 1516.8, "text": " this. Now you just say, put this into TensorFlow and go. Yeah, so they make some remarks here,"}, {"start": 1516.8, "end": 1523.6, "text": " namely that this algorithm is model free, right? There's no model of the environment, you simply"}, {"start": 1523.6, "end": 1531.04, "text": " learn a function that for each state tells you the Q value for each action. That's, that's all"}, {"start": 1531.04, "end": 1537.44, "text": " everything, everything that the all the logic needs to be within the neural network itself."}, {"start": 1537.44, "end": 1545.2, "text": " So that's pretty cool. And they say it's also off policy. It learns about the greedy strategy"}, {"start": 1545.2, "end": 1549.76, "text": " while following a behavior distribution that ensures adequate exploration of the state space."}, {"start": 1549.76, "end": 1556.8, "text": " So while while training, they do this epsilon greedy strategy that follows the greedy strategy,"}, {"start": 1556.8, "end": 1561.76, "text": " which is where you always take the maximum with one minus epsilon selects a random action with"}, {"start": 1561.76, "end": 1568.3999999999999, "text": " probability epsilon. So while you do your experience, you follow your Q function,"}, {"start": 1568.3999999999999, "end": 1573.52, "text": " you always ask the Q function, what's the best thing to do right here? But you know, that's"}, {"start": 1573.52, "end": 1580.48, "text": " that gets you into too much of exploitation. So in epsilon amount of time, you want to do a bit"}, {"start": 1580.48, "end": 1588.32, "text": " of exploration and just take a random action. Alright, so that's basically the algorithm. So"}, {"start": 1588.32, "end": 1593.1200000000001, "text": " the algorithm is right here, and they have some tricks to get it to work. And the biggest trick"}, {"start": 1593.1200000000001, "end": 1599.84, "text": " they got it to work is the so called replay buffer, this experience replay, because what"}, {"start": 1599.84, "end": 1607.28, "text": " happens if you play a game of Atari, right, of pong specifically, then, you know, you have this,"}, {"start": 1607.28, "end": 1611.36, "text": " and you're here and your opponent is here, and the ball is here. And then the next frame,"}, {"start": 1612.32, "end": 1621.12, "text": " you are here, again, your opponent might be a bit up, and the ball is here. Okay, and so on. So"}, {"start": 1621.12, "end": 1626.32, "text": " these samples here, they are all very, very correlated, right, the ones after another,"}, {"start": 1626.32, "end": 1631.36, "text": " especially if you now build mini batch, let's say, or mini batch sizes to this mini batch has almost"}, {"start": 1631.36, "end": 1637.76, "text": " no variability in it. So if we felt something like batch norm or whatnot, this, this will be like"}, {"start": 1637.76, "end": 1642.56, "text": " terrible, because these data samples are correlated. And we, in supervised learning,"}, {"start": 1642.56, "end": 1647.36, "text": " we make a pretty big deal out of, you know, shuffling our data set and all of the data"}, {"start": 1647.36, "end": 1655.04, "text": " points being IID and so on. So what they say is, rather than using the data samples, as we collect"}, {"start": 1655.04, "end": 1661.52, "text": " them, we put them into a big, big buffer, a big replay buffer. And from that replay buffer,"}, {"start": 1661.52, "end": 1670.0, "text": " we basically sample at random. Okay, so that means that, you know, some samples can be used multiple"}, {"start": 1670.0, "end": 1676.24, "text": " times. Other samples can be never sampled, because there is a fixed size and the new ones will always"}, {"start": 1676.24, "end": 1680.72, "text": " kick out the oldest ones. So some samples might not be used, some samples might be used twice or"}, {"start": 1680.72, "end": 1686.96, "text": " three times, we can also learn, you know, four times as fast as we sample. And then every sample"}, {"start": 1686.96, "end": 1693.92, "text": " on average will be used four times. So this, this experience replay proved very, very important for"}, {"start": 1693.92, "end": 1699.52, "text": " this algorithm to work. That's why they say deep Q learning with experience replay. So they have"}, {"start": 1699.52, "end": 1707.44, "text": " this replay memory D right here to capacity N. And you initialize your Q function with random weights,"}, {"start": 1707.44, "end": 1717.04, "text": " as you do with a neural network. And then you play these episodes for each episode, you start out with"}, {"start": 1717.04, "end": 1723.6000000000001, "text": " s1, the state one, and you do pre processing. So in pre process, they have some more tricks where they"}, {"start": 1724.48, "end": 1731.8400000000001, "text": " downscale the image, they concatenate four images in a row. Because sometimes in Atari get these"}, {"start": 1731.84, "end": 1737.36, "text": " flicker things. And also, if you concatenate four things in a row, you for example, can tell it in"}, {"start": 1737.36, "end": 1743.84, "text": " which direction the ball is moving and so on. So give a little bit of history. So one sample"}, {"start": 1743.84, "end": 1748.8, "text": " technically would be four frames, they also do sticky actions, and so on all of these things that"}, {"start": 1748.8, "end": 1756.1599999999999, "text": " you can find today in these emulators that are almost default now like sticky actions, they"}, {"start": 1756.16, "end": 1763.6000000000001, "text": " invented right here. So for the time steps within the episode, we want to, we've probability epsilon"}, {"start": 1763.6000000000001, "end": 1769.76, "text": " select a random action, otherwise, just ask your Q function, what should I do right here, give me"}, {"start": 1769.76, "end": 1777.28, "text": " the best action in this particular state, then you would execute that action and observe a reward and"}, {"start": 1777.28, "end": 1787.12, "text": " the next state. So the next image right here, you would set the next state to this transition. Okay,"}, {"start": 1787.12, "end": 1792.08, "text": " so in the state, there can be more, as I said, there can be more than the image, like the previous"}, {"start": 1792.08, "end": 1798.56, "text": " state, and the action you took. But right here, I believe it's like purely the current last four"}, {"start": 1798.56, "end": 1808.3999999999999, "text": " frames. And then you store that transition in the replay buffer. After that, you sample a random"}, {"start": 1808.3999999999999, "end": 1814.32, "text": " mini batch of transitions from the replay buffer. So here, you can see this here is where we"}, {"start": 1814.32, "end": 1820.96, "text": " de correlate the inputs, because if we simply were to use our last transition for learning,"}, {"start": 1820.96, "end": 1829.68, "text": " then we would run into a problem. But right here, we sample from that replay buffer. So this is"}, {"start": 1829.68, "end": 1835.52, "text": " going to be your input, this is going to be your x for your supervised learning of the deep neural"}, {"start": 1835.52, "end": 1841.76, "text": " network, what's going to be your sorry, without the reward, of course, what's going to be your"}, {"start": 1841.76, "end": 1847.3600000000001, "text": " y, your y, if you're at the end of the episode, it's simply the reward that you got, because"}, {"start": 1847.36, "end": 1852.6399999999999, "text": " there's no more reward coming. However, if you're not at the end, it's the reward that you got from"}, {"start": 1852.6399999999999, "end": 1860.32, "text": " this last step, plus all of the reward that you're going to get in the future. Now, you aren't in the"}, {"start": 1860.32, "end": 1866.8, "text": " future yet. But you can ask yourself, you can ask your Q function, what that reward is most likely"}, {"start": 1866.8, "end": 1872.08, "text": " going to be. If your Q function gets better, and this estimate gets better, and your labels get"}, {"start": 1872.08, "end": 1878.0, "text": " better, then your Q function gets better, and so on in a big circle. And then you perform a gradient"}, {"start": 1878.0, "end": 1887.6, "text": " descent step on this l2 loss between the label and your prediction. Note that there, if you"}, {"start": 1888.24, "end": 1894.3999999999999, "text": " are in a deep learning framework, there is like a stop gradient on this label right here. So the"}, {"start": 1894.3999999999999, "end": 1899.04, "text": " back propagation only happens with respect to this right here, which makes sense, right? So this is"}, {"start": 1899.04, "end": 1907.84, "text": " your x, this is your input, and f of x is usually what we back propagate into. Okay, there's no"}, {"start": 1907.84, "end": 1913.92, "text": " notion yet of like a second Q network and so on, which proved very valuable in the future of this"}, {"start": 1913.92, "end": 1921.04, "text": " paper. This paper simply applied kind of the most basic version of this, and they simply got it to"}, {"start": 1921.04, "end": 1927.76, "text": " work. They just got deep neural networks to work with reinforcement learning. And yeah, there's a"}, {"start": 1927.76, "end": 1935.84, "text": " big, a big chance that this was due to this experience replay, which I believe they did not"}, {"start": 1935.84, "end": 1943.36, "text": " invent. I mean, the, the, this has, of course, around the been around before, but they were the"}, {"start": 1943.36, "end": 1950.16, "text": " ones to realize and combine and do that. It's also pretty interesting, the neural network that they"}, {"start": 1950.16, "end": 1959.52, "text": " actually used was like super duper small. The input to the neural network consists of 84 by 84"}, {"start": 1959.52, "end": 1965.1200000000001, "text": " by four image produced by this. So this is the pre processing at the first hidden layer,"}, {"start": 1965.1200000000001, "end": 1970.96, "text": " convolves 16 eight by eight filters with stride four with the input image and applies the"}, {"start": 1970.96, "end": 1977.8400000000001, "text": " rectifier non linearity. So the relu, the second hidden layer convolves 30 to four by four filters"}, {"start": 1977.84, "end": 1983.76, "text": " with stride two again followed by rectifier non linearity. The final layer hidden layer is fully"}, {"start": 1983.76, "end": 1989.36, "text": " connected and consists of 256 rectifier units. The output layer is a fully connected linear layer"}, {"start": 1989.36, "end": 1995.36, "text": " with single output for each valid action. Number of valid actions is very between four and 18 on"}, {"start": 1995.36, "end": 2002.48, "text": " the games we considered. Okay, you can see that neural network is pretty small. It's two conv"}, {"start": 2002.48, "end": 2009.1200000000001, "text": " layers. And as was in fashion back then you had like big filters. So you know, big filters from"}, {"start": 2009.1200000000001, "end": 2017.28, "text": " like Alex net. Yeah, big filters, but fewer than today. So today, the trend is more like deeper"}, {"start": 2017.28, "end": 2022.96, "text": " layers, more filters, but they are not as big. They're like three by three filters today only."}, {"start": 2023.92, "end": 2030.08, "text": " Yeah, pretty interesting how they did it back then. Interesting also no max pooling and so on. So"}, {"start": 2030.08, "end": 2038.6399999999999, "text": " pretty cool. And here they go into experiments. So they show that their average reward in these"}, {"start": 2038.6399999999999, "end": 2043.52, "text": " games is kind of noisy, but it improves over time, especially also if you look at the"}, {"start": 2044.32, "end": 2051.68, "text": " average Q of the max action, it continuously goes up during training. So this is really a"}, {"start": 2051.68, "end": 2058.3199999999997, "text": " successful training, especially this investigative experiment they did right here where you can see"}, {"start": 2058.32, "end": 2064.4, "text": " one example of how the Q function what the Q function says, remember the Q function gives us"}, {"start": 2065.28, "end": 2073.28, "text": " the whatever the future reward is going to be, okay. And here we always look at the max action."}, {"start": 2073.28, "end": 2081.52, "text": " So in this first frame, you can see this enemy had just appeared. And you can see that from here"}, {"start": 2081.52, "end": 2087.6000000000004, "text": " to here, there's a spike in the Q value because you can shoot enemies. And that gives you"}, {"start": 2087.6, "end": 2093.6, "text": " reward the a this is already so the enemy isn't shot yet by the simple appearance of the enemy,"}, {"start": 2093.6, "end": 2101.52, "text": " the Q function also like already jumps in value, because it anticipates a future reward, right,"}, {"start": 2101.52, "end": 2110.0, "text": " then the the agent shoots. And you can see here the shot is about to land at the enemy. And that's"}, {"start": 2110.0, "end": 2115.12, "text": " when we're here. So this now the Q function is very sure that in the future, there's going to be"}, {"start": 2115.12, "end": 2124.08, "text": " a high reward. But then once the once the enemy is shot, then there is no more enemy to be shot."}, {"start": 2124.88, "end": 2133.68, "text": " And the Q function drops drastically, because it doesn't see a future reward as being as likely as"}, {"start": 2133.68, "end": 2139.68, "text": " at the beginning, when there was this new enemy to be shot. So that's, you know, pretty interesting."}, {"start": 2139.68, "end": 2144.72, "text": " And you can see pretty directly that there is a correlation between what's happening in the"}, {"start": 2144.72, "end": 2154.8799999999997, "text": " game and this learned Q function. If you compare this to other methods, and they really say that"}, {"start": 2154.8799999999997, "end": 2162.3199999999997, "text": " these other methods, most of them have some kind of very special feature engineered like so their"}, {"start": 2162.3199999999997, "end": 2167.04, "text": " method just takes RGB, but the other methods recognize that oh, in these Atari games, most of"}, {"start": 2167.04, "end": 2171.6, "text": " the time, you know, there are unique colors for the things so you know, the enemies are all like"}, {"start": 2171.6, "end": 2178.3199999999997, "text": " green, like and they make unique channels for those green enemies, or they even have handcrafted"}, {"start": 2178.3199999999997, "end": 2185.04, "text": " object detectors and tell the algorithm where these objects are. So the comparison really isn't"}, {"start": 2185.04, "end": 2194.72, "text": " fair. Yet, the DQN outperform these others like almost everywhere. And they also evaluated against"}, {"start": 2194.72, "end": 2203.2, "text": " a against a human. And I don't actually know they just say an expert human. I have no idea, maybe"}, {"start": 2203.2, "end": 2210.48, "text": " just put David silver in front of computers like okay, David, here you go. And you can you can,"}, {"start": 2211.04, "end": 2218.9599999999996, "text": " like what happened in Pong? Like, come on, David. But you can see there, there were still problems"}, {"start": 2218.96, "end": 2225.44, "text": " where the humans were vastly superior, and they mainly attribute this to the difficulty of the"}, {"start": 2225.44, "end": 2232.4, "text": " problem. And it could also be because for example, in breakout them, there's this kind of the most"}, {"start": 2232.4, "end": 2240.7200000000003, "text": " famous example where the agent kind of figured out this strategy of shooting the ball, shooting like"}, {"start": 2240.7200000000003, "end": 2246.48, "text": " a hole in to this wall that you have to break, and then shooting the ball up here. So the ball"}, {"start": 2246.48, "end": 2252.2400000000002, "text": " bounces up and down and basically you win. From then on, you just watch the ball go. And the agent"}, {"start": 2252.2400000000002, "end": 2257.52, "text": " does nothing anymore. So this deep q networks figured out that strategy and you need to pull it"}, {"start": 2257.52, "end": 2264.16, "text": " off very precisely, which of course the the computer can do very well. So it sometimes"}, {"start": 2264.16, "end": 2269.92, "text": " achieves these super high scores by pulling something off precisely. But in games where they"}, {"start": 2269.92, "end": 2276.56, "text": " say where you have to plan ahead for longer, it kind of fails. And we know that this long planning"}, {"start": 2277.44, "end": 2285.6, "text": " was about to be a problem for years to come. And it's still not solved. So still, Go Explore is"}, {"start": 2285.6, "end": 2291.6, "text": " highly controversial that can solve these kind of long exploration games. And those are still games,"}, {"start": 2291.6, "end": 2299.8399999999997, "text": " right? So we are basically not, we are very much further than they were in this paper. But also,"}, {"start": 2299.8399999999997, "end": 2309.2, "text": " we are basically no nowhere yet. Yeah, if I'm if I'm allowed to say that. So I enjoyed reading this"}, {"start": 2309.2, "end": 2316.64, "text": " paper, I this is it's very, it's very well written. If you somehow know how to think about"}, {"start": 2316.64, "end": 2323.2799999999997, "text": " reinforcement learning like this, this q function, what the q function means and why you would learn"}, {"start": 2323.2799999999997, "end": 2328.7999999999997, "text": " it in this way. I find this is not super well described, this kind of requires a bit of a"}, {"start": 2328.7999999999997, "end": 2336.64, "text": " knowledge of not of RL, but just have how to think of RL. But apart from this, everything else is"}, {"start": 2336.64, "end": 2344.24, "text": " written incredibly well, easy, straightforward. And this was just a nice work of its time. And I"}, {"start": 2344.24, "end": 2350.24, "text": " appreciate it for that. Alright, I'll see you next time. And I appreciate your time too. Bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=Nq3auVtvd9Q
[Classic] ImageNet Classification with Deep Convolutional Neural Networks (Paper Explained)
#ai #research #alexnet AlexNet was the start of the deep learning revolution. Up until 2012, the best computer vision systems relied on hand-crafted features and highly specialized algorithms to perform object classification. This paper was the first to successfully train a deep convolutional neural network on not one, but two GPUs and managed to outperform the competition on ImageNet by an order of magnitude. OUTLINE: 0:00 - Intro & Overview 2:00 - The necessity of larger models 6:20 - Why CNNs? 11:05 - ImageNet 12:05 - Model Architecture Overview 14:35 - ReLU Nonlinearities 18:45 - Multi-GPU training 21:30 - Classification Results 24:30 - Local Response Normalization 28:05 - Overlapping Pooling 32:25 - Data Augmentation 38:30 - Dropout 40:30 - More Results 43:50 - Conclusion Paper: http://www.cs.toronto.edu/~hinton/absps/imagenet.pdf Abstract: We trained a large, deep convolutional neural network to classify the 1.2 million high-resolution images in the ImageNet LSVRC-2010 contest into the 1000 different classes. On the test data, we achieved top-1 and top-5 error rates of 37.5% and 17.0% which is considerably better than the previous state-of-the-art. The neural network, which has 60 million parameters and 650,000 neurons, consists of five convolutional layers, some of which are followed by max-pooling layers, and three fully-connected layers with a final 1000-way softmax. To make training faster, we used non-saturating neurons and a very efficient GPU implementation of the convolution operation. To reduce overfitting in the fully-connected layers we employed a recently-developed regularization method called “dropout” that proved to be very effective. We also entered a variant of this model in the ILSVRC-2012 competition and achieved a winning top-5 test error rate of 15.3%, compared to 26.2% achieved by the second-best entry. Authors: Alex Krizhevsky, Ilya Sutskever, Geoffrey E. Hinton Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar (preferred to Patreon): https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there. Today we'll look at ImageNet classification with deep convolutional neural networks by Alex Krzyzewski, Ilya Satskiwer and Jeffrey E. Hinton. So this paper is another one in the installment of our historical paper overview, where we go through kind of old papers that were or weren't very impactful, and see what people knew at the time already, how this worked, and so on. Of course, this paper here, also known as AlexNet, was the one that started the deep learning revolution, so to say, or at least contributed in large part to it. It was the first paper that showed that you could train these very deep neural networks and very deep in here is a relative term. But the first one that showed that you could actually use CUDA GPUs to train those large networks efficiently, and it won the ImageNet competition that year. And it did so by a very, very large margin. So kind of shook the world. Because previously, computer vision was still doing like hand engineered features, and then using some kind of classifiers on top of those, this paper basically changed everything. So we'll go through the paper, and we'll see what was already known. And especially, I always enjoy with these papers, how did the choices that people make back then, how did they pull through to today, sort of what arbitrary choices that Alex Krzyzewski made right here? Are we still doing today? And what have we learned since then? So the paper is written relatively straightforward, I have to say, it's a good read, if you want to read it, and you know, straightforward, and sort of gives you a little bit of an intuition of how much work must have gone into this, which is, I guess, a lot. And yeah, so they start off by saying that, that current approaches to object recognition make essential use of machine learning methods. This was also new, right? Object recognition wasn't always learned the, you know, object recognizers, you could even do it in the in different way, like matching templates and so on. Machine learning was still one of the methods used. And of course, today, it's the method used. To improve their performance, we can collect larger data sets, learn more powerful models, and use better techniques for preventing overfitting. Until recently, data sets of labeled images were relatively small on the orders of 10s of 1000s of images. Okay, so this this specially at NORD, or here, the C410 or C4100. These are, you know, relatively small data sets with relatively small images as well, like C410 is 32 by 32 pixels. So they're saying that, okay, when these small data sets, you know, you can you can solve it with classical computer vision models. But if you have larger data sets, and especially more realistic data sets, like bigger resolution, and so on, you need bigger models. So they say, but objects in realistic settings, exhibit considerable variability to learn to recognize them, it is necessary to use much larger training sets. Okay, so they say that this ImageNet data set is one of those larger data sets consists of 15 million labeled high resolution images in over 22,000 categories. And people keep forgetting this. And I am included in that group of people, that the ImageNet data set is actually much larger than we know, than we when we talk of ImageNet. When we speak of ImageNet, we think of the ImageNet that has 1000 classes and about one or one and a half million images. However, that's only a subset of the much, much larger ImageNet data set with in many, many more categories. It's just that the ImageNet competitions were performed on this subset, because I guess people thought, well, 1000 classes and million images is already plenty. So we'll do that. So that's, I guess, how that came to be. So their argument is right here. To learn about 1000s of objects from millions of images, we need a model with a large learning capacity. However, the immense complexity of object recognition tasks means that this problem, this problem cannot be specified even by data set as large as ImageNet. So our model should also have lots of prior knowledge to compensate for all the data we don't have. So their main argument for using neural networks is that the size of the data set is so large, therefore, we need a large model, you know, granted, they already recognize the inherent, the inherent connection between large models and a lot of complex data. But in the opposite, they say, well, even if we have that much data, the task we are trying to solve object recognition is way more complicated than the amount of data we have. So our model should also have lots of prior knowledge to compensate for all the data we don't have. Remember at this time, convolutional neural networks weren't really, you know, known to do anything, I guess, I guess they were used for handwritten digit recognition, and so on and we're kind of on par with other methods. However, it wasn't like, obviously clear that you would use them for image recognition. So here they make they have to make like a argument to convince people that, okay, we can use neural networks for this tasks because they have such a high capacity. However, neural networks, feed forward neural networks are already too powerful. They don't know anything about the data, everything's connected to everything. And they argue right here, our model should have lots of prior knowledge to compensate for all the data we don't have. So they allude to the convolutional neural networks constitute one such class of models, their capacity can be controlled by varying the depth and breadth. And they also make strong and mostly correct assumptions about the nature of images, namely stationarity of statistics and locality of pixel dependencies. So that their argument here is that the convolutional operation is such a strong prior, that is mostly consistent with what we know about images that they are very well suited to computer vision. Again, something that was not abundantly clear at the time as it is right now. It's interesting to see how they get to this point where they say we need lots of capacity, but we also need a model with lots of prior knowledge and and of course, CNN's fit that very well. So they're they go into the problems of CNN, despite the attractive qualities, and despite the relative efficiency of their local architecture, they are prohibitively expensive to apply in large scale high resolution images. Luckily, current GPUs paired with a highly optimized implementation of 2d convolution are powerful enough to facilitate the training of interestingly large CNNs. And recent data sets such as ImageNet contain enough labeled example to train such model without severe overfitting. So overfitting was also still like very much at the forefront of people's minds back then. Right now, we don't really care about overfitting that much anymore. Basically, we figured out that if we just build large enough models, we we don't overfit, which is strange in itself, like this double descent phenomenon and so on. But overfitting was still a a very much at the forefront of people's minds. And they do a lot of things here to prevent overfitting, which gives them kind of a boost in the test accuracy, which might actually not have been the overfitting that they're combating. So they do, for example, in data augmentation already in this paper, and they always allude to how this is to prevent overfitting. However, we know nowadays that it might not be the overfitting that's combated in the by data augmentation, it might actually be more have something to do with like regularizing your function, making it more smooth and so on. But so you just see how how coming from a classical machine learning perspective, overfitting was like the number one or one of the number one problems in classical machine learning, you know, in SVMs and things like this. So it's it's, it's safe to say that they thought if we built these large models, we're going to have a huge overfitting problem. And yeah, so that's why this pulls through right here. Also, the I guess the one of the main contributions of this papers is to show to combine this CNN training with GPUs. Also not very non clear at the time, like it was known that you could do computation on GPUs. But the fact that these are, you know, very capable for training these CNNs, or generally neural networks wasn't something that was, you know, known at the time. So this paper basically showed that if you use a GPU, you can, you can get that much faster. And that makes it possible to train these big neural networks. Again, right here, the size of our network made overfitting a significant problem even with 1.2 million labeled training examples. So we use several effective techniques for preventing overfitting. And we'll, we'll look at those. And the end they say, the network's size is limited mainly by the amount of memory available on current GPUs and by the amount of training time that we're willing to tolerate. Our network takes between five and six days to train on two GTX 580 GPUs. All of our experiments suggest that our results can be improved by simply waiting for faster GPUs and bigger data sets to become available. And I mean, that proved to be absolutely true. We don't necessarily have bigger data sets right now, though we do. But certainly with faster GPUs and bigger GPUs, this became a this became the these networks became better simply by increasing their depth. And as you know, then Resnets came along, increasing the depth by an order of magnitude, and that gave another boost to computer vision. Alright, so they talk about the ImageNet data set here. And the main point in the ImageNet data set right here is the fact that the images are plenty. So there are over a million training images in this subset with 1000 classes, which was, you know, a very big that was that was unlike CIFAR 10 had 10 classes, CIFAR 100 had 100 classes, that was already a lot. A thousand classes that is like unheard of before this data set, I guess not unheard of, but yeah, and a million training images, completely crazy. And also, not only was it a lot of images, they were resolution was really big. So in the order of 256 by 256, whereas previous methods all were like 32 by 32. So definitely challenging data set. Even today, it's a challenging data set. Alright, so the architecture, the architecture, and there's this famous graphic right here of the Alex net architecture. So briefly, they describe these convolutional layers right here, as you can see, there's max pooling already here, they have dense layers at the end, they do generally increase the number of feature maps right here, while decreasing the resolution with max pooling. So all of this has sort of, you know, kept until today, I guess they also took it from earlier work on convolutional neural networks that generally found this to be a good idea. And the important part here, that is kind of special to Alex net is you can see there's are these two different pipelines. And, you know, Alex, for cutting off this part right here, I mean, you just know, like, there's the eight pages, we need to like we have like three lines too much, how can we fit the three lines, we've already cropped everything. Let's just cut off the top half here. It's essentially the same as the bottom. Yeah, so space constraints and PDFs for conference submissions, ruining yet another paper. Alright, but you can see there's this two this this two column architecture right here. So this network was so large that it didn't fit on one GPU. So they had to split it on two GPUs with the occasional intercommunication, right, you can see here, there's intercommunication between the two GPUs. And there is also no intercommunication right here on this layer. This was very intricate. That was one thing that really didn't hold until today, I guess until now with things like, I don't know, G shard or so, where you have different weights on different GPUs. Again, I guess the the invention of bigger GPUs made that sort of superfluous. But just imagine the amount of code they had to write, there was no TensorFlow at this point there. I don't think there was even cafe around there was just CUDA. And yeah, just this cross GPU memory writing, I just imagined this to be so so ugly, and big respect for writing all of this, all of this code. Alright, so the they go through a number of important things. And most of the things here aren't their invention, I would say, but they cleverly combine things that were already known about neural networks and things that were maybe developed somewhere that they have found to work really well. So the first one is the relu non linearity. Now, of course, relu is nowadays all like abundant. Everyone uses relu nonlinearities. But at that time, it was still very much in fashion to use something like the sigmoid right here or the hyperbolic tangent. And why is that because the neural networks were still inspired by the neurons where you had the soma of the neuron and then the input dendrites, sorry, dendrites with the input axons, and then you would sum up all the incoming signals. And then that would go over. So in a true neuron, you have this, this, this kind of curve where if the input rises above this order right here, the the action potential, maybe, I don't know what the the English term is, then if it rise above that, then the neuron would start to spike, right. And if it's below that it wouldn't. So people wanted to approximate this using some sort of a, a kind of differentiable, but something that's very similar to this step function. And that ultimately led to something like a sigmoid or an hyperbolic tangent. So people trying to stay close to biological neurons did this, but that gives you the problem that in this region, and in this region right here, you have almost no gradient to learn from. So you can see that they argue that in terms of training time with gradient descent, the saturating nonlinearities, so the hyperbolic tangent and the sigmoid are much slower than the non saturating linear non linearity. This one following Naren Tinton, we refer to neurons with this non linearity as rectified linear units. So taken from this, this other paper, they say, okay, we use these relu's, these rectified linear units, which are not exactly like real biological neurons, but they train much faster, right. And of course, relu's are used until this day. So you can see right here that a this is on a CIFAR 10. And they measure the time to reach 25% of the training error. And this here is with the relu's. And this here is with the hyperbolic tangent. And it takes much longer to reach the hyperbolic tangent, especially it takes six times faster to with the relu's. And they say that's one of the main components that allows them to learn this fast to even experiment with these big networks, because their entire training time is six days, right. But they probably didn't train it only once they experimented with it and saw what works. So if you have a couple of months of time and it takes you a week to train one of these things, you know, you don't, you can't afford a six times slowdown. Because that would mean you can only train like two models in the entire course of research. And that would severely hinder your progress. Now we are at the point where that becomes true again with these giant, giant transformer language models where people can train it once and then you know, like GPT-3 they say, oh, we made we discovered a bug halfway through and we've kind of fixed it but we're not sure we couldn't restart because it was too expensive. Maybe we're waiting for a moment. I'm still saying we're waiting for the resonant moment in the transformers. But yeah, relu's in, you know, here in not introduced here, but used here and have been prevailing until today. Training on multiple GPUs, something as I said that didn't didn't really get forward from here, especially the kind of GPU train. So if we train on multiple GPUs today, what we mean is that we have our model, right, and then we distribute that to multiple GPUs like this. And then we take a mini batch from the training data. And we simply split it up, let each GPU do its thing on its subset of the mini batch, and then at the end, kind of calculate the loss and then back propagate the gradients and synchronize the gradients between that. So we have one model that is on both GPUs. Here they distribute a model to two GPUs. And I'm also thinking that with frameworks like G shard, this could potentially have a revival, right here, this kind of distributing your models, especially within the same layer across many GPUs, and then having cross communication only at some points. So their argument is, this only has three gigabytes of memory, which limits the maximum size of networks can be trained on it. Turns out that 1.2 million training samples are enough to train networks, which are too big to fit on one GPU. Therefore, we spread the net across two GPUs. Current GPUs are particularly well suited to cross GPU parallelization, as they're able to read from and write to one another's memory directly without going through the host machine. Okay, so this means that for so sorry, here, they say the parallelization scheme that we employ essentially puts half the kernels or neurons on each GPU. With one additional trick, the GPUs communicate only in certain layers. That means that for example, the kernels of layer three take input from all kernel maps and layer two however the kernels in layer four, take input only from the kernel maps in layer three, which reside on the same GPU. So very, very interesting choice right here. And they they justify this here or they say the results. This scheme reduces our top one top five error rates by 1.7 to 1.2% respectively, as compared with a net with half as many kernels in each computational layer in each convolutional layer on one GPU. The two GPU net takes slightly less time to train than the one GPU net. So first of all, I have to say, big respect right here like, like, I can imagine they did this, you know, with the relu's and stuff, and they were already better than previous because they're so just to go to the results, the pre they beat the error rates of previous models by G enormous amount. So this is what they knew right here. This is on the 2010 image net split. So the previous best ones were like at around 2825%. And here their best one is at 17% top five error rate, I'm going to imagine that they trained it first and we're already better than the 25%. And I guess lots of people would just call it a day would be like, Oh, cool, we have this entirely new method. Not only did we show that we can train it, we actually show that it's better. And bada boom, I have point 1% error rate, and everything else can be a separate paper. No, they stuck with it, and they pushed it each. So each of these things right here, they say, Oh, this reduces the error rate by 1%. This reduces the error rate by 2%. And, you know, really, they they went about it, how far can we push this with everything? I mean, just imagine you come and you train a network, I'm pretty sure they first trained on one GPU, right? And, um, and then they thought, Oh, you know, maybe we can train an even bigger network by using two GPUs. And then they realized what it's gonna take like a crap ton amount of dumb code to cross synchronize and keep them in lockstep and blah, blah, blah, like, it's not even easy to write multi GPU code today with all the frameworks, just imagine that. And for them to having already observed that their network does better than everything that was previously to sit down and do the cross GPU thing, experiment with Okay, when do we cross communicate and whatnot, that is very, very respectable, right here. So maybe a lesson to be learned, or, or just the mentality of the people, maybe they just had more time, they were like, Okay, it's still like two months out, just competition deadline. I don't know. But no, I'm this, this is not something that I see today, very often, this this kind of persistence and additional pushing and reporting of what works in these kinds of things. I mean, some, some papers do it. But most papers do it because only with all the tricks, they can get that point 1% improvement. And this one already had the improvement and did it anyway. Okay, but multi GPU training didn't really like splitting the models across GPUs didn't really didn't really stick around, mainly because I guess the GPUs got larger in memory pretty quickly. So it wasn't that necessary. But also, I guess, because the frameworks were just too clunky. And now maybe witchy shard, this is coming back. So worth another shot, I guess. Next one, local response normalization, this also didn't really stick around, I got kind of dumped in favor of things like batch normalization. But with the resurfacing of things like layer normalization, this, it comes back to this thing here again, a little bit. So what they say is that what they want to do is they want to kind of normalize the response of these of these relu's. So what they do is each response, which is this alpha, they are these a here is normalized by the following quantity. And it's the all the responses of the other neurons around them or of the other kernels around them. And you can see the sum is over this weird quantity right here. So what does it mean if they have a bunch of convolutional filters? And these are the activation. So these are the feature maps after the convolution. And yeah, so if I have like 10 convolutional filters in my layer, this is going to be the output, the way they normalize is they normalize each filter, sorry, each output channel by averaging by see here, dividing by the average response of the channels around them, right. So let's maybe say the five channels, the two channels in front of them and two channels behind them, this is going to be they take the average across this one. And then for another channel right here, for this one, you would take the average of the five around that this isn't really something that stuck around, I guess, mainly because of the really dynamic situation right here. What people do today is they have things like layer normalization that simply averages across all of the channels, or they have group normalization that pre defines these groups like here is there's two groups. And we only normalize within this group and within this group, also always the same, this kind of dynamic normalization on across neighboring filters, as I said, didn't really stick around, not really sure why, but I guess it was just easier to implement it otherwise, or it just worked better. Again, here they say, this, this, it was motivated well, right, this scheme bears some resemblance to the local contrast normalization scheme of that, but ours would be more correctly termed brightness normalization, since we do not subtract the mean activity. Oh, they make it connection to biological neurons. Where is it? This sort of response normalization implements a form of lateral inhibition, inspired by type found in real neurons creating competition for big activities amongst neuron outputs computed using different kernels. Okay, so kind of inspired by real neurons, but also kind of inspired by other people doing also some kind of normalization. So people already knew that normalization was helpful at some times. And this is what they employed right here. Again, reducing the top error rates by 1.4 and 1.2%, respectively. So not a big improvement, but still an improvement. The last thing overlapping pooling, again, a thing that didn't really stick around that much, where they say, okay, instead of having a pooling layer, so if this is your image, and instead of pooling two by two in the stride of two, like we do today, and you know, pull it down to a smaller image, what we can do instead, is we can pull with overlapping windows. So in that case, they pull with a three by three window, but they do always do stride of two. So they have like these overlaps right here, resulting in the same size. But then each pixel right here has some sort of overlapping information from the pixels around it. Again, they say it reduces the top one and top five error rates by 0.4% and 0.3%. Maybe this this didn't stick around because I'm not sure maybe because people found it doesn't work in other problems. Who knows? So the overall architecture, as we said, is described in this picture right here. So you have the input image, which you can see has three channels. And they use convolutional filters with a here with a stride of four at the beginning to reduce the size. So at the beginning, it's 224 by 224. And then it's 48 by sorry, it's 55 by 55. That thing here 55 by 5548 feature maps, you can already see, as we said before, the feature maps keep increasing, while the number of the dimension, the resolution of the image keeps decreasing. The stride of four convolution here already employed in order to downsample the image at the same time as convolving it. Nowadays, a lot of architectures will simply not do max pooling at all, but always use the kind of strided convolution to downsample image while convolving it. What you also see here is that they thought that the feature map size should should also be large at the beginning, and then decrease, which is a reasonable assumption, right? Because if you have higher resolution images, you're probably going to need higher resolution feature maps. This didn't really come through until today. As you know, most architectures today, they just go with like three by three kernels from the very start, and don't really care about you know, also downsizing their, their filters. I don't really know why, whether it's just more convenient or less parameters, or whether there's really something to having small filters, but I just know, you know, this is something the large filters at the beginning is something that didn't didn't hold over time. Also, you can see right here, they have multiple dense layers at the end, I believe most architectures today simply go with two of those instead of three. So one like hidden layer, and then one classification layer. But it's, you know, it's, it's very close to the architectures today, right? There hasn't changed that much like the difference between this and the VGG 16 VGG 19 network is just depth. And then the difference between those and the resnet is just the whatever the skip connections right here. And that's where we are today. So so there hasn't, hasn't changed that much. Honestly, they also allude to the fact that actually, even though it doesn't look like it, most parameters are here in these dense layers. Those are most parameters of the network. This right here, a convolutional layer is like 1% of the parameters, even though it takes up a lot of space in the in the drawing. So maybe the reduction in the number of classification layers at the end also has something to do with the fact that that's where most parameters are. So if you get rid of one of those dense layers, you can like get many, many more convolutional layers. Alright, so the last part here is on reducing overfitting again, they didn't really investigate whether or not really their network was overfitting, like really establishing the overfitting it was I think maybe they did and maybe it was actually overfitting. But we now we we don't care about overfitting too much anymore. Maybe because we already use these augmentations naturally, but also because we built these deep models. So we somehow have an idea that they generalize naturally, I'm not sure whether they actually were only worried about it that much because of the history of machine learning, or whether they actually did see that everything was overfitting constantly. Okay, they say our neural network architecture has 60 million parameters. Although the thousand classes make each training example impose 10 bits of constraints on the mapping from image to label, this turns out to be insufficient to learn many parameters without considerable overfitting. Below we describe two primary ways in which we combat overfitting. Again, there's no one today, no one today makes this argument anymore. This Oh, we have this many parameters and there are that many images, right? We have 60 million parameters. We have 1.2 million images, 1000 classes, how you know when, how many parameters per sample is that and so on, how many bits of constraint we don't care about. We're fine with having like a billion times more parameters than training samples. We we don't worry about it anymore. So the first thing they do is data augmentation already. I mean, this was already known again, like lots of these things here were already known, but the the combination is just so cool in this paper where so first of all, again, they say, the transformed images are generating Python code on the CPU while the GPU is training on the previous batch of images. So these data augmentation schemes are in effect computationally free. Again, this code must have been ugly. The first form of data augmentation consists of generating image translations and horizontal reflections. We do this by extracting random 224 by 224 patches and their horizontal reflections from the 256 by 256 images. Okay, so random. So this was already this, these are the most valuable data augmentations that still we have today. Random horizontal flipping is still used in every pipeline of computer vision except if you want to read text, I guess. And random cropping is still the most powerful data augmentation technique for images today. And the it's crazy that this was already discovered. And I, I don't know whether they say right here how much this particular thing improves. I don't think they have a stat on how much this improves. They just say how much this this next thing improves. But I'm going to guess this was one of the vital things for pushing the performance because now we know cropping is very important. I guess they thought that they would, you know, translation was the important part. And so they focused on generating image translations. And to generate an image translation from a single image, naturally you have to crop it. However, we we now focus much more on the fact that we crop it and kind of have different sub images of the same image, especially in, you know, self supervised learning and things like this. We know that cropping is what is like the the power horse of these methods. So the fact that they extract random patches right here means that their network only operates on these sub patches. And then they compensate by a test time the networks makes a prediction by extracting five patches, the four corner patches and the center patch as well as their horizontal reflections and averaging the prediction made by the network's softmax layer on the 10 patches. I also believe that people don't do this too much. Nowadays, they most of the time they simply rescale the test images or something like this or fine tune at the end on the kind of scale training images, there are various techniques for doing this, but random cropping and horizontal flipping already employed right here. Also color, kind of color jittering, a form of color jittering, a very special form, altering the intensities of RGB channels and training images. Specifically, we perform PCA on the set of RGB pixel values throughout the ImageNet training set. To each training image, we add multiples of the found principal components with magnitudes proportional to the corresponding eigenvalues times a random variable drawn from a Gaussian with zero mean and standard deviation point one. This is I believe this has gone out of fashion. So people do color jitter and kind of brightness jitter and so on. But I don't think they particularly do this kind of PCA based image, image augmentation right here anymore. They say this scheme reduces the top one error rate by over 1%. I wonder why this isn't working, maybe because you need these stats over the entire data set and the other things may be working equivalently well, but you can simply apply them without knowing kind of your principal components. Okay, next thing, dropout. Dropout has been, you know, one of the things that was very important throughout the early stages of deep learning isn't that important anymore. Now, dropout, some people still use it, but most people I think don't use dropout anymore. And it's very interesting to see, but it definitely was a technique that was used a lot during like from Alex net to basically like now, like the last very few years. So they say, combining the predictions of many different models is a very successful way to reduce test errors, but it appears to be too expensive or big neural networks that already take several days to train. There is however, a very efficient version of model combination that only costs about a factor of two during training. So there's this technique called dropout, then they explain it to set to zero the output of each hidden neuron with probability point five. Again, people didn't know about dropout as they do now. But they introduced this right here. And they say it reduces their not sure that they also don't say how they how much they by how much this reduces the training error, but they say we use dropout in the first two fully connected layers. Without dropout, our network exhibits substantial overfitting dropout roughly doubles the number of iterations required to converge. So okay, so they did actually make sure or they did find the actual evidence of overfitting and saw that dropout reduces that. And I wonder why this doesn't happen nowadays, maybe because we have the we have less of these fully connected layers, but I can't really imagine. Maybe because we do more augmentation. I don't I don't know or maybe dropout is still used and I'm just I just don't know it and don't see it. Yeah, so here they use momentum to train this. And they do some qualitative analysis. They do some qualitative analysis. So first of all, they say, okay, they shatter all of the previous approaches, especially also then they build kind of ensemble methods, and they pre train they already do transfer learning, they already pre train on ImageNet 2011. And fine tune, then on the ImageNet 2012, right here, the ImageNet 2011, da da da da da, and then fine tuning on the ImageNet 2012. To reduce that error even further, like pulling all the tricks of these things are around still. Very cool. And then they look into what their network learned. So they find that there are a number of these kind of filters. You see these 11 by 11 filters in the first layer, where they show okay, this really and this was kind of already known that these neural networks extract filters like this, like color gradients or edge detectors in various forms and directions. And cool to see that this one also does so. This one here is also a very cool investigation where they look at examples. And the red bar, the red one is always the correct label. And the bars are basically what their model says are the top five things. And it's cool to look at. So for example, here you have might as the top one, but then also Black Widow, Cockroach Tick, Starfish, but the top labels are usually also very, very good labels. You can see here grill and it assigns convertible, which you know, by all means is correct. It's just not the class that the annotators assigned to this particular image, as well as here. Dalmatian was the highest prediction of the network where the label was actually cherry. And this is this is quite debatable, right? So you can see that a lot of the mistakes the network does is are, are, you know, forgivable, let's say. And you can see that for when the network doesn't do mistakes, the not only the top label is good, but a lot of the top five labels are also very, very adequate. Lastly, they look at a given training set image, which these are the training set images right here. And they look at the last layers feature vector and the five nearest or the nearest neighbors in Euclidean space of the entire training data set. And here's what you come up with. So you can see for the elephant, the nearest neighbors are all other elephants and regard that they are in different poses, right? They don't always look the same way these elephants also these dogs right here. So it's pretty cool to see that the network actually learns some invariances across the class and puts images with the same label into the same area in the embedding space. Yeah, so that's their that's their paper. They they they already allude to the fact that depth is very important. It is notable that our network's performance degrades if a single convolutional layer is removed. For example, removing any of the middle layers results in a loss of about 2% for the top one performance of the network. So the depth really is important for achieving our results. And as you know, this spurred an area of this burden area of trying to build deeper and deeper networks until resonance came along and built ultra deep networks. They also say we did not use any unsupervised pre training, even though we expect that it will help especially if we obtain enough computational power to significantly increase the size of the network without obtaining a corresponding increase of the amount of labeled data. Thus far, our results have improved as we have made our network larger and trained it longer, but we still have many orders of magnitude to go in order to match the infero temporal pathway of the human visual system. Ultimately, we would like to use very large and deep convolutional nets on video sequences, where the temporal structure provides very helpful information that is missing of our far less obvious in static images. So already the previewing of future research here with the self supervised with the many more layers and so on. Astounding that this kind of foresight, of course, all of this proved to be, you know, very, very adequate predictions right here. And yeah, so this was the paper right here, the paper that kicked off deep learning. I enjoy reading kind of these old papers, especially looking back at what was already known what still is around, which turns out to be a lot, a lot is still around. And the choices that people made back then, some of them defined our modern field. So that was it for Alex net, let me know what you think in the comments, and I'll see you next time. Bye.
[{"start": 0.0, "end": 6.48, "text": " Hi there. Today we'll look at ImageNet classification with deep convolutional neural networks by"}, {"start": 6.48, "end": 12.6, "text": " Alex Krzyzewski, Ilya Satskiwer and Jeffrey E. Hinton. So this paper is another one in"}, {"start": 12.6, "end": 19.18, "text": " the installment of our historical paper overview, where we go through kind of old papers that"}, {"start": 19.18, "end": 26.400000000000002, "text": " were or weren't very impactful, and see what people knew at the time already, how this"}, {"start": 26.4, "end": 32.72, "text": " worked, and so on. Of course, this paper here, also known as AlexNet, was the one that started"}, {"start": 32.72, "end": 38.64, "text": " the deep learning revolution, so to say, or at least contributed in large part to it."}, {"start": 38.64, "end": 43.84, "text": " It was the first paper that showed that you could train these very deep neural networks"}, {"start": 43.84, "end": 50.379999999999995, "text": " and very deep in here is a relative term. But the first one that showed that you could"}, {"start": 50.38, "end": 59.02, "text": " actually use CUDA GPUs to train those large networks efficiently, and it won the ImageNet"}, {"start": 59.02, "end": 66.52000000000001, "text": " competition that year. And it did so by a very, very large margin. So kind of shook"}, {"start": 66.52000000000001, "end": 72.68, "text": " the world. Because previously, computer vision was still doing like hand engineered features,"}, {"start": 72.68, "end": 79.08, "text": " and then using some kind of classifiers on top of those, this paper basically changed"}, {"start": 79.08, "end": 85.32, "text": " everything. So we'll go through the paper, and we'll see what was already known. And"}, {"start": 85.32, "end": 91.12, "text": " especially, I always enjoy with these papers, how did the choices that people make back"}, {"start": 91.12, "end": 97.56, "text": " then, how did they pull through to today, sort of what arbitrary choices that Alex Krzyzewski"}, {"start": 97.56, "end": 103.92, "text": " made right here? Are we still doing today? And what have we learned since then? So the"}, {"start": 103.92, "end": 109.12, "text": " paper is written relatively straightforward, I have to say, it's a good read, if you want"}, {"start": 109.12, "end": 114.32000000000001, "text": " to read it, and you know, straightforward, and sort of gives you a little bit of an intuition"}, {"start": 114.32000000000001, "end": 121.76, "text": " of how much work must have gone into this, which is, I guess, a lot. And yeah, so they"}, {"start": 121.76, "end": 128.24, "text": " start off by saying that, that current approaches to object recognition make essential use of"}, {"start": 128.24, "end": 133.88, "text": " machine learning methods. This was also new, right? Object recognition wasn't always learned"}, {"start": 133.88, "end": 140.68, "text": " the, you know, object recognizers, you could even do it in the in different way, like matching"}, {"start": 140.68, "end": 147.48, "text": " templates and so on. Machine learning was still one of the methods used. And of course,"}, {"start": 147.48, "end": 153.88, "text": " today, it's the method used. To improve their performance, we can collect larger data sets,"}, {"start": 153.88, "end": 159.07999999999998, "text": " learn more powerful models, and use better techniques for preventing overfitting. Until"}, {"start": 159.08, "end": 163.96, "text": " recently, data sets of labeled images were relatively small on the orders of 10s of 1000s"}, {"start": 163.96, "end": 171.56, "text": " of images. Okay, so this this specially at NORD, or here, the C410 or C4100. These are,"}, {"start": 171.56, "end": 176.24, "text": " you know, relatively small data sets with relatively small images as well, like C410"}, {"start": 176.24, "end": 183.84, "text": " is 32 by 32 pixels. So they're saying that, okay, when these small data sets, you know,"}, {"start": 183.84, "end": 190.12, "text": " you can you can solve it with classical computer vision models. But if you have larger data"}, {"start": 190.12, "end": 194.92000000000002, "text": " sets, and especially more realistic data sets, like bigger resolution, and so on, you need"}, {"start": 194.92000000000002, "end": 201.2, "text": " bigger models. So they say, but objects in realistic settings, exhibit considerable variability"}, {"start": 201.2, "end": 209.28, "text": " to learn to recognize them, it is necessary to use much larger training sets. Okay, so"}, {"start": 209.28, "end": 215.68, "text": " they say that this ImageNet data set is one of those larger data sets consists of 15 million"}, {"start": 215.68, "end": 222.12, "text": " labeled high resolution images in over 22,000 categories. And people keep forgetting this."}, {"start": 222.12, "end": 228.24, "text": " And I am included in that group of people, that the ImageNet data set is actually much"}, {"start": 228.24, "end": 233.6, "text": " larger than we know, than we when we talk of ImageNet. When we speak of ImageNet, we"}, {"start": 233.6, "end": 240.24, "text": " think of the ImageNet that has 1000 classes and about one or one and a half million images."}, {"start": 240.24, "end": 247.28, "text": " However, that's only a subset of the much, much larger ImageNet data set with in many,"}, {"start": 247.28, "end": 254.16, "text": " many more categories. It's just that the ImageNet competitions were performed on this subset,"}, {"start": 254.16, "end": 259.34, "text": " because I guess people thought, well, 1000 classes and million images is already plenty."}, {"start": 259.34, "end": 266.28, "text": " So we'll do that. So that's, I guess, how that came to be. So their argument is right"}, {"start": 266.28, "end": 271.03999999999996, "text": " here. To learn about 1000s of objects from millions of images, we need a model with a"}, {"start": 271.03999999999996, "end": 276.71999999999997, "text": " large learning capacity. However, the immense complexity of object recognition tasks means"}, {"start": 276.71999999999997, "end": 282.14, "text": " that this problem, this problem cannot be specified even by data set as large as ImageNet."}, {"start": 282.14, "end": 286.9, "text": " So our model should also have lots of prior knowledge to compensate for all the data we"}, {"start": 286.9, "end": 294.52, "text": " don't have. So their main argument for using neural networks is that the size of the data"}, {"start": 294.52, "end": 299.67999999999995, "text": " set is so large, therefore, we need a large model, you know, granted, they already recognize"}, {"start": 299.67999999999995, "end": 309.47999999999996, "text": " the inherent, the inherent connection between large models and a lot of complex data. But"}, {"start": 309.47999999999996, "end": 315.65999999999997, "text": " in the opposite, they say, well, even if we have that much data, the task we are trying"}, {"start": 315.66, "end": 323.34000000000003, "text": " to solve object recognition is way more complicated than the amount of data we have. So our model"}, {"start": 323.34000000000003, "end": 329.40000000000003, "text": " should also have lots of prior knowledge to compensate for all the data we don't have."}, {"start": 329.40000000000003, "end": 335.16, "text": " Remember at this time, convolutional neural networks weren't really, you know, known to"}, {"start": 335.16, "end": 339.72, "text": " do anything, I guess, I guess they were used for handwritten digit recognition, and so"}, {"start": 339.72, "end": 345.64000000000004, "text": " on and we're kind of on par with other methods. However, it wasn't like, obviously clear that"}, {"start": 345.64, "end": 351.03999999999996, "text": " you would use them for image recognition. So here they make they have to make like a"}, {"start": 351.03999999999996, "end": 357.24, "text": " argument to convince people that, okay, we can use neural networks for this tasks because"}, {"start": 357.24, "end": 364.21999999999997, "text": " they have such a high capacity. However, neural networks, feed forward neural networks are"}, {"start": 364.21999999999997, "end": 368.71999999999997, "text": " already too powerful. They don't know anything about the data, everything's connected to"}, {"start": 368.71999999999997, "end": 374.59999999999997, "text": " everything. And they argue right here, our model should have lots of prior knowledge"}, {"start": 374.6, "end": 380.98, "text": " to compensate for all the data we don't have. So they allude to the convolutional neural"}, {"start": 380.98, "end": 386.18, "text": " networks constitute one such class of models, their capacity can be controlled by varying"}, {"start": 386.18, "end": 391.18, "text": " the depth and breadth. And they also make strong and mostly correct assumptions about"}, {"start": 391.18, "end": 397.6, "text": " the nature of images, namely stationarity of statistics and locality of pixel dependencies."}, {"start": 397.6, "end": 404.28000000000003, "text": " So that their argument here is that the convolutional operation is such a strong prior, that is"}, {"start": 404.28, "end": 409.4, "text": " mostly consistent with what we know about images that they are very well suited to computer"}, {"start": 409.4, "end": 415.91999999999996, "text": " vision. Again, something that was not abundantly clear at the time as it is right now. It's"}, {"start": 415.91999999999996, "end": 420.47999999999996, "text": " interesting to see how they get to this point where they say we need lots of capacity, but"}, {"start": 420.47999999999996, "end": 430.38, "text": " we also need a model with lots of prior knowledge and and of course, CNN's fit that very well."}, {"start": 430.38, "end": 436.78, "text": " So they're they go into the problems of CNN, despite the attractive qualities, and despite"}, {"start": 436.78, "end": 441.94, "text": " the relative efficiency of their local architecture, they are prohibitively expensive to apply"}, {"start": 441.94, "end": 447.6, "text": " in large scale high resolution images. Luckily, current GPUs paired with a highly optimized"}, {"start": 447.6, "end": 453.24, "text": " implementation of 2d convolution are powerful enough to facilitate the training of interestingly"}, {"start": 453.24, "end": 458.48, "text": " large CNNs. And recent data sets such as ImageNet contain enough labeled example to train such"}, {"start": 458.48, "end": 465.16, "text": " model without severe overfitting. So overfitting was also still like very much at the forefront"}, {"start": 465.16, "end": 470.08000000000004, "text": " of people's minds back then. Right now, we don't really care about overfitting that much"}, {"start": 470.08000000000004, "end": 475.92, "text": " anymore. Basically, we figured out that if we just build large enough models, we we don't"}, {"start": 475.92, "end": 481.24, "text": " overfit, which is strange in itself, like this double descent phenomenon and so on."}, {"start": 481.24, "end": 489.34000000000003, "text": " But overfitting was still a a very much at the forefront of people's minds. And they"}, {"start": 489.34000000000003, "end": 496.64, "text": " do a lot of things here to prevent overfitting, which gives them kind of a boost in the test"}, {"start": 496.64, "end": 502.84000000000003, "text": " accuracy, which might actually not have been the overfitting that they're combating. So"}, {"start": 502.84000000000003, "end": 507.14, "text": " they do, for example, in data augmentation already in this paper, and they always allude"}, {"start": 507.14, "end": 513.92, "text": " to how this is to prevent overfitting. However, we know nowadays that it might not be the"}, {"start": 513.92, "end": 520.08, "text": " overfitting that's combated in the by data augmentation, it might actually be more have"}, {"start": 520.08, "end": 525.92, "text": " something to do with like regularizing your function, making it more smooth and so on."}, {"start": 525.92, "end": 533.28, "text": " But so you just see how how coming from a classical machine learning perspective, overfitting"}, {"start": 533.28, "end": 537.52, "text": " was like the number one or one of the number one problems in classical machine learning,"}, {"start": 537.52, "end": 545.4599999999999, "text": " you know, in SVMs and things like this. So it's it's, it's safe to say that they thought"}, {"start": 545.4599999999999, "end": 551.4599999999999, "text": " if we built these large models, we're going to have a huge overfitting problem. And yeah,"}, {"start": 551.4599999999999, "end": 558.0, "text": " so that's why this pulls through right here. Also, the I guess the one of the main contributions"}, {"start": 558.0, "end": 565.44, "text": " of this papers is to show to combine this CNN training with GPUs. Also not very non clear"}, {"start": 565.44, "end": 571.72, "text": " at the time, like it was known that you could do computation on GPUs. But the fact that"}, {"start": 571.72, "end": 578.4, "text": " these are, you know, very capable for training these CNNs, or generally neural networks wasn't"}, {"start": 578.4, "end": 584.88, "text": " something that was, you know, known at the time. So this paper basically showed that"}, {"start": 584.88, "end": 592.32, "text": " if you use a GPU, you can, you can get that much faster. And that makes it possible to"}, {"start": 592.32, "end": 600.08, "text": " train these big neural networks. Again, right here, the size of our network made overfitting"}, {"start": 600.08, "end": 605.4, "text": " a significant problem even with 1.2 million labeled training examples. So we use several"}, {"start": 605.4, "end": 611.84, "text": " effective techniques for preventing overfitting. And we'll, we'll look at those. And the end"}, {"start": 611.84, "end": 618.44, "text": " they say, the network's size is limited mainly by the amount of memory available on current"}, {"start": 618.44, "end": 623.4, "text": " GPUs and by the amount of training time that we're willing to tolerate. Our network takes"}, {"start": 623.4, "end": 630.5600000000001, "text": " between five and six days to train on two GTX 580 GPUs. All of our experiments suggest"}, {"start": 630.5600000000001, "end": 635.24, "text": " that our results can be improved by simply waiting for faster GPUs and bigger data sets"}, {"start": 635.24, "end": 640.8000000000001, "text": " to become available. And I mean, that proved to be absolutely true. We don't necessarily"}, {"start": 640.8, "end": 648.68, "text": " have bigger data sets right now, though we do. But certainly with faster GPUs and bigger"}, {"start": 648.68, "end": 656.16, "text": " GPUs, this became a this became the these networks became better simply by increasing"}, {"start": 656.16, "end": 661.4799999999999, "text": " their depth. And as you know, then Resnets came along, increasing the depth by an order"}, {"start": 661.4799999999999, "end": 668.0, "text": " of magnitude, and that gave another boost to computer vision. Alright, so they talk"}, {"start": 668.0, "end": 674.16, "text": " about the ImageNet data set here. And the main point in the ImageNet data set right"}, {"start": 674.16, "end": 681.12, "text": " here is the fact that the images are plenty. So there are over a million training images"}, {"start": 681.12, "end": 688.64, "text": " in this subset with 1000 classes, which was, you know, a very big that was that was unlike"}, {"start": 688.64, "end": 693.88, "text": " CIFAR 10 had 10 classes, CIFAR 100 had 100 classes, that was already a lot. A thousand"}, {"start": 693.88, "end": 702.6, "text": " classes that is like unheard of before this data set, I guess not unheard of, but yeah,"}, {"start": 702.6, "end": 709.12, "text": " and a million training images, completely crazy. And also, not only was it a lot of"}, {"start": 709.12, "end": 718.56, "text": " images, they were resolution was really big. So in the order of 256 by 256, whereas previous"}, {"start": 718.56, "end": 726.4399999999999, "text": " methods all were like 32 by 32. So definitely challenging data set. Even today, it's a challenging"}, {"start": 726.4399999999999, "end": 732.8399999999999, "text": " data set. Alright, so the architecture, the architecture, and there's this famous graphic"}, {"start": 732.8399999999999, "end": 740.68, "text": " right here of the Alex net architecture. So briefly, they describe these convolutional"}, {"start": 740.68, "end": 746.4599999999999, "text": " layers right here, as you can see, there's max pooling already here, they have dense"}, {"start": 746.46, "end": 753.88, "text": " layers at the end, they do generally increase the number of feature maps right here, while"}, {"start": 753.88, "end": 760.36, "text": " decreasing the resolution with max pooling. So all of this has sort of, you know, kept"}, {"start": 760.36, "end": 765.44, "text": " until today, I guess they also took it from earlier work on convolutional neural networks"}, {"start": 765.44, "end": 772.76, "text": " that generally found this to be a good idea. And the important part here, that is kind"}, {"start": 772.76, "end": 777.8, "text": " of special to Alex net is you can see there's are these two different pipelines. And, you"}, {"start": 777.8, "end": 783.88, "text": " know, Alex, for cutting off this part right here, I mean, you just know, like, there's"}, {"start": 783.88, "end": 789.72, "text": " the eight pages, we need to like we have like three lines too much, how can we fit the three"}, {"start": 789.72, "end": 794.76, "text": " lines, we've already cropped everything. Let's just cut off the top half here. It's essentially"}, {"start": 794.76, "end": 802.36, "text": " the same as the bottom. Yeah, so space constraints and PDFs for conference submissions,"}, {"start": 802.36, "end": 809.52, "text": " ruining yet another paper. Alright, but you can see there's this two this this two column"}, {"start": 809.52, "end": 816.72, "text": " architecture right here. So this network was so large that it didn't fit on one GPU. So"}, {"start": 816.72, "end": 823.64, "text": " they had to split it on two GPUs with the occasional intercommunication, right, you"}, {"start": 823.64, "end": 830.08, "text": " can see here, there's intercommunication between the two GPUs. And there is also no intercommunication"}, {"start": 830.08, "end": 835.84, "text": " right here on this layer. This was very intricate. That was one thing that really didn't hold"}, {"start": 835.84, "end": 841.76, "text": " until today, I guess until now with things like, I don't know, G shard or so, where you"}, {"start": 841.76, "end": 847.72, "text": " have different weights on different GPUs. Again, I guess the the invention of bigger"}, {"start": 847.72, "end": 853.88, "text": " GPUs made that sort of superfluous. But just imagine the amount of code they had to write,"}, {"start": 853.88, "end": 858.88, "text": " there was no TensorFlow at this point there. I don't think there was even cafe around there"}, {"start": 858.88, "end": 867.84, "text": " was just CUDA. And yeah, just this cross GPU memory writing, I just imagined this to be"}, {"start": 867.84, "end": 875.8, "text": " so so ugly, and big respect for writing all of this, all of this code. Alright, so the"}, {"start": 875.8, "end": 882.12, "text": " they go through a number of important things. And most of the things here aren't their invention,"}, {"start": 882.12, "end": 889.12, "text": " I would say, but they cleverly combine things that were already known about neural networks"}, {"start": 889.12, "end": 893.68, "text": " and things that were maybe developed somewhere that they have found to work really well."}, {"start": 893.68, "end": 898.8, "text": " So the first one is the relu non linearity. Now, of course, relu is nowadays all like"}, {"start": 898.8, "end": 904.88, "text": " abundant. Everyone uses relu nonlinearities. But at that time, it was still very much in"}, {"start": 904.88, "end": 910.04, "text": " fashion to use something like the sigmoid right here or the hyperbolic tangent. And"}, {"start": 910.04, "end": 915.8399999999999, "text": " why is that because the neural networks were still inspired by the neurons where you had"}, {"start": 915.8399999999999, "end": 921.8, "text": " the soma of the neuron and then the input dendrites, sorry, dendrites with the input"}, {"start": 921.8, "end": 929.16, "text": " axons, and then you would sum up all the incoming signals. And then that would go over. So in"}, {"start": 929.16, "end": 938.1999999999999, "text": " a true neuron, you have this, this, this kind of curve where if the input rises above this"}, {"start": 938.2, "end": 945.12, "text": " order right here, the the action potential, maybe, I don't know what the the English term"}, {"start": 945.12, "end": 952.24, "text": " is, then if it rise above that, then the neuron would start to spike, right. And if it's below"}, {"start": 952.24, "end": 959.6, "text": " that it wouldn't. So people wanted to approximate this using some sort of a, a kind of differentiable,"}, {"start": 959.6, "end": 965.9200000000001, "text": " but something that's very similar to this step function. And that ultimately led to"}, {"start": 965.92, "end": 972.88, "text": " something like a sigmoid or an hyperbolic tangent. So people trying to stay close to"}, {"start": 972.88, "end": 979.12, "text": " biological neurons did this, but that gives you the problem that in this region, and in"}, {"start": 979.12, "end": 985.5999999999999, "text": " this region right here, you have almost no gradient to learn from. So you can see that"}, {"start": 985.5999999999999, "end": 994.88, "text": " they argue that in terms of training time with gradient descent, the saturating nonlinearities,"}, {"start": 994.88, "end": 999.96, "text": " so the hyperbolic tangent and the sigmoid are much slower than the non saturating linear"}, {"start": 999.96, "end": 1005.4, "text": " non linearity. This one following Naren Tinton, we refer to neurons with this non linearity"}, {"start": 1005.4, "end": 1013.56, "text": " as rectified linear units. So taken from this, this other paper, they say, okay, we use these"}, {"start": 1013.56, "end": 1020.7, "text": " relu's, these rectified linear units, which are not exactly like real biological neurons,"}, {"start": 1020.7, "end": 1028.76, "text": " but they train much faster, right. And of course, relu's are used until this day. So"}, {"start": 1028.76, "end": 1034.28, "text": " you can see right here that a this is on a CIFAR 10. And they measure the time to reach"}, {"start": 1034.28, "end": 1041.68, "text": " 25% of the training error. And this here is with the relu's. And this here is with the"}, {"start": 1041.68, "end": 1048.48, "text": " hyperbolic tangent. And it takes much longer to reach the hyperbolic tangent, especially"}, {"start": 1048.48, "end": 1055.88, "text": " it takes six times faster to with the relu's. And they say that's one of the main components"}, {"start": 1055.88, "end": 1061.92, "text": " that allows them to learn this fast to even experiment with these big networks, because"}, {"start": 1061.92, "end": 1067.76, "text": " their entire training time is six days, right. But they probably didn't train it only once"}, {"start": 1067.76, "end": 1073.44, "text": " they experimented with it and saw what works. So if you have a couple of months of time"}, {"start": 1073.44, "end": 1079.24, "text": " and it takes you a week to train one of these things, you know, you don't, you can't afford"}, {"start": 1079.24, "end": 1085.3200000000002, "text": " a six times slowdown. Because that would mean you can only train like two models in the"}, {"start": 1085.3200000000002, "end": 1092.24, "text": " entire course of research. And that would severely hinder your progress. Now we are"}, {"start": 1092.24, "end": 1097.64, "text": " at the point where that becomes true again with these giant, giant transformer language"}, {"start": 1097.64, "end": 1104.0400000000002, "text": " models where people can train it once and then you know, like GPT-3 they say, oh, we"}, {"start": 1104.0400000000002, "end": 1108.96, "text": " made we discovered a bug halfway through and we've kind of fixed it but we're not sure"}, {"start": 1108.96, "end": 1114.96, "text": " we couldn't restart because it was too expensive. Maybe we're waiting for a moment. I'm still"}, {"start": 1114.96, "end": 1121.68, "text": " saying we're waiting for the resonant moment in the transformers. But yeah, relu's in,"}, {"start": 1121.68, "end": 1129.48, "text": " you know, here in not introduced here, but used here and have been prevailing until today."}, {"start": 1129.48, "end": 1135.2, "text": " Training on multiple GPUs, something as I said that didn't didn't really get forward"}, {"start": 1135.2, "end": 1141.6000000000001, "text": " from here, especially the kind of GPU train. So if we train on multiple GPUs today, what"}, {"start": 1141.6000000000001, "end": 1148.8, "text": " we mean is that we have our model, right, and then we distribute that to multiple GPUs"}, {"start": 1148.8, "end": 1155.44, "text": " like this. And then we take a mini batch from the training data. And we simply split it"}, {"start": 1155.44, "end": 1161.28, "text": " up, let each GPU do its thing on its subset of the mini batch, and then at the end, kind"}, {"start": 1161.28, "end": 1167.04, "text": " of calculate the loss and then back propagate the gradients and synchronize the gradients"}, {"start": 1167.04, "end": 1172.8799999999999, "text": " between that. So we have one model that is on both GPUs. Here they distribute a model"}, {"start": 1172.88, "end": 1180.2800000000002, "text": " to two GPUs. And I'm also thinking that with frameworks like G shard, this could potentially"}, {"start": 1180.2800000000002, "end": 1188.2, "text": " have a revival, right here, this kind of distributing your models, especially within the same layer"}, {"start": 1188.2, "end": 1196.7600000000002, "text": " across many GPUs, and then having cross communication only at some points. So their argument is,"}, {"start": 1196.7600000000002, "end": 1201.0, "text": " this only has three gigabytes of memory, which limits the maximum size of networks can be"}, {"start": 1201.0, "end": 1206.44, "text": " trained on it. Turns out that 1.2 million training samples are enough to train networks,"}, {"start": 1206.44, "end": 1212.72, "text": " which are too big to fit on one GPU. Therefore, we spread the net across two GPUs. Current"}, {"start": 1212.72, "end": 1217.66, "text": " GPUs are particularly well suited to cross GPU parallelization, as they're able to read"}, {"start": 1217.66, "end": 1224.44, "text": " from and write to one another's memory directly without going through the host machine. Okay,"}, {"start": 1224.44, "end": 1232.98, "text": " so this means that for so sorry, here, they say the parallelization scheme that we employ"}, {"start": 1232.98, "end": 1239.56, "text": " essentially puts half the kernels or neurons on each GPU. With one additional trick, the"}, {"start": 1239.56, "end": 1244.3600000000001, "text": " GPUs communicate only in certain layers. That means that for example, the kernels of layer"}, {"start": 1244.3600000000001, "end": 1248.92, "text": " three take input from all kernel maps and layer two however the kernels in layer four,"}, {"start": 1248.92, "end": 1253.96, "text": " take input only from the kernel maps in layer three, which reside on the same GPU. So very,"}, {"start": 1253.96, "end": 1263.44, "text": " very interesting choice right here. And they they justify this here or they say the results."}, {"start": 1263.44, "end": 1269.4, "text": " This scheme reduces our top one top five error rates by 1.7 to 1.2% respectively, as compared"}, {"start": 1269.4, "end": 1274.48, "text": " with a net with half as many kernels in each computational layer in each convolutional"}, {"start": 1274.48, "end": 1281.16, "text": " layer on one GPU. The two GPU net takes slightly less time to train than the one GPU net. So"}, {"start": 1281.16, "end": 1288.48, "text": " first of all, I have to say, big respect right here like, like, I can imagine they did this,"}, {"start": 1288.48, "end": 1292.24, "text": " you know, with the relu's and stuff, and they were already better than previous because"}, {"start": 1292.24, "end": 1297.96, "text": " they're so just to go to the results, the pre they beat the error rates of previous"}, {"start": 1297.96, "end": 1306.52, "text": " models by G enormous amount. So this is what they knew right here. This is on the 2010"}, {"start": 1306.52, "end": 1314.04, "text": " image net split. So the previous best ones were like at around 2825%. And here their"}, {"start": 1314.04, "end": 1320.6399999999999, "text": " best one is at 17% top five error rate, I'm going to imagine that they trained it first"}, {"start": 1320.6399999999999, "end": 1325.6399999999999, "text": " and we're already better than the 25%. And I guess lots of people would just call it"}, {"start": 1325.6399999999999, "end": 1330.28, "text": " a day would be like, Oh, cool, we have this entirely new method. Not only did we show"}, {"start": 1330.28, "end": 1336.28, "text": " that we can train it, we actually show that it's better. And bada boom, I have point 1%"}, {"start": 1336.28, "end": 1342.08, "text": " error rate, and everything else can be a separate paper. No, they stuck with it, and they pushed"}, {"start": 1342.08, "end": 1346.6, "text": " it each. So each of these things right here, they say, Oh, this reduces the error rate"}, {"start": 1346.6, "end": 1353.78, "text": " by 1%. This reduces the error rate by 2%. And, you know, really, they they went about"}, {"start": 1353.78, "end": 1359.26, "text": " it, how far can we push this with everything? I mean, just imagine you come and you train"}, {"start": 1359.26, "end": 1365.68, "text": " a network, I'm pretty sure they first trained on one GPU, right? And, um, and then they"}, {"start": 1365.68, "end": 1371.8, "text": " thought, Oh, you know, maybe we can train an even bigger network by using two GPUs."}, {"start": 1371.8, "end": 1377.68, "text": " And then they realized what it's gonna take like a crap ton amount of dumb code to cross"}, {"start": 1377.68, "end": 1381.8, "text": " synchronize and keep them in lockstep and blah, blah, blah, like, it's not even easy"}, {"start": 1381.8, "end": 1387.8, "text": " to write multi GPU code today with all the frameworks, just imagine that. And for them"}, {"start": 1387.8, "end": 1394.2, "text": " to having already observed that their network does better than everything that was previously"}, {"start": 1394.2, "end": 1401.1200000000001, "text": " to sit down and do the cross GPU thing, experiment with Okay, when do we cross communicate and"}, {"start": 1401.1200000000001, "end": 1411.24, "text": " whatnot, that is very, very respectable, right here. So maybe a lesson to be learned, or,"}, {"start": 1411.24, "end": 1415.8, "text": " or just the mentality of the people, maybe they just had more time, they were like, Okay,"}, {"start": 1415.8, "end": 1422.4, "text": " it's still like two months out, just competition deadline. I don't know. But no, I'm this,"}, {"start": 1422.4, "end": 1429.1200000000001, "text": " this is not something that I see today, very often, this this kind of persistence and additional"}, {"start": 1429.1200000000001, "end": 1434.52, "text": " pushing and reporting of what works in these kinds of things. I mean, some, some papers"}, {"start": 1434.52, "end": 1439.88, "text": " do it. But most papers do it because only with all the tricks, they can get that point"}, {"start": 1439.88, "end": 1446.3200000000002, "text": " 1% improvement. And this one already had the improvement and did it anyway. Okay, but multi"}, {"start": 1446.32, "end": 1453.96, "text": " GPU training didn't really like splitting the models across GPUs didn't really didn't"}, {"start": 1453.96, "end": 1459.6399999999999, "text": " really stick around, mainly because I guess the GPUs got larger in memory pretty quickly."}, {"start": 1459.6399999999999, "end": 1465.28, "text": " So it wasn't that necessary. But also, I guess, because the frameworks were just too clunky."}, {"start": 1465.28, "end": 1471.08, "text": " And now maybe witchy shard, this is coming back. So worth another shot, I guess. Next"}, {"start": 1471.08, "end": 1477.52, "text": " one, local response normalization, this also didn't really stick around, I got kind of"}, {"start": 1477.52, "end": 1482.9199999999998, "text": " dumped in favor of things like batch normalization. But with the resurfacing of things like layer"}, {"start": 1482.9199999999998, "end": 1490.58, "text": " normalization, this, it comes back to this thing here again, a little bit. So what they"}, {"start": 1490.58, "end": 1498.32, "text": " say is that what they want to do is they want to kind of normalize the response of these"}, {"start": 1498.32, "end": 1505.84, "text": " of these relu's. So what they do is each response, which is this alpha, they are these a here"}, {"start": 1505.84, "end": 1514.4199999999998, "text": " is normalized by the following quantity. And it's the all the responses of the other neurons"}, {"start": 1514.4199999999998, "end": 1519.2, "text": " around them or of the other kernels around them. And you can see the sum is over this"}, {"start": 1519.2, "end": 1524.84, "text": " weird quantity right here. So what does it mean if they have a bunch of convolutional"}, {"start": 1524.84, "end": 1531.3999999999999, "text": " filters? And these are the activation. So these are the feature maps after the convolution."}, {"start": 1531.3999999999999, "end": 1537.8, "text": " And yeah, so if I have like 10 convolutional filters in my layer, this is going to be the"}, {"start": 1537.8, "end": 1547.76, "text": " output, the way they normalize is they normalize each filter, sorry, each output channel by"}, {"start": 1547.76, "end": 1557.56, "text": " averaging by see here, dividing by the average response of the channels around them, right."}, {"start": 1557.56, "end": 1561.96, "text": " So let's maybe say the five channels, the two channels in front of them and two channels"}, {"start": 1561.96, "end": 1568.2, "text": " behind them, this is going to be they take the average across this one. And then for"}, {"start": 1568.2, "end": 1573.24, "text": " another channel right here, for this one, you would take the average of the five around"}, {"start": 1573.24, "end": 1578.72, "text": " that this isn't really something that stuck around, I guess, mainly because of the really"}, {"start": 1578.72, "end": 1587.4, "text": " dynamic situation right here. What people do today is they have things like layer normalization"}, {"start": 1587.4, "end": 1593.76, "text": " that simply averages across all of the channels, or they have group normalization that pre"}, {"start": 1593.76, "end": 1600.48, "text": " defines these groups like here is there's two groups. And we only normalize within this"}, {"start": 1600.48, "end": 1607.6, "text": " group and within this group, also always the same, this kind of dynamic normalization on"}, {"start": 1607.6, "end": 1614.1200000000001, "text": " across neighboring filters, as I said, didn't really stick around, not really sure why,"}, {"start": 1614.1200000000001, "end": 1621.24, "text": " but I guess it was just easier to implement it otherwise, or it just worked better. Again,"}, {"start": 1621.24, "end": 1628.24, "text": " here they say, this, this, it was motivated well, right, this scheme bears some resemblance"}, {"start": 1628.24, "end": 1632.72, "text": " to the local contrast normalization scheme of that, but ours would be more correctly"}, {"start": 1632.72, "end": 1638.56, "text": " termed brightness normalization, since we do not subtract the mean activity. Oh, they"}, {"start": 1638.56, "end": 1646.8, "text": " make it connection to biological neurons. Where is it? This sort of response normalization"}, {"start": 1646.8, "end": 1653.16, "text": " implements a form of lateral inhibition, inspired by type found in real neurons creating competition"}, {"start": 1653.16, "end": 1660.76, "text": " for big activities amongst neuron outputs computed using different kernels. Okay, so"}, {"start": 1660.76, "end": 1666.1200000000001, "text": " kind of inspired by real neurons, but also kind of inspired by other people doing also"}, {"start": 1666.1200000000001, "end": 1670.94, "text": " some kind of normalization. So people already knew that normalization was helpful at some"}, {"start": 1670.94, "end": 1676.3600000000001, "text": " times. And this is what they employed right here. Again, reducing the top error rates"}, {"start": 1676.36, "end": 1684.9599999999998, "text": " by 1.4 and 1.2%, respectively. So not a big improvement, but still an improvement. The"}, {"start": 1684.9599999999998, "end": 1691.12, "text": " last thing overlapping pooling, again, a thing that didn't really stick around that much,"}, {"start": 1691.12, "end": 1696.56, "text": " where they say, okay, instead of having a pooling layer, so if this is your image, and"}, {"start": 1696.56, "end": 1704.1599999999999, "text": " instead of pooling two by two in the stride of two, like we do today, and you know, pull"}, {"start": 1704.16, "end": 1711.88, "text": " it down to a smaller image, what we can do instead, is we can pull with overlapping windows."}, {"start": 1711.88, "end": 1717.16, "text": " So in that case, they pull with a three by three window, but they do always do stride"}, {"start": 1717.16, "end": 1723.1200000000001, "text": " of two. So they have like these overlaps right here, resulting in the same size. But then"}, {"start": 1723.1200000000001, "end": 1730.42, "text": " each pixel right here has some sort of overlapping information from the pixels around it. Again,"}, {"start": 1730.42, "end": 1738.04, "text": " they say it reduces the top one and top five error rates by 0.4% and 0.3%. Maybe this this"}, {"start": 1738.04, "end": 1745.16, "text": " didn't stick around because I'm not sure maybe because people found it doesn't work in other"}, {"start": 1745.16, "end": 1752.8400000000001, "text": " problems. Who knows? So the overall architecture, as we said, is described in this picture right"}, {"start": 1752.8400000000001, "end": 1759.42, "text": " here. So you have the input image, which you can see has three channels. And they use convolutional"}, {"start": 1759.42, "end": 1765.68, "text": " filters with a here with a stride of four at the beginning to reduce the size. So at"}, {"start": 1765.68, "end": 1774.8400000000001, "text": " the beginning, it's 224 by 224. And then it's 48 by sorry, it's 55 by 55. That thing here"}, {"start": 1774.8400000000001, "end": 1783.48, "text": " 55 by 5548 feature maps, you can already see, as we said before, the feature maps keep increasing,"}, {"start": 1783.48, "end": 1791.68, "text": " while the number of the dimension, the resolution of the image keeps decreasing. The stride"}, {"start": 1791.68, "end": 1797.3, "text": " of four convolution here already employed in order to downsample the image at the same"}, {"start": 1797.3, "end": 1803.6, "text": " time as convolving it. Nowadays, a lot of architectures will simply not do max pooling"}, {"start": 1803.6, "end": 1809.3, "text": " at all, but always use the kind of strided convolution to downsample image while convolving"}, {"start": 1809.3, "end": 1819.6399999999999, "text": " it. What you also see here is that they thought that the feature map size should should also"}, {"start": 1819.6399999999999, "end": 1825.36, "text": " be large at the beginning, and then decrease, which is a reasonable assumption, right? Because"}, {"start": 1825.36, "end": 1830.04, "text": " if you have higher resolution images, you're probably going to need higher resolution feature"}, {"start": 1830.04, "end": 1837.62, "text": " maps. This didn't really come through until today. As you know, most architectures today,"}, {"start": 1837.62, "end": 1844.32, "text": " they just go with like three by three kernels from the very start, and don't really care"}, {"start": 1844.32, "end": 1851.7399999999998, "text": " about you know, also downsizing their, their filters. I don't really know why, whether"}, {"start": 1851.7399999999998, "end": 1858.6399999999999, "text": " it's just more convenient or less parameters, or whether there's really something to having"}, {"start": 1858.6399999999999, "end": 1863.78, "text": " small filters, but I just know, you know, this is something the large filters at the"}, {"start": 1863.78, "end": 1872.44, "text": " beginning is something that didn't didn't hold over time. Also, you can see right here,"}, {"start": 1872.44, "end": 1878.54, "text": " they have multiple dense layers at the end, I believe most architectures today simply"}, {"start": 1878.54, "end": 1884.26, "text": " go with two of those instead of three. So one like hidden layer, and then one classification"}, {"start": 1884.26, "end": 1890.84, "text": " layer. But it's, you know, it's, it's very close to the architectures today, right? There"}, {"start": 1890.84, "end": 1896.98, "text": " hasn't changed that much like the difference between this and the VGG 16 VGG 19 network"}, {"start": 1896.98, "end": 1902.06, "text": " is just depth. And then the difference between those and the resnet is just the whatever"}, {"start": 1902.06, "end": 1908.4399999999998, "text": " the skip connections right here. And that's where we are today. So so there hasn't, hasn't"}, {"start": 1908.4399999999998, "end": 1913.34, "text": " changed that much. Honestly, they also allude to the fact that actually, even though it"}, {"start": 1913.34, "end": 1918.62, "text": " doesn't look like it, most parameters are here in these dense layers. Those are most"}, {"start": 1918.62, "end": 1924.34, "text": " parameters of the network. This right here, a convolutional layer is like 1% of the parameters,"}, {"start": 1924.34, "end": 1929.76, "text": " even though it takes up a lot of space in the in the drawing. So maybe the reduction"}, {"start": 1929.76, "end": 1934.06, "text": " in the number of classification layers at the end also has something to do with the"}, {"start": 1934.06, "end": 1939.9399999999998, "text": " fact that that's where most parameters are. So if you get rid of one of those dense layers,"}, {"start": 1939.94, "end": 1949.9, "text": " you can like get many, many more convolutional layers. Alright, so the last part here is"}, {"start": 1949.9, "end": 1957.6000000000001, "text": " on reducing overfitting again, they didn't really investigate whether or not really their"}, {"start": 1957.6000000000001, "end": 1962.54, "text": " network was overfitting, like really establishing the overfitting it was I think maybe they"}, {"start": 1962.54, "end": 1968.88, "text": " did and maybe it was actually overfitting. But we now we we don't care about overfitting"}, {"start": 1968.88, "end": 1974.46, "text": " too much anymore. Maybe because we already use these augmentations naturally, but also"}, {"start": 1974.46, "end": 1980.3200000000002, "text": " because we built these deep models. So we somehow have an idea that they generalize"}, {"start": 1980.3200000000002, "end": 1985.6000000000001, "text": " naturally, I'm not sure whether they actually were only worried about it that much because"}, {"start": 1985.6000000000001, "end": 1991.68, "text": " of the history of machine learning, or whether they actually did see that everything was"}, {"start": 1991.68, "end": 1997.48, "text": " overfitting constantly. Okay, they say our neural network architecture has 60 million"}, {"start": 1997.48, "end": 2002.78, "text": " parameters. Although the thousand classes make each training example impose 10 bits"}, {"start": 2002.78, "end": 2007.06, "text": " of constraints on the mapping from image to label, this turns out to be insufficient to"}, {"start": 2007.06, "end": 2011.78, "text": " learn many parameters without considerable overfitting. Below we describe two primary"}, {"start": 2011.78, "end": 2017.06, "text": " ways in which we combat overfitting. Again, there's no one today, no one today makes this"}, {"start": 2017.06, "end": 2022.54, "text": " argument anymore. This Oh, we have this many parameters and there are that many images,"}, {"start": 2022.54, "end": 2029.58, "text": " right? We have 60 million parameters. We have 1.2 million images, 1000 classes, how you"}, {"start": 2029.58, "end": 2038.08, "text": " know when, how many parameters per sample is that and so on, how many bits of constraint"}, {"start": 2038.08, "end": 2045.26, "text": " we don't care about. We're fine with having like a billion times more parameters than"}, {"start": 2045.26, "end": 2052.54, "text": " training samples. We we don't worry about it anymore. So the first thing they do is"}, {"start": 2052.54, "end": 2058.9, "text": " data augmentation already. I mean, this was already known again, like lots of these things"}, {"start": 2058.9, "end": 2065.42, "text": " here were already known, but the the combination is just so cool in this paper where so first"}, {"start": 2065.42, "end": 2073.32, "text": " of all, again, they say, the transformed images are generating Python code on the CPU while"}, {"start": 2073.32, "end": 2078.34, "text": " the GPU is training on the previous batch of images. So these data augmentation schemes"}, {"start": 2078.34, "end": 2085.46, "text": " are in effect computationally free. Again, this code must have been ugly. The first form"}, {"start": 2085.46, "end": 2091.5800000000004, "text": " of data augmentation consists of generating image translations and horizontal reflections."}, {"start": 2091.5800000000004, "end": 2097.82, "text": " We do this by extracting random 224 by 224 patches and their horizontal reflections from"}, {"start": 2097.82, "end": 2106.5800000000004, "text": " the 256 by 256 images. Okay, so random. So this was already this, these are the most"}, {"start": 2106.5800000000004, "end": 2112.1400000000003, "text": " valuable data augmentations that still we have today. Random horizontal flipping is"}, {"start": 2112.1400000000003, "end": 2118.2200000000003, "text": " still used in every pipeline of computer vision except if you want to read text, I guess."}, {"start": 2118.2200000000003, "end": 2127.26, "text": " And random cropping is still the most powerful data augmentation technique for images today."}, {"start": 2127.26, "end": 2136.82, "text": " And the it's crazy that this was already discovered. And I, I don't know whether they say right"}, {"start": 2136.82, "end": 2142.46, "text": " here how much this particular thing improves. I don't think they have a stat on how much"}, {"start": 2142.46, "end": 2147.46, "text": " this improves. They just say how much this this next thing improves. But I'm going to"}, {"start": 2147.46, "end": 2153.34, "text": " guess this was one of the vital things for pushing the performance because now we know"}, {"start": 2153.34, "end": 2159.6600000000003, "text": " cropping is very important. I guess they thought that they would, you know, translation was"}, {"start": 2159.6600000000003, "end": 2167.38, "text": " the important part. And so they focused on generating image translations. And to generate"}, {"start": 2167.38, "end": 2174.26, "text": " an image translation from a single image, naturally you have to crop it. However, we"}, {"start": 2174.26, "end": 2180.06, "text": " we now focus much more on the fact that we crop it and kind of have different sub images"}, {"start": 2180.06, "end": 2184.74, "text": " of the same image, especially in, you know, self supervised learning and things like this."}, {"start": 2184.74, "end": 2192.2999999999997, "text": " We know that cropping is what is like the the power horse of these methods. So the fact"}, {"start": 2192.2999999999997, "end": 2197.34, "text": " that they extract random patches right here means that their network only operates on"}, {"start": 2197.34, "end": 2201.94, "text": " these sub patches. And then they compensate by a test time the networks makes a prediction"}, {"start": 2201.94, "end": 2206.7999999999997, "text": " by extracting five patches, the four corner patches and the center patch as well as their"}, {"start": 2206.8, "end": 2212.3, "text": " horizontal reflections and averaging the prediction made by the network's softmax layer on the"}, {"start": 2212.3, "end": 2219.26, "text": " 10 patches. I also believe that people don't do this too much. Nowadays, they most of the"}, {"start": 2219.26, "end": 2225.78, "text": " time they simply rescale the test images or something like this or fine tune at the end"}, {"start": 2225.78, "end": 2231.1800000000003, "text": " on the kind of scale training images, there are various techniques for doing this, but"}, {"start": 2231.18, "end": 2239.2599999999998, "text": " random cropping and horizontal flipping already employed right here. Also color, kind of color"}, {"start": 2239.2599999999998, "end": 2244.74, "text": " jittering, a form of color jittering, a very special form, altering the intensities of"}, {"start": 2244.74, "end": 2251.14, "text": " RGB channels and training images. Specifically, we perform PCA on the set of RGB pixel values"}, {"start": 2251.14, "end": 2256.02, "text": " throughout the ImageNet training set. To each training image, we add multiples of the found"}, {"start": 2256.02, "end": 2262.38, "text": " principal components with magnitudes proportional to the corresponding eigenvalues times a random"}, {"start": 2262.38, "end": 2267.38, "text": " variable drawn from a Gaussian with zero mean and standard deviation point one. This is"}, {"start": 2267.38, "end": 2273.9, "text": " I believe this has gone out of fashion. So people do color jitter and kind of brightness"}, {"start": 2273.9, "end": 2284.7, "text": " jitter and so on. But I don't think they particularly do this kind of PCA based image, image augmentation"}, {"start": 2284.7, "end": 2295.02, "text": " right here anymore. They say this scheme reduces the top one error rate by over 1%. I wonder"}, {"start": 2295.02, "end": 2299.62, "text": " why this isn't working, maybe because you need these stats over the entire data set"}, {"start": 2299.62, "end": 2305.12, "text": " and the other things may be working equivalently well, but you can simply apply them without"}, {"start": 2305.12, "end": 2313.2999999999997, "text": " knowing kind of your principal components. Okay, next thing, dropout. Dropout has been,"}, {"start": 2313.3, "end": 2319.46, "text": " you know, one of the things that was very important throughout the early stages of deep"}, {"start": 2319.46, "end": 2325.1800000000003, "text": " learning isn't that important anymore. Now, dropout, some people still use it, but most"}, {"start": 2325.1800000000003, "end": 2331.94, "text": " people I think don't use dropout anymore. And it's very interesting to see, but it definitely"}, {"start": 2331.94, "end": 2339.98, "text": " was a technique that was used a lot during like from Alex net to basically like now,"}, {"start": 2339.98, "end": 2346.7400000000002, "text": " like the last very few years. So they say, combining the predictions of many different"}, {"start": 2346.7400000000002, "end": 2351.14, "text": " models is a very successful way to reduce test errors, but it appears to be too expensive"}, {"start": 2351.14, "end": 2356.5, "text": " or big neural networks that already take several days to train. There is however, a very efficient"}, {"start": 2356.5, "end": 2361.82, "text": " version of model combination that only costs about a factor of two during training. So"}, {"start": 2361.82, "end": 2366.7400000000002, "text": " there's this technique called dropout, then they explain it to set to zero the output"}, {"start": 2366.74, "end": 2374.66, "text": " of each hidden neuron with probability point five. Again, people didn't know about dropout"}, {"start": 2374.66, "end": 2383.2999999999997, "text": " as they do now. But they introduced this right here. And they say it reduces their not sure"}, {"start": 2383.2999999999997, "end": 2389.4199999999996, "text": " that they also don't say how they how much they by how much this reduces the training"}, {"start": 2389.4199999999996, "end": 2393.3399999999997, "text": " error, but they say we use dropout in the first two fully connected layers. Without"}, {"start": 2393.34, "end": 2398.2200000000003, "text": " dropout, our network exhibits substantial overfitting dropout roughly doubles the number"}, {"start": 2398.2200000000003, "end": 2404.06, "text": " of iterations required to converge. So okay, so they did actually make sure or they did"}, {"start": 2404.06, "end": 2411.1000000000004, "text": " find the actual evidence of overfitting and saw that dropout reduces that. And I wonder"}, {"start": 2411.1000000000004, "end": 2417.26, "text": " why this doesn't happen nowadays, maybe because we have the we have less of these fully connected"}, {"start": 2417.26, "end": 2422.42, "text": " layers, but I can't really imagine. Maybe because we do more augmentation. I don't I"}, {"start": 2422.42, "end": 2426.7000000000003, "text": " don't know or maybe dropout is still used and I'm just I just don't know it and don't"}, {"start": 2426.7000000000003, "end": 2439.66, "text": " see it. Yeah, so here they use momentum to train this. And they do some qualitative analysis."}, {"start": 2439.66, "end": 2443.38, "text": " They do some qualitative analysis. So first of all, they say, okay, they shatter all of"}, {"start": 2443.38, "end": 2449.94, "text": " the previous approaches, especially also then they build kind of ensemble methods, and they"}, {"start": 2449.94, "end": 2456.94, "text": " pre train they already do transfer learning, they already pre train on ImageNet 2011. And"}, {"start": 2456.94, "end": 2464.3, "text": " fine tune, then on the ImageNet 2012, right here, the ImageNet 2011, da da da da da, and"}, {"start": 2464.3, "end": 2470.38, "text": " then fine tuning on the ImageNet 2012. To reduce that error even further, like pulling"}, {"start": 2470.38, "end": 2479.66, "text": " all the tricks of these things are around still. Very cool. And then they look into"}, {"start": 2479.66, "end": 2486.62, "text": " what their network learned. So they find that there are a number of these kind of filters."}, {"start": 2486.62, "end": 2492.1, "text": " You see these 11 by 11 filters in the first layer, where they show okay, this really and"}, {"start": 2492.1, "end": 2498.04, "text": " this was kind of already known that these neural networks extract filters like this,"}, {"start": 2498.04, "end": 2504.14, "text": " like color gradients or edge detectors in various forms and directions. And cool to"}, {"start": 2504.14, "end": 2511.8599999999997, "text": " see that this one also does so. This one here is also a very cool investigation where they"}, {"start": 2511.8599999999997, "end": 2518.06, "text": " look at examples. And the red bar, the red one is always the correct label. And the bars"}, {"start": 2518.06, "end": 2524.48, "text": " are basically what their model says are the top five things. And it's cool to look at."}, {"start": 2524.48, "end": 2529.66, "text": " So for example, here you have might as the top one, but then also Black Widow, Cockroach"}, {"start": 2529.66, "end": 2539.3399999999997, "text": " Tick, Starfish, but the top labels are usually also very, very good labels. You can see here"}, {"start": 2539.3399999999997, "end": 2543.7799999999997, "text": " grill and it assigns convertible, which you know, by all means is correct. It's just not"}, {"start": 2543.7799999999997, "end": 2550.7, "text": " the class that the annotators assigned to this particular image, as well as here. Dalmatian"}, {"start": 2550.7, "end": 2557.46, "text": " was the highest prediction of the network where the label was actually cherry. And this"}, {"start": 2557.46, "end": 2562.42, "text": " is this is quite debatable, right? So you can see that a lot of the mistakes the network"}, {"start": 2562.42, "end": 2570.54, "text": " does is are, are, you know, forgivable, let's say. And you can see that for when the network"}, {"start": 2570.54, "end": 2577.54, "text": " doesn't do mistakes, the not only the top label is good, but a lot of the top five labels"}, {"start": 2577.54, "end": 2586.14, "text": " are also very, very adequate. Lastly, they look at a given training set image, which"}, {"start": 2586.14, "end": 2592.1, "text": " these are the training set images right here. And they look at the last layers feature vector"}, {"start": 2592.1, "end": 2598.14, "text": " and the five nearest or the nearest neighbors in Euclidean space of the entire training"}, {"start": 2598.14, "end": 2603.94, "text": " data set. And here's what you come up with. So you can see for the elephant, the nearest"}, {"start": 2603.94, "end": 2610.14, "text": " neighbors are all other elephants and regard that they are in different poses, right? They"}, {"start": 2610.14, "end": 2617.06, "text": " don't always look the same way these elephants also these dogs right here. So it's pretty"}, {"start": 2617.06, "end": 2622.06, "text": " cool to see that the network actually learns some invariances across the class and puts"}, {"start": 2622.06, "end": 2633.5, "text": " images with the same label into the same area in the embedding space. Yeah, so that's their"}, {"start": 2633.5, "end": 2641.54, "text": " that's their paper. They they they already allude to the fact that depth is very important."}, {"start": 2641.54, "end": 2646.7, "text": " It is notable that our network's performance degrades if a single convolutional layer is"}, {"start": 2646.7, "end": 2652.94, "text": " removed. For example, removing any of the middle layers results in a loss of about 2%"}, {"start": 2652.94, "end": 2658.08, "text": " for the top one performance of the network. So the depth really is important for achieving"}, {"start": 2658.08, "end": 2667.8199999999997, "text": " our results. And as you know, this spurred an area of this burden area of trying to build"}, {"start": 2667.8199999999997, "end": 2674.54, "text": " deeper and deeper networks until resonance came along and built ultra deep networks."}, {"start": 2674.54, "end": 2679.18, "text": " They also say we did not use any unsupervised pre training, even though we expect that it"}, {"start": 2679.18, "end": 2684.74, "text": " will help especially if we obtain enough computational power to significantly increase the size of"}, {"start": 2684.74, "end": 2690.54, "text": " the network without obtaining a corresponding increase of the amount of labeled data. Thus"}, {"start": 2690.54, "end": 2695.2999999999997, "text": " far, our results have improved as we have made our network larger and trained it longer,"}, {"start": 2695.2999999999997, "end": 2699.4399999999996, "text": " but we still have many orders of magnitude to go in order to match the infero temporal"}, {"start": 2699.4399999999996, "end": 2706.8999999999996, "text": " pathway of the human visual system. Ultimately, we would like to use very large and deep convolutional"}, {"start": 2706.8999999999996, "end": 2711.62, "text": " nets on video sequences, where the temporal structure provides very helpful information"}, {"start": 2711.62, "end": 2717.8599999999997, "text": " that is missing of our far less obvious in static images. So already the previewing of"}, {"start": 2717.8599999999997, "end": 2724.14, "text": " future research here with the self supervised with the many more layers and so on. Astounding"}, {"start": 2724.14, "end": 2730.74, "text": " that this kind of foresight, of course, all of this proved to be, you know, very, very"}, {"start": 2730.74, "end": 2737.74, "text": " adequate predictions right here. And yeah, so this was the paper right here, the paper"}, {"start": 2737.74, "end": 2745.24, "text": " that kicked off deep learning. I enjoy reading kind of these old papers, especially looking"}, {"start": 2745.24, "end": 2751.02, "text": " back at what was already known what still is around, which turns out to be a lot, a"}, {"start": 2751.02, "end": 2758.3799999999997, "text": " lot is still around. And the choices that people made back then, some of them defined"}, {"start": 2758.3799999999997, "end": 2764.8199999999997, "text": " our modern field. So that was it for Alex net, let me know what you think in the comments,"}, {"start": 2764.82, "end": 2767.9, "text": " and I'll see you next time. Bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=a6v92P0EbJc
Neural Architecture Search without Training (Paper Explained)
#ai #research #machinelearning Neural Architecture Search is typically very slow and resource-intensive. A meta-controller has to train many hundreds or thousands of different models to find a suitable building plan. This paper proposes to use statistics of the Jacobian around data points to estimate the performance of proposed architectures at initialization. This method does not require training and speeds up NAS by orders of magnitude. OUTLINE: 0:00 - Intro & Overview 0:50 - Neural Architecture Search 4:15 - Controller-based NAS 7:35 - Architecture Search Without Training 9:30 - Linearization Around Datapoints 14:10 - Linearization Statistics 19:00 - NAS-201 Benchmark 20:15 - Experiments 34:15 - Conclusion & Comments Paper: https://arxiv.org/abs/2006.04647 Code: https://github.com/BayesWatch/nas-without-training Abstract: The time and effort involved in hand-designing deep neural networks is immense. This has prompted the development of Neural Architecture Search (NAS) techniques to automate this design. However, NAS algorithms tend to be extremely slow and expensive; they need to train vast numbers of candidate networks to inform the search process. This could be remedied if we could infer a network's trained accuracy from its initial state. In this work, we examine how the linear maps induced by data points correlate for untrained network architectures in the NAS-Bench-201 search space, and motivate how this can be used to give a measure of modelling flexibility which is highly indicative of a network's trained performance. We incorporate this measure into a simple algorithm that allows us to search for powerful networks without any training in a matter of seconds on a single GPU. Code to reproduce our experiments is available at this https URL. Authors: Joseph Mellor, Jack Turner, Amos Storkey, Elliot J. Crowley Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar (preferred to Patreon): https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there. Today we're looking at neural architecture search without training by Joseph Meller, Jack Turner, Amos Storky and Elliot J. Crowley. On a high level, this paper performs neural architecture search by looking at the correlation matrices of the Jacobian of the data when you pass it through the network. And it does so at initialization. So you pass the data, you look at the Jacobian, and if it's very correlated, then the network is bad. And if it's very uncorrelated, then the network is good. And by simply observing that they can already achieve a very good score on neural architecture search benchmark. Alright, that was the high level and maybe a bit too simplified. But that's sort of what's going on. Okay, let's dive in. So what's neural architecture search neural architecture search is the discipline of you are given a data set, let's say here, we have a data set, which could be something like CIFAR 10, which is an image data set. And you are given a sort of a training procedure, let's say Adam or SGD for 100,000 steps or something like this with many batches of size 64. Okay, and you're given a loss function, which the loss function here could be the cross entropy between the outputs of the network, which we'll call L, and the label Y. And your task is now to find a neural network architecture that conforms to these specifications, but gives the lowest possible loss or the sorry, the highest possible validation accuracy in this case. So this here would be like the train and then you'd have the test accuracy or the validation accuracy. Okay, so you could decide, well, I'm going to go with, you know, first, like three convolutional layers, each one having like a real non linearity. But you could also say, well, I'm going to build like a skip connection from here to here. You could also say that I'm going to downsample by two, you could have maybe a bigger stride and so on. So the kernel size of the convolution, you can vary. Until now, people have done this by hand, right? In effect, we all use like the same 10 to 20 different architectures. So if it's an image problem, we tend to go for like a resnet or a wide resnet, like a VGG style architecture. Someone has come up with those at some point with each of those discovered that it works well. And we don't really do much exploration, we simply kind of use the same things over and over. And the the truth is that there might be much better architectures that we're simply not exploring, right, there might be much better building plans for networks that we don't know of that might perform a lot better with the same data and the same training. So neural architecture searches the process of automatically searching for these better architectures. Of course, that's a combinatorial problem. But the idea is that, you know, you can actually learn to construct good architectures. And by doing so, you can, you can sort of speed up this process that is manual otherwise. And the idea behind it is there some regularity of when an architecture is good, there's some like high level pattern that you as a human maybe cannot really grasp, but like a machine can figure out which architectures are good and which ones aren't. So there have been a few inventions in this in this area, but they are mostly costly. And that's what they say here. The time and effort involved in hand designing deep neural networks is immense. This has prompted the development of neural architecture search techniques to automate this design. However, neural architecture search algorithms tend to be extremely slow and expensive. They need to train vast numbers of candidate networks to inform the search process. So what neural architecture search methods do is what they'll have is they'll have something like a controller, the controller itself, of course, is going to be a neural network. So there will be this thing that will be the controller, and the controller will emit like a building plan. So the controller will emit like a building plan for this network right here. And then you train the entire thing once through for the entire 100,000 steps. And then you observe the final validation accuracy, which might be something like 80%. And then you know, okay, this is 80%. So you feed the 80% into your controller and the controller outputs the next building plan that it thinks will score higher. And then you train the entire thing again, and you maybe observe our 70% accuracy, you again, feed that in, right, and the controller realizes, oh, I may have done something wrong, let me try something else. And does again, if this looks like reinforcement learning to you, that's because this is reinforcement learning. So the re in the DC here, the controller would be the agent, the percentages here, the accuracies would be the reward. And the environment, the observations would be basically, this thing here, this thing would be the actions, but sometimes it's the observations and you need to score the different things. Okay. So the problem, of course, with this is that the reinforcement learning requires a lot of data, it requires a lot of steps to converge, because the signal from the reward is just so weak, you simply get one number for your action. And you don't know what you can change to make it better, you simply have to try. So you need a lot of steps. But this thing here is mighty slow, because each each single step in your reinforcement learning procedure involves training an entire neural network for like this many steps. Okay, so all of this is ginormous Lee slow, and resource intensive. And that, of course, blocks a lot of research, because, you know, we started with the plan to automate this part right here, but automating it itself is super expensive. So they go for a different solution. They say this could be remedied, if we could infer at net, sorry, if we could infer a network's trained accuracy from its initial state, okay, it seems a bit out there. But let's, let's give them benefit of the doubt. In this work, we examine how the linear maps induced by data points correlate for untrained network architectures in the NAS bench 201 search space, and motivate how this can be used to give a measure of modeling flexibility, which is highly indicative of a network's trained performance. We incorporate this measure into a simple algorithm that allows us to search for powerful networks without any training in a matter of seconds on a single GPU, okay, and they have the code available right here, if you want to go and check that out. So let's go in, let's go into that. The claims are pretty big. And the reasoning behind the claims is the following observation, you can already sort of see in this graphic right here, we'll, we'll go over what it means in one second. But what they do is they take different networks in this search space. And the search space in this case is given by this benchmark. So this benchmark basically has a long list, I think, of architectures that you could consider. Actually, so it's a, it's a constructive list. So they don't actually give you the list, but they give you like a, a way to construct architectures. And they took those architectures and they rank them by how well they score on the C for 10. So there are very good architectures, which are here, there are good ones, there are mediocre ones, and then the bad ones. Okay. And you can see that the histograms here of whatever they measure, they look quite different. So the histograms with the good ones, they all have kind of spiky around zero, and the histograms of the bad ones all sort of look spread out. So this is the measure that they're going to propose is they have some sort of number, some sort of histogram that they produce. And if the histogram is very spiky and close together around zero, then they conclude that this network is good. And if the histogram is very spread out like this, they conclude that the network is bad. Now these histograms, as you might expect, they are computed not from the final trained network, but they are computed from the initial network. So here they show, at least, you know, in this case, it seems to be that there is a general correlation between the trained accuracy and how this histogram looks. And we're going to explore what they do. So it's essentially it's pretty easy. They compute the linear map around each data point. So what is that? If you imagine a neural network as a nonlinear function, which I guess you should because it is. And so let's imagine it as like a nonlinear function from x to y. What they'll do is simply, they'll look at a given date training data point, which could be here, right, this could be the x, and this could be the the y. And, in fact, let's look at it in loss landscape, not even in y, but in L in terms of the loss, because we don't need necessarily a single label, this could be for unsupervised, this could be for anything, okay, so it maps a data point to a loss. Now, what we'll do is we'll simply linearize the function around that point, which means we'll just freeze all the non linearities in place. And that will give us this linear function right here. Okay, we just observed that this linear function can exist, it's the tangent to the loss landscape. And it's at a particular data point, right, it's in data space, not in weight space. Then we look at a different data point. So we look at this data point right here, another data point, what's the linear function around this one is sort of like whoops, D is like that. And then around this one is like this. Okay, so this is one function. Now let's look at a different function right here. So L, x, and we'll look at this function, the linear function, okay, so for some reason, this is like this. And if we consider two data points, their linearization is very similar. Now imagine that these two have been produced by the same sort of neural networks, it's just the architecture is a little different. But they have been produced like they have the same number of parameters in the neural network, which neural network would you prefer? Remember, you can in by training the neural network, you can actually shape this loss function, you can kind of shape that around. So which one would you prefer? I personally would prefer the top one. Because the top one already tells me that, hey, you know, I might have 10 parameters here. And this already sort of looks like each of the 10 parameters is doing something. So if I then go into my 10 parameters, and I, you know, turn this knob right here, then I might, you know, up this bump or down this bump or do something with it. But the sort of frequency curvature, the randomness of the function, the way that it fluctuates tells me that all of the different parameters must have some sort of effect, right? Because it's quite an expressive function. Whereas if I have the same number of parameters for a function like this, this sort of tells me, well, maybe only one of the when the only one of the weights is actually doing something, maybe only one of the dimensions is doing something, this seems odd, right? That even though I've initialized it randomly, a super regular function like this comes out. So maybe all of the all of these parameters down here, they don't do anything. Or the so somehow the signal doesn't get through. So that's, I, they don't explicitly say it in these terms. But this is how I make sense of this. What they're saying is that if you look at the linearizations of the functions, and you look at the, the angle right here, so the angle in this case is that and in this case is that and in this case is that so you look at the slope here. And the slope is basically the gradient of these linearized functions. And what you want to do is you want to look at the correlation between those of the different data points. So here we have three angles, one is very short, one is very bit longer, like this, and or no, even like this. And one is even over 90 degrees like that. They are not correlated at all, right? They're all very different. However, the angles here, they're all quite the same, as you can see. So what they propose is the following. Let's send all the data points or in that case, all the data points in a particular mini batch, let's send them through the function. And let's calculate their linearizations. So the linearization is nothing else than you send them through the network to obtain the f value for the x value. And then you calculate the gradient with respect to the input, right? Now you have to get used to this a bit, because usually we calculate the gradient with respect to the weight. But now we calculate the gradient with respect to the input, which if this is a linear function, so if you have a lit f of x equals w x, like a linear function, then this gradient del f del x would just give you the W will give you the slope of the linear function and the same in the neural network when you linearize it. Alright, so we're going to obtain all these linearizations. And that gives us the this matrix J right here. And what we can do is we can then observe the covariance matrix of J of all these linearizations. The covariance matrix simply tells you how two data points vary with each other. And in fact, they don't look at the covariance matrix, but they look at the correlation matrix, which is simply the scaled covariance matrix. So one entry in this covariance matrix, so you have n data points, and this gives you a matrix that's n by n. And that particular entry here, like the entry ij would simply state how does the angle of data point i correlate with the angle of data point j? Okay, that's the that's the covariance matrix. And now the hypothesis is, if all of these data points are sort of independent, like in our very expressive function here, then the these correlations, they should not be high. In fact, most data points should be rather uncorrelated. However, in this case, right here, if the function is sort of kind of degenerative or something, not very expressive, then all of these all of these angles or of these linearizations should be highly correlated. And that's what you see in this graph right here. This right here now is these correlation histogram of the correlations between local linear maps across all pairs of items in a mini batch of c410 training data. Each part is a histogram for a single untrained NAS bench 201 architecture. So remember, the expressivity is important because we want to train that function and therefore it's important that every parameter does something. And if it's degenerate, we can't train it well. And that's, I find that's the reasoning they sort of say this, but I'm not, I might make I might make the wrong sense out of it here. But it seems to me like that's what's actually going on. So you can see this is simply these matrix values rolled out and then plotted as a histogram. So what does it mean when an histogram is like super spread out like this? It means that there are a lot and I think down here are axes. Yes, there are a lot of data points that correlate highly or anti correlate highly with each other. Okay, which means that exactly this degeneracy happens. So either too high or too negative high correlation means that they're very much, they're kind of the same thing. So there is, if you have as many parameters as data points, that means that one parameter can potentially serve these two data points or these two that are correlated by one or negative one, you don't need both parameters and therefore you have a lot of parameters doing nothing. Whereas over here, with the good networks, you can see that this spikes around zero, meaning that the data points are not correlated, or the linearizations around the data points are not correlated. And therefore, you can sort of shape the function around each data point, however you want, which we sort of know that neural networks, what they do is they're so over expressive, that they're actually able to shape the functions around the data points without necessarily looking at other data points nearby. And that expressivity is what what you want. And that expressivity is what this in part measures. Okay, so they make a, they have some experiments here where they validate this. So for all these architectures in this benchmark, and maybe I should tell you what, show you what the benchmark looks like. So the benchmark has this particular form, this particular form, there's the skeleton. And in this skeleton, there is this block, and it's always repeated. And you're basically your task is to determine what this block should be. So this block has an input node a and an output node D, and two intermediate nodes. And what you have to do is basically you have to determine these connections right here. So there are six connections. And for each one, you have the option of putting different things there. Like you can see you put can put a convolution, you can put the identity function, which is a skip connection, zero wise, I'm I don't, maybe that's the zero function. So it basically means nothing. I'm not so sure, honestly. But you could technically put a convolution here and here, right? Or, and or different convolutions or things like this. So there are these 15,625 possible cells, okay. So the NAS benchmark contains 15,625 possible architectures that you'll have to search. And they take these architectures and they plot now they plot for each architecture, the validation accuracy after training and the training protocol is standardized, you don't have to care about that, right. And the score that they measure at the beginning of training. And what you can see is that there is a linear relationship sort of like a sort of from from these experiments, what you'll get is like this sort of feeling. What they're going to propose is that you should take that score as a as a measure. And here again, also, sort of sort sort of there is a there is a clear trend, as you can see, right here, though. Yeah. Though this, as you can see, this sort of spreads out and the most right one is ImageNet, which is the most difficult one, of course. So, and this is CIFAR 100, which is more difficult than CIFAR 10. So we can see that this sort of relationship at the top, it doesn't really hold anymore if the task gets difficult. And this is so what I think is happening, this is kind of an interjection of my own opinion. What's happening here is that this score that they discover, allows them pretty efficiently to see which networks are just degenerate, and cannot be trained. Like if you try to train them, they just perform really poorly. Okay. That it's probably a very good score for weeding those out. And that would mean if you kind of barrier here somewhere, right, you could just discard a whole lot of this crap, or even even here, right, you could just discard a whole lot of this crap. And also, now here, just, you know, all of this crap. Yeah, whereas here, as you can see, some of this score, sometimes it's higher than these ones, even though they perform better. And again, you could probably discard a lot of the crap. But it's not as distinctive for the well performing networks, because these here are all not the degenerate version, right? They're not degenerate in the sense that they're, they have some fundamental flaw where the function lacks now expressivity from the very start, so you can't train it. And then probably other factors come into play other factors, then you can simply determine with this particular score. But, you know, there is this relationship that's, that's, you know, you can see that. And they do some ablations on this here. For example, are your scores a proxy for a number of parameters? And they say, no, the number of parameters works way worse than this particular score, which you know, is a is a cool thing, then how important is the specific mini batch and initialization? And they say, look, right here, we for some architectures, we do different mini batch sizes. And you can see each of those groups, they don't vary too much in how they're it influences their score. This is, I believe this is the same architecture. So it's always an architecture that achieves in this case, for example, wow, that's not a straight line. 77% or so. And you can see if you go for different mini batches, the score varies only minimally. initialization is a bigger variance inducing thing. But also here, the scores don't vary too much. But it is interesting that the different initialization to get you to different score, because it would directly support kind of my hypothesis that what's going on here is that you sort of measure initial degeneracies. And you can sort of make up for these initial degeneracies in the architecture sometimes with sort of a different initialization. So the different initializations give you differently performing networks. We already know this from things like you know, lottery ticket hypothesis and so on, that the initialization can matter to some degree in these types of things. Now, that being said, they always train to the same, it seems, but their their score varies. So I might be backwards correct here or not correct. But in any case, the initialization here matters more, but also you can still see this linear relationship. And this is particularly interesting. This is even the case when you just input white noise. So instead of the data, you measure that score by just inputting noise that I guess has some sort of the same magnitude as the data would have, but it's just noise. And you can still sort of see this linear relationship, which is very interesting. And that I think also shows some that you what you find is a property of the network itself. And the fact that it is initialized and built in such a way that it allows you to train it in a very, in a sort of a benign manner. It has no degeneracies. Okay. So in last experiment, they go here and they say, we evaluated the score on initialized networks in the PyTorch CV library. So they go to this library that has a lot of these networks. But these networks are not the same as this benchmark. This benchmark is specifically designed to do architecture search. Now the networks in this library, they are all designed to perform really well. Some are designed to be quite small, some are designed to be quite fast and so on. But in general, they are all of their goal is to perform well. And they have been sort of found by humans to perform well. So they take now these networks on CIFAR-10 and they test them. So as you can see here, here is the test accuracy again, and here is their score that they give it. And they say, I can't move this anymore. Hello. Well, okay. They say that this linear relationship still sort of holds. It doesn't hold super, super well. But you can still sort of if you squint, if you squint hard, you can see that it sort of goes upward, though, you really have to squint hard, like what are these things right here. And what, again, what's the case is that if the score is low, you will sort of be able to cut off the cut off the worst performing ones. But really at the top here, it doesn't seem like there is a particular relation between between these networks and this initial score, which sort of strengthens my hypothesis that what this does is just kind of weed out the bad ones. But it's pretty cool because you can weed out the bad ones without any training, right? You'd simply forward prop, backward prop, there you have it. So cool. Now they come they, here is the experiment where they now really do this NAS benchmark and they compare with other methods. So some of these other methods are designed to do the call weight sharing, which basically is a technique where you can sort of speed up the speed up the algorithm as compared to non weight sharing and the non weight sharing. That's one of these we have discussed initially. That was my initial example with the controller and so on, where it takes super long. So here you see the method and how long each method takes. Now the best ones, as you can see already, the best ones here, or these these methods right here are the best ones, they score somewhat like a 93.9 or so on CIFAR 10. Whereas these weight sharing ones, they don't perform too well, except this one seems to perform quite well. And in this hours case, they perform worse than that, but they still perform better than a lot of the weight sharing ones. So what their point is basically is that they get a pretty good score, which is a 91.5 on CIFAR 10, which is, you know, it's at least not degenerate. It's a good accuracy. They score that with simply evaluating 10 architectures, right? And as n goes up as they evaluate more and more architectures, they do, they do get better, but not much. So they have a discussion here. I'm having trouble moving this. All right, so we'll sort of go through the discussion, we report results, yada, yada, yada, yada. As the setup, the non weight sharing methods are given a time budget of 12,000 seconds for our method and the non weight sharing methods are averaged, accuracies are averaged over 500 runs. For weight sharing methods, accuracies are reported over three runs. With the exception of GDAS, our method is able to outperform all the weight sharing methods while requiring a fraction of the search time. And that you may see at the table, this is the real, I mean, this is the real deal here, they only use here 1.7 seconds compared to the 12,000 seconds of the other methods, and you reach almost the same accuracy. Now to be said, 2% in this particular regime on CIFAR 10 is still a sizable difference. And that's the same benchmark, right? With the same sort of the same training schedule, and so on. So there's not too much room to tune here, you simply have to find a better architecture. So these things are still sizably ahead of this. And what it appears to me that these methods here that don't perform well, they're they're simply crap. It seems they're simply, I don't I don't know, but they might be trying out something or, you know, doing something researchy or whatnot. But it seems like if you're well able to weed out the bad architectures, you might be getting to a score like this. And then if you are actually performing a search to find the best one, then you might be getting to somewhere like this. And you can see this here throughout. So in CIFAR 100, they achieve a better score than these things, but a worse score than the non weight sharing method. And in ImageNet, it gets even the difference is even larger. So, again, what I can see here is that there's is a good method to maybe get you like, let's say 90% of the way of the way you want to go. And what's interesting is that here they say, we also show the effect of sample size, we showed accuracy of the networks chosen by our method for each end. So that's the sample size, we list the optimal accuracy for sample sizes 10 and 100 and random selection over the whole benchmark. So in this case, they have the the optimal one, which I guess they just draw 10 samples and then take the best one. So they train all of them and then take the best one, you can see that already gets you to the 93. And whereas in their case, sometimes when they add more, they get worse. So here they get better, but then they get worse again. So they comment on this right here. We observe that the sample size does not have a large effect on the accuracy of our method. But note that as sample size increases, our method suffers from a small amount of noise, increasing the gap between our score and the optimal result. And of course, the key practical benefit is execution time. So again, they are massively faster than the other methods. But to me, it seems you could just think of combining these methods, right, you combine this with this, in that what you want to do is actually actively search for the best ones. But by doing so you could if you could pretty quickly weed out the bad ones using this method down here, you might already have like a big speed up. Because, again, with comparison to this random ones, what appears to happen is that they get good at finding, you know, your 90% architecture, but then they fail to differentiate the top performance performers from each other, where you'd really have to train the network to find out what's you know, which one's better. So yeah, here they say they visualize the trade off between search time and accuracy for c410 for different NES algorithms on the NES benchmark are moving the need for training our method is able to find accurate networks in seconds instead of hours. And here you can see the accuracy and here you can see the time and all the good ones are either way over here or here. And there's is almost at zero while being quite close to the accuracy of the other ones. All right, yeah, that was that was this paper. Again, I think this is pretty valuable if you are especially if you're in a new domain, where you might not know what kind of network to build, you might just be able to write a little script that generates networks, run it through this algorithm. And at least you get an idea of which ones are certainly not worth considering. And then you can simply select one of the other ones it doesn't you know, often it doesn't need to be the best ones. And you can then tweak it a little bit manually the ones you found, maybe you see some regularity. And yeah, that was my two cents on this paper. I hope you liked it. If you did consider sharing it out and telling your friends about it and subscribing liking and leave a comment if you agree or disagree. That was it. Bye bye.
[{"start": 0.0, "end": 6.4, "text": " Hi there. Today we're looking at neural architecture search without training by Joseph Meller,"}, {"start": 6.4, "end": 13.040000000000001, "text": " Jack Turner, Amos Storky and Elliot J. Crowley. On a high level, this paper performs neural"}, {"start": 13.040000000000001, "end": 22.64, "text": " architecture search by looking at the correlation matrices of the Jacobian of the data when"}, {"start": 22.64, "end": 28.36, "text": " you pass it through the network. And it does so at initialization. So you pass the data,"}, {"start": 28.36, "end": 34.68, "text": " you look at the Jacobian, and if it's very correlated, then the network is bad. And if"}, {"start": 34.68, "end": 40.78, "text": " it's very uncorrelated, then the network is good. And by simply observing that they can"}, {"start": 40.78, "end": 46.92, "text": " already achieve a very good score on neural architecture search benchmark. Alright, that"}, {"start": 46.92, "end": 52.56, "text": " was the high level and maybe a bit too simplified. But that's sort of what's going on. Okay,"}, {"start": 52.56, "end": 57.96, "text": " let's dive in. So what's neural architecture search neural architecture search is the"}, {"start": 57.96, "end": 64.5, "text": " discipline of you are given a data set, let's say here, we have a data set, which could"}, {"start": 64.5, "end": 72.4, "text": " be something like CIFAR 10, which is an image data set. And you are given a sort of a training"}, {"start": 72.4, "end": 80.52, "text": " procedure, let's say Adam or SGD for 100,000 steps or something like this with many batches"}, {"start": 80.52, "end": 86.42, "text": " of size 64. Okay, and you're given a loss function, which the loss function here could"}, {"start": 86.42, "end": 94.0, "text": " be the cross entropy between the outputs of the network, which we'll call L, and the label"}, {"start": 94.0, "end": 102.8, "text": " Y. And your task is now to find a neural network architecture that conforms to these specifications,"}, {"start": 102.8, "end": 108.26, "text": " but gives the lowest possible loss or the sorry, the highest possible validation accuracy"}, {"start": 108.26, "end": 114.34, "text": " in this case. So this here would be like the train and then you'd have the test accuracy"}, {"start": 114.34, "end": 119.60000000000001, "text": " or the validation accuracy. Okay, so you could decide, well, I'm going to go with, you know,"}, {"start": 119.60000000000001, "end": 126.32000000000001, "text": " first, like three convolutional layers, each one having like a real non linearity. But"}, {"start": 126.32000000000001, "end": 130.96, "text": " you could also say, well, I'm going to build like a skip connection from here to here."}, {"start": 130.96, "end": 136.7, "text": " You could also say that I'm going to downsample by two, you could have maybe a bigger stride"}, {"start": 136.7, "end": 142.52, "text": " and so on. So the kernel size of the convolution, you can vary. Until now, people have done"}, {"start": 142.52, "end": 149.84, "text": " this by hand, right? In effect, we all use like the same 10 to 20 different architectures."}, {"start": 149.84, "end": 155.08, "text": " So if it's an image problem, we tend to go for like a resnet or a wide resnet, like a"}, {"start": 155.08, "end": 162.60000000000002, "text": " VGG style architecture. Someone has come up with those at some point with each of those"}, {"start": 162.60000000000002, "end": 168.02, "text": " discovered that it works well. And we don't really do much exploration, we simply kind"}, {"start": 168.02, "end": 175.64000000000001, "text": " of use the same things over and over. And the the truth is that there might be much"}, {"start": 175.64000000000001, "end": 179.84, "text": " better architectures that we're simply not exploring, right, there might be much better"}, {"start": 179.84, "end": 185.98000000000002, "text": " building plans for networks that we don't know of that might perform a lot better with"}, {"start": 185.98000000000002, "end": 192.28, "text": " the same data and the same training. So neural architecture searches the process of automatically"}, {"start": 192.28, "end": 198.4, "text": " searching for these better architectures. Of course, that's a combinatorial problem."}, {"start": 198.4, "end": 205.16, "text": " But the idea is that, you know, you can actually learn to construct good architectures. And"}, {"start": 205.16, "end": 211.82, "text": " by doing so, you can, you can sort of speed up this process that is manual otherwise."}, {"start": 211.82, "end": 216.22, "text": " And the idea behind it is there some regularity of when an architecture is good, there's some"}, {"start": 216.22, "end": 221.66, "text": " like high level pattern that you as a human maybe cannot really grasp, but like a machine"}, {"start": 221.66, "end": 226.44, "text": " can figure out which architectures are good and which ones aren't. So there have been"}, {"start": 226.44, "end": 233.66, "text": " a few inventions in this in this area, but they are mostly costly. And that's what they"}, {"start": 233.66, "end": 239.34, "text": " say here. The time and effort involved in hand designing deep neural networks is immense."}, {"start": 239.34, "end": 244.04, "text": " This has prompted the development of neural architecture search techniques to automate"}, {"start": 244.04, "end": 250.44, "text": " this design. However, neural architecture search algorithms tend to be extremely slow"}, {"start": 250.44, "end": 255.72, "text": " and expensive. They need to train vast numbers of candidate networks to inform the search"}, {"start": 255.72, "end": 262.28, "text": " process. So what neural architecture search methods do is what they'll have is they'll"}, {"start": 262.28, "end": 267.14, "text": " have something like a controller, the controller itself, of course, is going to be a neural"}, {"start": 267.14, "end": 272.4, "text": " network. So there will be this thing that will be the controller, and the controller"}, {"start": 272.4, "end": 279.22, "text": " will emit like a building plan. So the controller will emit like a building plan for this network"}, {"start": 279.22, "end": 285.04, "text": " right here. And then you train the entire thing once through for the entire 100,000"}, {"start": 285.04, "end": 291.68, "text": " steps. And then you observe the final validation accuracy, which might be something like 80%."}, {"start": 291.68, "end": 297.1, "text": " And then you know, okay, this is 80%. So you feed the 80% into your controller and the"}, {"start": 297.1, "end": 302.86, "text": " controller outputs the next building plan that it thinks will score higher. And then"}, {"start": 302.86, "end": 309.28000000000003, "text": " you train the entire thing again, and you maybe observe our 70% accuracy, you again,"}, {"start": 309.28000000000003, "end": 313.90000000000003, "text": " feed that in, right, and the controller realizes, oh, I may have done something wrong, let me"}, {"start": 313.90000000000003, "end": 319.24, "text": " try something else. And does again, if this looks like reinforcement learning to you,"}, {"start": 319.24, "end": 325.8, "text": " that's because this is reinforcement learning. So the re in the DC here, the controller would"}, {"start": 325.8, "end": 332.88, "text": " be the agent, the percentages here, the accuracies would be the reward. And the environment, the"}, {"start": 332.88, "end": 338.36, "text": " observations would be basically, this thing here, this thing would be the actions, but"}, {"start": 338.36, "end": 345.12, "text": " sometimes it's the observations and you need to score the different things. Okay. So the"}, {"start": 345.12, "end": 350.86, "text": " problem, of course, with this is that the reinforcement learning requires a lot of data,"}, {"start": 350.86, "end": 356.08000000000004, "text": " it requires a lot of steps to converge, because the signal from the reward is just so weak,"}, {"start": 356.08000000000004, "end": 361.92, "text": " you simply get one number for your action. And you don't know what you can change to"}, {"start": 361.92, "end": 367.14, "text": " make it better, you simply have to try. So you need a lot of steps. But this thing here"}, {"start": 367.14, "end": 373.90000000000003, "text": " is mighty slow, because each each single step in your reinforcement learning procedure involves"}, {"start": 373.90000000000003, "end": 380.76, "text": " training an entire neural network for like this many steps. Okay, so all of this is ginormous"}, {"start": 380.76, "end": 388.56, "text": " Lee slow, and resource intensive. And that, of course, blocks a lot of research, because,"}, {"start": 388.56, "end": 394.09999999999997, "text": " you know, we started with the plan to automate this part right here, but automating it itself"}, {"start": 394.09999999999997, "end": 402.06, "text": " is super expensive. So they go for a different solution. They say this could be remedied,"}, {"start": 402.06, "end": 410.14, "text": " if we could infer at net, sorry, if we could infer a network's trained accuracy from its"}, {"start": 410.14, "end": 416.68, "text": " initial state, okay, it seems a bit out there. But let's, let's give them benefit of the"}, {"start": 416.68, "end": 422.96, "text": " doubt. In this work, we examine how the linear maps induced by data points correlate for"}, {"start": 422.96, "end": 429.68, "text": " untrained network architectures in the NAS bench 201 search space, and motivate how this"}, {"start": 429.68, "end": 435.4, "text": " can be used to give a measure of modeling flexibility, which is highly indicative of"}, {"start": 435.4, "end": 441.64, "text": " a network's trained performance. We incorporate this measure into a simple algorithm that"}, {"start": 441.64, "end": 447.4, "text": " allows us to search for powerful networks without any training in a matter of seconds"}, {"start": 447.4, "end": 452.03999999999996, "text": " on a single GPU, okay, and they have the code available right here, if you want to go and"}, {"start": 452.03999999999996, "end": 460.03999999999996, "text": " check that out. So let's go in, let's go into that. The claims are pretty big. And the reasoning"}, {"start": 460.04, "end": 466.0, "text": " behind the claims is the following observation, you can already sort of see in this graphic"}, {"start": 466.0, "end": 471.34000000000003, "text": " right here, we'll, we'll go over what it means in one second. But what they do is they take"}, {"start": 471.34000000000003, "end": 476.5, "text": " different networks in this search space. And the search space in this case is given by"}, {"start": 476.5, "end": 484.6, "text": " this benchmark. So this benchmark basically has a long list, I think, of architectures"}, {"start": 484.6, "end": 490.0, "text": " that you could consider. Actually, so it's a, it's a constructive list. So they don't"}, {"start": 490.0, "end": 495.76000000000005, "text": " actually give you the list, but they give you like a, a way to construct architectures."}, {"start": 495.76000000000005, "end": 501.0, "text": " And they took those architectures and they rank them by how well they score on the C"}, {"start": 501.0, "end": 505.6, "text": " for 10. So there are very good architectures, which are here, there are good ones, there"}, {"start": 505.6, "end": 511.84000000000003, "text": " are mediocre ones, and then the bad ones. Okay. And you can see that the histograms"}, {"start": 511.84, "end": 516.92, "text": " here of whatever they measure, they look quite different. So the histograms with the good"}, {"start": 516.92, "end": 522.68, "text": " ones, they all have kind of spiky around zero, and the histograms of the bad ones all sort"}, {"start": 522.68, "end": 527.6999999999999, "text": " of look spread out. So this is the measure that they're going to propose is they have"}, {"start": 527.6999999999999, "end": 532.9, "text": " some sort of number, some sort of histogram that they produce. And if the histogram is"}, {"start": 532.9, "end": 540.16, "text": " very spiky and close together around zero, then they conclude that this network is good."}, {"start": 540.16, "end": 546.1999999999999, "text": " And if the histogram is very spread out like this, they conclude that the network is bad."}, {"start": 546.1999999999999, "end": 553.4, "text": " Now these histograms, as you might expect, they are computed not from the final trained"}, {"start": 553.4, "end": 559.9599999999999, "text": " network, but they are computed from the initial network. So here they show, at least, you"}, {"start": 559.9599999999999, "end": 566.3199999999999, "text": " know, in this case, it seems to be that there is a general correlation between the trained"}, {"start": 566.32, "end": 576.12, "text": " accuracy and how this histogram looks. And we're going to explore what they do. So it's"}, {"start": 576.12, "end": 582.1600000000001, "text": " essentially it's pretty easy. They compute the linear map around each data point. So"}, {"start": 582.1600000000001, "end": 588.48, "text": " what is that? If you imagine a neural network as a nonlinear function, which I guess you"}, {"start": 588.48, "end": 595.32, "text": " should because it is. And so let's imagine it as like a nonlinear function from x to"}, {"start": 595.32, "end": 601.88, "text": " y. What they'll do is simply, they'll look at a given date training data point, which"}, {"start": 601.88, "end": 609.5200000000001, "text": " could be here, right, this could be the x, and this could be the the y. And, in fact,"}, {"start": 609.5200000000001, "end": 614.72, "text": " let's look at it in loss landscape, not even in y, but in L in terms of the loss, because"}, {"start": 614.72, "end": 618.84, "text": " we don't need necessarily a single label, this could be for unsupervised, this could"}, {"start": 618.84, "end": 626.0400000000001, "text": " be for anything, okay, so it maps a data point to a loss. Now, what we'll do is we'll simply"}, {"start": 626.0400000000001, "end": 631.32, "text": " linearize the function around that point, which means we'll just freeze all the non"}, {"start": 631.32, "end": 637.1600000000001, "text": " linearities in place. And that will give us this linear function right here. Okay, we"}, {"start": 637.1600000000001, "end": 643.88, "text": " just observed that this linear function can exist, it's the tangent to the loss landscape."}, {"start": 643.88, "end": 649.0, "text": " And it's at a particular data point, right, it's in data space, not in weight space. Then"}, {"start": 649.0, "end": 653.56, "text": " we look at a different data point. So we look at this data point right here, another data"}, {"start": 653.56, "end": 660.88, "text": " point, what's the linear function around this one is sort of like whoops, D is like that."}, {"start": 660.88, "end": 667.56, "text": " And then around this one is like this. Okay, so this is one function. Now let's look at"}, {"start": 667.56, "end": 677.8, "text": " a different function right here. So L, x, and we'll look at this function, the linear"}, {"start": 677.8, "end": 686.4, "text": " function, okay, so for some reason, this is like this. And if we consider two data points,"}, {"start": 686.4, "end": 697.5, "text": " their linearization is very similar. Now imagine that these two have been produced by the same"}, {"start": 697.5, "end": 702.76, "text": " sort of neural networks, it's just the architecture is a little different. But they have been"}, {"start": 702.76, "end": 707.28, "text": " produced like they have the same number of parameters in the neural network, which neural"}, {"start": 707.28, "end": 712.12, "text": " network would you prefer? Remember, you can in by training the neural network, you can"}, {"start": 712.12, "end": 717.64, "text": " actually shape this loss function, you can kind of shape that around. So which one would"}, {"start": 717.64, "end": 724.56, "text": " you prefer? I personally would prefer the top one. Because the top one already tells"}, {"start": 724.56, "end": 729.3199999999999, "text": " me that, hey, you know, I might have 10 parameters here. And this already sort of looks like"}, {"start": 729.3199999999999, "end": 734.64, "text": " each of the 10 parameters is doing something. So if I then go into my 10 parameters, and"}, {"start": 734.64, "end": 739.88, "text": " I, you know, turn this knob right here, then I might, you know, up this bump or down this"}, {"start": 739.88, "end": 747.4799999999999, "text": " bump or do something with it. But the sort of frequency curvature, the randomness of"}, {"start": 747.4799999999999, "end": 752.9599999999999, "text": " the function, the way that it fluctuates tells me that all of the different parameters must"}, {"start": 752.96, "end": 758.48, "text": " have some sort of effect, right? Because it's quite an expressive function. Whereas if I"}, {"start": 758.48, "end": 765.2, "text": " have the same number of parameters for a function like this, this sort of tells me, well, maybe"}, {"start": 765.2, "end": 770.5600000000001, "text": " only one of the when the only one of the weights is actually doing something, maybe only one"}, {"start": 770.5600000000001, "end": 775.4000000000001, "text": " of the dimensions is doing something, this seems odd, right? That even though I've initialized"}, {"start": 775.4000000000001, "end": 781.32, "text": " it randomly, a super regular function like this comes out. So maybe all of the all of"}, {"start": 781.32, "end": 787.72, "text": " these parameters down here, they don't do anything. Or the so somehow the signal doesn't"}, {"start": 787.72, "end": 795.1600000000001, "text": " get through. So that's, I, they don't explicitly say it in these terms. But this is how I make"}, {"start": 795.1600000000001, "end": 803.0, "text": " sense of this. What they're saying is that if you look at the linearizations of the functions,"}, {"start": 803.0, "end": 810.0, "text": " and you look at the, the angle right here, so the angle in this case is that and in this"}, {"start": 810.0, "end": 816.96, "text": " case is that and in this case is that so you look at the slope here. And the slope is basically"}, {"start": 816.96, "end": 822.8, "text": " the gradient of these linearized functions. And what you want to do is you want to look"}, {"start": 822.8, "end": 828.44, "text": " at the correlation between those of the different data points. So here we have three angles,"}, {"start": 828.44, "end": 839.04, "text": " one is very short, one is very bit longer, like this, and or no, even like this. And"}, {"start": 839.04, "end": 845.5999999999999, "text": " one is even over 90 degrees like that. They are not correlated at all, right? They're"}, {"start": 845.5999999999999, "end": 852.76, "text": " all very different. However, the angles here, they're all quite the same, as you can see."}, {"start": 852.76, "end": 859.74, "text": " So what they propose is the following. Let's send all the data points or in that case,"}, {"start": 859.74, "end": 864.76, "text": " all the data points in a particular mini batch, let's send them through the function. And"}, {"start": 864.76, "end": 871.4399999999999, "text": " let's calculate their linearizations. So the linearization is nothing else than you send"}, {"start": 871.4399999999999, "end": 876.96, "text": " them through the network to obtain the f value for the x value. And then you calculate the"}, {"start": 876.96, "end": 881.24, "text": " gradient with respect to the input, right? Now you have to get used to this a bit, because"}, {"start": 881.24, "end": 886.52, "text": " usually we calculate the gradient with respect to the weight. But now we calculate the gradient"}, {"start": 886.52, "end": 891.68, "text": " with respect to the input, which if this is a linear function, so if you have a lit f"}, {"start": 891.68, "end": 899.66, "text": " of x equals w x, like a linear function, then this gradient del f del x would just give"}, {"start": 899.66, "end": 906.64, "text": " you the W will give you the slope of the linear function and the same in the neural network"}, {"start": 906.64, "end": 913.18, "text": " when you linearize it. Alright, so we're going to obtain all these linearizations. And that"}, {"start": 913.18, "end": 921.76, "text": " gives us the this matrix J right here. And what we can do is we can then observe the"}, {"start": 921.76, "end": 929.2399999999999, "text": " covariance matrix of J of all these linearizations. The covariance matrix simply tells you how"}, {"start": 929.2399999999999, "end": 934.3199999999999, "text": " two data points vary with each other. And in fact, they don't look at the covariance"}, {"start": 934.3199999999999, "end": 939.76, "text": " matrix, but they look at the correlation matrix, which is simply the scaled covariance matrix."}, {"start": 939.76, "end": 946.04, "text": " So one entry in this covariance matrix, so you have n data points, and this gives you"}, {"start": 946.04, "end": 951.92, "text": " a matrix that's n by n. And that particular entry here, like the entry ij would simply"}, {"start": 951.92, "end": 962.04, "text": " state how does the angle of data point i correlate with the angle of data point j? Okay, that's"}, {"start": 962.04, "end": 971.28, "text": " the that's the covariance matrix. And now the hypothesis is, if all of these data points"}, {"start": 971.28, "end": 977.1999999999999, "text": " are sort of independent, like in our very expressive function here, then the these correlations,"}, {"start": 977.1999999999999, "end": 983.04, "text": " they should not be high. In fact, most data points should be rather uncorrelated. However,"}, {"start": 983.04, "end": 989.28, "text": " in this case, right here, if the function is sort of kind of degenerative or something,"}, {"start": 989.28, "end": 994.9, "text": " not very expressive, then all of these all of these angles or of these linearizations"}, {"start": 994.9, "end": 1002.9, "text": " should be highly correlated. And that's what you see in this graph right here. This right"}, {"start": 1002.9, "end": 1009.68, "text": " here now is these correlation histogram of the correlations between local linear maps"}, {"start": 1009.68, "end": 1016.0799999999999, "text": " across all pairs of items in a mini batch of c410 training data. Each part is a histogram"}, {"start": 1016.08, "end": 1022.0400000000001, "text": " for a single untrained NAS bench 201 architecture. So remember, the expressivity is important"}, {"start": 1022.0400000000001, "end": 1026.8400000000001, "text": " because we want to train that function and therefore it's important that every parameter"}, {"start": 1026.8400000000001, "end": 1032.44, "text": " does something. And if it's degenerate, we can't train it well. And that's, I find that's"}, {"start": 1032.44, "end": 1040.44, "text": " the reasoning they sort of say this, but I'm not, I might make I might make the wrong sense"}, {"start": 1040.44, "end": 1045.64, "text": " out of it here. But it seems to me like that's what's actually going on. So you can see this"}, {"start": 1045.64, "end": 1050.5600000000002, "text": " is simply these matrix values rolled out and then plotted as a histogram. So what does"}, {"start": 1050.5600000000002, "end": 1056.0800000000002, "text": " it mean when an histogram is like super spread out like this? It means that there are a lot"}, {"start": 1056.0800000000002, "end": 1061.3600000000001, "text": " and I think down here are axes. Yes, there are a lot of data points that correlate highly"}, {"start": 1061.3600000000001, "end": 1068.48, "text": " or anti correlate highly with each other. Okay, which means that exactly this degeneracy"}, {"start": 1068.48, "end": 1075.84, "text": " happens. So either too high or too negative high correlation means that they're very much,"}, {"start": 1075.84, "end": 1080.8, "text": " they're kind of the same thing. So there is, if you have as many parameters as data points,"}, {"start": 1080.8, "end": 1088.6200000000001, "text": " that means that one parameter can potentially serve these two data points or these two that"}, {"start": 1088.6200000000001, "end": 1092.48, "text": " are correlated by one or negative one, you don't need both parameters and therefore you"}, {"start": 1092.48, "end": 1097.72, "text": " have a lot of parameters doing nothing. Whereas over here, with the good networks, you can"}, {"start": 1097.72, "end": 1106.08, "text": " see that this spikes around zero, meaning that the data points are not correlated, or"}, {"start": 1106.08, "end": 1110.2, "text": " the linearizations around the data points are not correlated. And therefore, you can"}, {"start": 1110.2, "end": 1116.0, "text": " sort of shape the function around each data point, however you want, which we sort of"}, {"start": 1116.0, "end": 1121.2, "text": " know that neural networks, what they do is they're so over expressive, that they're actually"}, {"start": 1121.2, "end": 1126.84, "text": " able to shape the functions around the data points without necessarily looking at other"}, {"start": 1126.84, "end": 1133.8999999999999, "text": " data points nearby. And that expressivity is what what you want. And that expressivity"}, {"start": 1133.8999999999999, "end": 1142.1999999999998, "text": " is what this in part measures. Okay, so they make a, they have some experiments here where"}, {"start": 1142.1999999999998, "end": 1146.52, "text": " they validate this. So for all these architectures in this benchmark, and maybe I should tell"}, {"start": 1146.52, "end": 1152.36, "text": " you what, show you what the benchmark looks like. So the benchmark has this particular"}, {"start": 1152.36, "end": 1157.8, "text": " form, this particular form, there's the skeleton. And in this skeleton, there is this block,"}, {"start": 1157.8, "end": 1162.4399999999998, "text": " and it's always repeated. And you're basically your task is to determine what this block"}, {"start": 1162.4399999999998, "end": 1167.8799999999999, "text": " should be. So this block has an input node a and an output node D, and two intermediate"}, {"start": 1167.8799999999999, "end": 1172.08, "text": " nodes. And what you have to do is basically you have to determine these connections right"}, {"start": 1172.08, "end": 1178.4399999999998, "text": " here. So there are six connections. And for each one, you have the option of putting different"}, {"start": 1178.44, "end": 1182.88, "text": " things there. Like you can see you put can put a convolution, you can put the identity"}, {"start": 1182.88, "end": 1187.96, "text": " function, which is a skip connection, zero wise, I'm I don't, maybe that's the zero function."}, {"start": 1187.96, "end": 1194.3200000000002, "text": " So it basically means nothing. I'm not so sure, honestly. But you could technically"}, {"start": 1194.3200000000002, "end": 1200.44, "text": " put a convolution here and here, right? Or, and or different convolutions or things like"}, {"start": 1200.44, "end": 1214.52, "text": " this. So there are these 15,625 possible cells, okay. So the NAS benchmark contains 15,625"}, {"start": 1214.52, "end": 1220.44, "text": " possible architectures that you'll have to search. And they take these architectures"}, {"start": 1220.44, "end": 1227.56, "text": " and they plot now they plot for each architecture, the validation accuracy after training and"}, {"start": 1227.56, "end": 1232.08, "text": " the training protocol is standardized, you don't have to care about that, right. And"}, {"start": 1232.08, "end": 1236.8799999999999, "text": " the score that they measure at the beginning of training. And what you can see is that"}, {"start": 1236.8799999999999, "end": 1243.96, "text": " there is a linear relationship sort of like a sort of from from these experiments, what"}, {"start": 1243.96, "end": 1250.1799999999998, "text": " you'll get is like this sort of feeling. What they're going to propose is that you should"}, {"start": 1250.18, "end": 1258.96, "text": " take that score as a as a measure. And here again, also, sort of sort sort of there is"}, {"start": 1258.96, "end": 1266.88, "text": " a there is a clear trend, as you can see, right here, though. Yeah. Though this, as"}, {"start": 1266.88, "end": 1271.6000000000001, "text": " you can see, this sort of spreads out and the most right one is ImageNet, which is the"}, {"start": 1271.6000000000001, "end": 1279.04, "text": " most difficult one, of course. So, and this is CIFAR 100, which is more difficult than"}, {"start": 1279.04, "end": 1286.2, "text": " CIFAR 10. So we can see that this sort of relationship at the top, it doesn't really"}, {"start": 1286.2, "end": 1291.36, "text": " hold anymore if the task gets difficult. And this is so what I think is happening, this"}, {"start": 1291.36, "end": 1297.52, "text": " is kind of an interjection of my own opinion. What's happening here is that this score that"}, {"start": 1297.52, "end": 1304.52, "text": " they discover, allows them pretty efficiently to see which networks are just degenerate,"}, {"start": 1304.52, "end": 1309.92, "text": " and cannot be trained. Like if you try to train them, they just perform really poorly."}, {"start": 1309.92, "end": 1316.28, "text": " Okay. That it's probably a very good score for weeding those out. And that would mean"}, {"start": 1316.28, "end": 1321.32, "text": " if you kind of barrier here somewhere, right, you could just discard a whole lot of this"}, {"start": 1321.32, "end": 1325.8, "text": " crap, or even even here, right, you could just discard a whole lot of this crap. And"}, {"start": 1325.8, "end": 1334.52, "text": " also, now here, just, you know, all of this crap. Yeah, whereas here, as you can see,"}, {"start": 1334.52, "end": 1338.48, "text": " some of this score, sometimes it's higher than these ones, even though they perform"}, {"start": 1338.48, "end": 1344.9199999999998, "text": " better. And again, you could probably discard a lot of the crap. But it's not as distinctive"}, {"start": 1344.9199999999998, "end": 1350.32, "text": " for the well performing networks, because these here are all not the degenerate version,"}, {"start": 1350.32, "end": 1355.32, "text": " right? They're not degenerate in the sense that they're, they have some fundamental flaw"}, {"start": 1355.32, "end": 1360.56, "text": " where the function lacks now expressivity from the very start, so you can't train it."}, {"start": 1360.56, "end": 1366.1599999999999, "text": " And then probably other factors come into play other factors, then you can simply determine"}, {"start": 1366.1599999999999, "end": 1373.48, "text": " with this particular score. But, you know, there is this relationship that's, that's,"}, {"start": 1373.48, "end": 1380.7, "text": " you know, you can see that. And they do some ablations on this here. For example, are your"}, {"start": 1380.7, "end": 1386.4, "text": " scores a proxy for a number of parameters? And they say, no, the number of parameters"}, {"start": 1386.4, "end": 1392.74, "text": " works way worse than this particular score, which you know, is a is a cool thing, then"}, {"start": 1392.74, "end": 1397.92, "text": " how important is the specific mini batch and initialization? And they say, look, right"}, {"start": 1397.92, "end": 1404.52, "text": " here, we for some architectures, we do different mini batch sizes. And you can see each of"}, {"start": 1404.52, "end": 1410.1200000000001, "text": " those groups, they don't vary too much in how they're it influences their score. This"}, {"start": 1410.12, "end": 1414.6799999999998, "text": " is, I believe this is the same architecture. So it's always an architecture that achieves"}, {"start": 1414.6799999999998, "end": 1422.6, "text": " in this case, for example, wow, that's not a straight line. 77% or so. And you can see"}, {"start": 1422.6, "end": 1428.4799999999998, "text": " if you go for different mini batches, the score varies only minimally. initialization"}, {"start": 1428.4799999999998, "end": 1436.56, "text": " is a bigger variance inducing thing. But also here, the scores don't vary too much. But"}, {"start": 1436.56, "end": 1441.8799999999999, "text": " it is interesting that the different initialization to get you to different score, because it"}, {"start": 1441.8799999999999, "end": 1447.56, "text": " would directly support kind of my hypothesis that what's going on here is that you sort"}, {"start": 1447.56, "end": 1454.3999999999999, "text": " of measure initial degeneracies. And you can sort of make up for these initial degeneracies"}, {"start": 1454.3999999999999, "end": 1458.8799999999999, "text": " in the architecture sometimes with sort of a different initialization. So the different"}, {"start": 1458.8799999999999, "end": 1464.7, "text": " initializations give you differently performing networks. We already know this from things"}, {"start": 1464.7, "end": 1470.1200000000001, "text": " like you know, lottery ticket hypothesis and so on, that the initialization can matter"}, {"start": 1470.1200000000001, "end": 1474.68, "text": " to some degree in these types of things. Now, that being said, they always train to the"}, {"start": 1474.68, "end": 1481.56, "text": " same, it seems, but their their score varies. So I might be backwards correct here or not"}, {"start": 1481.56, "end": 1489.9, "text": " correct. But in any case, the initialization here matters more, but also you can still"}, {"start": 1489.9, "end": 1496.68, "text": " see this linear relationship. And this is particularly interesting. This is even the"}, {"start": 1496.68, "end": 1503.1000000000001, "text": " case when you just input white noise. So instead of the data, you measure that score by just"}, {"start": 1503.1000000000001, "end": 1508.7, "text": " inputting noise that I guess has some sort of the same magnitude as the data would have,"}, {"start": 1508.7, "end": 1513.6000000000001, "text": " but it's just noise. And you can still sort of see this linear relationship, which is"}, {"start": 1513.6, "end": 1521.24, "text": " very interesting. And that I think also shows some that you what you find is a property"}, {"start": 1521.24, "end": 1528.24, "text": " of the network itself. And the fact that it is initialized and built in such a way that"}, {"start": 1528.24, "end": 1538.1999999999998, "text": " it allows you to train it in a very, in a sort of a benign manner. It has no degeneracies."}, {"start": 1538.2, "end": 1550.0800000000002, "text": " Okay. So in last experiment, they go here and they say, we evaluated the score on initialized"}, {"start": 1550.0800000000002, "end": 1554.56, "text": " networks in the PyTorch CV library. So they go to this library that has a lot of these"}, {"start": 1554.56, "end": 1559.68, "text": " networks. But these networks are not the same as this benchmark. This benchmark is specifically"}, {"start": 1559.68, "end": 1564.8600000000001, "text": " designed to do architecture search. Now the networks in this library, they are all designed"}, {"start": 1564.86, "end": 1569.36, "text": " to perform really well. Some are designed to be quite small, some are designed to be"}, {"start": 1569.36, "end": 1574.8799999999999, "text": " quite fast and so on. But in general, they are all of their goal is to perform well."}, {"start": 1574.8799999999999, "end": 1580.3999999999999, "text": " And they have been sort of found by humans to perform well. So they take now these networks"}, {"start": 1580.3999999999999, "end": 1586.9799999999998, "text": " on CIFAR-10 and they test them. So as you can see here, here is the test accuracy again,"}, {"start": 1586.98, "end": 1601.4, "text": " and here is their score that they give it. And they say, I can't move this anymore. Hello."}, {"start": 1601.4, "end": 1610.72, "text": " Well, okay. They say that this linear relationship still sort of holds. It doesn't hold super,"}, {"start": 1610.72, "end": 1618.48, "text": " super well. But you can still sort of if you squint, if you squint hard, you can see that"}, {"start": 1618.48, "end": 1623.8, "text": " it sort of goes upward, though, you really have to squint hard, like what are these things"}, {"start": 1623.8, "end": 1631.04, "text": " right here. And what, again, what's the case is that if the score is low, you will sort"}, {"start": 1631.04, "end": 1639.02, "text": " of be able to cut off the cut off the worst performing ones. But really at the top here,"}, {"start": 1639.02, "end": 1647.0, "text": " it doesn't seem like there is a particular relation between between these networks and"}, {"start": 1647.0, "end": 1652.96, "text": " this initial score, which sort of strengthens my hypothesis that what this does is just"}, {"start": 1652.96, "end": 1659.6, "text": " kind of weed out the bad ones. But it's pretty cool because you can weed out the bad ones"}, {"start": 1659.6, "end": 1664.48, "text": " without any training, right? You'd simply forward prop, backward prop, there you have"}, {"start": 1664.48, "end": 1671.84, "text": " it. So cool. Now they come they, here is the experiment where they now really do this NAS"}, {"start": 1671.84, "end": 1678.1200000000001, "text": " benchmark and they compare with other methods. So some of these other methods are designed"}, {"start": 1678.1200000000001, "end": 1682.8, "text": " to do the call weight sharing, which basically is a technique where you can sort of speed"}, {"start": 1682.8, "end": 1689.44, "text": " up the speed up the algorithm as compared to non weight sharing and the non weight sharing."}, {"start": 1689.44, "end": 1695.24, "text": " That's one of these we have discussed initially. That was my initial example with the controller"}, {"start": 1695.24, "end": 1701.68, "text": " and so on, where it takes super long. So here you see the method and how long each method"}, {"start": 1701.68, "end": 1713.04, "text": " takes. Now the best ones, as you can see already, the best ones here, or these these methods"}, {"start": 1713.04, "end": 1720.1599999999999, "text": " right here are the best ones, they score somewhat like a 93.9 or so on CIFAR 10. Whereas these"}, {"start": 1720.1599999999999, "end": 1725.02, "text": " weight sharing ones, they don't perform too well, except this one seems to perform quite"}, {"start": 1725.02, "end": 1732.6, "text": " well. And in this hours case, they perform worse than that, but they still perform better"}, {"start": 1732.6, "end": 1738.8, "text": " than a lot of the weight sharing ones. So what their point is basically is that they"}, {"start": 1738.8, "end": 1745.56, "text": " get a pretty good score, which is a 91.5 on CIFAR 10, which is, you know, it's at least"}, {"start": 1745.56, "end": 1756.6399999999999, "text": " not degenerate. It's a good accuracy. They score that with simply evaluating 10 architectures,"}, {"start": 1756.6399999999999, "end": 1764.36, "text": " right? And as n goes up as they evaluate more and more architectures, they do, they do get"}, {"start": 1764.36, "end": 1771.9199999999998, "text": " better, but not much. So they have a discussion here. I'm having trouble moving this. All"}, {"start": 1771.9199999999998, "end": 1778.1399999999999, "text": " right, so we'll sort of go through the discussion, we report results, yada, yada, yada, yada."}, {"start": 1778.1399999999999, "end": 1782.52, "text": " As the setup, the non weight sharing methods are given a time budget of 12,000 seconds"}, {"start": 1782.52, "end": 1787.24, "text": " for our method and the non weight sharing methods are averaged, accuracies are averaged"}, {"start": 1787.24, "end": 1793.36, "text": " over 500 runs. For weight sharing methods, accuracies are reported over three runs. With"}, {"start": 1793.36, "end": 1799.4399999999998, "text": " the exception of GDAS, our method is able to outperform all the weight sharing methods"}, {"start": 1799.4399999999998, "end": 1803.9599999999998, "text": " while requiring a fraction of the search time. And that you may see at the table, this is"}, {"start": 1803.9599999999998, "end": 1809.6, "text": " the real, I mean, this is the real deal here, they only use here 1.7 seconds compared to"}, {"start": 1809.6, "end": 1816.32, "text": " the 12,000 seconds of the other methods, and you reach almost the same accuracy. Now to"}, {"start": 1816.32, "end": 1823.0, "text": " be said, 2% in this particular regime on CIFAR 10 is still a sizable difference. And that's"}, {"start": 1823.0, "end": 1828.32, "text": " the same benchmark, right? With the same sort of the same training schedule, and so on."}, {"start": 1828.32, "end": 1833.6, "text": " So there's not too much room to tune here, you simply have to find a better architecture."}, {"start": 1833.6, "end": 1842.68, "text": " So these things are still sizably ahead of this. And what it appears to me that these"}, {"start": 1842.68, "end": 1848.84, "text": " methods here that don't perform well, they're they're simply crap. It seems they're simply,"}, {"start": 1848.84, "end": 1854.52, "text": " I don't I don't know, but they might be trying out something or, you know, doing something"}, {"start": 1854.52, "end": 1863.0, "text": " researchy or whatnot. But it seems like if you're well able to weed out the bad architectures,"}, {"start": 1863.0, "end": 1870.0, "text": " you might be getting to a score like this. And then if you are actually performing a"}, {"start": 1870.0, "end": 1875.6799999999998, "text": " search to find the best one, then you might be getting to somewhere like this. And you"}, {"start": 1875.68, "end": 1882.04, "text": " can see this here throughout. So in CIFAR 100, they achieve a better score than these"}, {"start": 1882.04, "end": 1889.44, "text": " things, but a worse score than the non weight sharing method. And in ImageNet, it gets even"}, {"start": 1889.44, "end": 1897.4, "text": " the difference is even larger. So, again, what I can see here is that there's is a good"}, {"start": 1897.4, "end": 1906.0, "text": " method to maybe get you like, let's say 90% of the way of the way you want to go. And"}, {"start": 1906.0, "end": 1910.96, "text": " what's interesting is that here they say, we also show the effect of sample size, we"}, {"start": 1910.96, "end": 1914.76, "text": " showed accuracy of the networks chosen by our method for each end. So that's the sample"}, {"start": 1914.76, "end": 1920.52, "text": " size, we list the optimal accuracy for sample sizes 10 and 100 and random selection over"}, {"start": 1920.52, "end": 1926.66, "text": " the whole benchmark. So in this case, they have the the optimal one, which I guess they"}, {"start": 1926.66, "end": 1931.3200000000002, "text": " just draw 10 samples and then take the best one. So they train all of them and then take"}, {"start": 1931.3200000000002, "end": 1938.3200000000002, "text": " the best one, you can see that already gets you to the 93. And whereas in their case,"}, {"start": 1938.3200000000002, "end": 1943.44, "text": " sometimes when they add more, they get worse. So here they get better, but then they get"}, {"start": 1943.44, "end": 1950.68, "text": " worse again. So they comment on this right here. We observe that the sample size does"}, {"start": 1950.68, "end": 1955.6000000000001, "text": " not have a large effect on the accuracy of our method. But note that as sample size increases,"}, {"start": 1955.6, "end": 1960.52, "text": " our method suffers from a small amount of noise, increasing the gap between our score"}, {"start": 1960.52, "end": 1968.36, "text": " and the optimal result. And of course, the key practical benefit is execution time. So"}, {"start": 1968.36, "end": 1975.24, "text": " again, they are massively faster than the other methods. But to me, it seems you could"}, {"start": 1975.24, "end": 1981.56, "text": " just think of combining these methods, right, you combine this with this, in that what you"}, {"start": 1981.56, "end": 1987.24, "text": " want to do is actually actively search for the best ones. But by doing so you could if"}, {"start": 1987.24, "end": 1992.72, "text": " you could pretty quickly weed out the bad ones using this method down here, you might"}, {"start": 1992.72, "end": 1999.72, "text": " already have like a big speed up. Because, again, with comparison to this random ones,"}, {"start": 1999.72, "end": 2005.8799999999999, "text": " what appears to happen is that they get good at finding, you know, your 90% architecture,"}, {"start": 2005.88, "end": 2012.64, "text": " but then they fail to differentiate the top performance performers from each other, where"}, {"start": 2012.64, "end": 2021.72, "text": " you'd really have to train the network to find out what's you know, which one's better."}, {"start": 2021.72, "end": 2026.18, "text": " So yeah, here they say they visualize the trade off between search time and accuracy"}, {"start": 2026.18, "end": 2031.92, "text": " for c410 for different NES algorithms on the NES benchmark are moving the need for training"}, {"start": 2031.92, "end": 2036.8400000000001, "text": " our method is able to find accurate networks in seconds instead of hours. And here you"}, {"start": 2036.8400000000001, "end": 2043.04, "text": " can see the accuracy and here you can see the time and all the good ones are either"}, {"start": 2043.04, "end": 2052.3, "text": " way over here or here. And there's is almost at zero while being quite close to the accuracy"}, {"start": 2052.3, "end": 2060.76, "text": " of the other ones. All right, yeah, that was that was this paper. Again, I think this is"}, {"start": 2060.76, "end": 2066.76, "text": " pretty valuable if you are especially if you're in a new domain, where you might not know"}, {"start": 2066.76, "end": 2072.0400000000004, "text": " what kind of network to build, you might just be able to write a little script that generates"}, {"start": 2072.0400000000004, "end": 2076.8, "text": " networks, run it through this algorithm. And at least you get an idea of which ones are"}, {"start": 2076.8, "end": 2081.48, "text": " certainly not worth considering. And then you can simply select one of the other ones"}, {"start": 2081.48, "end": 2085.96, "text": " it doesn't you know, often it doesn't need to be the best ones. And you can then tweak"}, {"start": 2085.96, "end": 2091.44, "text": " it a little bit manually the ones you found, maybe you see some regularity. And yeah, that"}, {"start": 2091.44, "end": 2096.32, "text": " was my two cents on this paper. I hope you liked it. If you did consider sharing it out"}, {"start": 2096.32, "end": 2102.28, "text": " and telling your friends about it and subscribing liking and leave a comment if you agree or"}, {"start": 2102.28, "end": 2119.4, "text": " disagree. That was it. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=eyxmSmjmNS0
[Classic] Generative Adversarial Networks (Paper Explained)
#ai #deeplearning #gan GANs are of the main models in modern deep learning. This is the paper that started it all! While the task of image classification was making progress, the task of image generation was still cumbersome and prone to artifacts. The main idea behind GANs is to pit two competing networks against each other, thereby creating a generative model that only ever has implicit access to the data through a second, discriminative, model. The paper combines architecture, experiments, and theoretical analysis beautifully. OUTLINE: 0:00 - Intro & Overview 3:50 - Motivation 8:40 - Minimax Loss Function 13:20 - Intuition Behind the Loss 19:30 - GAN Algorithm 22:05 - Theoretical Analysis 27:00 - Experiments 33:10 - Advantages & Disadvantages 35:00 - Conclusion Paper: https://arxiv.org/abs/1406.2661 Abstract: We propose a new framework for estimating generative models via an adversarial process, in which we simultaneously train two models: a generative model G that captures the data distribution, and a discriminative model D that estimates the probability that a sample came from the training data rather than G. The training procedure for G is to maximize the probability of D making a mistake. This framework corresponds to a minimax two-player game. In the space of arbitrary functions G and D, a unique solution exists, with G recovering the training data distribution and D equal to 1/2 everywhere. In the case where G and D are defined by multilayer perceptrons, the entire system can be trained with backpropagation. There is no need for any Markov chains or unrolled approximate inference networks during either training or generation of samples. Experiments demonstrate the potential of the framework through qualitative and quantitative evaluation of the generated samples. Authors: Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, Yoshua Bengio Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, today we'll look at generative adversarial nets by E. N. J. Goodfellow et al. So this one is another installment in our series of historical papers that had great impact. GANs nowadays, or generative adversarial nets back then, were sort of, this was the starting shot in a long line of research that is still continuing today. So I remember when I started my PhD in 2015, GANs were just about spiking. I remember NeurIPS or back then NIPS in 2016 and every other paper was about GANs. It was, there was also this famous Schmidhuber Goodfellow moment at the tutorial. It was a wild time. And this is the paper that started it all. And the paper is quite well written. It's very kind of focused on convincing you that this is a sound method mathematically, that it does do, you know, that it doesn't just do wild things. And also, it is already quite has a lot of the, it has a lot of sort of the modern tricks for GANs already sort of built into it. So astounding how much foresight there was already in this paper, but of course, GANs have come like a super long way since then. And today we'll just go through the paper and look at how it looked back then, and what this paper was like. So yeah, join me in this if you like it, please share it out. Let me know in the comments what you think of historic paper reviews. This is not going to be like in a beginner's tutorial in GANs, this is really going to be, we'll go through the paper, you'll see right here, the paper is from 2014. So it would still be another, like two years or so until GANs really take off from this point on, but the introduction, of course, was really important. Okay, so abstract, here we go. We propose a new framework for estimating generative models via an adversarial process, in which we simultaneously train two models, a generative model G, that captures the data distribution and a discriminative model D that estimates the probability that a sample came from the training data rather than G. Okay, this was sort of a new thing. Now I know I know people disagree with this being a new thing, but this was a new thing. And specifically, this, this was the first paper that made something like this really work for data. So to have a discriminator, the, and the words generator and discriminator were also introduced in this paper. So you train this D model, which is the discriminator. And the D model basically decides whether or not a given data point comes from data or comes from the fake distribution. And then you have a generative model G that is supposed to just create this data x rather and then coming from the database. So you want to sample a couple of times from the data. And sometimes you sample from this model G, and then the discriminator is supposed to decide whether or not it comes from the data set or from your count from your counterfeiter, like from this generator G. And it's supposed to see say whether it's data or fake. So you train the D model as a simple image classifier. So people already knew how to build image classifiers. This was this was shortly as you can see before Resnets came on the scene. So people already kind of knew how to build CNNs build really good image classifiers. And the thought here was really generative models weren't really a thing until then. So people were in language models were to back was kind of coming up, but they were would still be doing like RNNs using these were to back vectors for generating language in images, this like generative models weren't really much of a thing. So you would do like compositional models, or you would do auto encoders, which were just either really blurry, or really, really artifactory. And there are also approaches like deep belief networks and so on, but they have their own problems. So there wasn't really a satisfactory way to do image generation that resulted in really high quality images. Now here, I think the entire thought and this is not really spelled out, but the entire thought here is that, hey, we know how to train really, really good image classifiers, right? This has been evident in these since since AlexNet. So for two years, this was evident how to build a really good image classifiers. And the question here is to say that rather than also building really good generators, can't we like harness the power of building really good classifiers for training a generator, right? And this, this is this idea right here. This wasn't the one before, as you know, in like an auto encoder, what you do is you input a sample into some kind of auto bottleneck thing, whatever. And then at the end, you train your output sample to match the input sample as close as possible. And then in here, after you've trained this, this part here is your generative model. And then here in here, you'd input, like MCMC sampler or whatnot. And then of course, variational auto encoders came up, and so on. But still, what you always would do is you would somehow use the data directly. So this is data in order to train your model. So you would somehow say, ah, the output here should probably match the input in some way, or in some, at least distributional way. Right? This, this was a new thing, as you can see, right here, there is no direct connection between the data and the generator. And I think this, this was the success of this model, the fact that the generator did not, it wasn't trained from the data like you would do if you were just approaching this problem. But the philosophy here is let's use the power of discriminative models, which we know how to build in order to train this generator, right. So the generators task now isn't to match any sort of data point, the generators task is to produce images that the discriminator would classify as data. And you can do that by simply back propagating through the discriminator to the generator. Okay, so I think that's, that's the only thing that's kind of unstated in this paper, the reasoning behind why this is new, why this might work. But everything else is spelled out very well in this paper, I have to say if you read through it. So the training procedure for G is to maximize the probability of D making a mistake. This framework corresponds to a minimax two player game. So as I said, the paper is very much focused on convincing you that there's something sound happening here. Because at that time, if you were to look at this, you would say something like, there is no way, right? You would be like, yeah. So I can understand the motivation here to really convince people that, you know, something, something good is happening also on the on the theoretical side. In the space, sorry, in the space of arbitrary functions, G and D, a unique solution exists with G recovering the training data distribution D equals to one half everywhere. In the case where G and D are defined by multi layer perceptrons, the entire system can be trained with back propagation, there is no need for any Markov chains or unrolled approximate inference networks during either training or generation of samples. Okay, so the point here is that it's much easier than current methods of producing of generative models. And also, it does something sound. Now let's jump into the loss function right here. So they say, G and D play the following two player mini max game with value function V. And this is, you know, still understood until today. That it was already like, if this was a pure engineering paper, they could simply build the architecture and say, Oh, we let these networks fight, and they they are kind of adversarial, and they, they pump each other up and so on. And this here was more much more into the direction of kind of a a theoretical reasoning into why something like this would work. Of course, there are still a lot of engineering going on to actually make it work. So they, they have, there's this value function right here. Okay, and the value function is the following. So what you have is, you have the log probability of data. And you have one, the log one minus D of the generated samples. So here you can see, and this was introduced, this seems also obvious now, right? But you have a prior on what this is called the noise distribution, okay, they have a prior on your input noise to the generator, because the generator is supposed to come up with very many different data points. And if it is a, if it is a, you know, non stochastic function, like a neural network, then you need some way to make to produce different images. So there is this prior distribution over the noise, you feed that noise into the generator, the generator will produce an output, you put that into the discriminator. And then this right here, as you can see, the discriminator is trying to maximize this objective. So the discriminator is trying to maximize the probability of real data. And it is trying to minimize the probability of fake data. Okay. It is, this is simply a two way classification problem. At the same time, the generator, as you can see, is trying to minimize the objective. In fact, the order here is quite important. So the generator, as you can see, is trying to minimize whatever this here is. So the generator sort of is trying to minimize against the best possible discriminator. And so this is one, one observation right here is that the formulation is always with respect to a perfect discriminator. Now we know that this doesn't work because if you have a perfect discriminator, then generator cannot catch up because you have insufficient gradients and so on. And this was already recognized in this paper as well. But the formulation is with respect to a min max game and not a max min game. So the other point I want to make here is that you can see the discriminator appears in both in both terms right here. However, the generator only appears right here. Okay. And this, this basically means that the objective for the generator is only this part here because the other part is constant. So the generator is just trying to make the discriminator think that fake data is real. So it is trying to make the discriminator the class of fake data as small as possible for the data that it outputs while the discriminator is trying to make the class of fake data more than the class of sorry, real data. Yeah, it's trying to make it's trying to classify fake data as fake and real data as real. Whereas the generator has only this part on the right. This is I feel this is it's quite important. Why? Because already in this paper, they recognize that this might not be the best practical objective. And for the generator, they can actually exchange this part here on the right to simply say we want to so we want to instead of one minus D, instead of log one minus D, we simply want to use minus log D as an objective for the generator. So you can kind of play around with this. And as you know, lots of formulations have played around with this loss right here. And yeah, that's why we have like a billion billion billion billion Gann variations. They introduced the reasoning behind this. So there's an intuition right here. And you can see already in practice equation one may not provide sufficient gradient for G to learn well. Early in learning when G is poor, D can reject samples with high confidence because they're clearly different from the training data. In this case, this saturates rather than training G to minimize that we can train G to maximize log D. This objective function results in the same fixed point for the dynamic but provides much stronger gradients in early much stronger gradients early in learning. This is in contrast to like other papers that simply say, Oh, we do this and they at least say it provides the same fixed point, right? Yeah. So again, they're trying to convince you that this is doing something useful and that this is easier. Okay. So this strategy is analogous to other things. Training maintains samples from a Markov chain from one learning step in the next order to avoid burning in the Markov chain in another loop of learning. Sorry, okay, this is from another paper. So their point here is that it's analogous to other papers that use these Markov chains where you always do one step in G and one step in D, we alternate between k steps of optimizing D and one step of optimizing G because you have this inner maximization over D and then the outer maximization, the outer minimization over G. So this has already been around the fact that you kind of have to have these optimizations in lockstep. But the difference here is you don't need any sort of like Markov chain in the inner loop and so on. You simply need back propagation. So here's an illustration of how that might work. So at the beginning here, you have your z space and this is always sampled uniformly as you can see right here, this is from a prior distribution and through the mapping. So this here is from z to x is G. So this is the mapping G, you can see that the uniform distribution is now mapped to something non uniform, which results in the green thing. So G is the green line, while as this is data, the black dots are data. And if you have a discriminator, the discriminator is supposed to tell you where there's data and where there's fake data. Now so green here is fake. Now this blue line is sort of a half trained discriminator. Now you train D right? You max maximize D the discriminator, and that gives you this blue line right here. So this, this is a perfect discriminator for these two data distributions. It tells you it's basically the ratio of green to black at each point. And now you train the generator according to this and you can see that the gradient of the discriminator is so the gradient of the discriminator is in this direction. Okay, so it's like up this hill. And that's why you want to shift your green curve over here according to the gradient of the discriminator. Note that, you know, we first trained the discriminator. And now in a second step, we minimize, we optimize the generator. So now we shift this green curve over in order to in along the gradient of the blue curve. So it's important the green curve doesn't see the black curve ever. The generator doesn't see the data, the generator simply sees that blue curve, and it goes along the gradient of that blue curve of the discriminator. Okay. And then if you do this many, many steps, actually, there are dots right here, you will end up with a discriminator that has no clue what's where this is one half probability everywhere because the ratio is the same. And you will end up with the probability of data equal to the probability of the output generated samples. And this can happen if the generator simply remembers the training data. But there are a number of things that counter that, for example, the generator is continuous while the training data is, of course, discrete. So there is this in between things right here, where there is no training data. In fact, to hit exactly training data is very, very unlikely. But of course, you can still you can still peek at the training data. But also, the there, I think there are two things why the generator doesn't simply remember the training data first, because it doesn't ever see the training data directly. So it can only see it through the discriminator. And second of all, because it is built as these multi layer neural networks, it doesn't have the power to just remember this because as there is kind of this notion of continuous function. So, and the these neural networks are rather smooth functions often. And therefore, I think that is something that helps the generator avoid remembering the training data. Of course, there is still this problem of mode collapse that was really big in GANs. So even if it doesn't remember the training data, it might focus on the easiest part of the training data and forget all other parts. And that was a direct result actually, of this objective. So where was it? So this objective directly led to mode collapse in some in some form, because it penalizes different errors differently. So of course, people have come up with ways to to solve that. Okay, now, here is the algorithm. As you can see, this was already quite this was already quite the algorithm we use nowadays. So for k steps, this is the inner maximization. And here they say that we use k equals one. So all this is this is pretty much what we use today, the early days of GAN were still like how much do I need to discriminator per generator and so on. Nowadays, everyone's just using one step here, one step there, or even training and jointly works in some cases. So you want to sample a mini batch of noise samples, and then you will sample a mini batch of m examples from training data generation. So from this data, you want to update the discriminator by sending its stochastic gradient. And this is simply the gradient of the objective. And then after those k steps, you want to sample another mini batch of noise samples and update the generator by descending its stochastic gradient. And you can see right here already, there is this reduced objective that doesn't include this because it falls away in the gradient, right. And they say the gradient based up this can use any standard learning based rule, we use momentum in our experiments. Very cool. So I believe they already also say that it is somewhere here. It's pretty, it's pretty fun that they say, Oh, in our generator, we only input noise at the lowest layer. This is also something that if you think that G here is a multi layer network, so it's kind of a multi layer network that outputs an image, right. And if you ask yourself, if I have noise, how would I input that into there, it's so clear nowadays that, you know, we just put it here. But this was not clear at all. This was kind of an invention of this paper, because you could, you know, put it pretty much at all layers, you could distribute it and so on. You could add some right here. It was this paper that already established the fact that we input noise kind of as a vector at the very beginning and then just let the neural network produce the image from that. So, yeah, pretty, pretty cool. It's pretty sneaky how many things are hidden in these initial papers, how many decisions that are made there, then are just taken over. And you know, this one, I guess, turned out to be fairly, fairly good. Okay, so here they go for some theoretical analysis. And the first they want to convince you that if the generator, if this all works well, if this, if both parties, this generator and the discriminator optimize their objective to the optimum, then the generator will have captured the data distribution, so the global optimality of this, and they go about convincing you of that. So the first thing that they convince you of is that if you fix the generator, the optimal discriminator is this, and we've already seen this in this drawing right here. So the optimal discriminator is simply the ratio of the data of the likelihood of data versus the likelihood of the generated data. Okay, so you train, you always train the discriminator in the inner loop. And that's simply the consequence of this pointwise. This is true pointwise, therefore, it's true over the entire data distribution. In the next thing, they convince you that the global minimum of the virtual training criterion, and this is the value function, this min max game is achieved if and only if this holds. At that point, the training criterion achieves the value of negative log four. And this, again, this was already already here, the fact that this has a global minimum, and it is achieved when the generator matches the data distribution, which is pretty cool. So in the proof, it's pretty simple, actually, they first say, look, if this is the case, we just simply plug that in this, the discriminator will be confused. So if the generator exactly captures the data, the discriminator will have no clue what's going on, right? Because it can't because they're equal. So it must basically output the probability of one half everywhere. And then your objective becomes a constant negative log four. Now if you then plug that into the other equation, you'll see that the training criterion ends up being negative log four plus twice the Jensen Shannon divergence between the data and the generated distribution. And since this term here is always positive, that means that this thing here can never be less than negative log four. And therefore, the negative log four is the optimum. Okay, that's it's that the proof is is pretty cool, I have to say, to show that this has the optimum at that place. And the last thing they convince you of is that this algorithm actually converges. And the convergence is simply predicated on the fact that if you look at each of these problems individually, they are convex. So like here is convex in x for every alpha. So each of these are sort of convex problems. And then it will naturally converge to the to their minimum. However, in practice, adversarial nets represent a limited family of distributions via the function. We optimize the parameters rather than the distribution itself, using a multi layer perceptron to define g introduces multiple critical points in parameter space. However, the excellent performance of the multi layer perceptrons in practice suggest that they are a reasonable model to use despite their lack of theoretical guarantees. So they say if we could optimize these probability distribution directly, it is a convex problem and we will always converge. But in practice, of course, we only optimize the parameters of an MLP or a CNN. And that doesn't always converge, but we have reasonable hopes that it will converge. Okay, so again, it's very much focused on convincing me that this is doing something sensible, which I hope now you are convinced. So there is a global optimum point, it's when the generator captures the data distribution perfectly. This is this can be achieved and will be achieved if you can optimize this probability distributions with a reasonable degree of freedom. And the neural networks provide that reasonable degree of freedom and, you know, give us good hope that in practice, it will work. So they apply this to data sets, namely, MNIST, the Toronto phase database and CIFAR-10. The generator nets used a mixture of rectifier linear activations and sigmoid activations, while the discriminator net used maxout activations. That was still a thing. Dropout was applied in training at the discriminator net, while our theoretical framework was used to draw data, yeah, while our theoretical framework permits the use of dropout and other noise at intermediate layers of the generator, we used noise as the input to only the bottom most layer of the generator network. Again, this wasn't kind of clear at the beginning. And also, the fact that to leave out dropout and so on in the generator was, I guess they found that empirically. And then there was, of course, no way to evaluate these things. Like how do we evaluate generative models? Nowadays, we have these inception distances and so on. But then we estimate probability of the test set under P, under the generated data, by fitting a Gaussian-Parson window to the samples generated with G and reporting the log likelihood under this distribution. The theta parameter, yada, yada, yada. Results are reported. This method of estimating the likelihood has somewhat high variance and does not perform well in high dimensional spaces. But it is the best method available to our knowledge. Advances in generative models that can sample but not estimate likelihood directly motivate further research into into how to evaluate such models. They were absolutely right in this. There was a lot of research into into how to evaluate these models. However, it is my opinion that we still have very, very limited methods of evaluating models like this. Like we have better methods, but it's not really satisfactory how it is right now. So you see that these models, these adversarial nets, by the way, they're always called adversarial nets right here, where I think we call them, like most people would call them adversarial networks. But it's just interesting to see the nets. Also in the title, right, it says, I think it says nets, does it? I think it does. We'll look at it after. So they outperform these other models, especially these belief networks were kind of popular at the time. And you can see the samples right here, were in no way comparable to examples that you get from the modern GANs. But this was already very, very, very good, especially the MNIST. And then here you could actually recognize so the ones with the yellow are always from the training data set, they're like the nearest neighbors of the things on the left. So they want to show that it doesn't simply remember the training data, though I'm not so sure like, this seems like it has some sort of somehow remembered the training data a little bit. Also this one right here, and there was already a way. So this was also very foresighted. So these A to C were fully connected networks, which might be one of the reasons why it worked moderately well, right. But the last one was a convolutional discriminator and a deconvolutional generator. So already using kind of deconvolutions that are used everywhere today. So they are used in GANs in whatnot, VAEs to up sample anything, if you want to do pixel wise classification, you use deconvolutions. So again, this this paper sort of introduced a lot of things that later that we still use in GANs today. Now I'm sure deconvolutions weren't invented here. But you know, we still we still use them. So legit, they were the first GAN paper to use deconvolutions. Haha. Yeah. They also say we make no claim that these samples are better than samples generated by existing methods. We believe that these samples are at least competitive with the better generative models in the literature and highlight the potential of the adversarial framework. Today this paper would be so rejected. Like, wait, you're not better. Get out of here. You can't claim you can't claim this anymore. Doesn't work anymore. I'm sorry. Interpreters has always has to be better than everything else nowadays. Otherwise it's a it's a it's a weak reject their experimental evidence doesn't doesn't convince me. You can't simply say something's cool. Also already introduced in this paper digits obtained by linearly interpolating between coordinates in z space of the full model like this thing here. Every single GAN paper had interpolations in the like in this in the GAN spike. And it came all came from here. So already this is just like, this is like every GAN paper then had like rows of these like of these interpolations. I should know I've written a paper on it and introduced right here. Who knows if they hadn't done this? Yeah, I guess it's it's kind of an obvious thing. But still, you know, very, very cool to see that this was already done. And here, GANs compared to other different methods like deep directed graphical models, generative auto encoders, and compared in very many ways. So this is a actually a good reference if you want to learn about these different kinds of models. And they make the claim here that there are advantages and disadvantages. So disadvantages mainly come with training these things because you have to train them in lockstep. But then also, the disadvantages that you don't have an explicit representation. So there is no explicit representation of this probability distribution, you never build the data distribution, you can only sample from it. However, the advantages are that Markov chains are never needed. Only backprop is used to obtain gradients, no inference is needed during learning. And a wide variety of functions can be incorporated into the model. Because, you know, I haven't read this paper in a while. And I just have to laugh nowadays, because, you know, now all the people are trying to reintroduce, like there are as many papers like reintroducing Markov chains into GANs being like, Oh, GANs would be so much better if they had an MCMC sampler somewhere. You're like, No, this is the point was to get rid of it. And like, no inference is needed during learning, which, you know, for some of these other models, you actually need an inference during training, right? So this is very, very costly. How many models are there nowadays where it's like, Oh, if we just do this inference during training? Yeah. So it's quite it's quite funny to see people kind of trying to, to just combine everything with everything and in the process, sort of reverse, reverse whatever these methods were originally meant to get rid of now not saying anything against these methods, but it's just kind of funny. Yeah, so they had a lot of conclusions and future work. They already say, you know, conditional GANs are very easy to do straightforward, learn the approximate inference can be performed by training an auxiliary network to predict z given x. And this, of course, as you know, has come, you know, has come to fruit very often, early papers already introduced the D. So if you have the G network producing some producing an x and then the D network discriminating, that you would also have like a encoder right here to produce back the z noise to give you the latent encoding, sort of like a variational autoencoder, but not really, it's more like a reverse generator. You know, this models nowadays are big by GAN and things like this, that employ this exact thing that was sort of predicted right here. Of course, they're much earlier models also using this as long as I can remember, people have attempted to bring encoders into GANs. They have a bunch of other things like semi supervised learning, you can use this to do to do get more data for a classifier, which is also done. So a lot of things here already have foresight in this papers is pretty cool. And the coolest thing, look at that savages, good fellow not even using the full eight pages just new dropping this on the world. Absolutely cool. Mad respect. Yeah. So yeah, this was kind of my take on general yet is generative adversarial nets. And yeah, you'd please tell me if you like historic paper overviews. It's more kind of a rant than it really is a paper explanation. But I do enjoy going through this papers and kind of looking at them in hindsight. All right, that was it for me. I wish you a nice day. Bye bye.
[{"start": 0.0, "end": 7.1000000000000005, "text": " Hi there, today we'll look at generative adversarial nets by E. N. J. Goodfellow et al."}, {"start": 7.1000000000000005, "end": 12.120000000000001, "text": " So this one is another installment in our series of historical papers that had great"}, {"start": 12.120000000000001, "end": 13.120000000000001, "text": " impact."}, {"start": 13.120000000000001, "end": 21.66, "text": " GANs nowadays, or generative adversarial nets back then, were sort of, this was the starting"}, {"start": 21.66, "end": 26.8, "text": " shot in a long line of research that is still continuing today."}, {"start": 26.8, "end": 34.24, "text": " So I remember when I started my PhD in 2015, GANs were just about spiking."}, {"start": 34.24, "end": 41.64, "text": " I remember NeurIPS or back then NIPS in 2016 and every other paper was about GANs."}, {"start": 41.64, "end": 49.2, "text": " It was, there was also this famous Schmidhuber Goodfellow moment at the tutorial."}, {"start": 49.2, "end": 51.980000000000004, "text": " It was a wild time."}, {"start": 51.980000000000004, "end": 55.08, "text": " And this is the paper that started it all."}, {"start": 55.08, "end": 58.559999999999995, "text": " And the paper is quite well written."}, {"start": 58.559999999999995, "end": 65.56, "text": " It's very kind of focused on convincing you that this is a sound method mathematically,"}, {"start": 65.56, "end": 69.88, "text": " that it does do, you know, that it doesn't just do wild things."}, {"start": 69.88, "end": 76.42, "text": " And also, it is already quite has a lot of the, it has a lot of sort of the modern tricks"}, {"start": 76.42, "end": 79.44, "text": " for GANs already sort of built into it."}, {"start": 79.44, "end": 85.96, "text": " So astounding how much foresight there was already in this paper, but of course, GANs"}, {"start": 85.96, "end": 89.92, "text": " have come like a super long way since then."}, {"start": 89.92, "end": 95.2, "text": " And today we'll just go through the paper and look at how it looked back then, and what"}, {"start": 95.2, "end": 96.72, "text": " this paper was like."}, {"start": 96.72, "end": 100.56, "text": " So yeah, join me in this if you like it, please share it out."}, {"start": 100.56, "end": 104.72, "text": " Let me know in the comments what you think of historic paper reviews."}, {"start": 104.72, "end": 110.56, "text": " This is not going to be like in a beginner's tutorial in GANs, this is really going to"}, {"start": 110.56, "end": 117.24, "text": " be, we'll go through the paper, you'll see right here, the paper is from 2014."}, {"start": 117.24, "end": 123.75999999999999, "text": " So it would still be another, like two years or so until GANs really take off from this"}, {"start": 123.75999999999999, "end": 128.8, "text": " point on, but the introduction, of course, was really important."}, {"start": 128.8, "end": 132.96, "text": " Okay, so abstract, here we go."}, {"start": 132.96, "end": 139.16, "text": " We propose a new framework for estimating generative models via an adversarial process,"}, {"start": 139.16, "end": 144.68, "text": " in which we simultaneously train two models, a generative model G, that captures the data"}, {"start": 144.68, "end": 150.68, "text": " distribution and a discriminative model D that estimates the probability that a sample"}, {"start": 150.68, "end": 156.64000000000001, "text": " came from the training data rather than G. Okay, this was sort of a new thing."}, {"start": 156.64000000000001, "end": 162.3, "text": " Now I know I know people disagree with this being a new thing, but this was a new thing."}, {"start": 162.3, "end": 167.58, "text": " And specifically, this, this was the first paper that made something like this really"}, {"start": 167.58, "end": 169.44, "text": " work for data."}, {"start": 169.44, "end": 176.24, "text": " So to have a discriminator, the, and the words generator and discriminator were also introduced"}, {"start": 176.24, "end": 177.66000000000003, "text": " in this paper."}, {"start": 177.66000000000003, "end": 181.64000000000001, "text": " So you train this D model, which is the discriminator."}, {"start": 181.64000000000001, "end": 188.32000000000002, "text": " And the D model basically decides whether or not a given data point comes from data"}, {"start": 188.32000000000002, "end": 192.28, "text": " or comes from the fake distribution."}, {"start": 192.28, "end": 200.08, "text": " And then you have a generative model G that is supposed to just create this data x rather"}, {"start": 200.08, "end": 202.22, "text": " and then coming from the database."}, {"start": 202.22, "end": 206.48, "text": " So you want to sample a couple of times from the data."}, {"start": 206.48, "end": 211.64, "text": " And sometimes you sample from this model G, and then the discriminator is supposed to"}, {"start": 211.64, "end": 219.08, "text": " decide whether or not it comes from the data set or from your count from your counterfeiter,"}, {"start": 219.08, "end": 225.64000000000001, "text": " like from this generator G. And it's supposed to see say whether it's data or fake."}, {"start": 225.64000000000001, "end": 229.46, "text": " So you train the D model as a simple image classifier."}, {"start": 229.46, "end": 232.8, "text": " So people already knew how to build image classifiers."}, {"start": 232.8, "end": 238.9, "text": " This was this was shortly as you can see before Resnets came on the scene."}, {"start": 238.9, "end": 244.48000000000002, "text": " So people already kind of knew how to build CNNs build really good image classifiers."}, {"start": 244.48, "end": 251.04, "text": " And the thought here was really generative models weren't really a thing until then."}, {"start": 251.04, "end": 256.4, "text": " So people were in language models were to back was kind of coming up, but they were"}, {"start": 256.4, "end": 262.82, "text": " would still be doing like RNNs using these were to back vectors for generating language"}, {"start": 262.82, "end": 267.36, "text": " in images, this like generative models weren't really much of a thing."}, {"start": 267.36, "end": 272.92, "text": " So you would do like compositional models, or you would do auto encoders, which were"}, {"start": 272.92, "end": 278.56, "text": " just either really blurry, or really, really artifactory."}, {"start": 278.56, "end": 283.56, "text": " And there are also approaches like deep belief networks and so on, but they have their own"}, {"start": 283.56, "end": 284.56, "text": " problems."}, {"start": 284.56, "end": 289.76, "text": " So there wasn't really a satisfactory way to do image generation that resulted in really"}, {"start": 289.76, "end": 292.92, "text": " high quality images."}, {"start": 292.92, "end": 297.48, "text": " Now here, I think the entire thought and this is not really spelled out, but the entire"}, {"start": 297.48, "end": 304.72, "text": " thought here is that, hey, we know how to train really, really good image classifiers,"}, {"start": 304.72, "end": 305.72, "text": " right?"}, {"start": 305.72, "end": 309.44, "text": " This has been evident in these since since AlexNet."}, {"start": 309.44, "end": 314.0, "text": " So for two years, this was evident how to build a really good image classifiers."}, {"start": 314.0, "end": 320.16, "text": " And the question here is to say that rather than also building really good generators,"}, {"start": 320.16, "end": 326.92, "text": " can't we like harness the power of building really good classifiers for training a generator,"}, {"start": 326.92, "end": 327.92, "text": " right?"}, {"start": 327.92, "end": 329.52000000000004, "text": " And this, this is this idea right here."}, {"start": 329.52000000000004, "end": 334.0, "text": " This wasn't the one before, as you know, in like an auto encoder, what you do is you input"}, {"start": 334.0, "end": 338.76, "text": " a sample into some kind of auto bottleneck thing, whatever."}, {"start": 338.76, "end": 344.74, "text": " And then at the end, you train your output sample to match the input sample as close"}, {"start": 344.74, "end": 345.92, "text": " as possible."}, {"start": 345.92, "end": 350.6, "text": " And then in here, after you've trained this, this part here is your generative model."}, {"start": 350.6, "end": 355.12, "text": " And then here in here, you'd input, like MCMC sampler or whatnot."}, {"start": 355.12, "end": 359.08, "text": " And then of course, variational auto encoders came up, and so on."}, {"start": 359.08, "end": 365.16, "text": " But still, what you always would do is you would somehow use the data directly."}, {"start": 365.16, "end": 368.36, "text": " So this is data in order to train your model."}, {"start": 368.36, "end": 373.2, "text": " So you would somehow say, ah, the output here should probably match the input in some way,"}, {"start": 373.2, "end": 376.36, "text": " or in some, at least distributional way."}, {"start": 376.36, "end": 377.36, "text": " Right?"}, {"start": 377.36, "end": 381.56, "text": " This, this was a new thing, as you can see, right here, there is no direct connection"}, {"start": 381.56, "end": 385.2, "text": " between the data and the generator."}, {"start": 385.2, "end": 390.24, "text": " And I think this, this was the success of this model, the fact that the generator did"}, {"start": 390.24, "end": 394.8, "text": " not, it wasn't trained from the data like you would do if you were just approaching"}, {"start": 394.8, "end": 395.96, "text": " this problem."}, {"start": 395.96, "end": 402.92, "text": " But the philosophy here is let's use the power of discriminative models, which we know how"}, {"start": 402.92, "end": 406.86, "text": " to build in order to train this generator, right."}, {"start": 406.86, "end": 412.0, "text": " So the generators task now isn't to match any sort of data point, the generators task"}, {"start": 412.0, "end": 417.64, "text": " is to produce images that the discriminator would classify as data."}, {"start": 417.64, "end": 423.6, "text": " And you can do that by simply back propagating through the discriminator to the generator."}, {"start": 423.6, "end": 430.2, "text": " Okay, so I think that's, that's the only thing that's kind of unstated in this paper, the"}, {"start": 430.2, "end": 435.28000000000003, "text": " reasoning behind why this is new, why this might work."}, {"start": 435.28, "end": 441.59999999999997, "text": " But everything else is spelled out very well in this paper, I have to say if you read through"}, {"start": 441.59999999999997, "end": 442.59999999999997, "text": " it."}, {"start": 442.59999999999997, "end": 450.47999999999996, "text": " So the training procedure for G is to maximize the probability of D making a mistake."}, {"start": 450.47999999999996, "end": 453.91999999999996, "text": " This framework corresponds to a minimax two player game."}, {"start": 453.91999999999996, "end": 458.28, "text": " So as I said, the paper is very much focused on convincing you that there's something sound"}, {"start": 458.28, "end": 459.28, "text": " happening here."}, {"start": 459.28, "end": 463.52, "text": " Because at that time, if you were to look at this, you would say something like, there"}, {"start": 463.52, "end": 466.76, "text": " is no way, right?"}, {"start": 466.76, "end": 469.76, "text": " You would be like, yeah."}, {"start": 469.76, "end": 476.79999999999995, "text": " So I can understand the motivation here to really convince people that, you know, something,"}, {"start": 476.79999999999995, "end": 480.88, "text": " something good is happening also on the on the theoretical side."}, {"start": 480.88, "end": 486.52, "text": " In the space, sorry, in the space of arbitrary functions, G and D, a unique solution exists"}, {"start": 486.52, "end": 491.9, "text": " with G recovering the training data distribution D equals to one half everywhere."}, {"start": 491.9, "end": 496.0, "text": " In the case where G and D are defined by multi layer perceptrons, the entire system can be"}, {"start": 496.0, "end": 500.84, "text": " trained with back propagation, there is no need for any Markov chains or unrolled approximate"}, {"start": 500.84, "end": 505.64, "text": " inference networks during either training or generation of samples."}, {"start": 505.64, "end": 513.24, "text": " Okay, so the point here is that it's much easier than current methods of producing of"}, {"start": 513.24, "end": 514.76, "text": " generative models."}, {"start": 514.76, "end": 518.88, "text": " And also, it does something sound."}, {"start": 518.88, "end": 525.04, "text": " Now let's jump into the loss function right here."}, {"start": 525.04, "end": 532.8, "text": " So they say, G and D play the following two player mini max game with value function V."}, {"start": 532.8, "end": 539.12, "text": " And this is, you know, still understood until today."}, {"start": 539.12, "end": 543.76, "text": " That it was already like, if this was a pure engineering paper, they could simply build"}, {"start": 543.76, "end": 548.88, "text": " the architecture and say, Oh, we let these networks fight, and they they are kind of"}, {"start": 548.88, "end": 552.96, "text": " adversarial, and they, they pump each other up and so on."}, {"start": 552.96, "end": 558.36, "text": " And this here was more much more into the direction of kind of a a theoretical reasoning"}, {"start": 558.36, "end": 560.74, "text": " into why something like this would work."}, {"start": 560.74, "end": 566.16, "text": " Of course, there are still a lot of engineering going on to actually make it work."}, {"start": 566.16, "end": 570.72, "text": " So they, they have, there's this value function right here."}, {"start": 570.72, "end": 574.24, "text": " Okay, and the value function is the following."}, {"start": 574.24, "end": 580.34, "text": " So what you have is, you have the log probability of data."}, {"start": 580.34, "end": 586.28, "text": " And you have one, the log one minus D of the generated samples."}, {"start": 586.28, "end": 591.0, "text": " So here you can see, and this was introduced, this seems also obvious now, right?"}, {"start": 591.0, "end": 597.2, "text": " But you have a prior on what this is called the noise distribution, okay, they have a"}, {"start": 597.2, "end": 603.0, "text": " prior on your input noise to the generator, because the generator is supposed to come"}, {"start": 603.0, "end": 606.38, "text": " up with very many different data points."}, {"start": 606.38, "end": 612.96, "text": " And if it is a, if it is a, you know, non stochastic function, like a neural network,"}, {"start": 612.96, "end": 616.96, "text": " then you need some way to make to produce different images."}, {"start": 616.96, "end": 623.48, "text": " So there is this prior distribution over the noise, you feed that noise into the generator,"}, {"start": 623.48, "end": 628.48, "text": " the generator will produce an output, you put that into the discriminator."}, {"start": 628.48, "end": 633.52, "text": " And then this right here, as you can see, the discriminator is trying to maximize this"}, {"start": 633.52, "end": 635.0, "text": " objective."}, {"start": 635.0, "end": 639.8000000000001, "text": " So the discriminator is trying to maximize the probability of real data."}, {"start": 639.8000000000001, "end": 644.36, "text": " And it is trying to minimize the probability of fake data."}, {"start": 644.36, "end": 645.84, "text": " Okay."}, {"start": 645.84, "end": 650.6800000000001, "text": " It is, this is simply a two way classification problem."}, {"start": 650.68, "end": 655.9599999999999, "text": " At the same time, the generator, as you can see, is trying to minimize the objective."}, {"start": 655.9599999999999, "end": 659.0999999999999, "text": " In fact, the order here is quite important."}, {"start": 659.0999999999999, "end": 667.56, "text": " So the generator, as you can see, is trying to minimize whatever this here is."}, {"start": 667.56, "end": 673.28, "text": " So the generator sort of is trying to minimize against the best possible discriminator."}, {"start": 673.28, "end": 678.9, "text": " And so this is one, one observation right here is that the formulation is always with"}, {"start": 678.9, "end": 681.9599999999999, "text": " respect to a perfect discriminator."}, {"start": 681.9599999999999, "end": 685.68, "text": " Now we know that this doesn't work because if you have a perfect discriminator, then"}, {"start": 685.68, "end": 691.42, "text": " generator cannot catch up because you have insufficient gradients and so on."}, {"start": 691.42, "end": 694.4399999999999, "text": " And this was already recognized in this paper as well."}, {"start": 694.4399999999999, "end": 701.78, "text": " But the formulation is with respect to a min max game and not a max min game."}, {"start": 701.78, "end": 708.56, "text": " So the other point I want to make here is that you can see the discriminator appears"}, {"start": 708.56, "end": 711.3599999999999, "text": " in both in both terms right here."}, {"start": 711.3599999999999, "end": 715.1999999999999, "text": " However, the generator only appears right here."}, {"start": 715.1999999999999, "end": 716.1999999999999, "text": " Okay."}, {"start": 716.1999999999999, "end": 721.68, "text": " And this, this basically means that the objective for the generator is only this part here because"}, {"start": 721.68, "end": 723.76, "text": " the other part is constant."}, {"start": 723.76, "end": 730.78, "text": " So the generator is just trying to make the discriminator think that fake data is real."}, {"start": 730.78, "end": 737.52, "text": " So it is trying to make the discriminator the class of fake data as small as possible"}, {"start": 737.52, "end": 745.72, "text": " for the data that it outputs while the discriminator is trying to make the class of fake data more"}, {"start": 745.72, "end": 748.72, "text": " than the class of sorry, real data."}, {"start": 748.72, "end": 754.76, "text": " Yeah, it's trying to make it's trying to classify fake data as fake and real data as real."}, {"start": 754.76, "end": 757.24, "text": " Whereas the generator has only this part on the right."}, {"start": 757.24, "end": 761.56, "text": " This is I feel this is it's quite important."}, {"start": 761.56, "end": 762.56, "text": " Why?"}, {"start": 762.56, "end": 768.04, "text": " Because already in this paper, they recognize that this might not be the best practical"}, {"start": 768.04, "end": 769.04, "text": " objective."}, {"start": 769.04, "end": 774.76, "text": " And for the generator, they can actually exchange this part here on the right to simply say"}, {"start": 774.76, "end": 784.8, "text": " we want to so we want to instead of one minus D, instead of log one minus D, we simply want"}, {"start": 784.8, "end": 789.64, "text": " to use minus log D as an objective for the generator."}, {"start": 789.64, "end": 791.2399999999999, "text": " So you can kind of play around with this."}, {"start": 791.24, "end": 796.24, "text": " And as you know, lots of formulations have played around with this loss right here."}, {"start": 796.24, "end": 802.4, "text": " And yeah, that's why we have like a billion billion billion billion Gann variations."}, {"start": 802.4, "end": 805.82, "text": " They introduced the reasoning behind this."}, {"start": 805.82, "end": 809.6, "text": " So there's an intuition right here."}, {"start": 809.6, "end": 815.04, "text": " And you can see already in practice equation one may not provide sufficient gradient for"}, {"start": 815.04, "end": 816.92, "text": " G to learn well."}, {"start": 816.92, "end": 820.32, "text": " Early in learning when G is poor, D can reject samples with high confidence because they're"}, {"start": 820.32, "end": 822.24, "text": " clearly different from the training data."}, {"start": 822.24, "end": 828.84, "text": " In this case, this saturates rather than training G to minimize that we can train G to maximize"}, {"start": 828.84, "end": 834.12, "text": " log D. This objective function results in the same fixed point for the dynamic but provides"}, {"start": 834.12, "end": 839.5600000000001, "text": " much stronger gradients in early much stronger gradients early in learning."}, {"start": 839.5600000000001, "end": 844.44, "text": " This is in contrast to like other papers that simply say, Oh, we do this and they at least"}, {"start": 844.44, "end": 847.48, "text": " say it provides the same fixed point, right?"}, {"start": 847.48, "end": 848.48, "text": " Yeah."}, {"start": 848.48, "end": 853.12, "text": " So again, they're trying to convince you that this is doing something useful and that this"}, {"start": 853.12, "end": 854.12, "text": " is easier."}, {"start": 854.12, "end": 855.12, "text": " Okay."}, {"start": 855.12, "end": 859.22, "text": " So this strategy is analogous to other things."}, {"start": 859.22, "end": 865.2, "text": " Training maintains samples from a Markov chain from one learning step in the next order to"}, {"start": 865.2, "end": 869.0, "text": " avoid burning in the Markov chain in another loop of learning."}, {"start": 869.0, "end": 870.96, "text": " Sorry, okay, this is from another paper."}, {"start": 870.96, "end": 877.4, "text": " So their point here is that it's analogous to other papers that use these Markov chains"}, {"start": 877.4, "end": 883.16, "text": " where you always do one step in G and one step in D, we alternate between k steps of"}, {"start": 883.16, "end": 889.1, "text": " optimizing D and one step of optimizing G because you have this inner maximization over"}, {"start": 889.1, "end": 894.48, "text": " D and then the outer maximization, the outer minimization over G. So this has already been"}, {"start": 894.48, "end": 899.3199999999999, "text": " around the fact that you kind of have to have these optimizations in lockstep."}, {"start": 899.3199999999999, "end": 904.56, "text": " But the difference here is you don't need any sort of like Markov chain in the inner"}, {"start": 904.56, "end": 905.56, "text": " loop and so on."}, {"start": 905.56, "end": 908.16, "text": " You simply need back propagation."}, {"start": 908.16, "end": 911.68, "text": " So here's an illustration of how that might work."}, {"start": 911.68, "end": 917.06, "text": " So at the beginning here, you have your z space and this is always sampled uniformly"}, {"start": 917.06, "end": 922.88, "text": " as you can see right here, this is from a prior distribution and through the mapping."}, {"start": 922.88, "end": 929.6199999999999, "text": " So this here is from z to x is G. So this is the mapping G, you can see that the uniform"}, {"start": 929.6199999999999, "end": 935.52, "text": " distribution is now mapped to something non uniform, which results in the green thing."}, {"start": 935.52, "end": 943.56, "text": " So G is the green line, while as this is data, the black dots are data."}, {"start": 943.56, "end": 950.52, "text": " And if you have a discriminator, the discriminator is supposed to tell you where there's data"}, {"start": 950.52, "end": 952.6999999999999, "text": " and where there's fake data."}, {"start": 952.6999999999999, "end": 957.28, "text": " Now so green here is fake."}, {"start": 957.28, "end": 960.64, "text": " Now this blue line is sort of a half trained discriminator."}, {"start": 960.64, "end": 962.54, "text": " Now you train D right?"}, {"start": 962.54, "end": 969.3199999999999, "text": " You max maximize D the discriminator, and that gives you this blue line right here."}, {"start": 969.3199999999999, "end": 975.16, "text": " So this, this is a perfect discriminator for these two data distributions."}, {"start": 975.16, "end": 980.9599999999999, "text": " It tells you it's basically the ratio of green to black at each point."}, {"start": 980.9599999999999, "end": 987.48, "text": " And now you train the generator according to this and you can see that the gradient"}, {"start": 987.48, "end": 993.8000000000001, "text": " of the discriminator is so the gradient of the discriminator is in this direction."}, {"start": 993.8000000000001, "end": 997.4, "text": " Okay, so it's like up this hill."}, {"start": 997.4, "end": 1003.48, "text": " And that's why you want to shift your green curve over here according to the gradient"}, {"start": 1003.48, "end": 1005.0, "text": " of the discriminator."}, {"start": 1005.0, "end": 1009.72, "text": " Note that, you know, we first trained the discriminator."}, {"start": 1009.72, "end": 1016.34, "text": " And now in a second step, we minimize, we optimize the generator."}, {"start": 1016.34, "end": 1024.92, "text": " So now we shift this green curve over in order to in along the gradient of the blue curve."}, {"start": 1024.92, "end": 1029.7, "text": " So it's important the green curve doesn't see the black curve ever."}, {"start": 1029.7, "end": 1035.24, "text": " The generator doesn't see the data, the generator simply sees that blue curve, and it goes along"}, {"start": 1035.24, "end": 1038.8400000000001, "text": " the gradient of that blue curve of the discriminator."}, {"start": 1038.8400000000001, "end": 1039.8400000000001, "text": " Okay."}, {"start": 1039.8400000000001, "end": 1044.96, "text": " And then if you do this many, many steps, actually, there are dots right here, you will"}, {"start": 1044.96, "end": 1051.52, "text": " end up with a discriminator that has no clue what's where this is one half probability"}, {"start": 1051.52, "end": 1053.8, "text": " everywhere because the ratio is the same."}, {"start": 1053.8, "end": 1061.64, "text": " And you will end up with the probability of data equal to the probability of the output"}, {"start": 1061.64, "end": 1064.18, "text": " generated samples."}, {"start": 1064.18, "end": 1069.28, "text": " And this can happen if the generator simply remembers the training data."}, {"start": 1069.28, "end": 1074.28, "text": " But there are a number of things that counter that, for example, the generator is continuous"}, {"start": 1074.28, "end": 1078.96, "text": " while the training data is, of course, discrete."}, {"start": 1078.96, "end": 1085.28, "text": " So there is this in between things right here, where there is no training data."}, {"start": 1085.28, "end": 1089.6399999999999, "text": " In fact, to hit exactly training data is very, very unlikely."}, {"start": 1089.6399999999999, "end": 1094.04, "text": " But of course, you can still you can still peek at the training data."}, {"start": 1094.04, "end": 1099.8, "text": " But also, the there, I think there are two things why the generator doesn't simply remember"}, {"start": 1099.8, "end": 1104.84, "text": " the training data first, because it doesn't ever see the training data directly."}, {"start": 1104.84, "end": 1108.76, "text": " So it can only see it through the discriminator."}, {"start": 1108.76, "end": 1113.76, "text": " And second of all, because it is built as these multi layer neural networks, it doesn't"}, {"start": 1113.76, "end": 1122.6399999999999, "text": " have the power to just remember this because as there is kind of this notion of continuous"}, {"start": 1122.6399999999999, "end": 1123.6399999999999, "text": " function."}, {"start": 1123.6399999999999, "end": 1128.12, "text": " So, and the these neural networks are rather smooth functions often."}, {"start": 1128.12, "end": 1133.6799999999998, "text": " And therefore, I think that is something that helps the generator avoid remembering the"}, {"start": 1133.6799999999998, "end": 1134.8799999999999, "text": " training data."}, {"start": 1134.8799999999999, "end": 1138.8799999999999, "text": " Of course, there is still this problem of mode collapse that was really big in GANs."}, {"start": 1138.8799999999999, "end": 1143.4399999999998, "text": " So even if it doesn't remember the training data, it might focus on the easiest part of"}, {"start": 1143.4399999999998, "end": 1146.4199999999998, "text": " the training data and forget all other parts."}, {"start": 1146.4199999999998, "end": 1151.6799999999998, "text": " And that was a direct result actually, of this objective."}, {"start": 1151.6799999999998, "end": 1153.52, "text": " So where was it?"}, {"start": 1153.52, "end": 1161.76, "text": " So this objective directly led to mode collapse in some in some form, because it penalizes"}, {"start": 1161.76, "end": 1164.0, "text": " different errors differently."}, {"start": 1164.0, "end": 1169.52, "text": " So of course, people have come up with ways to to solve that."}, {"start": 1169.52, "end": 1173.92, "text": " Okay, now, here is the algorithm."}, {"start": 1173.92, "end": 1181.7, "text": " As you can see, this was already quite this was already quite the algorithm we use nowadays."}, {"start": 1181.7, "end": 1184.32, "text": " So for k steps, this is the inner maximization."}, {"start": 1184.32, "end": 1187.5800000000002, "text": " And here they say that we use k equals one."}, {"start": 1187.5800000000002, "end": 1191.48, "text": " So all this is this is pretty much what we use today, the early days of GAN were still"}, {"start": 1191.48, "end": 1196.44, "text": " like how much do I need to discriminator per generator and so on."}, {"start": 1196.44, "end": 1202.3600000000001, "text": " Nowadays, everyone's just using one step here, one step there, or even training and jointly"}, {"start": 1202.3600000000001, "end": 1204.46, "text": " works in some cases."}, {"start": 1204.46, "end": 1209.04, "text": " So you want to sample a mini batch of noise samples, and then you will sample a mini batch"}, {"start": 1209.04, "end": 1214.28, "text": " of m examples from training data generation."}, {"start": 1214.28, "end": 1220.28, "text": " So from this data, you want to update the discriminator by sending its stochastic gradient."}, {"start": 1220.28, "end": 1222.8, "text": " And this is simply the gradient of the objective."}, {"start": 1222.8, "end": 1227.48, "text": " And then after those k steps, you want to sample another mini batch of noise samples"}, {"start": 1227.48, "end": 1231.24, "text": " and update the generator by descending its stochastic gradient."}, {"start": 1231.24, "end": 1236.36, "text": " And you can see right here already, there is this reduced objective that doesn't include"}, {"start": 1236.36, "end": 1242.08, "text": " this because it falls away in the gradient, right."}, {"start": 1242.08, "end": 1246.04, "text": " And they say the gradient based up this can use any standard learning based rule, we use"}, {"start": 1246.04, "end": 1249.1599999999999, "text": " momentum in our experiments."}, {"start": 1249.1599999999999, "end": 1250.1599999999999, "text": " Very cool."}, {"start": 1250.1599999999999, "end": 1259.0, "text": " So I believe they already also say that it is somewhere here."}, {"start": 1259.0, "end": 1264.12, "text": " It's pretty, it's pretty fun that they say, Oh, in our generator, we only input noise"}, {"start": 1264.12, "end": 1266.08, "text": " at the lowest layer."}, {"start": 1266.08, "end": 1272.3999999999999, "text": " This is also something that if you think that G here is a multi layer network, so it's kind"}, {"start": 1272.3999999999999, "end": 1276.72, "text": " of a multi layer network that outputs an image, right."}, {"start": 1276.72, "end": 1281.1999999999998, "text": " And if you ask yourself, if I have noise, how would I input that into there, it's so"}, {"start": 1281.1999999999998, "end": 1284.9199999999998, "text": " clear nowadays that, you know, we just put it here."}, {"start": 1284.9199999999998, "end": 1286.6, "text": " But this was not clear at all."}, {"start": 1286.6, "end": 1290.8, "text": " This was kind of an invention of this paper, because you could, you know, put it pretty"}, {"start": 1290.8, "end": 1294.6399999999999, "text": " much at all layers, you could distribute it and so on."}, {"start": 1294.64, "end": 1298.48, "text": " You could add some right here."}, {"start": 1298.48, "end": 1302.92, "text": " It was this paper that already established the fact that we input noise kind of as a"}, {"start": 1302.92, "end": 1308.3600000000001, "text": " vector at the very beginning and then just let the neural network produce the image from"}, {"start": 1308.3600000000001, "end": 1309.3600000000001, "text": " that."}, {"start": 1309.3600000000001, "end": 1311.5800000000002, "text": " So, yeah, pretty, pretty cool."}, {"start": 1311.5800000000002, "end": 1317.1200000000001, "text": " It's pretty sneaky how many things are hidden in these initial papers, how many decisions"}, {"start": 1317.1200000000001, "end": 1320.1200000000001, "text": " that are made there, then are just taken over."}, {"start": 1320.1200000000001, "end": 1323.92, "text": " And you know, this one, I guess, turned out to be fairly, fairly good."}, {"start": 1323.92, "end": 1328.52, "text": " Okay, so here they go for some theoretical analysis."}, {"start": 1328.52, "end": 1336.4, "text": " And the first they want to convince you that if the generator, if this all works well,"}, {"start": 1336.4, "end": 1341.88, "text": " if this, if both parties, this generator and the discriminator optimize their objective"}, {"start": 1341.88, "end": 1350.52, "text": " to the optimum, then the generator will have captured the data distribution, so the global"}, {"start": 1350.52, "end": 1356.32, "text": " optimality of this, and they go about convincing you of that."}, {"start": 1356.32, "end": 1362.72, "text": " So the first thing that they convince you of is that if you fix the generator, the optimal"}, {"start": 1362.72, "end": 1366.96, "text": " discriminator is this, and we've already seen this in this drawing right here."}, {"start": 1366.96, "end": 1375.9, "text": " So the optimal discriminator is simply the ratio of the data of the likelihood of data"}, {"start": 1375.9, "end": 1379.44, "text": " versus the likelihood of the generated data."}, {"start": 1379.44, "end": 1387.0800000000002, "text": " Okay, so you train, you always train the discriminator in the inner loop."}, {"start": 1387.0800000000002, "end": 1391.24, "text": " And that's simply the consequence of this pointwise."}, {"start": 1391.24, "end": 1397.44, "text": " This is true pointwise, therefore, it's true over the entire data distribution."}, {"start": 1397.44, "end": 1404.96, "text": " In the next thing, they convince you that the global minimum of the virtual training"}, {"start": 1404.96, "end": 1410.8, "text": " criterion, and this is the value function, this min max game is achieved if and only"}, {"start": 1410.8, "end": 1412.88, "text": " if this holds."}, {"start": 1412.88, "end": 1419.04, "text": " At that point, the training criterion achieves the value of negative log four."}, {"start": 1419.04, "end": 1426.92, "text": " And this, again, this was already already here, the fact that this has a global minimum,"}, {"start": 1426.92, "end": 1432.32, "text": " and it is achieved when the generator matches the data distribution, which is pretty cool."}, {"start": 1432.32, "end": 1438.36, "text": " So in the proof, it's pretty simple, actually, they first say, look, if this is the case,"}, {"start": 1438.36, "end": 1443.6599999999999, "text": " we just simply plug that in this, the discriminator will be confused."}, {"start": 1443.6599999999999, "end": 1448.98, "text": " So if the generator exactly captures the data, the discriminator will have no clue what's"}, {"start": 1448.98, "end": 1450.9199999999998, "text": " going on, right?"}, {"start": 1450.9199999999998, "end": 1453.1599999999999, "text": " Because it can't because they're equal."}, {"start": 1453.1599999999999, "end": 1457.8799999999999, "text": " So it must basically output the probability of one half everywhere."}, {"start": 1457.88, "end": 1462.44, "text": " And then your objective becomes a constant negative log four."}, {"start": 1462.44, "end": 1468.88, "text": " Now if you then plug that into the other equation, you'll see that the training criterion ends"}, {"start": 1468.88, "end": 1473.88, "text": " up being negative log four plus twice the Jensen Shannon divergence between the data"}, {"start": 1473.88, "end": 1477.0800000000002, "text": " and the generated distribution."}, {"start": 1477.0800000000002, "end": 1483.2, "text": " And since this term here is always positive, that means that this thing here can never"}, {"start": 1483.2, "end": 1486.3400000000001, "text": " be less than negative log four."}, {"start": 1486.34, "end": 1489.8799999999999, "text": " And therefore, the negative log four is the optimum."}, {"start": 1489.8799999999999, "end": 1497.72, "text": " Okay, that's it's that the proof is is pretty cool, I have to say, to show that this has"}, {"start": 1497.72, "end": 1502.12, "text": " the optimum at that place."}, {"start": 1502.12, "end": 1507.32, "text": " And the last thing they convince you of is that this algorithm actually converges."}, {"start": 1507.32, "end": 1512.48, "text": " And the convergence is simply predicated on the fact that if you look at each of these"}, {"start": 1512.48, "end": 1515.56, "text": " problems individually, they are convex."}, {"start": 1515.56, "end": 1523.3799999999999, "text": " So like here is convex in x for every alpha."}, {"start": 1523.3799999999999, "end": 1526.96, "text": " So each of these are sort of convex problems."}, {"start": 1526.96, "end": 1534.08, "text": " And then it will naturally converge to the to their minimum."}, {"start": 1534.08, "end": 1539.6, "text": " However, in practice, adversarial nets represent a limited family of distributions via the"}, {"start": 1539.6, "end": 1540.6, "text": " function."}, {"start": 1540.6, "end": 1546.1999999999998, "text": " We optimize the parameters rather than the distribution itself, using a multi layer perceptron"}, {"start": 1546.1999999999998, "end": 1550.1599999999999, "text": " to define g introduces multiple critical points in parameter space."}, {"start": 1550.1599999999999, "end": 1554.08, "text": " However, the excellent performance of the multi layer perceptrons in practice suggest"}, {"start": 1554.08, "end": 1559.04, "text": " that they are a reasonable model to use despite their lack of theoretical guarantees."}, {"start": 1559.04, "end": 1565.12, "text": " So they say if we could optimize these probability distribution directly, it is a convex problem"}, {"start": 1565.12, "end": 1567.06, "text": " and we will always converge."}, {"start": 1567.06, "end": 1573.36, "text": " But in practice, of course, we only optimize the parameters of an MLP or a CNN."}, {"start": 1573.36, "end": 1579.84, "text": " And that doesn't always converge, but we have reasonable hopes that it will converge."}, {"start": 1579.84, "end": 1585.48, "text": " Okay, so again, it's very much focused on convincing me that this is doing something"}, {"start": 1585.48, "end": 1588.36, "text": " sensible, which I hope now you are convinced."}, {"start": 1588.36, "end": 1595.1799999999998, "text": " So there is a global optimum point, it's when the generator captures the data distribution"}, {"start": 1595.18, "end": 1597.88, "text": " perfectly."}, {"start": 1597.88, "end": 1608.0, "text": " This is this can be achieved and will be achieved if you can optimize this probability distributions"}, {"start": 1608.0, "end": 1610.16, "text": " with a reasonable degree of freedom."}, {"start": 1610.16, "end": 1614.96, "text": " And the neural networks provide that reasonable degree of freedom and, you know, give us good"}, {"start": 1614.96, "end": 1618.48, "text": " hope that in practice, it will work."}, {"start": 1618.48, "end": 1628.52, "text": " So they apply this to data sets, namely, MNIST, the Toronto phase database and CIFAR-10."}, {"start": 1628.52, "end": 1633.84, "text": " The generator nets used a mixture of rectifier linear activations and sigmoid activations,"}, {"start": 1633.84, "end": 1636.72, "text": " while the discriminator net used maxout activations."}, {"start": 1636.72, "end": 1639.0, "text": " That was still a thing."}, {"start": 1639.0, "end": 1644.68, "text": " Dropout was applied in training at the discriminator net, while our theoretical framework was used"}, {"start": 1644.68, "end": 1650.76, "text": " to draw data, yeah, while our theoretical framework permits the use of dropout and other"}, {"start": 1650.76, "end": 1657.88, "text": " noise at intermediate layers of the generator, we used noise as the input to only the bottom"}, {"start": 1657.88, "end": 1660.24, "text": " most layer of the generator network."}, {"start": 1660.24, "end": 1663.3, "text": " Again, this wasn't kind of clear at the beginning."}, {"start": 1663.3, "end": 1669.96, "text": " And also, the fact that to leave out dropout and so on in the generator was, I guess they"}, {"start": 1669.96, "end": 1673.1200000000001, "text": " found that empirically."}, {"start": 1673.12, "end": 1676.4799999999998, "text": " And then there was, of course, no way to evaluate these things."}, {"start": 1676.4799999999998, "end": 1678.6799999999998, "text": " Like how do we evaluate generative models?"}, {"start": 1678.6799999999998, "end": 1681.56, "text": " Nowadays, we have these inception distances and so on."}, {"start": 1681.56, "end": 1688.1, "text": " But then we estimate probability of the test set under P, under the generated data, by"}, {"start": 1688.1, "end": 1693.6999999999998, "text": " fitting a Gaussian-Parson window to the samples generated with G and reporting the log likelihood"}, {"start": 1693.6999999999998, "end": 1695.7399999999998, "text": " under this distribution."}, {"start": 1695.7399999999998, "end": 1701.08, "text": " The theta parameter, yada, yada, yada."}, {"start": 1701.08, "end": 1702.08, "text": " Results are reported."}, {"start": 1702.08, "end": 1706.6, "text": " This method of estimating the likelihood has somewhat high variance and does not perform"}, {"start": 1706.6, "end": 1708.6399999999999, "text": " well in high dimensional spaces."}, {"start": 1708.6399999999999, "end": 1712.3999999999999, "text": " But it is the best method available to our knowledge."}, {"start": 1712.3999999999999, "end": 1717.04, "text": " Advances in generative models that can sample but not estimate likelihood directly motivate"}, {"start": 1717.04, "end": 1721.1999999999998, "text": " further research into into how to evaluate such models."}, {"start": 1721.1999999999998, "end": 1724.72, "text": " They were absolutely right in this."}, {"start": 1724.72, "end": 1729.12, "text": " There was a lot of research into into how to evaluate these models."}, {"start": 1729.12, "end": 1736.4799999999998, "text": " However, it is my opinion that we still have very, very limited methods of evaluating models"}, {"start": 1736.4799999999998, "end": 1737.6399999999999, "text": " like this."}, {"start": 1737.6399999999999, "end": 1747.52, "text": " Like we have better methods, but it's not really satisfactory how it is right now."}, {"start": 1747.52, "end": 1753.12, "text": " So you see that these models, these adversarial nets, by the way, they're always called adversarial"}, {"start": 1753.12, "end": 1759.4799999999998, "text": " nets right here, where I think we call them, like most people would call them adversarial"}, {"start": 1759.4799999999998, "end": 1761.1599999999999, "text": " networks."}, {"start": 1761.1599999999999, "end": 1765.9399999999998, "text": " But it's just interesting to see the nets."}, {"start": 1765.9399999999998, "end": 1769.4199999999998, "text": " Also in the title, right, it says, I think it says nets, does it?"}, {"start": 1769.4199999999998, "end": 1770.4199999999998, "text": " I think it does."}, {"start": 1770.4199999999998, "end": 1772.3999999999999, "text": " We'll look at it after."}, {"start": 1772.3999999999999, "end": 1781.02, "text": " So they outperform these other models, especially these belief networks were kind of popular"}, {"start": 1781.02, "end": 1782.52, "text": " at the time."}, {"start": 1782.52, "end": 1788.48, "text": " And you can see the samples right here, were in no way comparable to examples that you"}, {"start": 1788.48, "end": 1790.96, "text": " get from the modern GANs."}, {"start": 1790.96, "end": 1796.04, "text": " But this was already very, very, very good, especially the MNIST."}, {"start": 1796.04, "end": 1801.04, "text": " And then here you could actually recognize so the ones with the yellow are always from"}, {"start": 1801.04, "end": 1806.52, "text": " the training data set, they're like the nearest neighbors of the things on the left."}, {"start": 1806.52, "end": 1811.12, "text": " So they want to show that it doesn't simply remember the training data, though I'm not"}, {"start": 1811.12, "end": 1816.1999999999998, "text": " so sure like, this seems like it has some sort of somehow remembered the training data"}, {"start": 1816.1999999999998, "end": 1818.56, "text": " a little bit."}, {"start": 1818.56, "end": 1824.5, "text": " Also this one right here, and there was already a way."}, {"start": 1824.5, "end": 1826.1999999999998, "text": " So this was also very foresighted."}, {"start": 1826.1999999999998, "end": 1833.0, "text": " So these A to C were fully connected networks, which might be one of the reasons why it worked"}, {"start": 1833.0, "end": 1835.8999999999999, "text": " moderately well, right."}, {"start": 1835.9, "end": 1842.52, "text": " But the last one was a convolutional discriminator and a deconvolutional generator."}, {"start": 1842.52, "end": 1848.42, "text": " So already using kind of deconvolutions that are used everywhere today."}, {"start": 1848.42, "end": 1855.0400000000002, "text": " So they are used in GANs in whatnot, VAEs to up sample anything, if you want to do pixel"}, {"start": 1855.0400000000002, "end": 1859.4, "text": " wise classification, you use deconvolutions."}, {"start": 1859.4, "end": 1868.2800000000002, "text": " So again, this this paper sort of introduced a lot of things that later that we still use"}, {"start": 1868.2800000000002, "end": 1869.8200000000002, "text": " in GANs today."}, {"start": 1869.8200000000002, "end": 1874.0, "text": " Now I'm sure deconvolutions weren't invented here."}, {"start": 1874.0, "end": 1876.8400000000001, "text": " But you know, we still we still use them."}, {"start": 1876.8400000000001, "end": 1881.64, "text": " So legit, they were the first GAN paper to use deconvolutions."}, {"start": 1881.64, "end": 1883.1200000000001, "text": " Haha."}, {"start": 1883.1200000000001, "end": 1885.0800000000002, "text": " Yeah."}, {"start": 1885.08, "end": 1890.5, "text": " They also say we make no claim that these samples are better than samples generated"}, {"start": 1890.5, "end": 1891.9399999999998, "text": " by existing methods."}, {"start": 1891.9399999999998, "end": 1896.12, "text": " We believe that these samples are at least competitive with the better generative models"}, {"start": 1896.12, "end": 1899.78, "text": " in the literature and highlight the potential of the adversarial framework."}, {"start": 1899.78, "end": 1902.56, "text": " Today this paper would be so rejected."}, {"start": 1902.56, "end": 1905.4199999999998, "text": " Like, wait, you're not better."}, {"start": 1905.4199999999998, "end": 1906.6799999999998, "text": " Get out of here."}, {"start": 1906.6799999999998, "end": 1909.8799999999999, "text": " You can't claim you can't claim this anymore."}, {"start": 1909.8799999999999, "end": 1911.76, "text": " Doesn't work anymore."}, {"start": 1911.76, "end": 1912.9199999999998, "text": " I'm sorry."}, {"start": 1912.92, "end": 1916.24, "text": " Interpreters has always has to be better than everything else nowadays."}, {"start": 1916.24, "end": 1921.4, "text": " Otherwise it's a it's a it's a weak reject their experimental evidence doesn't doesn't"}, {"start": 1921.4, "end": 1923.2, "text": " convince me."}, {"start": 1923.2, "end": 1926.48, "text": " You can't simply say something's cool."}, {"start": 1926.48, "end": 1931.5800000000002, "text": " Also already introduced in this paper digits obtained by linearly interpolating between"}, {"start": 1931.5800000000002, "end": 1935.72, "text": " coordinates in z space of the full model like this thing here."}, {"start": 1935.72, "end": 1942.0800000000002, "text": " Every single GAN paper had interpolations in the like in this in the GAN spike."}, {"start": 1942.08, "end": 1944.4399999999998, "text": " And it came all came from here."}, {"start": 1944.4399999999998, "end": 1951.1999999999998, "text": " So already this is just like, this is like every GAN paper then had like rows of these"}, {"start": 1951.1999999999998, "end": 1953.32, "text": " like of these interpolations."}, {"start": 1953.32, "end": 1959.58, "text": " I should know I've written a paper on it and introduced right here."}, {"start": 1959.58, "end": 1961.52, "text": " Who knows if they hadn't done this?"}, {"start": 1961.52, "end": 1964.56, "text": " Yeah, I guess it's it's kind of an obvious thing."}, {"start": 1964.56, "end": 1969.86, "text": " But still, you know, very, very cool to see that this was already done."}, {"start": 1969.86, "end": 1976.76, "text": " And here, GANs compared to other different methods like deep directed graphical models,"}, {"start": 1976.76, "end": 1981.6, "text": " generative auto encoders, and compared in very many ways."}, {"start": 1981.6, "end": 1985.04, "text": " So this is a actually a good reference if you want to learn about these different kinds"}, {"start": 1985.04, "end": 1986.34, "text": " of models."}, {"start": 1986.34, "end": 1991.28, "text": " And they make the claim here that there are advantages and disadvantages."}, {"start": 1991.28, "end": 1996.6399999999999, "text": " So disadvantages mainly come with training these things because you have to train them"}, {"start": 1996.6399999999999, "end": 1999.36, "text": " in lockstep."}, {"start": 1999.36, "end": 2005.52, "text": " But then also, the disadvantages that you don't have an explicit representation."}, {"start": 2005.52, "end": 2010.24, "text": " So there is no explicit representation of this probability distribution, you never build"}, {"start": 2010.24, "end": 2014.3999999999999, "text": " the data distribution, you can only sample from it."}, {"start": 2014.3999999999999, "end": 2019.1999999999998, "text": " However, the advantages are that Markov chains are never needed."}, {"start": 2019.1999999999998, "end": 2023.32, "text": " Only backprop is used to obtain gradients, no inference is needed during learning."}, {"start": 2023.32, "end": 2026.8799999999999, "text": " And a wide variety of functions can be incorporated into the model."}, {"start": 2026.88, "end": 2030.8400000000001, "text": " Because, you know, I haven't read this paper in a while."}, {"start": 2030.8400000000001, "end": 2036.88, "text": " And I just have to laugh nowadays, because, you know, now all the people are trying to"}, {"start": 2036.88, "end": 2044.0800000000002, "text": " reintroduce, like there are as many papers like reintroducing Markov chains into GANs"}, {"start": 2044.0800000000002, "end": 2049.8, "text": " being like, Oh, GANs would be so much better if they had an MCMC sampler somewhere."}, {"start": 2049.8, "end": 2053.52, "text": " You're like, No, this is the point was to get rid of it."}, {"start": 2053.52, "end": 2060.32, "text": " And like, no inference is needed during learning, which, you know, for some of these other models,"}, {"start": 2060.32, "end": 2065.24, "text": " you actually need an inference during training, right?"}, {"start": 2065.24, "end": 2068.04, "text": " So this is very, very costly."}, {"start": 2068.04, "end": 2073.2599999999998, "text": " How many models are there nowadays where it's like, Oh, if we just do this inference during"}, {"start": 2073.2599999999998, "end": 2074.6, "text": " training?"}, {"start": 2074.6, "end": 2076.4, "text": " Yeah."}, {"start": 2076.4, "end": 2084.04, "text": " So it's quite it's quite funny to see people kind of trying to, to just combine everything"}, {"start": 2084.04, "end": 2090.8, "text": " with everything and in the process, sort of reverse, reverse whatever these methods were"}, {"start": 2090.8, "end": 2096.2000000000003, "text": " originally meant to get rid of now not saying anything against these methods, but it's just"}, {"start": 2096.2000000000003, "end": 2098.0, "text": " kind of funny."}, {"start": 2098.0, "end": 2104.08, "text": " Yeah, so they had a lot of conclusions and future work."}, {"start": 2104.08, "end": 2110.52, "text": " They already say, you know, conditional GANs are very easy to do straightforward, learn"}, {"start": 2110.52, "end": 2114.2799999999997, "text": " the approximate inference can be performed by training an auxiliary network to predict"}, {"start": 2114.2799999999997, "end": 2115.3199999999997, "text": " z given x."}, {"start": 2115.3199999999997, "end": 2120.3199999999997, "text": " And this, of course, as you know, has come, you know, has come to fruit very often, early"}, {"start": 2120.3199999999997, "end": 2128.12, "text": " papers already introduced the D. So if you have the G network producing some producing"}, {"start": 2128.12, "end": 2135.16, "text": " an x and then the D network discriminating, that you would also have like a encoder right"}, {"start": 2135.16, "end": 2143.12, "text": " here to produce back the z noise to give you the latent encoding, sort of like a variational"}, {"start": 2143.12, "end": 2147.62, "text": " autoencoder, but not really, it's more like a reverse generator."}, {"start": 2147.62, "end": 2154.56, "text": " You know, this models nowadays are big by GAN and things like this, that employ this"}, {"start": 2154.56, "end": 2158.32, "text": " exact thing that was sort of predicted right here."}, {"start": 2158.32, "end": 2163.7999999999997, "text": " Of course, they're much earlier models also using this as long as I can remember, people"}, {"start": 2163.7999999999997, "end": 2170.2799999999997, "text": " have attempted to bring encoders into GANs."}, {"start": 2170.2799999999997, "end": 2175.08, "text": " They have a bunch of other things like semi supervised learning, you can use this to do"}, {"start": 2175.08, "end": 2179.48, "text": " to do get more data for a classifier, which is also done."}, {"start": 2179.48, "end": 2184.68, "text": " So a lot of things here already have foresight in this papers is pretty cool."}, {"start": 2184.68, "end": 2190.8, "text": " And the coolest thing, look at that savages, good fellow not even using the full eight"}, {"start": 2190.8, "end": 2195.2400000000002, "text": " pages just new dropping this on the world."}, {"start": 2195.2400000000002, "end": 2196.2400000000002, "text": " Absolutely cool."}, {"start": 2196.2400000000002, "end": 2198.28, "text": " Mad respect."}, {"start": 2198.28, "end": 2199.28, "text": " Yeah."}, {"start": 2199.28, "end": 2208.0, "text": " So yeah, this was kind of my take on general yet is generative adversarial nets."}, {"start": 2208.0, "end": 2212.82, "text": " And yeah, you'd please tell me if you like historic paper overviews."}, {"start": 2212.82, "end": 2216.64, "text": " It's more kind of a rant than it really is a paper explanation."}, {"start": 2216.64, "end": 2220.2, "text": " But I do enjoy going through this papers and kind of looking at them in hindsight."}, {"start": 2220.2, "end": 2221.88, "text": " All right, that was it for me."}, {"start": 2221.88, "end": 2222.88, "text": " I wish you a nice day."}, {"start": 2222.88, "end": 2241.88, "text": " Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=yexR53My2O4
[Classic] Word2Vec: Distributed Representations of Words and Phrases and their Compositionality
#ai #research #word2vec Word vectors have been one of the most influential techniques in modern NLP to date. This paper describes Word2Vec, which the most popular technique to obtain word vectors. The paper introduces the negative sampling technique as an approximation to noise contrastive estimation and shows that this allows the training of word vectors from giant corpora on a single machine in a very short time. OUTLINE: 0:00 - Intro & Outline 1:50 - Distributed Word Representations 5:40 - Skip-Gram Model 12:00 - Hierarchical Softmax 14:55 - Negative Sampling 22:30 - Mysterious 3/4 Power 25:50 - Frequent Words Subsampling 28:15 - Empirical Results 29:45 - Conclusion & Comments Paper: https://arxiv.org/abs/1310.4546 Code: https://code.google.com/archive/p/word2vec/ Abstract: The recently introduced continuous Skip-gram model is an efficient method for learning high-quality distributed vector representations that capture a large number of precise syntactic and semantic word relationships. In this paper we present several extensions that improve both the quality of the vectors and the training speed. By subsampling of the frequent words we obtain significant speedup and also learn more regular word representations. We also describe a simple alternative to the hierarchical softmax called negative sampling. An inherent limitation of word representations is their indifference to word order and their inability to represent idiomatic phrases. For example, the meanings of "Canada" and "Air" cannot be easily combined to obtain "Air Canada". Motivated by this example, we present a simple method for finding phrases in text, and show that learning good vector representations for millions of phrases is possible. Authors: Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg Corrado, Jeffrey Dean Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there. Today we'll look at distributed representations of words and phrases and their compositionality by Thomas Mikolov, Ilya Sotskyver, Kai Chen, Greg Corrado and Jeffrey Dean. This is another historical paper. It's one of three papers. It's the middle one that introduces the original word2vec algorithm. And if you, as you might know, word2vec was extremely influential in NLP since this paper basically until recently, where it's sort of gone out of fashion a bit in research with the rise of things like Elmo and BERT, but it's still very, very relevant. So we'll look at this historical paper today with kind of the hindsight of being a couple years into the future. In fact, as you see right here, this was released in 2013. So it's seven years later now. And we'll look back and we'll see what they said back then about the system. This is not going to be like a very, you know, well enhanced PowerPoint presentation of how word2vec works. We're going to look at the paper and read it together. If you like, you know, content like this, if you like historical paper readings, let me know in the comments. Share it out if you do like it. And of course, subscribe. Because this kind of historical papers, I enjoy them. But, you know, many people might already know what these things are. Yeah. Okay, let's, you know, go through the paper and pick up their ideas and kind of put them in context. They say the recently introduced continuous skipgram model is an efficient method for learning high quality distributed vector representations that capture a large number of precise syntactic and semantic word relationships. So the skipgram model was already introduced by Miklov in an earlier paper that came out, I believe not like one or two months prior to this one. As I said, word2vec is a series of papers, I don't think there is a paper called word2vec. Rather, they here have released the code along with the with the paper, the code was called word2vec. So the skipgram model was introduced previously, but it is replicated right here. So this in the skipgram model, what you're trying to do is you're trying to get a distributed word representation. So what does that mean? That means that for each word in your language, let's take these words right here, for each word in the language, you want to come up with a vector that somehow describes that word in a continuous fashion. So with in a 2, might be mapped to, I don't know, 0.1, 0.9, and 0.3. learn might be mapped to negative 0.5, and so on. So each word gets assigned a vector in the same dimensional space. And what the previous paper kind of discovered is that if you do this correctly, then these vectors, they have they have some kind of properties. And we can already kind of jump ahead, because this was already a bit a bit researched in the last paper. The semantics of these vectors will be something like this. So here they have a two dimensional PCA. So these are the first two dimensions of the 1000 dimensional skipgram vector. So the vectors they obtain, they can do things like this, where they can show that in the spaces, for example, there appears to be a vector direction that characterizes the capital of a country. So if you take a few countries and their capitals, and you average that vector, you get a kind of a direction for capitalness of a city. Given a country, you can see that there is a pretty clear relation here. Now, some of these things have later been revised to such that they are ultimately ended up being not that impressive. For example, there was always this kind of math with vectors. And I don't I believe this is this might not be in this, this is in the last paper where they discovered that if you take the vector for king, and you subtract the vector for man, and you add the vector for woman, then that would result in the vector for queen. So the way they did it was basically, they did this calculation right here. And then they searched in the point they ended up they searched for the nearest neighbor in their vocabulary. And that turned out to be queen. But in order to make it a queen, actually, you have to exclude the original word king and people quickly discovered that if you don't exclude the original word it, you know, the result of this kind of arithmetic will almost always lead to the result of the original word king. And then a lot of these analogy tasks are simply the result of you then discarding that word during the nearest neighbor search, and then queen just happens to be one of the closest words. And it's sort of much less dependent on which exact calculation you do here. So there's been a lot of follow up work kind of analyzing criticizing these vector maths. But definitely, we know that these word vectors turned out to be extremely, extremely helpful and syntactically and semantically relevant in downstream tasks because they have performed very, very well. So how does the skip gram model work? How does how does it assign vectors to each to each word? So first of all, it has a dictionary. So there is a word, an input word. And for each word, you have a big dictionary. And the dictionary big dictionary basically says that, you know, to the word two is going to be mapped to this vector point one, da da da da da da, and so on. The word learn is going to be mapped to that vector. And then you also have these output vectors right here. And what you're trying to do is you're trying to take a phrase from the data set, like this one right here. And you take out one word like this word vector right here. And you're trying to frame this as a prediction task. So you're trying to frame this as, in this case, four different prediction tasks. So you're telling your machine, I give you the word vector. And which other words are around the word vector, you just tell it that you don't tell it anything else, you just say, which other words are around the word vector. And the correct answers, in this case would be to learn word and representations. So this you construct four different training examples, where you have an x and y. So the x is always vector, and the y is two. And then the next training sample, the x is vector, and the y is learn, and, and so on. Okay. So this here, each training sample is a classification task, right? And the classification task is an is, as you can see, no, you can't see right here. But the classification task is, you have the input word, and you classify it into one of many, many, many, many, many, many classes. Namely, there are as many classes as you have words in the dictionary. So each word in the dictionary will have a class associated with it, right? So in ImageNet, you have like 1000 classes, but in these, that's already a lot. But in these tasks, you're going to have 100,000 classes, because there are 100,000 words in the English language that you want to want to treat. And there are many more. But in this case, they leave away all the words that appear less than five times in their corpus. That's still a lot of words. So it's a it's like a super duper, duper lot of classification task. But ultimately, if you do something like this, then the origin, so the representation that you end up with is going to be very, very good at doing these kind of downstream tasks. And that's what they discovered. So their skip gram model is nothing else than taking a word and predicting the surrounding words from that word. And this is what it means. This is the formal statement of the skip gram objective. What you want to do is the objective of the skip gram model is to maximize the average log probability this one. So for the word we're considering the word T, we want to maximize the log probability of each word w that is in around the word C, sorry, around the word w in a context window of C. That's exactly what we did before. Take a word like this model right here, and from it, we predict all of the words around it in a given window, right? That's all. That's the entire objective. And that will give you very good representations. And this is how you would implement that. So what you'll have is you'll have these vector representation v that comes from your original dictionary. Those are the things you learn. And then because you have like a 30,000 way classifier, you know that a classification layer is nothing else than a linear layer followed by a softmax operation. And that linear layer also has parameters. These are the v primes. Okay, so first you have the lookup in the dictionary for the word vector right here. And this is the vector of the classification layer. Now there are modifications where you can use like the same vectors and so on, or you can also make use of these vectors. But ultimately, you care about these vectors right here. And the vectors here are simply the classification layers weights. So here you can see that there is what you're trying to maximize is the inner product between the word that you're considering and the words around that word. And you're trying to do a classification task. So you need to normalize. Now this is the normalization constant, and it goes over all of your vocabulary. So that's what they tackle here. They say, w is the number of words in the vocabulary. This formulation is impractical because the cost of computing the gradient is proportional to w, which is often large. And that's 10 to the five to 10 to the seven terms. So many like 10s of millions of terms in your vocabulary. That's just not feasible, right? So people have been, you know, sort of trying different ways to get around very, very large number of classes. And here it seems that that is really our bottleneck. In the previous paper, they've already shown that this objective can give you very good word representation. But now we need to get around the fact that we have such large vocabularies. So the first idea here is hierarchical softmax. And this is kind of a tangent. I find this paper, by the way, it's sort of hard to read because it's like a half engineering paper. But yeah, so first they introduced this hierarchical softmax, which is kind of a distraction. It's kind of a, here is what we do. Here's what we considered first, but then didn't end up using really they do compare with it. But the flow of text is sort of that you expect this to be part of the final model, which it isn't. So in the hierarchical softmax, what you do instead of having this giant multi class classification task right here, you take all of these classes right here, and you put them in a sort of a tree. Okay, so you take this, and you put them into a tree. So instead of classifying, you know, let's say we have 1000 classes, instead of classifying 1000 ways, we first classify in two ways. And then we classify in two ways again, from each one, and then we classify in two ways. Again, as you know, 1000 is like two to the 10. So we need approximately 10 layers of this before we are actually arriving at 1000 classes. But it also means that we only have two way classifications each time. So in the hierarchical softmax, we build trees like this, and then we so we have a word, we look up its vector, sorry, its vector, and then we classify it for each of these nodes. So your output isn't going to be 1000 1000 log probabilities, your output is going to be a log probability, a binary log probability for each of the nodes right here. So you want to know, okay, here, is it in the upper half or the lower half of my classes? Okay, cool. It's in the upper half. Okay, here is in the upper half or the lower half and so on. And you learn all to predict all of these junctions right here. And that's going to end up you with you having to predict less. And of course, you are constrained, you impose a very big prior on the class distribution classes aren't independently anymore. Namely, if two classes here are in the same subtree, that means that they are going to be predicted, their predictions are going to be correlated, because the path to them is the same partially. So how you arrange the classes here is very important. And there has been a lot of work in this. But as I said, this is rather a bit a distraction right here. Hierarchical softmax is a way to solve this. However, they went with a different way right here. They went with this approach called negative sampling. Negative sampling has been, it's been very influential. Not only in word2vec, but negative sampling is one of the cornerstones of the current trend in self supervised learning and contrastive estimation and so on. So this, all of this, you know, it pops up in unlikely ways in other fields. And it sort of, I'm not going to say it originated here, but definitely it was introduced into the popular deep learning world right here. So they say an alternative to hierarchical softmax is noise contrastive estimation. Okay, so in noise contrastive estimation posits that a good model should be able to differentiate data from noise by means of logistic regression. You know, that seems very reasonable. This is similar to the hinge loss and so on. While NCE can be shown to approximately maximize the log probability of the softmax, the skip-gram model is only concerned with learning high quality vector representations. So we are free to simplify noise contrastive estimation as long as the vector representations retain their quality. We define negative sampling by this following objective. So this is very interesting. They see, okay, noise contrastive estimation, you know, it approximately maximizes the log probability. So the noise contrastive estimation would actually be the correct way to approximate their problem. However, they say, well, as long as, you know, as long as something reasonable comes out, we're free to change that up a bit. So they go with this negative sampling approach right here. And you can see that this is almost the same. So it's written a bit differently from the original softmax thing because the original softmax thing was written as a fraction and here it's as a sum. But what you're trying to do in the noise in the negative sampling framework is you try to maximize the following. You're trying to maximize the inner product of the word you're considering and the words around them. Okay, so you're trying to still predict the words around you. But now instead of having this prediction softmax over all of the classes, you only have the softmax over a subset of classes. So what you'll do is you sample words from your vocabulary at random and you sample k of them. And you're simply trying to now minimize the inner product between those words and your word. Okay, so what does that ultimately lead to? It ultimately leads to the following. You have a word like this word here, negative. And what you're trying to do is you're not trying that much to predict the word sampling. What you're trying to do is you're trying to say that in my space right here, I simply want sampling to be closer than any other words that's not in the context window. Okay, so here is my word negative and here is my word sampling. And I want these two to be close. And if I sample another word, like here, this is the word cake. If I sample that, I simply want that to be far away, farther than the word sampling. Okay, so this is now a comparative. It's not I classify sampling as the highest class. It's simply I want to classify the word sampling against the other classes higher. All right, so and this is now much, much easier. So instead of a thousand or 10,000 or a million way classification, I now maybe have I have a k plus one way classification, right? Pretty easy, right? I simply sample k other words. And as I assume, because I have so many words chances that I actually sample one that's in my context window is very small, right? So I simply sample other words and I say, Well, these other words are random. They have nothing to do with the current frame that I'm looking at. So they should be, you know, they can be whatever they want, but at least they should be farther away than the words that are actually in my in my context. And that is negative sampling, the process of sampling negatives, this right here, and then making sure that the positives, which are these here, in this case, the words in the context, are classified with a higher probability than the negatives for a given input word, right? This here is the input word. That's it. That's negative sampling. And of course, yeah, as I said, you recognize this from current things like self supervised learning, where you want to have the same image augmented twice, go through the pipeline, you know, you augment the put a little bit of different noise, and then you have a different image. And at the end, you say these two should be close together, while this other one should be far apart. It's the exact same thing here, except that you have a different way of obtaining the positive and the negative samples. In this case, positive samples are everything that's in the context, negative samples are just randomly sampled from the data set. And that, you know, works, of course, that works much, much, much faster. And you can see that this turns out to give you vectors that are pretty good. And you can train with higher vectors, sorry, with higher dimensional vectors, you can train with bigger vocabularies with this, this has turned out to be very, very influential. As I said, now with the rise of BERT and so on, BERT2Vec is kind of getting forgotten. But this was a revolution. And distributed vectors. So it wasn't a thing, really, it kind of was a thing before that. But it wasn't really a thing that people used. What people would do is still they would do n-gram models before that. So they would kind of just they would sort of chunk up their sentences into n-grams into overlapping n-grams, and then have a big giant table for their where they index their n-grams. So the word, I don't know, so the word, hello, is ID one, the word, hello, there is ID two, and so on. So you have a big table for all the n-grams. And then what we would try to do is you would try to do this kind of bag of words estimation, where you would take a, you know, whatever n-grams appeared in your sentence, and you would have this big, you know, classification, where you associate the n-grams with each other, and so on. So distributed word representations were kind of a revolution at that point, especially distributed representation that actually outperformed these old n-gram methods. So there are a number of tricks right here that are, I think, not understood until this day. For example, the question is, how do you sample these negative samples? Right here, this basically says, get k words from your vocabulary at random according to this distribution right here. Now, how are you going to do that? Basically, you have a spectrum of options. The one side of the spectrum is going to be completely uniform. Okay, we sample each word with the same probability. And the other side of the spectrum is something like, sample this according to their unigram. These are two different things. They're opposites in this in this fashion. So here you say, hey, some words appear way, way, way more often than other words. Shouldn't we prefer them when we sample, right? Shouldn't we, if we have a corpus, and shouldn't we sample from the corpus? And if in the corpus, one word appears 50 times more than the other word, then shouldn't we sample that 50 times more as a negative because it's, you know, so abundant, and it should give a higher classification accuracy? Whereas on the other hand, you could say, no, no, no, we should simply sample every word in our dictionary uniformly. They came up with something in between, which they say, both NC and negative sampling have noise distribution as a free parameter, we investigated a number of choices and found that the unigram distribution raised to the three quarter power, ie unigram to the three quarter, outperformed significantly the unigram and uniform distributions for both NC and neg on every task we tried, including language modeling. This, I think, is a mystery until today. And it actually turned out that this exponent right here is magically much better than like the exponent of one or even the exponent of one half, like you might be reasonably assumed that the square root, you know, might be something but the three quarters, I think turned out to be very good and very mystical. So what does it, what does it mean? It means that you have kind of a balance between words that appear often words that don't appear often. Usually in these kind of things, you have a power law, where we have very few words that appear very often. And then you have, okay, that's the tail shouldn't go up, but you have a very long tail of words. And what you want to do is, in this case, you want to sample these words here more, but they are they appear so much more often than if you simply sample according to their unigram distribution, you'll basically not regard these words right here, you'll forget about them, and your performance will suffer because they do appear every now and then. So what you want to do is you want to push that those down a little bit, and the optimal amount for the little bit turns out to be to raise it the, you raise it to the three quarters. Strange, but, you know, turned out to work well. The other thing they do is they do the, they do a sub sampling of frequent words. So, again, this is a way to kind of push down the often appearing words where they say, the most frequent words can easily occur hundreds of millions of times, like in the array, such words usually provide less information value than the rare words. For example, while the skipgram model benefits from observing the co occurrences of France and Paris, it benefits much less from observing the frequent co occurrences of France and the as nearly every word co occurs frequently with in a sentence with the. So, they do another trick here to counter this imbalance between rare and frequent words, use a simple sub sampling approach, each word in the training set is discarded with probability computed by that formula. Right, so they have a formula right here, and you might be asking again, why, why this formula. So this is the sampling probability of a word, and it goes with one over t t is a temperature parameter, and f is the frequency with which the word appears in the corpus. So, as you can see, as the word appears more in the, in the corpus, then, so this is the frequency as the word appears more than this thing goes down, then this thing goes up, so it's discarded with this probability, so it's discarded with a higher probability, if it appears more often. Where f is frequency of a word, t is a chosen threshold, we chose this sub sampling formula because it aggressively sub samples words whose frequencies greater than t, while preserving the ranking of the frequencies. Although this sub sampling formula was chosen heuristically we found it to work well in practice. It accelerates learning and even significantly improves the accuracy of the learned vectors of the rare words, as will be shown in the following sections. So, again, something sort of arbitrary it's, it's more understandable than the three quarters but still it's sort of arbitrary, they experimented around they found this works well and then every everybody ended up, you know, using that. So, that's how this kind of stuff happens. Okay, so now we get into the empirical results and the empirical results in this case were already sort of given in the previous paper, but here they have these the analogical reasoning task, where you can see that the negative sampling did outperform the others by quite a bit right here. So, the negative sampling approaches outperformed the hierarchical softmax and the noise contrastive estimation. And in the previous paper they also compared with other baselines and saw that it also outperforms those while being quite time, time efficient. So, you can see that, especially with the sub sampling approaches, the time here is 36 minutes for and I think they have like a huge corpus that they train on these were to back code turned out to be really, really efficient code. And that's why it got so popular as well. They did the same thing for phrases right here. So, for phrases like New York Times and so on, but this was kind of more of a, this was more of a side thing. The phrase vectors turned out to be, you know, rather a side thing from the actual code right here. So, yeah, as, as I said, this paper is very different from other research papers and that it's it's sort of half an engineering paper and all of these papers are, they're kind of hard to read because they just kind of state some things in the order is kind of weird sometimes why they do things is kind of weird sometimes, but you can't, you know, you can't deny that it had the quite the effect on the community. And this is it is a very cool paper, very cool series of papers, and it's very cool that actually they released the code, and they made the code such that it is super duper efficient, even like on a single machine. And that was very cool because you know being Google, they could have just released code that is very efficient on a distributed data center. And they didn't do that. So that this is, it's sort of not really like today anymore like today, when they release code it's always you need, you need like 50 cloud TPUs to do it, and it's still cool that they release code but this was, this was really a step into kind of democratizing AI. And yeah, so that was my rant about Word2Vec. I hope you enjoyed this. I hope this still was useful to you, even though most of you probably already knew Word2Vec. And yeah, so I'll see you next time. Bye bye.
[{"start": 0.0, "end": 12.0, "text": " Hi there. Today we'll look at distributed representations of words and phrases and their compositionality by Thomas Mikolov, Ilya Sotskyver, Kai Chen, Greg Corrado and Jeffrey Dean."}, {"start": 12.0, "end": 21.0, "text": " This is another historical paper. It's one of three papers. It's the middle one that introduces the original word2vec algorithm."}, {"start": 21.0, "end": 40.0, "text": " And if you, as you might know, word2vec was extremely influential in NLP since this paper basically until recently, where it's sort of gone out of fashion a bit in research with the rise of things like Elmo and BERT, but it's still very, very relevant."}, {"start": 40.0, "end": 53.0, "text": " So we'll look at this historical paper today with kind of the hindsight of being a couple years into the future. In fact, as you see right here, this was released in 2013. So it's seven years later now."}, {"start": 53.0, "end": 66.0, "text": " And we'll look back and we'll see what they said back then about the system. This is not going to be like a very, you know, well enhanced PowerPoint presentation of how word2vec works."}, {"start": 66.0, "end": 77.0, "text": " We're going to look at the paper and read it together. If you like, you know, content like this, if you like historical paper readings, let me know in the comments."}, {"start": 77.0, "end": 89.0, "text": " Share it out if you do like it. And of course, subscribe. Because this kind of historical papers, I enjoy them. But, you know, many people might already know what these things are."}, {"start": 89.0, "end": 98.0, "text": " Yeah. Okay, let's, you know, go through the paper and pick up their ideas and kind of put them in context."}, {"start": 98.0, "end": 111.0, "text": " They say the recently introduced continuous skipgram model is an efficient method for learning high quality distributed vector representations that capture a large number of precise syntactic and semantic word relationships."}, {"start": 111.0, "end": 121.0, "text": " So the skipgram model was already introduced by Miklov in an earlier paper that came out, I believe not like one or two months prior to this one."}, {"start": 121.0, "end": 135.0, "text": " As I said, word2vec is a series of papers, I don't think there is a paper called word2vec. Rather, they here have released the code along with the with the paper, the code was called word2vec."}, {"start": 135.0, "end": 148.0, "text": " So the skipgram model was introduced previously, but it is replicated right here. So this in the skipgram model, what you're trying to do is you're trying to get a distributed word representation."}, {"start": 148.0, "end": 161.0, "text": " So what does that mean? That means that for each word in your language, let's take these words right here, for each word in the language, you want to come up with a vector that somehow describes that word in a continuous fashion."}, {"start": 161.0, "end": 174.0, "text": " So with in a 2, might be mapped to, I don't know, 0.1, 0.9, and 0.3. learn might be mapped to negative 0.5, and so on."}, {"start": 174.0, "end": 179.0, "text": " So each word gets assigned a vector in the same dimensional space."}, {"start": 179.0, "end": 195.0, "text": " And what the previous paper kind of discovered is that if you do this correctly, then these vectors, they have they have some kind of properties. And we can already kind of jump ahead, because this was already a bit a bit researched in the last paper."}, {"start": 195.0, "end": 199.0, "text": " The semantics of these vectors will be something like this."}, {"start": 199.0, "end": 222.0, "text": " So here they have a two dimensional PCA. So these are the first two dimensions of the 1000 dimensional skipgram vector. So the vectors they obtain, they can do things like this, where they can show that in the spaces, for example, there appears to be a vector direction that characterizes the capital of a country."}, {"start": 222.0, "end": 233.0, "text": " So if you take a few countries and their capitals, and you average that vector, you get a kind of a direction for capitalness of a city."}, {"start": 233.0, "end": 238.0, "text": " Given a country, you can see that there is a pretty clear relation here."}, {"start": 238.0, "end": 252.0, "text": " Now, some of these things have later been revised to such that they are ultimately ended up being not that impressive. For example, there was always this kind of math with vectors."}, {"start": 252.0, "end": 274.0, "text": " And I don't I believe this is this might not be in this, this is in the last paper where they discovered that if you take the vector for king, and you subtract the vector for man, and you add the vector for woman, then that would result in the vector for queen."}, {"start": 274.0, "end": 286.0, "text": " So the way they did it was basically, they did this calculation right here. And then they searched in the point they ended up they searched for the nearest neighbor in their vocabulary."}, {"start": 286.0, "end": 303.0, "text": " And that turned out to be queen. But in order to make it a queen, actually, you have to exclude the original word king and people quickly discovered that if you don't exclude the original word it, you know, the result of this kind of arithmetic will almost always lead to the result of the original word king."}, {"start": 303.0, "end": 315.0, "text": " And then a lot of these analogy tasks are simply the result of you then discarding that word during the nearest neighbor search, and then queen just happens to be one of the closest words."}, {"start": 315.0, "end": 326.0, "text": " And it's sort of much less dependent on which exact calculation you do here. So there's been a lot of follow up work kind of analyzing criticizing these vector maths."}, {"start": 326.0, "end": 340.0, "text": " But definitely, we know that these word vectors turned out to be extremely, extremely helpful and syntactically and semantically relevant in downstream tasks because they have performed very, very well."}, {"start": 340.0, "end": 350.0, "text": " So how does the skip gram model work? How does how does it assign vectors to each to each word?"}, {"start": 350.0, "end": 360.0, "text": " So first of all, it has a dictionary. So there is a word, an input word. And for each word, you have a big dictionary."}, {"start": 360.0, "end": 370.0, "text": " And the dictionary big dictionary basically says that, you know, to the word two is going to be mapped to this vector point one, da da da da da da, and so on."}, {"start": 370.0, "end": 381.0, "text": " The word learn is going to be mapped to that vector. And then you also have these output vectors right here."}, {"start": 381.0, "end": 390.0, "text": " And what you're trying to do is you're trying to take a phrase from the data set, like this one right here."}, {"start": 390.0, "end": 403.0, "text": " And you take out one word like this word vector right here. And you're trying to frame this as a prediction task."}, {"start": 403.0, "end": 413.0, "text": " So you're trying to frame this as, in this case, four different prediction tasks. So you're telling your machine, I give you the word vector."}, {"start": 413.0, "end": 425.0, "text": " And which other words are around the word vector, you just tell it that you don't tell it anything else, you just say, which other words are around the word vector."}, {"start": 425.0, "end": 432.0, "text": " And the correct answers, in this case would be to learn word and representations."}, {"start": 432.0, "end": 445.0, "text": " So this you construct four different training examples, where you have an x and y. So the x is always vector, and the y is two."}, {"start": 445.0, "end": 453.0, "text": " And then the next training sample, the x is vector, and the y is learn, and, and so on. Okay."}, {"start": 453.0, "end": 466.0, "text": " So this here, each training sample is a classification task, right? And the classification task is an is, as you can see, no, you can't see right here."}, {"start": 466.0, "end": 477.0, "text": " But the classification task is, you have the input word, and you classify it into one of many, many, many, many, many, many classes."}, {"start": 477.0, "end": 488.0, "text": " Namely, there are as many classes as you have words in the dictionary. So each word in the dictionary will have a class associated with it, right?"}, {"start": 488.0, "end": 502.0, "text": " So in ImageNet, you have like 1000 classes, but in these, that's already a lot. But in these tasks, you're going to have 100,000 classes, because there are 100,000 words in the English language that you want to want to treat."}, {"start": 502.0, "end": 510.0, "text": " And there are many more. But in this case, they leave away all the words that appear less than five times in their corpus. That's still a lot of words."}, {"start": 510.0, "end": 527.0, "text": " So it's a it's like a super duper, duper lot of classification task. But ultimately, if you do something like this, then the origin, so the representation that you end up with is going to be very, very good at doing these kind of downstream tasks."}, {"start": 527.0, "end": 540.0, "text": " And that's what they discovered. So their skip gram model is nothing else than taking a word and predicting the surrounding words from that word."}, {"start": 540.0, "end": 545.0, "text": " And this is what it means. This is the formal statement of the skip gram objective."}, {"start": 545.0, "end": 554.0, "text": " What you want to do is the objective of the skip gram model is to maximize the average log probability this one."}, {"start": 554.0, "end": 572.0, "text": " So for the word we're considering the word T, we want to maximize the log probability of each word w that is in around the word C, sorry, around the word w in a context window of C."}, {"start": 572.0, "end": 584.0, "text": " That's exactly what we did before. Take a word like this model right here, and from it, we predict all of the words around it in a given window, right?"}, {"start": 584.0, "end": 592.0, "text": " That's all. That's the entire objective. And that will give you very good representations."}, {"start": 592.0, "end": 603.0, "text": " And this is how you would implement that. So what you'll have is you'll have these vector representation v that comes from your original dictionary."}, {"start": 603.0, "end": 615.0, "text": " Those are the things you learn. And then because you have like a 30,000 way classifier, you know that a classification layer is nothing else than a linear layer followed by a softmax operation."}, {"start": 615.0, "end": 627.0, "text": " And that linear layer also has parameters. These are the v primes. Okay, so first you have the lookup in the dictionary for the word vector right here."}, {"start": 627.0, "end": 636.0, "text": " And this is the vector of the classification layer. Now there are modifications where you can use like the same vectors and so on, or you can also make use of these vectors."}, {"start": 636.0, "end": 646.0, "text": " But ultimately, you care about these vectors right here. And the vectors here are simply the classification layers weights."}, {"start": 646.0, "end": 662.0, "text": " So here you can see that there is what you're trying to maximize is the inner product between the word that you're considering and the words around that word."}, {"start": 662.0, "end": 674.0, "text": " And you're trying to do a classification task. So you need to normalize. Now this is the normalization constant, and it goes over all of your vocabulary."}, {"start": 674.0, "end": 682.0, "text": " So that's what they tackle here. They say, w is the number of words in the vocabulary."}, {"start": 682.0, "end": 694.0, "text": " This formulation is impractical because the cost of computing the gradient is proportional to w, which is often large. And that's 10 to the five to 10 to the seven terms."}, {"start": 694.0, "end": 701.0, "text": " So many like 10s of millions of terms in your vocabulary. That's just not feasible, right?"}, {"start": 701.0, "end": 708.0, "text": " So people have been, you know, sort of trying different ways to get around very, very large number of classes."}, {"start": 708.0, "end": 717.0, "text": " And here it seems that that is really our bottleneck. In the previous paper, they've already shown that this objective can give you very good word representation."}, {"start": 717.0, "end": 726.0, "text": " But now we need to get around the fact that we have such large vocabularies. So the first idea here is hierarchical softmax. And this is kind of a tangent."}, {"start": 726.0, "end": 733.0, "text": " I find this paper, by the way, it's sort of hard to read because it's like a half engineering paper."}, {"start": 733.0, "end": 740.0, "text": " But yeah, so first they introduced this hierarchical softmax, which is kind of a distraction."}, {"start": 740.0, "end": 748.0, "text": " It's kind of a, here is what we do. Here's what we considered first, but then didn't end up using really they do compare with it."}, {"start": 748.0, "end": 755.0, "text": " But the flow of text is sort of that you expect this to be part of the final model, which it isn't."}, {"start": 755.0, "end": 768.0, "text": " So in the hierarchical softmax, what you do instead of having this giant multi class classification task right here, you take all of these classes right here, and you put them in a sort of a tree."}, {"start": 768.0, "end": 781.0, "text": " Okay, so you take this, and you put them into a tree. So instead of classifying, you know, let's say we have 1000 classes, instead of classifying 1000 ways, we first classify in two ways."}, {"start": 781.0, "end": 790.0, "text": " And then we classify in two ways again, from each one, and then we classify in two ways. Again, as you know, 1000 is like two to the 10."}, {"start": 790.0, "end": 799.0, "text": " So we need approximately 10 layers of this before we are actually arriving at 1000 classes."}, {"start": 799.0, "end": 805.0, "text": " But it also means that we only have two way classifications each time."}, {"start": 805.0, "end": 819.0, "text": " So in the hierarchical softmax, we build trees like this, and then we so we have a word, we look up its vector, sorry, its vector, and then we classify it for each of these nodes."}, {"start": 819.0, "end": 833.0, "text": " So your output isn't going to be 1000 1000 log probabilities, your output is going to be a log probability, a binary log probability for each of the nodes right here."}, {"start": 833.0, "end": 844.0, "text": " So you want to know, okay, here, is it in the upper half or the lower half of my classes? Okay, cool. It's in the upper half. Okay, here is in the upper half or the lower half and so on."}, {"start": 844.0, "end": 852.0, "text": " And you learn all to predict all of these junctions right here. And that's going to end up you with you having to predict less."}, {"start": 852.0, "end": 876.0, "text": " And of course, you are constrained, you impose a very big prior on the class distribution classes aren't independently anymore. Namely, if two classes here are in the same subtree, that means that they are going to be predicted, their predictions are going to be correlated, because the path to them is the same partially."}, {"start": 876.0, "end": 888.0, "text": " So how you arrange the classes here is very important. And there has been a lot of work in this. But as I said, this is rather a bit a distraction right here."}, {"start": 888.0, "end": 895.0, "text": " Hierarchical softmax is a way to solve this. However, they went with a different way right here."}, {"start": 895.0, "end": 915.0, "text": " They went with this approach called negative sampling. Negative sampling has been, it's been very influential. Not only in word2vec, but negative sampling is one of the cornerstones of the current trend in self supervised learning and contrastive estimation and so on."}, {"start": 915.0, "end": 933.0, "text": " So this, all of this, you know, it pops up in unlikely ways in other fields. And it sort of, I'm not going to say it originated here, but definitely it was introduced into the popular deep learning world right here."}, {"start": 933.0, "end": 939.0, "text": " So they say an alternative to hierarchical softmax is noise contrastive estimation."}, {"start": 939.0, "end": 949.0, "text": " Okay, so in noise contrastive estimation posits that a good model should be able to differentiate data from noise by means of logistic regression."}, {"start": 949.0, "end": 955.0, "text": " You know, that seems very reasonable. This is similar to the hinge loss and so on."}, {"start": 955.0, "end": 973.0, "text": " While NCE can be shown to approximately maximize the log probability of the softmax, the skip-gram model is only concerned with learning high quality vector representations. So we are free to simplify noise contrastive estimation as long as the vector representations retain their quality."}, {"start": 973.0, "end": 984.0, "text": " We define negative sampling by this following objective. So this is very interesting. They see, okay, noise contrastive estimation, you know, it approximately maximizes the log probability."}, {"start": 984.0, "end": 999.0, "text": " So the noise contrastive estimation would actually be the correct way to approximate their problem. However, they say, well, as long as, you know, as long as something reasonable comes out, we're free to change that up a bit."}, {"start": 999.0, "end": 1004.0, "text": " So they go with this negative sampling approach right here."}, {"start": 1004.0, "end": 1018.0, "text": " And you can see that this is almost the same. So it's written a bit differently from the original softmax thing because the original softmax thing was written as a fraction and here it's as a sum."}, {"start": 1018.0, "end": 1026.0, "text": " But what you're trying to do in the noise in the negative sampling framework is you try to maximize the following."}, {"start": 1026.0, "end": 1038.0, "text": " You're trying to maximize the inner product of the word you're considering and the words around them. Okay, so you're trying to still predict the words around you."}, {"start": 1038.0, "end": 1049.0, "text": " But now instead of having this prediction softmax over all of the classes, you only have the softmax over a subset of classes."}, {"start": 1049.0, "end": 1066.0, "text": " So what you'll do is you sample words from your vocabulary at random and you sample k of them. And you're simply trying to now minimize the inner product between those words and your word."}, {"start": 1066.0, "end": 1070.0, "text": " Okay, so what does that ultimately lead to?"}, {"start": 1070.0, "end": 1082.0, "text": " It ultimately leads to the following. You have a word like this word here, negative. And what you're trying to do is you're not trying that much to predict the word sampling."}, {"start": 1082.0, "end": 1095.0, "text": " What you're trying to do is you're trying to say that in my space right here, I simply want sampling to be closer than any other words that's not in the context window."}, {"start": 1095.0, "end": 1109.0, "text": " Okay, so here is my word negative and here is my word sampling. And I want these two to be close. And if I sample another word, like here, this is the word cake."}, {"start": 1109.0, "end": 1118.0, "text": " If I sample that, I simply want that to be far away, farther than the word sampling."}, {"start": 1118.0, "end": 1132.0, "text": " Okay, so this is now a comparative. It's not I classify sampling as the highest class. It's simply I want to classify the word sampling against the other classes higher."}, {"start": 1132.0, "end": 1145.0, "text": " All right, so and this is now much, much easier. So instead of a thousand or 10,000 or a million way classification, I now maybe have I have a k plus one way classification, right?"}, {"start": 1145.0, "end": 1158.0, "text": " Pretty easy, right? I simply sample k other words. And as I assume, because I have so many words chances that I actually sample one that's in my context window is very small, right?"}, {"start": 1158.0, "end": 1166.0, "text": " So I simply sample other words and I say, Well, these other words are random. They have nothing to do with the current frame that I'm looking at."}, {"start": 1166.0, "end": 1179.0, "text": " So they should be, you know, they can be whatever they want, but at least they should be farther away than the words that are actually in my in my context."}, {"start": 1179.0, "end": 1193.0, "text": " And that is negative sampling, the process of sampling negatives, this right here, and then making sure that the positives, which are these here, in this case, the words in the context,"}, {"start": 1193.0, "end": 1205.0, "text": " are classified with a higher probability than the negatives for a given input word, right? This here is the input word."}, {"start": 1205.0, "end": 1213.0, "text": " That's it. That's negative sampling. And of course, yeah, as I said, you recognize this from current things like"}, {"start": 1213.0, "end": 1223.0, "text": " self supervised learning, where you want to have the same image augmented twice, go through the pipeline, you know, you augment the put a little bit of different noise,"}, {"start": 1223.0, "end": 1232.0, "text": " and then you have a different image. And at the end, you say these two should be close together, while this other one should be far apart."}, {"start": 1232.0, "end": 1245.0, "text": " It's the exact same thing here, except that you have a different way of obtaining the positive and the negative samples. In this case, positive samples are everything that's in the context,"}, {"start": 1245.0, "end": 1256.0, "text": " negative samples are just randomly sampled from the data set. And that, you know, works, of course, that works much, much, much faster."}, {"start": 1256.0, "end": 1268.0, "text": " And you can see that this turns out to give you vectors that are pretty good. And you can train with higher vectors, sorry, with higher dimensional vectors,"}, {"start": 1268.0, "end": 1280.0, "text": " you can train with bigger vocabularies with this, this has turned out to be very, very influential. As I said, now with the rise of BERT and so on, BERT2Vec is kind of getting forgotten."}, {"start": 1280.0, "end": 1293.0, "text": " But this was a revolution. And distributed vectors. So it wasn't a thing, really, it kind of was a thing before that. But it wasn't really a thing that people used."}, {"start": 1293.0, "end": 1304.0, "text": " What people would do is still they would do n-gram models before that. So they would kind of just they would sort of chunk up their sentences into n-grams into overlapping n-grams,"}, {"start": 1304.0, "end": 1321.0, "text": " and then have a big giant table for their where they index their n-grams. So the word, I don't know, so the word, hello, is ID one, the word, hello, there is ID two, and so on."}, {"start": 1321.0, "end": 1331.0, "text": " So you have a big table for all the n-grams. And then what we would try to do is you would try to do this kind of bag of words estimation, where you would take a, you know,"}, {"start": 1331.0, "end": 1341.0, "text": " whatever n-grams appeared in your sentence, and you would have this big, you know, classification, where you associate the n-grams with each other, and so on."}, {"start": 1341.0, "end": 1353.0, "text": " So distributed word representations were kind of a revolution at that point, especially distributed representation that actually outperformed these old n-gram methods."}, {"start": 1353.0, "end": 1364.0, "text": " So there are a number of tricks right here that are, I think, not understood until this day. For example, the question is, how do you sample these negative samples?"}, {"start": 1364.0, "end": 1376.0, "text": " Right here, this basically says, get k words from your vocabulary at random according to this distribution right here. Now, how are you going to do that?"}, {"start": 1376.0, "end": 1388.0, "text": " Basically, you have a spectrum of options. The one side of the spectrum is going to be completely uniform. Okay, we sample each word with the same probability."}, {"start": 1388.0, "end": 1401.0, "text": " And the other side of the spectrum is something like, sample this according to their unigram. These are two different things. They're opposites in this in this fashion."}, {"start": 1401.0, "end": 1411.0, "text": " So here you say, hey, some words appear way, way, way more often than other words. Shouldn't we prefer them when we sample, right?"}, {"start": 1411.0, "end": 1423.0, "text": " Shouldn't we, if we have a corpus, and shouldn't we sample from the corpus? And if in the corpus, one word appears 50 times more than the other word,"}, {"start": 1423.0, "end": 1431.0, "text": " then shouldn't we sample that 50 times more as a negative because it's, you know, so abundant, and it should give a higher classification accuracy?"}, {"start": 1431.0, "end": 1443.0, "text": " Whereas on the other hand, you could say, no, no, no, we should simply sample every word in our dictionary uniformly. They came up with something in between, which they say,"}, {"start": 1443.0, "end": 1456.0, "text": " both NC and negative sampling have noise distribution as a free parameter, we investigated a number of choices and found that the unigram distribution raised to the three quarter power,"}, {"start": 1456.0, "end": 1469.0, "text": " ie unigram to the three quarter, outperformed significantly the unigram and uniform distributions for both NC and neg on every task we tried, including language modeling."}, {"start": 1469.0, "end": 1485.0, "text": " This, I think, is a mystery until today. And it actually turned out that this exponent right here is magically much better than like the exponent of one or even the exponent of one half, like you might be reasonably assumed that the square root,"}, {"start": 1485.0, "end": 1494.0, "text": " you know, might be something but the three quarters, I think turned out to be very good and very mystical. So what does it, what does it mean?"}, {"start": 1494.0, "end": 1506.0, "text": " It means that you have kind of a balance between words that appear often words that don't appear often. Usually in these kind of things, you have a power law, where we have very few words that appear very often."}, {"start": 1506.0, "end": 1523.0, "text": " And then you have, okay, that's the tail shouldn't go up, but you have a very long tail of words. And what you want to do is, in this case, you want to sample these words here more, but they are they appear so much more often than if you simply sample according to their unigram distribution,"}, {"start": 1523.0, "end": 1547.0, "text": " you'll basically not regard these words right here, you'll forget about them, and your performance will suffer because they do appear every now and then. So what you want to do is you want to push that those down a little bit, and the optimal amount for the little bit turns out to be to raise it the, you raise it to the three quarters."}, {"start": 1547.0, "end": 1567.0, "text": " Strange, but, you know, turned out to work well. The other thing they do is they do the, they do a sub sampling of frequent words. So, again, this is a way to kind of push down the often appearing words where they say, the most frequent words can easily occur hundreds of millions of times,"}, {"start": 1567.0, "end": 1589.0, "text": " like in the array, such words usually provide less information value than the rare words. For example, while the skipgram model benefits from observing the co occurrences of France and Paris, it benefits much less from observing the frequent co occurrences of France and the as nearly every word co occurs frequently with in a sentence with the."}, {"start": 1589.0, "end": 1604.0, "text": " So, they do another trick here to counter this imbalance between rare and frequent words, use a simple sub sampling approach, each word in the training set is discarded with probability computed by that formula."}, {"start": 1604.0, "end": 1625.0, "text": " Right, so they have a formula right here, and you might be asking again, why, why this formula. So this is the sampling probability of a word, and it goes with one over t t is a temperature parameter, and f is the frequency with which the word appears in the corpus."}, {"start": 1625.0, "end": 1648.0, "text": " So, as you can see, as the word appears more in the, in the corpus, then, so this is the frequency as the word appears more than this thing goes down, then this thing goes up, so it's discarded with this probability, so it's discarded with a higher probability, if it appears more often."}, {"start": 1648.0, "end": 1663.0, "text": " Where f is frequency of a word, t is a chosen threshold, we chose this sub sampling formula because it aggressively sub samples words whose frequencies greater than t, while preserving the ranking of the frequencies."}, {"start": 1663.0, "end": 1676.0, "text": " Although this sub sampling formula was chosen heuristically we found it to work well in practice. It accelerates learning and even significantly improves the accuracy of the learned vectors of the rare words, as will be shown in the following sections."}, {"start": 1676.0, "end": 1690.0, "text": " So, again, something sort of arbitrary it's, it's more understandable than the three quarters but still it's sort of arbitrary, they experimented around they found this works well and then every everybody ended up, you know, using that."}, {"start": 1690.0, "end": 1694.0, "text": " So, that's how this kind of stuff happens."}, {"start": 1694.0, "end": 1719.0, "text": " Okay, so now we get into the empirical results and the empirical results in this case were already sort of given in the previous paper, but here they have these the analogical reasoning task, where you can see that the negative sampling did outperform the others by quite a bit right here."}, {"start": 1719.0, "end": 1739.0, "text": " So, the negative sampling approaches outperformed the hierarchical softmax and the noise contrastive estimation. And in the previous paper they also compared with other baselines and saw that it also outperforms those while being quite time, time efficient."}, {"start": 1739.0, "end": 1757.0, "text": " So, you can see that, especially with the sub sampling approaches, the time here is 36 minutes for and I think they have like a huge corpus that they train on these were to back code turned out to be really, really efficient code."}, {"start": 1757.0, "end": 1761.0, "text": " And that's why it got so popular as well."}, {"start": 1761.0, "end": 1765.0, "text": " They did the same thing for phrases right here."}, {"start": 1765.0, "end": 1775.0, "text": " So, for phrases like New York Times and so on, but this was kind of more of a, this was more of a side thing."}, {"start": 1775.0, "end": 1785.0, "text": " The phrase vectors turned out to be, you know, rather a side thing from the actual code right here."}, {"start": 1785.0, "end": 1814.0, "text": " So, yeah, as, as I said, this paper is very different from other research papers and that it's it's sort of half an engineering paper and all of these papers are, they're kind of hard to read because they just kind of state some things in the order is kind of weird sometimes why they do things is kind of weird sometimes, but you can't, you know, you can't deny that it had the quite the effect on the community."}, {"start": 1814.0, "end": 1831.0, "text": " And this is it is a very cool paper, very cool series of papers, and it's very cool that actually they released the code, and they made the code such that it is super duper efficient, even like on a single machine."}, {"start": 1831.0, "end": 1842.0, "text": " And that was very cool because you know being Google, they could have just released code that is very efficient on a distributed data center."}, {"start": 1842.0, "end": 1866.0, "text": " And they didn't do that. So that this is, it's sort of not really like today anymore like today, when they release code it's always you need, you need like 50 cloud TPUs to do it, and it's still cool that they release code but this was, this was really a step into kind of democratizing AI."}, {"start": 1866.0, "end": 1878.0, "text": " And yeah, so that was my rant about Word2Vec. I hope you enjoyed this. I hope this still was useful to you, even though most of you probably already knew Word2Vec."}, {"start": 1878.0, "end": 1896.0, "text": " And yeah, so I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=GWt6Fu05voI
[Classic] Deep Residual Learning for Image Recognition (Paper Explained)
#ai #research #resnet ResNets are one of the cornerstones of modern Computer Vision. Before their invention, people were not able to scale deep neural networks beyond 20 or so layers, but with this paper's invention of residual connections, all of a sudden networks could be arbitrarily deep. This led to a big spike in the performance of convolutional neural networks and rapid adoption in the community. To this day, ResNets are the backbone of most vision models and residual connections appear all throughout deep learning. OUTLINE: 0:00 - Intro & Overview 1:45 - The Problem with Depth 3:15 - VGG-Style Networks 6:00 - Overfitting is Not the Problem 7:25 - Motivation for Residual Connections 10:25 - Residual Blocks 12:10 - From VGG to ResNet 18:50 - Experimental Results 23:30 - Bottleneck Blocks 24:40 - Deeper ResNets 28:15 - More Results 29:50 - Conclusion & Comments Paper: https://arxiv.org/abs/1512.03385 Abstract: Deeper neural networks are more difficult to train. We present a residual learning framework to ease the training of networks that are substantially deeper than those used previously. We explicitly reformulate the layers as learning residual functions with reference to the layer inputs, instead of learning unreferenced functions. We provide comprehensive empirical evidence showing that these residual networks are easier to optimize, and can gain accuracy from considerably increased depth. On the ImageNet dataset we evaluate residual nets with a depth of up to 152 layers---8x deeper than VGG nets but still having lower complexity. An ensemble of these residual nets achieves 3.57% error on the ImageNet test set. This result won the 1st place on the ILSVRC 2015 classification task. We also present analysis on CIFAR-10 with 100 and 1000 layers. The depth of representations is of central importance for many visual recognition tasks. Solely due to our extremely deep representations, we obtain a 28% relative improvement on the COCO object detection dataset. Deep residual nets are foundations of our submissions to ILSVRC & COCO 2015 competitions, where we also won the 1st places on the tasks of ImageNet detection, ImageNet localization, COCO detection, and COCO segmentation. Authors: Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Hi there, today we'll look at deep residual learning for image recognition by Kaiming He, Xiangyu Cheng, Shaoqing Ren and Jian Sun. So this, you know it, this is an old paper. It is from 2015. But I thought we'd still look at it because this not only is it one of the most influential papers in modern deep learning, it is also a very well written paper. And I remember it like it was yesterday when this came out. This was like a bomb. So around that time, this meme was going around. I was winning ImageNet, but then someone made a deeper net. This was a, this was a time when after AlexNet, people were trying to build bigger and bigger networks. And every time someone managed to build a bigger network, the accuracy on ImageNet data set would increase pretty much in lockstep with how much bigger the network was. But people got to the limit of building big networks. And then this paper drops and changed everything. And now residual connections are everywhere, not only in image recognition, they are in transformers, they are in whatever, wherever you go, you'll probably find some residual connections somewhere in there. So yeah, let's let's look at this paper. And let's revisit what kind of problems people had then and how they solved it. So here they go directly into into this problem of deep neural networks. And the problem that people had was they knew that if you can increase the if you can increase the depth of a neural network, you can make it perform better, you can make it generalized better, you can reach lower training loss, but optimizing it was hard. Specifically, this was a phenomenon that people observed. So if you have a 20 layer neural network, you could train it and you know, there's this learning rate drop, people have had already figured out that you need to drop drop the learning rate, and it would reach a certain level. And here, this would be the test error over here. However, if after a certain point, if they increase the depth even more, the training error would actually go up again. And so with the test error, and this is not a problem of overfitting, because overfitting would be when the training error is lower or as low, and then the test error went up. So this is the first thing, this is not a phenomenon of overfitting of too many parameters. So why can't we train bigger layers networks until that time have very much followed kind of the original network design that was envisioned by sort of people like Yann LeCun, and also Alex net, and the most popular ones were these VGG nets. And they were very much of the philosophy that you'd have like some, you have the image here, and you input that into into convolutional layers, which first would kind of keep a big resolution, but would increase the channel size by you know, some amount, and then you would sort of downscale the image as you increase the number of filters. So you would stack more and more filters, when I draw more filters, you would stack more and more filters while downscaling the resolution of the image. The reasoning was that if you do image classification, right, then, you know, where on this where on this, maybe you want to classify this into a Lego tower or whatever that is. It's not that important where it is. So on the lower levels, you would want to parse out like very low layer features like edges and so on. And these are still important where they are right, the fact that here's an edge, here's an edge, here's an edge. But then as you go higher up and go to more and more abstract features, and we already knew that these neural networks, they tend to learn more and more abstract features as you go up the layers, the hypothesis was that the exact localization of these abstract features would be less and less important. So if there is if you recognize that there is a rectangle, it's not that important where it is, just that it's somewhere there, and maybe where it is in relation to the other. So if you have, if you recognize, want to recognize a car, the lower layers would recognize the fact that there are edges. And then the intermediate layers would recognize the geometric shapes of maybe here, the wheels and these bodies. But it's not that important where exactly they are. And then the higher layers would learn to combine the individual parts to each other. And again, it becomes less and less important where these things are. And more and more important that you build more expressive features. So people would downscale the resolution upscale the number of filters. Now that's a good heuristic. But this is based this was basically the architecture of these networks. And we would question why would if we increase the number of layers, so if we instead of one here, we have two of these layers, right, we simply have two of these layers. And here we have two of these layers. Why does it get worse? Especially this paper here makes an interesting observation. So it is not caused by overfitting. And adding more layers leads to a higher training error. The degradation indicates that is not all systems are similarly easy to optimize. Let us consider a shallower architecture and its deeper counterparts that adds more layers onto it. There exists a solution by construction to the deeper model, the added layers are identity mapping and the other layers are copied from the learned shallower model. So pretty easy if you have a shallow model, like five layers that learns a particular function, I can pretty easily prove that there is a deep model that learns the same function by simply copying over these five layers and having these here learn the identity function. Okay, so if we're able to learn this, we should be able to train this network to at least the same accuracy. That's what this paper argues, because it can, you know, these layers can simply learn the identity function. So it must have something to do with the easiness of optimizing these deep architectures, not with overfitting. And this is, I think, if you read the entire text here, it's very, very clear. If you read it, they lead you through this reasoning saying that, look, all these layers have to do is learn the identity function, and then we could at least get the same accuracy. So so what? Why don't they learn the identity function? Well, because we initialize most weights, you know, towards zero, we initialize them randomly, but mostly we initialize them around zero, our initialization procedure, usually sample from some Gaussian with some kind of a standard deviation, but around the mean of zero. And also, if we use things like weight decay, l two regularization, all of these things, they do they bias the weights towards zero. So if there is any natural thing that these networks are good at is they learn the zero function really well, learning the identity function is as difficult as learning any other function, the identity function, the convolutional filter is actually pretty difficult to learn. Because you know, if I have a my, if I have my three by three filter, where is my no, no, this is my three by three filter, the identity function is it like a one here and zeros everywhere else. That's the that that would be one of the things it's not that easy, you need to learn nine weights in the correct way. So this paper says, Can we do something to make the default function of the network not be the zero function, or whatever the randomly initialized function? Can we make the default function, the one function, can we make the default function, the identity function? And that brings you to residual connection. So instead of learning to transform x, via a neural network into x, which is the identity function, why don't we have x, stay x, and then learn whatever we need to change? Okay, so if let's call that tilde, if the assumption is that it's a good default to not change much, so this is almost the same as this, we might make this built this directly into the architecture, the fact that these two are equal, plus plus some deviation that is learned right here. And the hypothesis is that, especially the deeper you go, if you go very deep, each function here will actually learn not that much, it will learn to basically change the signal a little bit, but mostly, it will learn the identity function if it behaves well. And therefore, it might be, you know, reasonable to build this into the architecture. And of course, this has turned out to be very accurate, it has actually been reasonable to build this into the architecture. So that's what they propose right here. So instead of just having weight layers one after another, what they propose is to have these skip connections in here. So these skip connections, they will, instead of learning the function, they call this entire function h of x, which might be very complicated, they learn the function, whatever f and f is whatever you need to change about x, you see, at the end, you add x to it. So these weight layers here, they simply learn whatever makes this next, this output different from this input, and learning differences. Now you have the desired property, because what do we know about weight layers from before? Well, they tend towards the zero function, right? If we use weight decay, or generally how we initialize them, they tend towards the zero function. Well, if f tends towards the zero function, then h becomes the identity function. So the default function of this network is the identity function. And whenever we learn something, we learn how to deviate from the identity function. And that is, that is a much better default function. Now it's not entirely true that the default function is the identity function, you see that here, for example, there's after the skip connection, there is actually a relu. So there's still it's still a nonlinear function in total the network in total. But the default for the individual blocks here is the identity. Okay, now if you chain these blocks, you get a residual network. And that's what they propose right here. So on the left, you see this original VGG architecture, like we described it. So you can see you have an image which has four channels, and you first up it to 64 channels, you keep the resolution, and then you max pool, which halves the resolution, but you go up with the filters to 128, you max pool again, go up with the filters, and so on. Now this has, even though it doesn't look like it, this has a lot of parameters, and it needs a lot of computation. So it has 19.6 billion floating point operation for a forward pass. In contrast, the networks we're going to build here, the residual networks have 3.6 billion flops. So they are much, much less in terms of complexity than the old VGG networks, while still being much deeper. Okay, the hypothesis is the deeper, the better. And as a trade off per layer, you don't actually need to have that many parameters because you don't learn that much per layer. But the succession of layers gains you much more than simply having single massive layers. You can see at the same size of resolution here, you the the resonance can get away with much less amounts of filters. And that's why they are less, they are of less size. So this is the comparison, the VGG 19. Now they do build this 34 layer network, which they call plane. And you can see, it is simply a 34 layer network with no pooling right here. And here instead of pooling, they do a stride to convolution, which has also become, this has become kind of more standard than doing max or average pooling to downscale to do simply stride to convolution. So this paper has actually set the standards for a lot of things in modern deep learning. So our goal is to going to be to compare, first of all, the VGG 19 to the 34 layer plane to show that you lose performance when you simply up the number of layers. But then when you introduce the residual connections, as you can see right here, so there is always this jumping connection right here. So along these jumping connections, the signal can travel as the identity function. What we're going to see is that if we go from plane to residual, introducing no extra parameters, just the skip connections will change everything. You'll make this network all of a sudden trainable and make the deeper networks the better networks. Okay, the only little caveat here is, of course, in order to build a residual connection, the output has to be of the same size as the input because you need to add the input to the output. And this here, for example, is not given. So here, you can see this signal after this layer is going to be half as big because it's a stride to convolution. So the output right here is only half the size, but it is twice the number of filters. You can see right here, this has 64 filters. And here we go to 128 filters. That's why this connection right here has parameters in order to simply expand the number of filters. So these are these one by one convolutions that simply project the 64 filters to 128 filters. However, this doesn't introduce too many parameters because it's only one by one. In fact, here, the 34 parameters residual network. No, I'm wrong. You have different options. So the world has ended up at the option of doing one by one convolutions. But in this paper, they still they still explore three different options. And I guess here in this particular experiment, the option A is simply to zero pad. So to leave the first 64 channels, but to simply append 128 zero padded filters there or channels, option B is the one by one convolution. And option C is actually that all of these connections right here also have the one by one convolutions, which introduces extra parameters. And they they realize that option C isn't improving over option B substantially, and in fact, is only improving marginally. And they say, okay, that's probably just because we have more parameters. So ultimately, they went with option B. And I think that's what the world does right now. I also I when I read this first, I particularly enjoyed this paragraph right here. Let's read it together. Our implementation for image net follows the practice in the image is resized with the shorter randomly sampled in this for scale augmentation a this crop is randomly sampled from the image or its horizontal flip with the per pixel has been subtracted. The standard color augmentation is used we adopt the batch normalization right after each convolution before activation we this an age old discussion was born when to use batch normalization before count before the activation or after the activation I still I think people are still fighting over this today. We initialize the weights as in 13 and train all plane residual nets from scratch use SGD yada yada yada yada, the learning rate starts from this is divided by then. So here in this paragraph, in this paragraph, they detail basically all the training procedure and all the tricks that they use that I remember specifically that, you know, I've read all of this, which was the idea and I could follow like, oh, this is super well explained. This is so cool, and so on. And then I expect basically an implementation of that. And then there's one single paragraph with like 20 lines saying, Oh, and by the way, we use these 50 tricks from these other papers. And yeah, that's when it I guess, it was already happening, you needed to do all the modern tricks in order to really reach the top accuracies. But you know, in hindsight, we know it wasn't the tricks that helped them, it was actually their idea. I just I just thought it was rather funny. So you can see right here the results of this. If you look at the left, these are the plane networks. And we've already sort of seen this. Now this is on ImageNet right here. You can see the 18 layer network simply has lower train and validation accuracy. So the solid line here is the validation. On ImageNet, bold curves denote validation error of the center crops. So I guess they do, yeah, they do center crops. So the training error is going to be higher because they do these different augmentations. But you can see the training and the validation error are higher in the deeper network if you don't reuse residual connections. Again, this is not due to overfitting. And this is because we can't train these deep networks, because we should be able to the solution space of the 18 layer network is a subspace of the solution space of the 34 layer network. Everything tells us we should be able to learn the 34 layers to at least the accuracy of the 18 layers, but we can't. However, introduce residual connections, bum, bum, bum, bum. And you can see that the trend is exactly reversed. Now the 34 layer with residual connections has a much, much lower training and validation error than the 18 layer. In fact, look at this table right here. If you introduce the residual connections to the 18 layers, it's marginally better. However, if you introduce the residual connections to the 34 layers, it is a lot better. And this is another testament to the fact that these residual connections, they really help more and more the deeper you go, you can see the effect in. So this 18 layers, this is sort of a VGG 19 depth network. While it and there, we already know we can train these without residual connections, right, because we were able to train VGG 19. However, if we go higher to more layers, we can these residual connections all of a sudden, make it a lot a lot better. You can see that it's not it's not that we can't train the 34 layers, but the residual connections just help a lot more. And it most of a sudden, most of most importantly, they don't degrade the performance from the shallower network. So they, they explore the different options right here and compare it to others. Different options, as I said, being a, b, and c, where a is the zero padding for the projection, b is having projections simply between where the channels don't fit, and c being having projections in every single residual connection. And you can see right here that the option b gives you quite a bit of a boost, while option c doesn't give you that much of a boost introduces many more parameters. And you know, overall, is, I guess, they decided against it, which, since then the world has also decided against it. They also do deeper networks. So they built deeper networks, like 50 layer ResNet, 101 layer ResNet and 152 layer ResNet and the 152 layer ResNet ended up being the best one, as you can see here. And you can see a pretty gain like it almost almost lockstep gain depth. More depth means better network and this at the time, this these numbers, they were unheard of, like even 50 layer deep neural network was bombastic, but 152 layers, it was, it was crazy. And the fact that still it has less parameters than the VGG 19 and performs better. That was mind mind blowing, absolutely mind blowing. And then at the end, they built an ensemble of these models and ended up taking the 2015 ImageNet competition winner. That was still like very important back then it was still very important who wins who wins ImageNet that year, where I think I haven't even followed up on the last few years. It's some kind of wide fix ResNet whatnot with pre trained and 50 billion extra data. Yeah. So for the deeper networks, they decide that they are computationally rather become rather expensive. So they introduce these bottleneck blocks here on the right, where as you can see, so here, if you have a 64 dimensional input, you do 64 feature channels in your convolution, have a 64 dimensional output, you can save computation if you first project the higher. So here you have a 256 dimensional input, and they say we can save computational power by pretty much projecting down to 64 first, because then our complexity of this layer, which is the expensive layer, will be the same as the complexity of one of these layers. And then we can project up again, the one by one convolution, they are significantly lower computational intensive than the three by three convolutions, like it's nine times less operations, if you think about it. So that's what they use to build the deeper residual networks. And these residual networks, the ResNet 50, 101, 152, they are still staples today, you can have these are you can have pre trained versions of those and people still use it like ResNet 50 is used in every segmentation whatnot application. So yeah, this has turned out these decisions here have, you know, made it long way. Here you can see the number of parameters in these residual networks. And this was the absolute craziest thing right here. 1202 layers, okay. So you can see still until here, ResNet 110. Now this is on CIFAR 10, right here, not on ImageNet anymore. But you can see that even 110 layers still had less parameters or actually the select the same order of parameters than these previous networks that were only 19 layers deep. This was unheard of and much more unheard of 1202 layer network to train on CIFAR 10. It's a bit of an overkill, but they say their goal was explicitly to study depth. And you can see here that with the deeper and deeper networks, they outperformed all of the previous networks, so all of the baselines and themselves as they went deeper and deeper and deeper. However, once you go to 1002 layers, you go up again. So here's the question, was this all just kind of a trick, a hack? And do we run into the same problem again? And that's the question they asked themselves. And the answer is no. So if you look right here, so here you see again, the plane networks. In the plane networks, you can pretty easily see that the more layers you have, the higher your error goes, whereas in the residual network, it's exactly the opposite way. The more layers you have, the lower your error. And if you compare this 110 layer network with the 1200 layer network, you see your validation error going up again. However, your training error and I can't zoom in more, but it's the same. It's the same and it's at zero. So here they conclude and the the here they conclude, now we are overfitting. They don't use like the biggest data augmentation like we use today. So overfitting was still a thing back then. So now they conclude, okay, now we have actually built a large enough network that is overfitting and then and the fact that we go up again in the training error is due to the fact that we are probably overfitting. So not only have they enabled us to build deeper networks, they have effectively shown that this can get you to the to the point where you don't need deeper networks anymore, at least on C410 because you are overfitting and it can effectively get you there. This is a lot of evidence for the fact that this biasing the networks towards the identity function is a very valid thing to do and is the solution to the we can't train deep networks problems. Lastly, they investigate the size of the responses. So their hypothesis is that if if it is really beneficial to bias the network towards the identity function, and if it is really true that each of these layers only learns a little bit, right, because the identity function is already very good. Each of these layers only needs to learn kind of a small function. They look at the responses of these things. So the response magnitude of these layers, right here of the signal through the layers, and they compare those with the response magnitude of the other neural networks where you don't have the skip connection. The hypothesis is, if we look at these, then the responses of these layers should be much larger because they have to learn much more. And the responses here will be much smaller because the identity function is already doing most of the work. And that's exactly what you find. So here, the layers are ordered by response and you can see the plane networks in the dashed lines are significantly above the residual network, even and that's not a function of the depth because if the depth was actually equal here, you would expect that the dashed lines would would stretch like this, right, they would kind of stretch out. However, exactly the opposite is happening. You can see that the residual networks even at the beginning, their responses are very much smaller. And this is kind of what I like about this paper. It's, it's one narrative. It is a hypothesis. And then every single, like the hypothesis is taken, and they make predictions from the hypothesis, they say, Okay, if we are right with our hypothesis, not only should our idea get us better accuracy, that's what most people most papers do today. But also, you know, but also, it should be that we can, for example, push our network to the brink of where we actually are overfitting, like here. And it should also be that the responses of our signal through our layers is smaller. And yeah, that's research like this is just pretty, pretty cool. And it's, I think, a lesson for us that sadly, the world has taken the ResNets, but the world hasn't all taken the research methodology of this paper. So yeah, if you again, if you want a good read, it's very well written, you I'm very sure you can follow it even if you have read very few papers. And with that, yeah, I hope you enjoyed this. Please tell me what you think of going through kind of old papers, looking at whether or not they have stood the test of time. And yeah, any other comments, leave them in the comments. I do read them. And I'll see you next time. Bye bye.
[{"start": 0.0, "end": 5.6000000000000005, "text": " Hi there, today we'll look at deep residual learning for image recognition by Kaiming"}, {"start": 5.6000000000000005, "end": 11.36, "text": " He, Xiangyu Cheng, Shaoqing Ren and Jian Sun."}, {"start": 11.36, "end": 15.68, "text": " So this, you know it, this is an old paper."}, {"start": 15.68, "end": 18.2, "text": " It is from 2015."}, {"start": 18.2, "end": 23.92, "text": " But I thought we'd still look at it because this not only is it one of the most influential"}, {"start": 23.92, "end": 30.160000000000004, "text": " papers in modern deep learning, it is also a very well written paper."}, {"start": 30.160000000000004, "end": 34.2, "text": " And I remember it like it was yesterday when this came out."}, {"start": 34.2, "end": 37.120000000000005, "text": " This was like a bomb."}, {"start": 37.120000000000005, "end": 42.24, "text": " So around that time, this meme was going around."}, {"start": 42.24, "end": 48.44, "text": " I was winning ImageNet, but then someone made a deeper net."}, {"start": 48.44, "end": 56.18, "text": " This was a, this was a time when after AlexNet, people were trying to build bigger and bigger"}, {"start": 56.18, "end": 58.04, "text": " networks."}, {"start": 58.04, "end": 63.9, "text": " And every time someone managed to build a bigger network, the accuracy on ImageNet data"}, {"start": 63.9, "end": 70.16, "text": " set would increase pretty much in lockstep with how much bigger the network was."}, {"start": 70.16, "end": 74.28, "text": " But people got to the limit of building big networks."}, {"start": 74.28, "end": 78.08, "text": " And then this paper drops and changed everything."}, {"start": 78.08, "end": 83.36, "text": " And now residual connections are everywhere, not only in image recognition, they are in"}, {"start": 83.36, "end": 89.8, "text": " transformers, they are in whatever, wherever you go, you'll probably find some residual"}, {"start": 89.8, "end": 93.8, "text": " connections somewhere in there."}, {"start": 93.8, "end": 97.48, "text": " So yeah, let's let's look at this paper."}, {"start": 97.48, "end": 104.25999999999999, "text": " And let's revisit what kind of problems people had then and how they solved it."}, {"start": 104.26, "end": 112.36, "text": " So here they go directly into into this problem of deep neural networks."}, {"start": 112.36, "end": 120.36000000000001, "text": " And the problem that people had was they knew that if you can increase the if you can increase"}, {"start": 120.36000000000001, "end": 126.04, "text": " the depth of a neural network, you can make it perform better, you can make it generalized"}, {"start": 126.04, "end": 131.88, "text": " better, you can reach lower training loss, but optimizing it was hard."}, {"start": 131.88, "end": 134.6, "text": " Specifically, this was a phenomenon that people observed."}, {"start": 134.6, "end": 138.78, "text": " So if you have a 20 layer neural network, you could train it and you know, there's this"}, {"start": 138.78, "end": 143.74, "text": " learning rate drop, people have had already figured out that you need to drop drop the"}, {"start": 143.74, "end": 147.96, "text": " learning rate, and it would reach a certain level."}, {"start": 147.96, "end": 151.68, "text": " And here, this would be the test error over here."}, {"start": 151.68, "end": 159.04, "text": " However, if after a certain point, if they increase the depth even more, the training"}, {"start": 159.04, "end": 161.46, "text": " error would actually go up again."}, {"start": 161.46, "end": 167.44, "text": " And so with the test error, and this is not a problem of overfitting, because overfitting"}, {"start": 167.44, "end": 173.60000000000002, "text": " would be when the training error is lower or as low, and then the test error went up."}, {"start": 173.60000000000002, "end": 178.24, "text": " So this is the first thing, this is not a phenomenon of overfitting of too many parameters."}, {"start": 178.24, "end": 185.06, "text": " So why can't we train bigger layers networks until that time have very much followed kind"}, {"start": 185.06, "end": 193.8, "text": " of the original network design that was envisioned by sort of people like Yann LeCun, and also"}, {"start": 193.8, "end": 198.48, "text": " Alex net, and the most popular ones were these VGG nets."}, {"start": 198.48, "end": 203.64000000000001, "text": " And they were very much of the philosophy that you'd have like some, you have the image"}, {"start": 203.64000000000001, "end": 213.24, "text": " here, and you input that into into convolutional layers, which first would kind of keep a big"}, {"start": 213.24, "end": 219.84, "text": " resolution, but would increase the channel size by you know, some amount, and then you"}, {"start": 219.84, "end": 225.94, "text": " would sort of downscale the image as you increase the number of filters."}, {"start": 225.94, "end": 230.8, "text": " So you would stack more and more filters, when I draw more filters, you would stack"}, {"start": 230.8, "end": 236.74, "text": " more and more filters while downscaling the resolution of the image."}, {"start": 236.74, "end": 243.72, "text": " The reasoning was that if you do image classification, right, then, you know, where on this where"}, {"start": 243.72, "end": 251.28, "text": " on this, maybe you want to classify this into a Lego tower or whatever that is."}, {"start": 251.28, "end": 253.4, "text": " It's not that important where it is."}, {"start": 253.4, "end": 258.92, "text": " So on the lower levels, you would want to parse out like very low layer features like"}, {"start": 258.92, "end": 260.48, "text": " edges and so on."}, {"start": 260.48, "end": 264.52, "text": " And these are still important where they are right, the fact that here's an edge, here's"}, {"start": 264.52, "end": 266.12, "text": " an edge, here's an edge."}, {"start": 266.12, "end": 271.0, "text": " But then as you go higher up and go to more and more abstract features, and we already"}, {"start": 271.0, "end": 276.22, "text": " knew that these neural networks, they tend to learn more and more abstract features as"}, {"start": 276.22, "end": 282.08, "text": " you go up the layers, the hypothesis was that the exact localization of these abstract features"}, {"start": 282.08, "end": 284.32, "text": " would be less and less important."}, {"start": 284.32, "end": 289.4, "text": " So if there is if you recognize that there is a rectangle, it's not that important where"}, {"start": 289.4, "end": 295.36, "text": " it is, just that it's somewhere there, and maybe where it is in relation to the other."}, {"start": 295.36, "end": 301.64, "text": " So if you have, if you recognize, want to recognize a car, the lower layers would recognize"}, {"start": 301.64, "end": 303.72, "text": " the fact that there are edges."}, {"start": 303.72, "end": 308.56, "text": " And then the intermediate layers would recognize the geometric shapes of maybe here, the wheels"}, {"start": 308.56, "end": 310.40000000000003, "text": " and these bodies."}, {"start": 310.40000000000003, "end": 312.64, "text": " But it's not that important where exactly they are."}, {"start": 312.64, "end": 319.44, "text": " And then the higher layers would learn to combine the individual parts to each other."}, {"start": 319.44, "end": 324.6, "text": " And again, it becomes less and less important where these things are."}, {"start": 324.6, "end": 327.54, "text": " And more and more important that you build more expressive features."}, {"start": 327.54, "end": 331.84000000000003, "text": " So people would downscale the resolution upscale the number of filters."}, {"start": 331.84000000000003, "end": 333.72, "text": " Now that's a good heuristic."}, {"start": 333.72, "end": 340.20000000000005, "text": " But this is based this was basically the architecture of these networks."}, {"start": 340.20000000000005, "end": 346.6, "text": " And we would question why would if we increase the number of layers, so if we instead of"}, {"start": 346.6, "end": 353.68, "text": " one here, we have two of these layers, right, we simply have two of these layers."}, {"start": 353.68, "end": 356.04, "text": " And here we have two of these layers."}, {"start": 356.04, "end": 359.36, "text": " Why does it get worse?"}, {"start": 359.36, "end": 365.84000000000003, "text": " Especially this paper here makes an interesting observation."}, {"start": 365.84000000000003, "end": 370.1, "text": " So it is not caused by overfitting."}, {"start": 370.1, "end": 375.72, "text": " And adding more layers leads to a higher training error."}, {"start": 375.72, "end": 381.36, "text": " The degradation indicates that is not all systems are similarly easy to optimize."}, {"start": 381.36, "end": 385.48, "text": " Let us consider a shallower architecture and its deeper counterparts that adds more layers"}, {"start": 385.48, "end": 387.14, "text": " onto it."}, {"start": 387.14, "end": 392.24, "text": " There exists a solution by construction to the deeper model, the added layers are identity"}, {"start": 392.24, "end": 396.52000000000004, "text": " mapping and the other layers are copied from the learned shallower model."}, {"start": 396.52000000000004, "end": 403.36, "text": " So pretty easy if you have a shallow model, like five layers that learns a particular"}, {"start": 403.36, "end": 408.92, "text": " function, I can pretty easily prove that there is a deep model that learns the same function"}, {"start": 408.92, "end": 416.24, "text": " by simply copying over these five layers and having these here learn the identity function."}, {"start": 416.24, "end": 422.88, "text": " Okay, so if we're able to learn this, we should be able to train this network to at least"}, {"start": 422.88, "end": 424.04, "text": " the same accuracy."}, {"start": 424.04, "end": 428.56, "text": " That's what this paper argues, because it can, you know, these layers can simply learn"}, {"start": 428.56, "end": 430.04, "text": " the identity function."}, {"start": 430.04, "end": 436.52000000000004, "text": " So it must have something to do with the easiness of optimizing these deep architectures, not"}, {"start": 436.52000000000004, "end": 437.52000000000004, "text": " with overfitting."}, {"start": 437.52, "end": 444.24, "text": " And this is, I think, if you read the entire text here, it's very, very clear."}, {"start": 444.24, "end": 449.91999999999996, "text": " If you read it, they lead you through this reasoning saying that, look, all these layers"}, {"start": 449.91999999999996, "end": 455.91999999999996, "text": " have to do is learn the identity function, and then we could at least get the same accuracy."}, {"start": 455.91999999999996, "end": 458.71999999999997, "text": " So so what?"}, {"start": 458.71999999999997, "end": 460.71999999999997, "text": " Why don't they learn the identity function?"}, {"start": 460.71999999999997, "end": 466.12, "text": " Well, because we initialize most weights, you know, towards zero, we initialize them"}, {"start": 466.12, "end": 471.68, "text": " randomly, but mostly we initialize them around zero, our initialization procedure, usually"}, {"start": 471.68, "end": 477.56, "text": " sample from some Gaussian with some kind of a standard deviation, but around the mean"}, {"start": 477.56, "end": 479.64, "text": " of zero."}, {"start": 479.64, "end": 485.0, "text": " And also, if we use things like weight decay, l two regularization, all of these things,"}, {"start": 485.0, "end": 489.06, "text": " they do they bias the weights towards zero."}, {"start": 489.06, "end": 495.0, "text": " So if there is any natural thing that these networks are good at is they learn the zero"}, {"start": 495.0, "end": 502.04, "text": " function really well, learning the identity function is as difficult as learning any other"}, {"start": 502.04, "end": 508.2, "text": " function, the identity function, the convolutional filter is actually pretty difficult to learn."}, {"start": 508.2, "end": 514.28, "text": " Because you know, if I have a my, if I have my three by three filter, where is my no,"}, {"start": 514.28, "end": 522.16, "text": " no, this is my three by three filter, the identity function is it like a one here and"}, {"start": 522.16, "end": 523.48, "text": " zeros everywhere else."}, {"start": 523.48, "end": 528.84, "text": " That's the that that would be one of the things it's not that easy, you need to learn nine"}, {"start": 528.84, "end": 532.98, "text": " weights in the correct way."}, {"start": 532.98, "end": 539.0, "text": " So this paper says, Can we do something to make the default function of the network not"}, {"start": 539.0, "end": 542.9200000000001, "text": " be the zero function, or whatever the randomly initialized function?"}, {"start": 542.9200000000001, "end": 547.36, "text": " Can we make the default function, the one function, can we make the default function,"}, {"start": 547.36, "end": 549.46, "text": " the identity function?"}, {"start": 549.46, "end": 552.52, "text": " And that brings you to residual connection."}, {"start": 552.52, "end": 560.52, "text": " So instead of learning to transform x, via a neural network into x, which is the identity"}, {"start": 560.52, "end": 570.24, "text": " function, why don't we have x, stay x, and then learn whatever we need to change?"}, {"start": 570.24, "end": 577.12, "text": " Okay, so if let's call that tilde, if the assumption is that it's a good default to"}, {"start": 577.12, "end": 584.84, "text": " not change much, so this is almost the same as this, we might make this built this directly"}, {"start": 584.84, "end": 592.44, "text": " into the architecture, the fact that these two are equal, plus plus some deviation that"}, {"start": 592.44, "end": 594.28, "text": " is learned right here."}, {"start": 594.28, "end": 601.78, "text": " And the hypothesis is that, especially the deeper you go, if you go very deep, each function"}, {"start": 601.78, "end": 606.74, "text": " here will actually learn not that much, it will learn to basically change the signal"}, {"start": 606.74, "end": 612.08, "text": " a little bit, but mostly, it will learn the identity function if it behaves well."}, {"start": 612.08, "end": 616.96, "text": " And therefore, it might be, you know, reasonable to build this into the architecture."}, {"start": 616.96, "end": 622.32, "text": " And of course, this has turned out to be very accurate, it has actually been reasonable"}, {"start": 622.32, "end": 624.38, "text": " to build this into the architecture."}, {"start": 624.38, "end": 627.4, "text": " So that's what they propose right here."}, {"start": 627.4, "end": 633.0, "text": " So instead of just having weight layers one after another, what they propose is to have"}, {"start": 633.0, "end": 635.9, "text": " these skip connections in here."}, {"start": 635.9, "end": 640.8, "text": " So these skip connections, they will, instead of learning the function, they call this entire"}, {"start": 640.8, "end": 650.28, "text": " function h of x, which might be very complicated, they learn the function, whatever f and f"}, {"start": 650.28, "end": 655.52, "text": " is whatever you need to change about x, you see, at the end, you add x to it."}, {"start": 655.52, "end": 663.72, "text": " So these weight layers here, they simply learn whatever makes this next, this output different"}, {"start": 663.72, "end": 667.3000000000001, "text": " from this input, and learning differences."}, {"start": 667.3000000000001, "end": 672.48, "text": " Now you have the desired property, because what do we know about weight layers from before?"}, {"start": 672.48, "end": 675.5600000000001, "text": " Well, they tend towards the zero function, right?"}, {"start": 675.5600000000001, "end": 680.48, "text": " If we use weight decay, or generally how we initialize them, they tend towards the zero"}, {"start": 680.48, "end": 681.48, "text": " function."}, {"start": 681.48, "end": 688.1, "text": " Well, if f tends towards the zero function, then h becomes the identity function."}, {"start": 688.1, "end": 692.6800000000001, "text": " So the default function of this network is the identity function."}, {"start": 692.68, "end": 696.9599999999999, "text": " And whenever we learn something, we learn how to deviate from the identity function."}, {"start": 696.9599999999999, "end": 702.64, "text": " And that is, that is a much better default function."}, {"start": 702.64, "end": 706.4799999999999, "text": " Now it's not entirely true that the default function is the identity function, you see"}, {"start": 706.4799999999999, "end": 712.76, "text": " that here, for example, there's after the skip connection, there is actually a relu."}, {"start": 712.76, "end": 718.42, "text": " So there's still it's still a nonlinear function in total the network in total."}, {"start": 718.42, "end": 723.0799999999999, "text": " But the default for the individual blocks here is the identity."}, {"start": 723.0799999999999, "end": 728.12, "text": " Okay, now if you chain these blocks, you get a residual network."}, {"start": 728.12, "end": 731.36, "text": " And that's what they propose right here."}, {"start": 731.36, "end": 736.42, "text": " So on the left, you see this original VGG architecture, like we described it."}, {"start": 736.42, "end": 742.8399999999999, "text": " So you can see you have an image which has four channels, and you first up it to 64 channels,"}, {"start": 742.8399999999999, "end": 747.76, "text": " you keep the resolution, and then you max pool, which halves the resolution, but you"}, {"start": 747.76, "end": 755.4, "text": " go up with the filters to 128, you max pool again, go up with the filters, and so on."}, {"start": 755.4, "end": 761.8, "text": " Now this has, even though it doesn't look like it, this has a lot of parameters, and"}, {"start": 761.8, "end": 763.2, "text": " it needs a lot of computation."}, {"start": 763.2, "end": 768.86, "text": " So it has 19.6 billion floating point operation for a forward pass."}, {"start": 768.86, "end": 775.68, "text": " In contrast, the networks we're going to build here, the residual networks have 3.6 billion"}, {"start": 775.68, "end": 776.76, "text": " flops."}, {"start": 776.76, "end": 784.68, "text": " So they are much, much less in terms of complexity than the old VGG networks, while still being"}, {"start": 784.68, "end": 785.88, "text": " much deeper."}, {"start": 785.88, "end": 790.28, "text": " Okay, the hypothesis is the deeper, the better."}, {"start": 790.28, "end": 796.16, "text": " And as a trade off per layer, you don't actually need to have that many parameters because"}, {"start": 796.16, "end": 798.62, "text": " you don't learn that much per layer."}, {"start": 798.62, "end": 804.72, "text": " But the succession of layers gains you much more than simply having single massive layers."}, {"start": 804.72, "end": 810.6800000000001, "text": " You can see at the same size of resolution here, you the the resonance can get away with"}, {"start": 810.6800000000001, "end": 813.58, "text": " much less amounts of filters."}, {"start": 813.58, "end": 818.88, "text": " And that's why they are less, they are of less size."}, {"start": 818.88, "end": 822.1600000000001, "text": " So this is the comparison, the VGG 19."}, {"start": 822.1600000000001, "end": 826.24, "text": " Now they do build this 34 layer network, which they call plane."}, {"start": 826.24, "end": 833.62, "text": " And you can see, it is simply a 34 layer network with no pooling right here."}, {"start": 833.62, "end": 838.84, "text": " And here instead of pooling, they do a stride to convolution, which has also become, this"}, {"start": 838.84, "end": 844.92, "text": " has become kind of more standard than doing max or average pooling to downscale to do"}, {"start": 844.92, "end": 847.18, "text": " simply stride to convolution."}, {"start": 847.18, "end": 853.44, "text": " So this paper has actually set the standards for a lot of things in modern deep learning."}, {"start": 853.44, "end": 861.16, "text": " So our goal is to going to be to compare, first of all, the VGG 19 to the 34 layer plane"}, {"start": 861.16, "end": 866.64, "text": " to show that you lose performance when you simply up the number of layers."}, {"start": 866.64, "end": 872.28, "text": " But then when you introduce the residual connections, as you can see right here, so there is always"}, {"start": 872.28, "end": 874.6999999999999, "text": " this jumping connection right here."}, {"start": 874.6999999999999, "end": 879.48, "text": " So along these jumping connections, the signal can travel as the identity function."}, {"start": 879.48, "end": 886.36, "text": " What we're going to see is that if we go from plane to residual, introducing no extra parameters,"}, {"start": 886.36, "end": 890.8, "text": " just the skip connections will change everything."}, {"start": 890.8, "end": 898.12, "text": " You'll make this network all of a sudden trainable and make the deeper networks the better networks."}, {"start": 898.12, "end": 904.8399999999999, "text": " Okay, the only little caveat here is, of course, in order to build a residual connection, the"}, {"start": 904.8399999999999, "end": 910.52, "text": " output has to be of the same size as the input because you need to add the input to the output."}, {"start": 910.52, "end": 912.3199999999999, "text": " And this here, for example, is not given."}, {"start": 912.3199999999999, "end": 918.92, "text": " So here, you can see this signal after this layer is going to be half as big because it's"}, {"start": 918.92, "end": 920.7199999999999, "text": " a stride to convolution."}, {"start": 920.72, "end": 929.12, "text": " So the output right here is only half the size, but it is twice the number of filters."}, {"start": 929.12, "end": 932.0600000000001, "text": " You can see right here, this has 64 filters."}, {"start": 932.0600000000001, "end": 934.76, "text": " And here we go to 128 filters."}, {"start": 934.76, "end": 941.34, "text": " That's why this connection right here has parameters in order to simply expand the number"}, {"start": 941.34, "end": 942.34, "text": " of filters."}, {"start": 942.34, "end": 950.84, "text": " So these are these one by one convolutions that simply project the 64 filters to 128"}, {"start": 950.84, "end": 951.84, "text": " filters."}, {"start": 951.84, "end": 957.24, "text": " However, this doesn't introduce too many parameters because it's only one by one."}, {"start": 957.24, "end": 963.0400000000001, "text": " In fact, here, the 34 parameters residual network."}, {"start": 963.0400000000001, "end": 965.5600000000001, "text": " No, I'm wrong."}, {"start": 965.5600000000001, "end": 967.12, "text": " You have different options."}, {"start": 967.12, "end": 973.08, "text": " So the world has ended up at the option of doing one by one convolutions."}, {"start": 973.08, "end": 977.24, "text": " But in this paper, they still they still explore three different options."}, {"start": 977.24, "end": 983.08, "text": " And I guess here in this particular experiment, the option A is simply to zero pad."}, {"start": 983.08, "end": 993.78, "text": " So to leave the first 64 channels, but to simply append 128 zero padded filters there"}, {"start": 993.78, "end": 998.64, "text": " or channels, option B is the one by one convolution."}, {"start": 998.64, "end": 1004.8399999999999, "text": " And option C is actually that all of these connections right here also have the one by"}, {"start": 1004.8399999999999, "end": 1008.4399999999999, "text": " one convolutions, which introduces extra parameters."}, {"start": 1008.4399999999999, "end": 1015.68, "text": " And they they realize that option C isn't improving over option B substantially, and"}, {"start": 1015.68, "end": 1018.56, "text": " in fact, is only improving marginally."}, {"start": 1018.56, "end": 1021.54, "text": " And they say, okay, that's probably just because we have more parameters."}, {"start": 1021.54, "end": 1028.56, "text": " So ultimately, they went with option B. And I think that's what the world does right now."}, {"start": 1028.56, "end": 1034.6, "text": " I also I when I read this first, I particularly enjoyed this paragraph right here."}, {"start": 1034.6, "end": 1036.0, "text": " Let's read it together."}, {"start": 1036.0, "end": 1040.68, "text": " Our implementation for image net follows the practice in the image is resized with the"}, {"start": 1040.68, "end": 1045.78, "text": " shorter randomly sampled in this for scale augmentation a this crop is randomly sampled"}, {"start": 1045.78, "end": 1049.84, "text": " from the image or its horizontal flip with the per pixel has been subtracted."}, {"start": 1049.84, "end": 1053.6799999999998, "text": " The standard color augmentation is used we adopt the batch normalization right after"}, {"start": 1053.6799999999998, "end": 1060.3, "text": " each convolution before activation we this an age old discussion was born when to use"}, {"start": 1060.3, "end": 1066.0, "text": " batch normalization before count before the activation or after the activation I still"}, {"start": 1066.0, "end": 1070.5, "text": " I think people are still fighting over this today."}, {"start": 1070.5, "end": 1077.28, "text": " We initialize the weights as in 13 and train all plane residual nets from scratch use SGD"}, {"start": 1077.28, "end": 1081.08, "text": " yada yada yada yada, the learning rate starts from this is divided by then."}, {"start": 1081.08, "end": 1086.8, "text": " So here in this paragraph, in this paragraph, they detail basically all the training procedure"}, {"start": 1086.8, "end": 1091.52, "text": " and all the tricks that they use that I remember specifically that, you know, I've read all"}, {"start": 1091.52, "end": 1096.28, "text": " of this, which was the idea and I could follow like, oh, this is super well explained."}, {"start": 1096.28, "end": 1098.72, "text": " This is so cool, and so on."}, {"start": 1098.72, "end": 1101.68, "text": " And then I expect basically an implementation of that."}, {"start": 1101.68, "end": 1106.44, "text": " And then there's one single paragraph with like 20 lines saying, Oh, and by the way,"}, {"start": 1106.44, "end": 1110.78, "text": " we use these 50 tricks from these other papers."}, {"start": 1110.78, "end": 1116.4, "text": " And yeah, that's when it I guess, it was already happening, you needed to do all the modern"}, {"start": 1116.4, "end": 1121.7, "text": " tricks in order to really reach the top accuracies."}, {"start": 1121.7, "end": 1126.56, "text": " But you know, in hindsight, we know it wasn't the tricks that helped them, it was actually"}, {"start": 1126.56, "end": 1129.3400000000001, "text": " their idea."}, {"start": 1129.3400000000001, "end": 1132.3600000000001, "text": " I just I just thought it was rather funny."}, {"start": 1132.36, "end": 1137.76, "text": " So you can see right here the results of this."}, {"start": 1137.76, "end": 1140.2199999999998, "text": " If you look at the left, these are the plane networks."}, {"start": 1140.2199999999998, "end": 1141.6799999999998, "text": " And we've already sort of seen this."}, {"start": 1141.6799999999998, "end": 1144.4399999999998, "text": " Now this is on ImageNet right here."}, {"start": 1144.4399999999998, "end": 1150.34, "text": " You can see the 18 layer network simply has lower train and validation accuracy."}, {"start": 1150.34, "end": 1157.0, "text": " So the solid line here is the validation."}, {"start": 1157.0, "end": 1162.1399999999999, "text": " On ImageNet, bold curves denote validation error of the center crops."}, {"start": 1162.14, "end": 1164.3600000000001, "text": " So I guess they do, yeah, they do center crops."}, {"start": 1164.3600000000001, "end": 1170.66, "text": " So the training error is going to be higher because they do these different augmentations."}, {"start": 1170.66, "end": 1177.48, "text": " But you can see the training and the validation error are higher in the deeper network if"}, {"start": 1177.48, "end": 1179.2800000000002, "text": " you don't reuse residual connections."}, {"start": 1179.2800000000002, "end": 1182.0, "text": " Again, this is not due to overfitting."}, {"start": 1182.0, "end": 1188.5600000000002, "text": " And this is because we can't train these deep networks, because we should be able to the"}, {"start": 1188.56, "end": 1194.12, "text": " solution space of the 18 layer network is a subspace of the solution space of the 34"}, {"start": 1194.12, "end": 1195.3999999999999, "text": " layer network."}, {"start": 1195.3999999999999, "end": 1200.8, "text": " Everything tells us we should be able to learn the 34 layers to at least the accuracy of"}, {"start": 1200.8, "end": 1203.08, "text": " the 18 layers, but we can't."}, {"start": 1203.08, "end": 1207.4199999999998, "text": " However, introduce residual connections, bum, bum, bum, bum."}, {"start": 1207.4199999999998, "end": 1210.44, "text": " And you can see that the trend is exactly reversed."}, {"start": 1210.44, "end": 1217.04, "text": " Now the 34 layer with residual connections has a much, much lower training and validation"}, {"start": 1217.04, "end": 1219.04, "text": " error than the 18 layer."}, {"start": 1219.04, "end": 1222.68, "text": " In fact, look at this table right here."}, {"start": 1222.68, "end": 1228.6, "text": " If you introduce the residual connections to the 18 layers, it's marginally better."}, {"start": 1228.6, "end": 1234.6, "text": " However, if you introduce the residual connections to the 34 layers, it is a lot better."}, {"start": 1234.6, "end": 1238.94, "text": " And this is another testament to the fact that these residual connections, they really"}, {"start": 1238.94, "end": 1243.98, "text": " help more and more the deeper you go, you can see the effect in."}, {"start": 1243.98, "end": 1250.3600000000001, "text": " So this 18 layers, this is sort of a VGG 19 depth network."}, {"start": 1250.3600000000001, "end": 1254.88, "text": " While it and there, we already know we can train these without residual connections,"}, {"start": 1254.88, "end": 1258.28, "text": " right, because we were able to train VGG 19."}, {"start": 1258.28, "end": 1265.72, "text": " However, if we go higher to more layers, we can these residual connections all of a sudden,"}, {"start": 1265.72, "end": 1268.76, "text": " make it a lot a lot better."}, {"start": 1268.76, "end": 1274.52, "text": " You can see that it's not it's not that we can't train the 34 layers, but the residual"}, {"start": 1274.52, "end": 1276.72, "text": " connections just help a lot more."}, {"start": 1276.72, "end": 1284.36, "text": " And it most of a sudden, most of most importantly, they don't degrade the performance from the"}, {"start": 1284.36, "end": 1287.64, "text": " shallower network."}, {"start": 1287.64, "end": 1295.16, "text": " So they, they explore the different options right here and compare it to others."}, {"start": 1295.16, "end": 1300.28, "text": " Different options, as I said, being a, b, and c, where a is the zero padding for the"}, {"start": 1300.28, "end": 1305.76, "text": " projection, b is having projections simply between where the channels don't fit, and"}, {"start": 1305.76, "end": 1310.24, "text": " c being having projections in every single residual connection."}, {"start": 1310.24, "end": 1315.48, "text": " And you can see right here that the option b gives you quite a bit of a boost, while"}, {"start": 1315.48, "end": 1320.64, "text": " option c doesn't give you that much of a boost introduces many more parameters."}, {"start": 1320.64, "end": 1328.1200000000001, "text": " And you know, overall, is, I guess, they decided against it, which, since then the world has"}, {"start": 1328.1200000000001, "end": 1330.3600000000001, "text": " also decided against it."}, {"start": 1330.3600000000001, "end": 1333.5200000000002, "text": " They also do deeper networks."}, {"start": 1333.5200000000002, "end": 1344.2800000000002, "text": " So they built deeper networks, like 50 layer ResNet, 101 layer ResNet and 152 layer ResNet"}, {"start": 1344.2800000000002, "end": 1350.3200000000002, "text": " and the 152 layer ResNet ended up being the best one, as you can see here."}, {"start": 1350.32, "end": 1356.6799999999998, "text": " And you can see a pretty gain like it almost almost lockstep gain depth."}, {"start": 1356.6799999999998, "end": 1363.48, "text": " More depth means better network and this at the time, this these numbers, they were unheard"}, {"start": 1363.48, "end": 1372.8, "text": " of, like even 50 layer deep neural network was bombastic, but 152 layers, it was, it"}, {"start": 1372.8, "end": 1373.96, "text": " was crazy."}, {"start": 1373.96, "end": 1381.56, "text": " And the fact that still it has less parameters than the VGG 19 and performs better."}, {"start": 1381.56, "end": 1385.38, "text": " That was mind mind blowing, absolutely mind blowing."}, {"start": 1385.38, "end": 1392.28, "text": " And then at the end, they built an ensemble of these models and ended up taking the 2015"}, {"start": 1392.28, "end": 1394.48, "text": " ImageNet competition winner."}, {"start": 1394.48, "end": 1399.58, "text": " That was still like very important back then it was still very important who wins who wins"}, {"start": 1399.58, "end": 1405.6399999999999, "text": " ImageNet that year, where I think I haven't even followed up on the last few years."}, {"start": 1405.6399999999999, "end": 1412.84, "text": " It's some kind of wide fix ResNet whatnot with pre trained and 50 billion extra data."}, {"start": 1412.84, "end": 1413.86, "text": " Yeah."}, {"start": 1413.86, "end": 1421.12, "text": " So for the deeper networks, they decide that they are computationally rather become rather"}, {"start": 1421.12, "end": 1422.12, "text": " expensive."}, {"start": 1422.12, "end": 1427.6399999999999, "text": " So they introduce these bottleneck blocks here on the right, where as you can see, so"}, {"start": 1427.64, "end": 1436.76, "text": " here, if you have a 64 dimensional input, you do 64 feature channels in your convolution,"}, {"start": 1436.76, "end": 1443.5800000000002, "text": " have a 64 dimensional output, you can save computation if you first project the higher."}, {"start": 1443.5800000000002, "end": 1449.88, "text": " So here you have a 256 dimensional input, and they say we can save computational power"}, {"start": 1449.88, "end": 1455.92, "text": " by pretty much projecting down to 64 first, because then our complexity of this layer,"}, {"start": 1455.92, "end": 1462.0800000000002, "text": " which is the expensive layer, will be the same as the complexity of one of these layers."}, {"start": 1462.0800000000002, "end": 1467.66, "text": " And then we can project up again, the one by one convolution, they are significantly"}, {"start": 1467.66, "end": 1472.74, "text": " lower computational intensive than the three by three convolutions, like it's nine times"}, {"start": 1472.74, "end": 1477.24, "text": " less operations, if you think about it."}, {"start": 1477.24, "end": 1481.3200000000002, "text": " So that's what they use to build the deeper residual networks."}, {"start": 1481.32, "end": 1487.6399999999999, "text": " And these residual networks, the ResNet 50, 101, 152, they are still staples today, you"}, {"start": 1487.6399999999999, "end": 1492.62, "text": " can have these are you can have pre trained versions of those and people still use it"}, {"start": 1492.62, "end": 1499.3999999999999, "text": " like ResNet 50 is used in every segmentation whatnot application."}, {"start": 1499.3999999999999, "end": 1506.3999999999999, "text": " So yeah, this has turned out these decisions here have, you know, made it long way."}, {"start": 1506.4, "end": 1511.52, "text": " Here you can see the number of parameters in these residual networks."}, {"start": 1511.52, "end": 1516.8000000000002, "text": " And this was the absolute craziest thing right here."}, {"start": 1516.8000000000002, "end": 1521.88, "text": " 1202 layers, okay."}, {"start": 1521.88, "end": 1525.76, "text": " So you can see still until here, ResNet 110."}, {"start": 1525.76, "end": 1529.52, "text": " Now this is on CIFAR 10, right here, not on ImageNet anymore."}, {"start": 1529.52, "end": 1536.8, "text": " But you can see that even 110 layers still had less parameters or actually the select"}, {"start": 1536.8, "end": 1544.42, "text": " the same order of parameters than these previous networks that were only 19 layers deep."}, {"start": 1544.42, "end": 1554.52, "text": " This was unheard of and much more unheard of 1202 layer network to train on CIFAR 10."}, {"start": 1554.52, "end": 1560.2, "text": " It's a bit of an overkill, but they say their goal was explicitly to study depth."}, {"start": 1560.2, "end": 1566.54, "text": " And you can see here that with the deeper and deeper networks, they outperformed all"}, {"start": 1566.54, "end": 1572.56, "text": " of the previous networks, so all of the baselines and themselves as they went deeper and deeper"}, {"start": 1572.56, "end": 1574.24, "text": " and deeper."}, {"start": 1574.24, "end": 1579.84, "text": " However, once you go to 1002 layers, you go up again."}, {"start": 1579.84, "end": 1586.24, "text": " So here's the question, was this all just kind of a trick, a hack?"}, {"start": 1586.24, "end": 1588.4199999999998, "text": " And do we run into the same problem again?"}, {"start": 1588.4199999999998, "end": 1591.0, "text": " And that's the question they asked themselves."}, {"start": 1591.0, "end": 1592.9599999999998, "text": " And the answer is no."}, {"start": 1592.9599999999998, "end": 1600.6799999999998, "text": " So if you look right here, so here you see again, the plane networks."}, {"start": 1600.6799999999998, "end": 1607.82, "text": " In the plane networks, you can pretty easily see that the more layers you have, the higher"}, {"start": 1607.82, "end": 1613.6799999999998, "text": " your error goes, whereas in the residual network, it's exactly the opposite way."}, {"start": 1613.6799999999998, "end": 1617.06, "text": " The more layers you have, the lower your error."}, {"start": 1617.06, "end": 1624.12, "text": " And if you compare this 110 layer network with the 1200 layer network, you see your"}, {"start": 1624.12, "end": 1626.36, "text": " validation error going up again."}, {"start": 1626.36, "end": 1631.3999999999999, "text": " However, your training error and I can't zoom in more, but it's the same."}, {"start": 1631.3999999999999, "end": 1633.56, "text": " It's the same and it's at zero."}, {"start": 1633.56, "end": 1640.76, "text": " So here they conclude and the the here they conclude, now we are overfitting."}, {"start": 1640.76, "end": 1644.32, "text": " They don't use like the biggest data augmentation like we use today."}, {"start": 1644.32, "end": 1647.8, "text": " So overfitting was still a thing back then."}, {"start": 1647.8, "end": 1653.2, "text": " So now they conclude, okay, now we have actually built a large enough network that is overfitting"}, {"start": 1653.2, "end": 1659.76, "text": " and then and the fact that we go up again in the training error is due to the fact that"}, {"start": 1659.76, "end": 1662.8, "text": " we are probably overfitting."}, {"start": 1662.8, "end": 1669.2, "text": " So not only have they enabled us to build deeper networks, they have effectively shown"}, {"start": 1669.2, "end": 1676.6399999999999, "text": " that this can get you to the to the point where you don't need deeper networks anymore,"}, {"start": 1676.6399999999999, "end": 1682.04, "text": " at least on C410 because you are overfitting and it can effectively get you there."}, {"start": 1682.04, "end": 1686.96, "text": " This is a lot of evidence for the fact that this biasing the networks towards the identity"}, {"start": 1686.96, "end": 1695.08, "text": " function is a very valid thing to do and is the solution to the we can't train deep networks"}, {"start": 1695.08, "end": 1696.08, "text": " problems."}, {"start": 1696.08, "end": 1699.96, "text": " Lastly, they investigate the size of the responses."}, {"start": 1699.96, "end": 1705.96, "text": " So their hypothesis is that if if it is really beneficial to bias the network towards the"}, {"start": 1705.96, "end": 1714.78, "text": " identity function, and if it is really true that each of these layers only learns a little"}, {"start": 1714.78, "end": 1718.6, "text": " bit, right, because the identity function is already very good."}, {"start": 1718.6, "end": 1723.12, "text": " Each of these layers only needs to learn kind of a small function."}, {"start": 1723.12, "end": 1726.0, "text": " They look at the responses of these things."}, {"start": 1726.0, "end": 1732.52, "text": " So the response magnitude of these layers, right here of the signal through the layers,"}, {"start": 1732.52, "end": 1738.6399999999999, "text": " and they compare those with the response magnitude of the other neural networks where you don't"}, {"start": 1738.6399999999999, "end": 1740.28, "text": " have the skip connection."}, {"start": 1740.28, "end": 1746.72, "text": " The hypothesis is, if we look at these, then the responses of these layers should be much"}, {"start": 1746.72, "end": 1752.92, "text": " larger because they have to learn much more."}, {"start": 1752.92, "end": 1757.36, "text": " And the responses here will be much smaller because the identity function is already doing"}, {"start": 1757.36, "end": 1759.48, "text": " most of the work."}, {"start": 1759.48, "end": 1760.8, "text": " And that's exactly what you find."}, {"start": 1760.8, "end": 1765.6, "text": " So here, the layers are ordered by response and you can see the plane networks in the"}, {"start": 1765.6, "end": 1772.12, "text": " dashed lines are significantly above the residual network, even and that's not a function of"}, {"start": 1772.12, "end": 1779.24, "text": " the depth because if the depth was actually equal here, you would expect that the dashed"}, {"start": 1779.24, "end": 1783.76, "text": " lines would would stretch like this, right, they would kind of stretch out."}, {"start": 1783.76, "end": 1786.24, "text": " However, exactly the opposite is happening."}, {"start": 1786.24, "end": 1790.3999999999999, "text": " You can see that the residual networks even at the beginning, their responses are very"}, {"start": 1790.3999999999999, "end": 1791.86, "text": " much smaller."}, {"start": 1791.86, "end": 1794.28, "text": " And this is kind of what I like about this paper."}, {"start": 1794.28, "end": 1796.96, "text": " It's, it's one narrative."}, {"start": 1796.96, "end": 1798.8799999999999, "text": " It is a hypothesis."}, {"start": 1798.8799999999999, "end": 1804.6, "text": " And then every single, like the hypothesis is taken, and they make predictions from the"}, {"start": 1804.6, "end": 1810.1399999999999, "text": " hypothesis, they say, Okay, if we are right with our hypothesis, not only should our idea"}, {"start": 1810.1399999999999, "end": 1814.8799999999999, "text": " get us better accuracy, that's what most people most papers do today."}, {"start": 1814.8799999999999, "end": 1821.44, "text": " But also, you know, but also, it should be that we can, for example, push our network"}, {"start": 1821.44, "end": 1826.16, "text": " to the brink of where we actually are overfitting, like here."}, {"start": 1826.16, "end": 1833.56, "text": " And it should also be that the responses of our signal through our layers is smaller."}, {"start": 1833.56, "end": 1838.4, "text": " And yeah, that's research like this is just pretty, pretty cool."}, {"start": 1838.4, "end": 1845.48, "text": " And it's, I think, a lesson for us that sadly, the world has taken the ResNets, but the world"}, {"start": 1845.48, "end": 1850.3600000000001, "text": " hasn't all taken the research methodology of this paper."}, {"start": 1850.36, "end": 1856.4799999999998, "text": " So yeah, if you again, if you want a good read, it's very well written, you I'm very"}, {"start": 1856.4799999999998, "end": 1861.0, "text": " sure you can follow it even if you have read very few papers."}, {"start": 1861.0, "end": 1865.8799999999999, "text": " And with that, yeah, I hope you enjoyed this."}, {"start": 1865.8799999999999, "end": 1870.56, "text": " Please tell me what you think of going through kind of old papers, looking at whether or"}, {"start": 1870.56, "end": 1873.6799999999998, "text": " not they have stood the test of time."}, {"start": 1873.6799999999998, "end": 1877.74, "text": " And yeah, any other comments, leave them in the comments."}, {"start": 1877.74, "end": 1879.04, "text": " I do read them."}, {"start": 1879.04, "end": 1880.04, "text": " And I'll see you next time."}, {"start": 1880.04, "end": 1880.54, "text": " Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=GwItCHOifG8
I'M TAKING A BREAK... (Channel Update July 2020)
Past, Present & Future of this Channel. OUTLINE: 0:00 - I'm going on a break 0:20 - Channel Stats 1:20 - Other Platforms 4:20 - Drama Videos 5:30 - Flatland 8:40 - SpineNet Thumbnail 9:55 - Future Content 12:55 - How do I select papers? 15:50 - Financial Support, Ads & Merch 18:50 - Conclusion Our Flatland Repo: https://github.com/yk/youtube-flatland Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher LinkedIn: https://www.linkedin.com/in/yannic-kilcher-488534136/ If you want to support me, the best thing to do is to share out the content :) If you want to support me financially (completely optional and voluntary, but a lot of people have asked for this): SubscribeStar: https://www.subscribestar.com/yannickilcher Patreon: https://www.patreon.com/yannickilcher Bitcoin (BTC): bc1q49lsw3q325tr58ygf8sudx2dqfguclvngvy2cq Ethereum (ETH): 0x7ad3513E3B8f66799f507Aa7874b1B0eBC7F85e2 Litecoin (LTC): LQW2TRyKYetVC8WjFkhpPhtpbDM4Vw7r9m Monero (XMR): 4ACL8AGrEo5hAir8A9CeVrW8pEauWvnp1WnSDZxW7tziCDLhZAGsgzhRQABDnFy8yuM9fWJDviJPHKRjV4FWt19CJZN9D4n
Yes, you read that right. I am going on a break. Don't worry though, there will still be videos, just not as many. I've decided to basically reduce the upload frequency a little bit, mostly because I am going on a break, but also because I kind of want to have time to do other things, but we'll get to that later. So how's our little channel doing? We've just passed 1 million views. One million times someone thought, well that's kind of worth watching and only about 900,000 times where they were severely disappointed after clicking on the video. I think, I still think that's a net gain, honestly. The channel just surpassed 30,000 subscribers, so technically in log space we're already halfway to a hundred thousand. It's only a matter of time, and I think I've said this in the last update, but this is just absolutely overwhelming how many people are interested in machine learning research and topics related to it. So that's pretty cool and encouraging. Thank you everyone who has already subscribed and especially the people that leave comments, the people that share the videos. This means a lot and I think it's awesome, and it's quite motivating to continue doing this, honestly. I'm having lots of fun. Along with that I've gained almost 5,000 Twitter followers. I think more than 5,000 Twitter followers, which is strange because Twitter is weird, but you know. So that's pretty cool, I guess. I wonder if all of those are subscribed to the channel. In any case, I just want to highlight again that the community around machine learning research is in the absolute largest part a very, very positive community. You people are absolutely great. The comment sections are just so much better than anything else on the entire Internet, including paper reviews at major conferences. Really, this is a half joke that the comment section is better than the reviews on papers, but it is actually very often true. People are discussing ideas in the comments that are valuable and creative and asking interesting questions and helping each other out. And that also counts for our Discord server. So if you're not on our Discord server, we do have one. There is a channel for beginners question, there's a channel for discussing the videos that are on the YouTube channel and people are generally very, very helpful there. It's a vibrant community and I can only recommend that if you're looking to contribute to the community and be part of it, it's a great place. That being said, I'm also on a number of other platforms such as LinkedIn. I finally made a LinkedIn account. I was always kind of skeptic. I don't know how LinkedIn works. Like what is the difference between follow and connect and then people like write little messages while connecting and it says like I'd love to connect but then you accept them and then that message pops up and then it's saying I'd love to connect but you've already connected at that point. This is weird. Like how does LinkedIn work? Someone tell me. What is it for? Like I get it. It's like professional social networking, but ah, it's just it seems weird to me. Okay, but there is an entire community there and I do post my videos there. I'm not like super active on LinkedIn. I have to say that. I'm also on Bitchute, Mines, Parler. So the reason why I'm mentioning these things is that with recent developments, especially around this Yann LeCun video, there were some developments that potentially threaten the existence of this channel and I don't want to make it a single point of failure. So I would appreciate it if you follow me on at least one other thing, at least one other point of contact so that in the case that something might happen, which is unlikely, but you know can, I still have a way of distributing this content. All the links are in the video description. I'd love to see you there wherever. So with respect to the Yann LeCun situation, he has left Twitter now de facto and and people wanted me to kind of make a follow-up video, asked me about it, but I feel you know, I have nothing more substantial to say and just to make a video for video's sake. It's not really a thing I want to go into. General, it's kind of sad, but these kind of news and drama videos, they do get a lot of attention. Not like outrageous, but they do get. I want to keep this channel mostly on YouTube. Mostly about the machine learning research, and I only want to make videos when I really do have some information to add. You know Yann LeCun is an adult and he's able to make his decisions of whether he wants to leave Twitter or not. It's probably for the better for his mental health. So with respect to the drama videos, I always kind of say that I'll pull you in with the drama and then before you know it, I educate you. Ha! Checkmate. So that's how this works and how we ultimately end up with many more machine learners than originally wanted to be. We gotcha. So in other news, Flatland. Round one of Flatland has officially started and I've previously made a video about Flatland. It is a NeurIPS challenge. It is a challenge where we have to route trains around a 2D map and I wanted to make this kind of a community project where we do research together. Hopefully do something with machine learning, with reinforcement learning to tackle this problem and to crush the challenge and this is looking extremely good. So on our Discord server, there is a core group of people that is really engaged and this is one of the reasons why I kind of want to reduce my upload frequency because I want to have time to participate more in these community efforts. I really want to have time to do more myself in the Flatland research group that we have. We do open research. Anyone is welcome. You're still very welcome. Join our Discord server and join us and contribute to the code. There is a core group right now that is really pushing forward. So just to highlight a few of them, there is Novik, Edward Durek, Dolas, Frostbite, China CEO, trademarked, AI Adrian and I'm Peter and I forgot Nuber Panic. I'm so sorry Nuber Panic. You're beautiful. These people are helping each other reach more and better performance profiling code, implementing parts from other papers and it's just great to see that people can collaborate on this even though it's technically a competition. But you know, I guess we're competing against nature. For anyone I haven't mentioned here, I'm very very sorry. Any list of names is always prone to leave people out. I do not want to diminish your impact. So right now this Deque and algorithm is able to reach about a 95% success rate with three to five agents on the map. So three to five trains. But round one has just started and we see that some of these environments have many many more agents in them. So there's still a lot of work to do. So we need you to come and contribute and join the fun. It is fun. And as I said, I will be working on this myself more as well because it's fun. So again big shout out to anyone on Discord that has contributed in any way. This is just awesome. We've just had recently our first Blackland Town Hall with entirely community generated content. So these people came together and basically joined in making one PowerPoint presentation and then presented to each other their knowledge of the environment. And amazingly we also had the Flatland organizers come in and tell us their perspective about the challenge, the environment, and what's challenging and what's changed and so on. This was just unprecedented for me the amount of contributions there. The first Town Hall is available if you join Discord. It's linked there. It's recorded. You can still see it. And as I said, there's still plenty of time to join the competition together with us. Okay, next thing. You've probably seen the SpineNet video and the thumbnail there was excessively beautiful. So the story behind it is on the Discord server I've asked people to help me with this thumbnail, which was originally rather boring and I just kind of wanted to know which subtitle I should put there. And then one of the Discord members, Lucas Ferreira, just gone ahead and drawn up this very beautiful image of a SpineNet robot that has the SpineNet as a spine. And this is this kind of stuff is just awesome. So again big shout out to Lucas Ferreira and the absolutely amazing thumbnail that this has generated. And also the contributions to anyone that comes on the Discord server and into the Beginners Question channel asks some question and usually gets some form of help. Now that being said, please don't just come and we'll solve your problem. Like try to search for a solution before going into that group of very well-meaning people because you know if if too many people just expect them to solve their problems, it won't be as well-meaning anymore in the future. Okay, so how does this channel go forward? I want to make the content a bit more diverse and kind of branch out and as I already said the upload frequency will be sort of lower after my break and also during my break. But I have some ideas of how to generate kind of more interesting content or different content. So here are my ideas and this is a list and please tell me what you think of it. And you can do this at this video and you can do this at any point. You can give feedback about what kind of videos you like, what kind of style of videos you like, anything really. I'm happy to listen to people and incorporate all the feedback that I can. So I want to do some more channel updates, maybe more frequently, maybe once every two three weeks. Just to let you know what's going on, kind of what's going on with the channel, what's going on with the community. This should be fun. So another idea I had is to look at kind of historical papers and I think I got the idea from a comment in my comment section. So shout out to whoever lifted me to that. It's a great idea to basically go back to historical papers and just kind of see what people back then knew and didn't know and predicted and were right about and especially I wonder what kind of choices did they make that survive until this day. Kind of arbitrary choices that someone made in some paper that just stuck around. It's interesting to see and there will be a series of kind of classical papers that I will extend from time to time. And I hope you enjoy that. Also want to do more a bit of live coding videos. Lots of people have requested that. I'm not the best coder in the world, but I have done my fair share of machine learning research hands-on. I have lots of more stupid ideas that might or might not work out and I'm very happy to implement them live. Then next thing I want to branch out in topics, maybe more exotic things. Causality is a big thing. Quantum machine learning, whatnot. More practical applications, robotics control. Also fairness. A lot of people, especially after the Jan Lecun video asked me to look more into the fairness literature. I am naturally very interested in that and approach it from kind of a technical but also a societal standpoint. Throughout all of that I would like to include the community more. So you. I don't really know how to do that properly yet. So here's the first thing that I'm going to include you. If you have a good idea of how to do more community inclusion in the channel's content, please tell me. Because I think the community has lots of stuff to give. And it would be a shame if it were only me always doing all the things where other people would be much better at it. Okay, the last question on this is a question that I get very often and that is how do I select papers? And there seems to be a misconception in this. So let me tell you. I select papers by what interests me. And that alone. If I make a video about a paper, it means that I found it interesting enough to read it and I found it interesting enough to make a video about it. Now this can be accelerated by sending me appropriate amounts of protein and carbohydrates. But generally me making a video is not an endorsement of a paper. It doesn't mean that this paper is the most important paper or influential. It doesn't mean anything beyond I find it interesting. If I ever get sponsored deals, I'll let you know that a video is sponsored. And that's that. I will not change how I select papers. I will not go by some kind of impact. I would like to branch out my content. I see the danger in only kind of covering what the big companies do. But honestly, they do a lot of interesting stuff. They do a lot of stuff and I'm constantly looking at research that's kind of outside the box. Whatever is interesting, you know, that's what it's going to be. I will not start going by some impact factor. And I will not start politicizing my paper review selection anytime soon. You know, I've already had multiple people, high profile people come to me and say, well, with your platform, couldn't you once a week take a paper where the first author is an underrepresented minority and review that? And, you know, I appreciate the sentiment behind it and I see where it comes from. But if you consider the practical implications of something like this, like I'd have to, you know, go through papers, Google the first author, kind of try to find a talk or a picture of them and estimate whether the melanin content in their skin is high enough for this to qualify now. And something like this and just the thought of this, how someone could do something like this and not start to vomit is just beyond me. I don't know what to say other than that. So let me say this, if your thinking leads you to a place where it's necessary to treat people differently based on the color of their skin, you're wrong. Like, that's my opinion, but you're wrong. The answer to bias cannot consist of more bias. That's that. I do not care how the person that wrote a paper looks like. If your paper is on this channel, it means your work was interesting to me. And I hope that can be my contribution to making the community more fair and just. Okay, last thing. Lots of people have asked me if I had a Patreon or something like this. And I've sort of resisted that kind of stuff until now, mainly because I knew that the day would come when I reduce my upload frequency. And I didn't want to kind of trick people into thinking that I was going to continue this forever. Again, financial support is not my main goal here. And it is completely, absolutely and utterly voluntary. And so I just want to have that out there. So I have made a Patreon page. I do have some reservation with respect to Patreon because of free speech issues and so on. So I've also made a subscribe star page. Both are equal. Both have equal tiers. All the tiers are equal. There is no option where it just where you could just put an amount which I would like. So I just tried to make a bunch of tiers. All of them are equal. So I had to ask myself, what do I give as a benefit? Because I don't want someone to have to pay for like extra content. Because the entire goal of this channel is to educate people, including people that don't have money to go to good universities that might live in other parts of the world, where education is not as available, where resources are not as available to give extra content to people that pay seems to be so I thought, okay, what I could give to the people that do support me on these pages is you will get a PDF of my scribbled, one note document of the papers that are review. I mean, it's not very helpful because I mostly scribble and it's going to be like subdividing the pages weirdly, maybe it has more of a symbolic value. And if if you're really into that, you know, at least there's something. I've also made a bunch of crypto wallets. So if you'd rather want to use that support me, you are welcome to do so. All the links are in the description of the video. Again, financial support. Very, very, very optional and very voluntary. Though of course, I do think anyone that does, I am also going to experiment with ads on the videos. And as creators, we have kind of different options of which ads are displayed, and how often and so on. I find mid video ads annoying, I find non skippable ads annoying and so on. I'm really counting on you here to give me feedback after various videos of how much the ads annoy you, which ones annoy you, which ones don't. I'm really counting on you. OK. OK, last thing I am planning, planning on a line of merch, mainly because I think it's funny. But I don't know if that's going to work out. But, you know, maybe if you have fun T-shirt ideas or so, just let me know. All right. That was the update. As I said, I probably won't be reading comments too much, but I will catch up after the break. And I hope you continue enjoying this channel even with kind of the lower upload frequency and the new types of content that come in. If you do have suggestions for new exotic content that vaguely has to do with machine learning or not, let me know. Let me know what you think of anything I said. And I wish you an awesome summer and I hope to see you here anytime. Ciao.
[{"start": 0.0, "end": 7.24, "text": " Yes, you read that right. I am going on a break. Don't worry though, there will still be videos, just not as many."}, {"start": 7.5200000000000005, "end": 14.36, "text": " I've decided to basically reduce the upload frequency a little bit, mostly because I am going on a break,"}, {"start": 14.36, "end": 19.8, "text": " but also because I kind of want to have time to do other things, but we'll get to that later."}, {"start": 19.84, "end": 23.94, "text": " So how's our little channel doing? We've just passed 1 million views."}, {"start": 23.94, "end": 31.94, "text": " One million times someone thought, well that's kind of worth watching and only about 900,000 times where they were severely disappointed"}, {"start": 32.620000000000005, "end": 38.900000000000006, "text": " after clicking on the video. I think, I still think that's a net gain, honestly. The channel just surpassed"}, {"start": 39.74, "end": 45.900000000000006, "text": " 30,000 subscribers, so technically in log space we're already halfway to a hundred thousand."}, {"start": 45.900000000000006, "end": 51.480000000000004, "text": " It's only a matter of time, and I think I've said this in the last update, but this is just absolutely"}, {"start": 51.48, "end": 58.879999999999995, "text": " overwhelming how many people are interested in machine learning research and topics related to it."}, {"start": 59.04, "end": 61.04, "text": " So that's pretty cool and"}, {"start": 62.0, "end": 65.64, "text": " encouraging. Thank you everyone who has already subscribed and"}, {"start": 66.92, "end": 72.6, "text": " especially the people that leave comments, the people that share the videos. This means a lot and"}, {"start": 72.88, "end": 77.75999999999999, "text": " I think it's awesome, and it's quite motivating to continue doing this, honestly."}, {"start": 77.76, "end": 81.72, "text": " I'm having lots of fun. Along with that I've gained almost"}, {"start": 83.0, "end": 87.32000000000001, "text": " 5,000 Twitter followers. I think more than 5,000 Twitter followers, which is"}, {"start": 88.2, "end": 90.2, "text": " strange because Twitter is"}, {"start": 90.88000000000001, "end": 92.4, "text": " weird,"}, {"start": 92.4, "end": 94.4, "text": " but you know."}, {"start": 94.76, "end": 96.76, "text": " So that's pretty cool, I guess."}, {"start": 97.76, "end": 100.44, "text": " I wonder if all of those are subscribed to the channel."}, {"start": 100.44, "end": 107.72, "text": " In any case, I just want to highlight again that the community around machine learning research is in the"}, {"start": 107.92, "end": 113.25999999999999, "text": " absolute largest part a very, very positive community. You people are absolutely great."}, {"start": 113.25999999999999, "end": 120.08, "text": " The comment sections are just so much better than anything else on the entire Internet, including"}, {"start": 120.75999999999999, "end": 123.75999999999999, "text": " paper reviews at major conferences. Really,"}, {"start": 123.75999999999999, "end": 128.32, "text": " this is a half joke that the comment section is better than the reviews on papers,"}, {"start": 128.32, "end": 131.92, "text": " but it is actually very often true. People are"}, {"start": 132.88, "end": 135.32, "text": " discussing ideas in the comments that are"}, {"start": 136.28, "end": 143.44, "text": " valuable and creative and asking interesting questions and helping each other out. And that also counts for our Discord server."}, {"start": 143.44, "end": 146.4, "text": " So if you're not on our Discord server,"}, {"start": 146.88, "end": 150.76, "text": " we do have one. There is a channel for beginners question,"}, {"start": 150.76, "end": 157.51999999999998, "text": " there's a channel for discussing the videos that are on the YouTube channel and people are generally very, very helpful there."}, {"start": 157.52, "end": 162.20000000000002, "text": " It's a vibrant community and I can only recommend that if you're looking to"}, {"start": 162.8, "end": 167.8, "text": " contribute to the community and be part of it, it's a great place. That being said,"}, {"start": 167.8, "end": 175.46, "text": " I'm also on a number of other platforms such as LinkedIn. I finally made a LinkedIn account. I was always kind of"}, {"start": 176.44, "end": 178.44, "text": " skeptic. I don't know how LinkedIn works."}, {"start": 178.44, "end": 183.88, "text": " Like what is the difference between follow and connect and then people like write little messages"}, {"start": 183.88, "end": 191.07999999999998, "text": " while connecting and it says like I'd love to connect but then you accept them and then that message pops up and then it's"}, {"start": 191.07999999999998, "end": 195.24, "text": " saying I'd love to connect but you've already connected at that point."}, {"start": 195.24, "end": 201.56, "text": " This is weird. Like how does LinkedIn work? Someone tell me. What is it for? Like I get it."}, {"start": 201.56, "end": 204.0, "text": " It's like professional social networking, but ah,"}, {"start": 205.04, "end": 212.28, "text": " it's just it seems weird to me. Okay, but there is an entire community there and I do post my videos there."}, {"start": 212.28, "end": 215.8, "text": " I'm not like super active on LinkedIn. I have to say that."}, {"start": 216.32, "end": 218.32, "text": " I'm also on"}, {"start": 218.64000000000001, "end": 225.52, "text": " Bitchute, Mines, Parler. So the reason why I'm mentioning these things is that with recent developments,"}, {"start": 225.56, "end": 227.8, "text": " especially around this Yann LeCun video,"}, {"start": 228.84, "end": 231.68, "text": " there were some developments that potentially"}, {"start": 232.44, "end": 237.68, "text": " threaten the existence of this channel and I don't want to make it a single point of failure."}, {"start": 237.68, "end": 245.32, "text": " So I would appreciate it if you follow me on at least one other thing, at least one other point of"}, {"start": 245.6, "end": 253.64000000000001, "text": " contact so that in the case that something might happen, which is unlikely, but you know can, I"}, {"start": 254.32, "end": 256.32, "text": " still have a way of"}, {"start": 256.4, "end": 261.2, "text": " distributing this content. All the links are in the video description. I'd love to see you there wherever."}, {"start": 261.4, "end": 264.8, "text": " So with respect to the Yann LeCun situation,"}, {"start": 264.8, "end": 268.0, "text": " he has left Twitter now de facto and"}, {"start": 268.56, "end": 272.88, "text": " and people wanted me to kind of make a follow-up video, asked me about it,"}, {"start": 272.88, "end": 279.88, "text": " but I feel you know, I have nothing more substantial to say and just to make a video for video's sake."}, {"start": 279.88, "end": 282.64, "text": " It's not really a thing I want to go into. General,"}, {"start": 283.12, "end": 288.6, "text": " it's kind of sad, but these kind of news and drama videos, they do get a lot of attention."}, {"start": 288.6, "end": 294.04, "text": " Not like outrageous, but they do get. I want to keep this channel mostly on YouTube."}, {"start": 294.04, "end": 301.52000000000004, "text": " Mostly about the machine learning research, and I only want to make videos when I really do have some information to add."}, {"start": 301.52000000000004, "end": 308.32000000000005, "text": " You know Yann LeCun is an adult and he's able to make his decisions of whether he wants to leave Twitter or not."}, {"start": 308.32000000000005, "end": 310.32000000000005, "text": " It's probably for the better for"}, {"start": 310.76, "end": 314.16, "text": " his mental health. So with respect to the drama videos,"}, {"start": 314.16, "end": 320.48, "text": " I always kind of say that I'll pull you in with the drama and then before you know it, I educate you. Ha!"}, {"start": 320.48, "end": 327.44, "text": " Checkmate. So that's how this works and how we ultimately end up with many more machine learners than"}, {"start": 327.68, "end": 332.48, "text": " originally wanted to be. We gotcha. So in other news, Flatland."}, {"start": 332.76, "end": 338.24, "text": " Round one of Flatland has officially started and I've previously made a video about Flatland."}, {"start": 338.24, "end": 343.12, "text": " It is a NeurIPS challenge. It is a challenge where we have to route trains"}, {"start": 343.88, "end": 345.64000000000004, "text": " around a"}, {"start": 345.64, "end": 350.28, "text": " 2D map and I wanted to make this kind of a community project where we do research together."}, {"start": 350.8, "end": 355.88, "text": " Hopefully do something with machine learning, with reinforcement learning to tackle this problem and"}, {"start": 356.32, "end": 360.68, "text": " to crush the challenge and this is looking extremely good."}, {"start": 360.68, "end": 362.8, "text": " So on our Discord server,"}, {"start": 362.8, "end": 366.52, "text": " there is a core group of people that is really engaged and"}, {"start": 366.68, "end": 372.56, "text": " this is one of the reasons why I kind of want to reduce my upload frequency because I want to have time to"}, {"start": 372.56, "end": 375.48, "text": " participate more in these community efforts."}, {"start": 375.48, "end": 381.6, "text": " I really want to have time to do more myself in the Flatland research group that we have."}, {"start": 381.6, "end": 386.96, "text": " We do open research. Anyone is welcome. You're still very welcome. Join our Discord server and"}, {"start": 387.44, "end": 393.36, "text": " join us and contribute to the code. There is a core group right now that is really pushing forward."}, {"start": 393.36, "end": 400.6, "text": " So just to highlight a few of them, there is Novik, Edward Durek, Dolas, Frostbite, China CEO,"}, {"start": 400.6, "end": 402.6, "text": " trademarked,"}, {"start": 402.6, "end": 409.20000000000005, "text": " AI Adrian and I'm Peter and I forgot Nuber Panic. I'm so sorry Nuber Panic. You're beautiful."}, {"start": 409.24, "end": 415.12, "text": " These people are helping each other reach more and better performance profiling code,"}, {"start": 416.08000000000004, "end": 423.8, "text": " implementing parts from other papers and it's just great to see that people can collaborate on this even though it's technically a competition."}, {"start": 423.8, "end": 428.72, "text": " But you know, I guess we're competing against nature. For anyone I haven't mentioned here,"}, {"start": 428.72, "end": 436.12, "text": " I'm very very sorry. Any list of names is always prone to leave people out. I do not want to diminish your impact."}, {"start": 436.12, "end": 441.48, "text": " So right now this Deque and algorithm is able to reach about a 95% success rate"}, {"start": 441.76000000000005, "end": 445.32000000000005, "text": " with three to five agents on the map. So three to five trains."}, {"start": 445.48, "end": 451.96000000000004, "text": " But round one has just started and we see that some of these environments have many many more agents in them."}, {"start": 451.96000000000004, "end": 455.8, "text": " So there's still a lot of work to do. So we need you to"}, {"start": 455.8, "end": 459.72, "text": " come and contribute and join the fun. It is fun."}, {"start": 459.72, "end": 464.78000000000003, "text": " And as I said, I will be working on this myself more as well because"}, {"start": 465.48, "end": 470.62, "text": " it's fun. So again big shout out to anyone on Discord that has contributed in any way."}, {"start": 473.0, "end": 476.36, "text": " This is just awesome. We've just had recently our first"}, {"start": 477.04, "end": 482.92, "text": " Blackland Town Hall with entirely community generated content. So"}, {"start": 482.92, "end": 491.92, "text": " these people came together and basically joined in making one PowerPoint presentation and then presented to each other their knowledge of the environment."}, {"start": 491.92, "end": 497.76, "text": " And amazingly we also had the Flatland organizers come in and tell us their perspective about"}, {"start": 497.96000000000004, "end": 502.68, "text": " the challenge, the environment, and what's challenging and what's changed and so on."}, {"start": 503.20000000000005, "end": 508.16, "text": " This was just unprecedented for me the amount of contributions there."}, {"start": 508.52000000000004, "end": 512.24, "text": " The first Town Hall is available if you join Discord."}, {"start": 512.24, "end": 518.5600000000001, "text": " It's linked there. It's recorded. You can still see it. And as I said, there's still"}, {"start": 519.12, "end": 522.32, "text": " plenty of time to join the competition together with us."}, {"start": 522.44, "end": 528.76, "text": " Okay, next thing. You've probably seen the SpineNet video and the thumbnail there was"}, {"start": 529.4, "end": 531.4, "text": " excessively beautiful."}, {"start": 531.44, "end": 534.96, "text": " So the story behind it is on the Discord server"}, {"start": 534.96, "end": 540.16, "text": " I've asked people to help me with this thumbnail, which was originally rather boring"}, {"start": 540.16, "end": 546.68, "text": " and I just kind of wanted to know which subtitle I should put there. And then one of the Discord members, Lucas Ferreira,"}, {"start": 546.68, "end": 553.0799999999999, "text": " just gone ahead and drawn up this very beautiful image of a SpineNet"}, {"start": 553.6, "end": 557.4399999999999, "text": " robot that has the SpineNet as a spine. And"}, {"start": 558.1999999999999, "end": 560.76, "text": " this is this kind of stuff is just awesome."}, {"start": 560.76, "end": 567.88, "text": " So again big shout out to Lucas Ferreira and the absolutely amazing thumbnail that this has generated. And also the"}, {"start": 567.88, "end": 574.56, "text": " contributions to anyone that comes on the Discord server and into the Beginners Question channel asks some question and"}, {"start": 575.36, "end": 578.4399999999999, "text": " usually gets some form of help. Now that being said,"}, {"start": 579.56, "end": 585.2, "text": " please don't just come and we'll solve your problem. Like try to search for a solution before"}, {"start": 585.84, "end": 592.28, "text": " going into that group of very well-meaning people because you know if if too many people"}, {"start": 592.28, "end": 598.36, "text": " just expect them to solve their problems, it won't be as well-meaning anymore in the future. Okay,"}, {"start": 598.36, "end": 604.92, "text": " so how does this channel go forward? I want to make the content a bit more diverse and kind of branch out and"}, {"start": 606.3199999999999, "end": 613.1999999999999, "text": " as I already said the upload frequency will be sort of lower after my break and also during my break."}, {"start": 613.1999999999999, "end": 618.68, "text": " But I have some ideas of how to generate kind of more interesting content or different content."}, {"start": 618.68, "end": 624.28, "text": " So here are my ideas and this is a list and please tell me what you think of it."}, {"start": 624.28, "end": 627.88, "text": " And you can do this at this video and you can do this at any point."}, {"start": 627.88, "end": 635.3199999999999, "text": " You can give feedback about what kind of videos you like, what kind of style of videos you like, anything really."}, {"start": 635.3199999999999, "end": 638.12, "text": " I'm happy to listen to people and"}, {"start": 639.12, "end": 641.12, "text": " incorporate all the feedback that I can."}, {"start": 641.68, "end": 647.28, "text": " So I want to do some more channel updates, maybe more frequently, maybe once every two three weeks."}, {"start": 647.28, "end": 653.0799999999999, "text": " Just to let you know what's going on, kind of what's going on with the channel, what's going on with the community."}, {"start": 653.16, "end": 654.4399999999999, "text": " This should be fun."}, {"start": 654.4399999999999, "end": 657.12, "text": " So another idea I had is to look at kind of"}, {"start": 657.56, "end": 663.8, "text": " historical papers and I think I got the idea from a comment in my comment section. So shout out to whoever"}, {"start": 664.48, "end": 671.9599999999999, "text": " lifted me to that. It's a great idea to basically go back to historical papers and just kind of see what people back then"}, {"start": 671.96, "end": 679.72, "text": " knew and didn't know and predicted and were right about and especially I wonder what kind of choices did they make"}, {"start": 679.88, "end": 683.88, "text": " that survive until this day. Kind of arbitrary choices that"}, {"start": 684.6800000000001, "end": 687.64, "text": " someone made in some paper that just stuck around."}, {"start": 688.44, "end": 695.32, "text": " It's interesting to see and there will be a series of kind of classical papers that I will extend from time to time."}, {"start": 695.32, "end": 700.2, "text": " And I hope you enjoy that. Also want to do more a bit of live coding videos."}, {"start": 700.2, "end": 707.0400000000001, "text": " Lots of people have requested that. I'm not the best coder in the world, but I have done my fair share of machine learning research"}, {"start": 707.6400000000001, "end": 712.2800000000001, "text": " hands-on. I have lots of more stupid ideas that might or might not work out and"}, {"start": 712.84, "end": 719.2800000000001, "text": " I'm very happy to implement them live. Then next thing I want to branch out in topics, maybe more exotic things."}, {"start": 720.0400000000001, "end": 727.08, "text": " Causality is a big thing. Quantum machine learning, whatnot. More practical applications, robotics control."}, {"start": 727.08, "end": 734.2800000000001, "text": " Also fairness. A lot of people, especially after the Jan Lecun video asked me to look more into the fairness literature."}, {"start": 734.36, "end": 740.9200000000001, "text": " I am naturally very interested in that and approach it from kind of a technical but also a societal"}, {"start": 741.7, "end": 747.32, "text": " standpoint. Throughout all of that I would like to include the community more. So you."}, {"start": 747.64, "end": 750.76, "text": " I don't really know how to do that properly yet."}, {"start": 750.76, "end": 757.24, "text": " So here's the first thing that I'm going to include you. If you have a good idea of how to do more community"}, {"start": 757.3199999999999, "end": 764.4399999999999, "text": " inclusion in the channel's content, please tell me. Because I think the community has lots of stuff to give."}, {"start": 764.92, "end": 768.04, "text": " And it would be a shame if it were only me"}, {"start": 768.4399999999999, "end": 772.4399999999999, "text": " always doing all the things where other people would be much better at it."}, {"start": 772.6, "end": 779.64, "text": " Okay, the last question on this is a question that I get very often and that is how do I select papers?"}, {"start": 779.64, "end": 783.0, "text": " And there seems to be a misconception in this."}, {"start": 783.64, "end": 788.28, "text": " So let me tell you. I select papers by what interests me."}, {"start": 788.68, "end": 791.72, "text": " And that alone. If I make a video about a paper,"}, {"start": 791.8, "end": 798.04, "text": " it means that I found it interesting enough to read it and I found it interesting enough to make a video about it."}, {"start": 798.1999999999999, "end": 804.04, "text": " Now this can be accelerated by sending me appropriate amounts of protein and carbohydrates."}, {"start": 804.12, "end": 808.52, "text": " But generally me making a video is not an endorsement of a paper."}, {"start": 808.52, "end": 813.72, "text": " It doesn't mean that this paper is the most important paper or influential."}, {"start": 813.72, "end": 817.3199999999999, "text": " It doesn't mean anything beyond I find it interesting."}, {"start": 817.3199999999999, "end": 821.3199999999999, "text": " If I ever get sponsored deals, I'll let you know that a video is sponsored."}, {"start": 821.3199999999999, "end": 825.72, "text": " And that's that. I will not change how I select papers."}, {"start": 825.72, "end": 830.12, "text": " I will not go by some kind of impact. I would like to branch out my content."}, {"start": 830.12, "end": 834.12, "text": " I see the danger in only kind of covering what the big companies do."}, {"start": 834.12, "end": 836.92, "text": " But honestly, they do a lot of interesting stuff."}, {"start": 836.92, "end": 841.7199999999999, "text": " They do a lot of stuff and I'm constantly looking at research that's kind of outside the box."}, {"start": 841.7199999999999, "end": 844.92, "text": " Whatever is interesting, you know, that's what it's going to be."}, {"start": 844.92, "end": 847.7199999999999, "text": " I will not start going by some impact factor."}, {"start": 847.7199999999999, "end": 854.52, "text": " And I will not start politicizing my paper review selection anytime soon."}, {"start": 854.52, "end": 860.92, "text": " You know, I've already had multiple people, high profile people come to me and say,"}, {"start": 860.92, "end": 871.7199999999999, "text": " well, with your platform, couldn't you once a week take a paper where the first author is an underrepresented minority and review that?"}, {"start": 871.7199999999999, "end": 878.12, "text": " And, you know, I appreciate the sentiment behind it and I see where it comes from."}, {"start": 878.12, "end": 885.3199999999999, "text": " But if you consider the practical implications of something like this, like I'd have to, you know, go through papers,"}, {"start": 885.32, "end": 899.32, "text": " Google the first author, kind of try to find a talk or a picture of them and estimate whether the melanin content in their skin is high enough for this to qualify now."}, {"start": 899.32, "end": 910.5200000000001, "text": " And something like this and just the thought of this, how someone could do something like this and not start to vomit is just beyond me."}, {"start": 910.5200000000001, "end": 912.5200000000001, "text": " I don't know what to say other than that."}, {"start": 912.52, "end": 927.3199999999999, "text": " So let me say this, if your thinking leads you to a place where it's necessary to treat people differently based on the color of their skin, you're wrong."}, {"start": 927.3199999999999, "end": 931.3199999999999, "text": " Like, that's my opinion, but you're wrong."}, {"start": 931.3199999999999, "end": 937.3199999999999, "text": " The answer to bias cannot consist of more bias."}, {"start": 937.3199999999999, "end": 938.3199999999999, "text": " That's that."}, {"start": 938.3199999999999, "end": 942.12, "text": " I do not care how the person that wrote a paper looks like."}, {"start": 942.12, "end": 946.12, "text": " If your paper is on this channel, it means your work was interesting to me."}, {"start": 946.12, "end": 951.32, "text": " And I hope that can be my contribution to making the community more fair and just."}, {"start": 951.32, "end": 952.32, "text": " Okay, last thing."}, {"start": 952.32, "end": 957.32, "text": " Lots of people have asked me if I had a Patreon or something like this."}, {"start": 957.32, "end": 966.92, "text": " And I've sort of resisted that kind of stuff until now, mainly because I knew that the day would come when I reduce my upload frequency."}, {"start": 966.92, "end": 973.92, "text": " And I didn't want to kind of trick people into thinking that I was going to continue this forever."}, {"start": 973.92, "end": 978.92, "text": " Again, financial support is not my main goal here."}, {"start": 978.92, "end": 984.92, "text": " And it is completely, absolutely and utterly voluntary."}, {"start": 984.92, "end": 987.92, "text": " And so I just want to have that out there."}, {"start": 987.92, "end": 989.92, "text": " So I have made a Patreon page."}, {"start": 989.92, "end": 996.92, "text": " I do have some reservation with respect to Patreon because of free speech issues and so on."}, {"start": 996.92, "end": 999.92, "text": " So I've also made a subscribe star page."}, {"start": 999.92, "end": 1000.92, "text": " Both are equal."}, {"start": 1000.92, "end": 1001.92, "text": " Both have equal tiers."}, {"start": 1001.92, "end": 1003.92, "text": " All the tiers are equal."}, {"start": 1003.92, "end": 1007.92, "text": " There is no option where it just where you could just put an amount which I would like."}, {"start": 1007.92, "end": 1009.92, "text": " So I just tried to make a bunch of tiers."}, {"start": 1009.92, "end": 1010.92, "text": " All of them are equal."}, {"start": 1010.92, "end": 1013.92, "text": " So I had to ask myself, what do I give as a benefit?"}, {"start": 1013.92, "end": 1018.92, "text": " Because I don't want someone to have to pay for like extra content."}, {"start": 1018.92, "end": 1047.92, "text": " Because the entire goal of this channel is to educate people, including people that don't have money to go to good universities that might live in other parts of the world, where education is not as available, where resources are not as available to give extra content to people that pay seems to be so I thought, okay, what I could give to the people that do support me on these pages is you will get a PDF of my scribbled,"}, {"start": 1047.92, "end": 1051.92, "text": " one note document of the papers that are review."}, {"start": 1051.92, "end": 1059.92, "text": " I mean, it's not very helpful because I mostly scribble and it's going to be like subdividing the pages weirdly, maybe it has more of a symbolic value."}, {"start": 1059.92, "end": 1067.92, "text": " And if if you're really into that, you know, at least there's something."}, {"start": 1067.92, "end": 1070.92, "text": " I've also made a bunch of crypto wallets."}, {"start": 1070.92, "end": 1076.92, "text": " So if you'd rather want to use that support me, you are welcome to do so."}, {"start": 1076.92, "end": 1079.92, "text": " All the links are in the description of the video."}, {"start": 1079.92, "end": 1081.92, "text": " Again, financial support."}, {"start": 1081.92, "end": 1084.92, "text": " Very, very, very optional and very voluntary."}, {"start": 1084.92, "end": 1091.92, "text": " Though of course, I do think anyone that does, I am also going to experiment with ads on the videos."}, {"start": 1091.92, "end": 1097.92, "text": " And as creators, we have kind of different options of which ads are displayed, and how often and so on."}, {"start": 1097.92, "end": 1102.92, "text": " I find mid video ads annoying, I find non skippable ads annoying and so on."}, {"start": 1102.92, "end": 1111.92, "text": " I'm really counting on you here to give me feedback after various videos of how much the ads annoy you, which ones annoy you, which ones don't."}, {"start": 1111.92, "end": 1113.92, "text": " I'm really counting on you. OK."}, {"start": 1113.92, "end": 1121.92, "text": " OK, last thing I am planning, planning on a line of merch, mainly because I think it's funny."}, {"start": 1121.92, "end": 1123.92, "text": " But I don't know if that's going to work out."}, {"start": 1123.92, "end": 1128.92, "text": " But, you know, maybe if you have fun T-shirt ideas or so, just let me know."}, {"start": 1128.92, "end": 1130.92, "text": " All right. That was the update."}, {"start": 1130.92, "end": 1136.92, "text": " As I said, I probably won't be reading comments too much, but I will catch up after the break."}, {"start": 1136.92, "end": 1145.92, "text": " And I hope you continue enjoying this channel even with kind of the lower upload frequency and the new types of content that come in."}, {"start": 1145.92, "end": 1153.92, "text": " If you do have suggestions for new exotic content that vaguely has to do with machine learning or not, let me know."}, {"start": 1153.92, "end": 1155.92, "text": " Let me know what you think of anything I said."}, {"start": 1155.92, "end": 1163.92, "text": " And I wish you an awesome summer and I hope to see you here anytime."}, {"start": 1163.92, "end": 1186.92, "text": " Ciao."}]
Yannic Kilchner
https://www.youtube.com/watch?v=5IRlUVrEVL8
Deep Ensembles: A Loss Landscape Perspective (Paper Explained)
#ai #research #optimization Deep Ensembles work surprisingly well for improving the generalization capabilities of deep neural networks. Surprisingly, they outperform Bayesian Networks, which are - in theory - doing the same thing. This paper investigates how Deep Ensembles are especially suited to capturing the non-convex loss landscape of neural networks. OUTLINE: 0:00 - Intro & Overview 2:05 - Deep Ensembles 4:15 - The Solution Space of Deep Networks 7:30 - Bayesian Models 9:00 - The Ensemble Effect 10:25 - Experiment Setup 11:30 - Solution Equality While Training 19:40 - Tracking Multiple Trajectories 21:20 - Similarity of Independent Solutions 24:10 - Comparison to Baselines 30:10 - Weight Space Cross-Sections 35:55 - Diversity vs Accuracy 41:00 - Comparing Ensembling Methods 44:55 - Conclusion & Comments Paper: https://arxiv.org/abs/1912.02757 Abstract: Deep ensembles have been empirically shown to be a promising approach for improving accuracy, uncertainty and out-of-distribution robustness of deep learning models. While deep ensembles were theoretically motivated by the bootstrap, non-bootstrap ensembles trained with just random initialization also perform well in practice, which suggests that there could be other explanations for why deep ensembles work well. Bayesian neural networks, which learn distributions over the parameters of the network, are theoretically well-motivated by Bayesian principles, but do not perform as well as deep ensembles in practice, particularly under dataset shift. One possible explanation for this gap between theory and practice is that popular scalable variational Bayesian methods tend to focus on a single mode, whereas deep ensembles tend to explore diverse modes in function space. We investigate this hypothesis by building on recent work on understanding the loss landscape of neural networks and adding our own exploration to measure the similarity of functions in the space of predictions. Our results show that random initializations explore entirely different modes, while functions along an optimization trajectory or sampled from the subspace thereof cluster within a single mode predictions-wise, while often deviating significantly in the weight space. Developing the concept of the diversity--accuracy plane, we show that the decorrelation power of random initializations is unmatched by popular subspace sampling methods. Finally, we evaluate the relative effects of ensembling, subspace based methods and ensembles of subspace based methods, and the experimental results validate our hypothesis. Authors: Stanislav Fort, Huiyi Hu, Balaji Lakshminarayanan Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we'll look at deep ensembles, a loss landscape perspective by Stanislav Fort, Hui Hu and Balaji Lakshminarayanan. This paper on a high level explains the loss landscape of deep ensemble models, so ensembles of deep neural network. And it hypothesizes and it shows through experiments that each member of the ensemble by means of being initialized at a random point will go and through optimization, go and end up at a different place in weight space. And therefore, the deep ensemble is able to capture different modes of the functional space of the space of solutions. They compare this to Bayesian networks, which are sort of promised to do the same thing, but they often only characterize a single mode and therefore they don't generalize as well. So join me exploring this paper, I think it's pretty cool paper, the experiments are cleverly designed to show what they're supposed to show. And I generally enjoy this type of research because it's kind of an explanatory research that shows you what's going on inside of these networks rather than you know, chasing the next state of the art number. It's also an example of research that you can still do while you're you don't have, you know, giant resources of compute, even though this is by deep mind. But I do believe that this kind of research is still, you know, wide open and available to academia. And whereas the other kinds, the state of the art kind, slowly goes into more and more of the money game. Alright, in any case, join me in reading this paper. If you like it, share it out, leave a comment to think to tell me what you think, and leave a like if you enjoyed it. Alright, so we'll start off the abstract says deep ensembles have been empirically shown to be a promising approach for improving accuracy, uncertainty and out of distribution robustness of deep learning models. So what are deep ensembles really quick and an ensemble model and we're in the classification setting. So in the classification setting, we have data points and each data point has features. So which are the x x is some kind of D dimensional feature. And then you have y which is the label. So that's in some, let's say that's some natural number or something like this or is element of a class set. Now that's the complex numbers. It's its element of some, some some bounded set of class labels. So it's either a cat or a dog or, you know, what, what whatever you want. So you have a data set of these things and your plan is to use x to predict y. If you build an ons, if you build a model, a deep neural network, for example, for this task, you would simply characterize this function here, you would parameterize it as a deep neural networks of many, many layers. If you build an ensemble, now, what you would do is you would take the data set and simply train multiple different ones of these deep neural networks. So you'll train multiple different ones. And if you now want to classify data point, you'll input that data point into all of these three. And at the end, you would somehow aggregate and there are different methods of doing this. But the most obvious one is simply either to aggregate by the mean or the mode. Median, whatever you want, you could also kind of also learn something here, but you can just average the predictions. And that will usually give you a better prediction than if you only have one model. So this is called an ensemble model. And if the ensemble members, these thing here are neural networks or deep networks, this is called a deep ensemble. So why do we hope to become better? That's the point of this paper is to show what happens in the lost landscape of these deep neural networks. And why do they perform better than other methods that are supposed to achieve the same thing. So usually, when you build an ensemble model, what are you hoping for, you're hoping to sort of learn a generalizable function, and they have this drawing right here, where it's a bit of a you have to sort of think differently than you usually do. So on the x axis, you have the space of solutions. So imagine that your your neural network only has a single weight. So this axis here is that single weight, or you can project or whatnot, this is the space of different solutions. So after you optimize, you land somewhere on this axis. And you can see that there is a solid line, which represents the accuracy on the training set. And then there is a dashed line, which represents the accuracy of the validation set for a given parameter. So what you usually do is you optimize one neural network to its very best training accuracy. So let's say you start off here, what you would do is you would see my training accuracy is this high, I need a different color right here is this high. And you calculate the gradient and you could do gradient descent. And that means you go down the loss up the accuracy. So you go over and over and over until you reach this point right here, where you have maximum training accuracy. And then you'll suffer some generalization loss like you know, so right here, it suffers some generalization loss because the validation accuracy at that point isn't as high. But generally, it's correlated as you can see, by the general overlap of these two lines of these two shapes right here. Okay, so this is called a maximum a posteriori estimate, you simply optimize one neural network until the best the best training error. There are different approaches right here, there are approaches that say, okay, we can do we could do better. So first of all, what you see right here is rather peculiar. And you might not be used to this, that there are different peaks right here, there are different peaks, as you can see in the training and the validation error. So they're correlated. And the idea is that neural networks are very nonlinear. And we've known from other papers that they have many, many local minima. And in fact, so this is one of the astounding things about neural network, most of these minima are performing equally well. So even though the neural network has different local minima, they all perform about equally well. And other papers even say they're all sort of connected on a low loss landscape. So there are many, many things that are still mysterious about neural network. But we know that there are multiple minima. And we know that we basically need to find one of them. And it doesn't really matter which one it they all perform sort of equally well. Now, as you can, as you might imagine, there are people who aren't really satisfied with this. And their approach is to say, why don't we just capture this entire curve right here. So if we could build a model that could not only, you know, not only tell us at this point right here, you're this good, but could tell us that at any point, right? How good we are capture the entire distribution of solutions. And these are usually in the category of the Bayesian neural networks, they try to capture the entire distribution. Of course, that's not really feasible, because, you know, you always have to calculate that posterior. So what they end up doing is they do some approximation. And usually they do some sort of a multivariate Gaussian approximation, because you can calculate posteriors in closed form and so on. And this paper, this paper's hypothesis is that these can only usually capture the only usually capture one of these peaks. So they are very able to capture the surrounding right here, they're taking capture very accurately, what happens around this particular peak, they are very aware of the shape of the curvature here, and can tell you a lot of things about it. So they can tell you, for example, that the validation so that you might want to be a bit over here, rather than over here. But they cannot, they don't generally know about these other modes, because they are only approximations. They generally don't produce multimodal solutions. Another approach is a deep ensemble. Now, this paper shows that in general, if you train a deep ensemble, what will happen is because you randomly initialize the deep ensemble, at some points, it will happen that if you do gradient descent on all of them, they will end up sort of covering all these different modes, they still they don't have an idea of you know, the curvature, oh, sorry, this one shouldn't go here, this one should go here, the curve, they don't really know about the curvature, but they will give you these different minima right here. And therefore, they can capture the landscape much, much more easily. If you know that these three are minima, you sort of, it might look something like this. And that's a hell of a lot better than simply the Bayesian approximation that only is able to capture one of the peaks, but really accurately. So their hypothesis here is that deep ensembles do this job of capturing the different modes of the functional space much better than the Bayesian methods. And it is why the deep methods sorry, why the deep ensembles work so well, because they end up in different minima. And that is, it's really interesting proposition. And what I find really interesting as well are the experiments that they do to show this. So they have a lot of these experiments right here. First of all, to the setup, they use c4 10 c4 100, and so on. And on c4 10, you can see right here, they use a small CNN, medium CNN, and a resnet. Now the small and medium CNNs, their accuracy is really, really subpar. So take the results here with some grain of salt, because there are effects in these neural network that are really qualitatively different. If you are seriously underperforming, like this one, like if you have a seriously too small network rather than a large network. Now they do verify all of their things also with this large network and 90% accuracy is acceptable for c4 10. I don't think there's the big qualitative difference between 90 and 95 and so on. But the 64 if it were only this, I would be rather critical of this work. But it's fine to if you if you see the effect at 64 and then some of the effects you check to carry over to the 90% one, I'm going to generally believe you. Okay. So first of all, what they do here is they look at a training trajectory of just a single run. So this paper is half about ensembles, but also half generally about what what does training of neural networks do and they reach some very, very cool conclusions that even are independent of deep ensembles. So here, the first thing we do is we have some initial random initialization in weight spades of your weight. And then you do gradient descent and you run and you run right and you get to some minima right here, some minimum right here. And then you do a second one. So you initialize somewhere else. And because you initialize somewhere else, you run, you run, you run, you end up at a different minimum. Okay, this is a property. So these are not convex functions, right? We know about neural networks, you'll end up a different minima. But the minima, they will, they will perform about equally well. So the question is, do those different minima that perform equally well, describe the same function? Or are they fundamentally different functions that just happen to reach the same accuracy? And the question is very interesting. And this paper attempts to answer that. So here you can see in the description, on the left, cosine similarity between checkpoints to measure weight space alignment, along optimization trajectory. So we only consider one of these runs only consider the left one, for example, and you plot it here. And here, this later one comes later, sorry. So you plot the left only a single run and you ask yourself, the checkpoint that I have after epoch 20, how similar is it to the checkpoint that I have after epoch five, that will be right here. Now, we have to read up how they compare the checkpoints. And this is weight space alignment. Okay, so weight space alignment, it basically means how much do the weights align in the cosine fashion, as you can see right here, this is simply the cosine between the weights, this is one way of comparing two functions. If two functions align in weight space, there's a decent chance that they describe the same thing. So as you can see here, we go as we go down the optimization trajectory, of course, each one is similar to themselves. But you can see that there is kind of a shift right here. So at the beginning, the zero of checkpoint is very dissimilar to the checkpoint at the end. But after very short while you kind of cross over, and then all these checkpoints right here are sort of similar. So the if you just look at two rows, you look at the bottom row, and you look at the top row, the bottom row tells you how similar are the checkpoints during training to the initial checkpoint. And you can see pretty quickly, they are very dissimilar. So at this point right here, there's kind of a dissimilarity happening where the checkpoint goes away from its initialization to something else. And the top row tells you how similar are they to where the network ends up. And you can see that there appears to be a period in, let's say here where this shift away starts up until here, where it's kind of not similar to anything. But then after that, after here, everything is similar to the final checkpoint. Okay, so this is sort of tells us a hypothesis is that you initialize randomly somewhere you have this last landscape, right? initialize randomly somewhere here, and then you go go go and at some point you fall into one of one of those valleys, and then you simply go to that to that valley. If you initialize somewhere differently, you can see that at the beginning, you might be here somewhere, and then you fall into that valley over here. And after that, you're pretty much set. So this is going to be our hypothesis from now on that in these neural networks, you the initialization is basically you you're somewhere and you kind of meander around a bit until you happen to go into one of these directions, which happens pretty quickly. And then you fall into a hole basically. And that's that's rather a convex setting in that thing. Okay, a really interesting thing that they do is a really interesting thing is that they check the disagreement of predictions. So you might think that if a neural network achieves 65 or 90, let's call it 90% accuracy on c410, right, that there are just you know, there there this data set that's 100%. And there are just these 10% over here, they're just the hardest, right. And the more you train, the more are you you're able to push this boundary to the right. So if you train more, if you have a better network, you're just able to explain more and more of the samples. However, this this experiment here is going to show that this is not the case, what they measure is the disagreement in predictions, which basically means that if I there is this data set, the validation data set, and if I have one random initialization, and I train it to 90% accuracy, it will have it will say these, it will not be able to classify these here. But if I have the same network, but a different initialization, it might not be able to classify these over here, but will be perfectly able to classify these over here. Right? This is a very also very interesting property. And you can see right here, the disagreement of predictions as you go through the training. So again, we're going to look at the bottom and the top row. So the bottom row and the top row red is very disagreeing. Blue is very agreeing. You can see again, that Oh, I introduced again, I introduced the different runs. I'm already taking this away from later. We are just looking at one single run for now. This this is a result that's going to come up later when we look at two different runs of the same neural network. And that's the astounding part. Okay, here, we're just going to look at one run again during training. So we can see right here at the beginning, of course, every checkpoint agrees with itself on the predictions. However, you can see that pretty quickly, the checkpoints start disagreeing very quickly, everything is red right here. However, on the top, you can see how much how much do these checkpoints agree with the end with the 30th epoch checkpoint, and see that there is a period that is red right from here to let's say here. And then after that, they all start agreeing. So from here on out, it's all pretty blue, which basically means that that they agree with the last checkpoint. So with the that all of these agree with the end of the training. Again, this is our hypothesis here that once you're in this valley, that the function kind of stays the same and you only sort of micro optimize the function. However, at the beginning, you decide into which of those valleys you want to go. And these are different initializations will lead you to different valleys. And that's what they show right here. So they do a t-SNE plot of predictions t-SNE is a method to project to down project high dimensional vectors. And this is the weight space projected to two dimensions. So t-SNE axis one and two, these are rather arbitrary. It's just the if you think of a PCA, it's the directions of maximum variance. And you can see the three different runs, they immediately at the beginning right here, they immediately go, you can see they have they do large distances at the beginning, between the steps of optimization. And they do in very different directions just by means of being initialized at different points and having maybe a bit of noise in the training process. But once they are at the particular location, they sort of just kind of bounce around right here and right here and try to find the best minima in that region. So this is our first indication that the if we train the same network multiple times with random initializations, it's going to end up at multi at different places. And what we're wondering is we already know that a single network is very different at the end than at the beginning of training. What we want to know is, are two networks also very different even though they're trained on the same objective? Just because they are at different places in the weight space doesn't mean they are functionally that different, there are symmetries. And it's going to turn out yes, they actually are very, very different. So this is right here. Here you can see two different things. And we're going to read the plot along with it. Just so I remember what I'm seeing here. So using two different architectures, okay, for each of these architectures, the left subplot shows the cosine similarity between the different solution weight space. And the right subplot shows the fraction of labels on which the predictions from different solutions disagree. Okay, so it's the same as before, the left is the alignment. And now it's not during training. Now we restart independently, we train the same network 10 different times. And after that, we're going to compare the 10 different solutions. Remember, these all achieve roughly the same accuracy on the data sets. And this is the same whether you go to a big architecture like this ResNet 20, or to a small architecture like this small CNN right here, you can see that every single solution, of course, agrees a lot with itself, that's the diagonal right here, but it's completely not aligned, it's completely orthogonal to all the other solutions. So all the solutions in weight space are orthogonal. Now, there's still the chance that there's you know, some symmetry in weight space. Because, you know, if I if I have a neural network, I can just exchange the exchange the connections. And if I also exchange the neurons, then it will be the same function. However, you can see right here that they completely disagree. So this small CNN, remember, it had like a 65% accuracy, the solutions, the red here, they disagree on 25% of the labels. So that this is exactly this effect we saw before, we train one solution, and it will not be able to classify these parts of the validation data set. And we train the same network with the same data set with the same loss with everything the same, again, just from a random initialization that's different, it will end up equally performing equally well, but it will make the mistakes on an entirely different set of the validation data points. This is rather astounding, I feel because I think most people are of the of the idea that all the kind of data points have an intrinsic hardness. And if if we get to 70% accuracy, it will always be the same 70% of data points that we miss classify or sorry, that we correctly classify. This is not the case. And this is one thing I think this paper and this line of research does pretty cool is to look at these networks in terms of their prediction agreement. So they go further and they compare this to four different methods. So they say, okay, ensembles, ensembles are one method of kind of doing these getting different solutions, which means we start from random initializations, but there are other ones. So for example, there is just place this correctly or random subspace sampling. So what does it mean? They say we start at an optimized solution. So you train a network one single network. And then we choose a random direction at v in weight space, we step in that direction by choosing different values of t, looking at the predictions at configurations, the theta zero plus TV, we repeat this from many different v, but always the same theta zero. So in our original kind of drawing of this thing, we optimize one single network, let's say that's here. And then we sort of wiggle around in here into different random directions. Now, of course, there's only one random direction right here. If maybe we can look at this at at the so if here, we have the loss landscape, and maybe over here, there is a bit of a of a thing. And over here, there is a bit of a you you thought I was gonna draw. Okay, so we start here, and maybe that converges to somewhere here. So what we're going to do is we're going to select random directions in that space. And we're just going to go a few steps into this direction and compare the weights now here, you can already see by the way, I'm drawing it that this will probably make you stay in the same region. And our hope with ensembles is, of course, is that they are able to capture all of the three different modes right here. But it is a way to obtain different solutions that all also perform quite well, if you only perturb your solution by a little bit, it also works quite well, and you can build an ensemble out of these methods right here, you can build an ensemble out of these. In fact, these Bayesian methods, if you do these approximations with Gaussians, that's pretty much what they will end up doing is they will end up characterizing the local, the local landscape around one of these minimum. But here, we simply do it by randomly stepping into a direction. That's the first method that we're going to investigate to obtain an ensemble of different solutions. So deep ensembles means we initially random, we randomly initialize many times and then train from scratch each member. This method here means we start from an hour from a solution and we simply perturb it into random directions. The next thing we can do is we can do dropouts. Subspace dropout. We again start at an optimized solution, apply dropout with randomly chosen probability. Again, our hypothesis is going to be that this is going to keep the network rather in the sort of same kind of functional mode and not switch over. Diagonal Gaussian subspace. Again, we start from an optimized solution, you can see the pattern. And here we actually do some sort of a Gaussian approximation to the functional space, we calculate a mean and a standard deviation, and we draw samples of the parameters from that distribution, and then the same in a low rank regime. And here you see what happens. So here is these things. For example, the random subspaces. Here is this overlapped with the plot we saw before. So here we have three different trajectories of runs. And then at the end of each trajectory, we take the best solution. And we do this random exploration around it. And this here is the t-SNE, the t-SNE projection. Now this isn't, I have to say this isn't a projection of the weights itself. Sorry, I did not say that before. This is a projection of the predictions, I believe, of a subset of data points. So this is the prediction projection of that. And you can see that if we perturb the solutions like this, all of these solutions, all of these ensembles, they rather they stay in their basin of attraction, as you can see right here. So with a deep ensemble, we would build an ensemble that, sorry, sorry, sorry, we would build an ensemble that combines this point and this point and this point. Whereas here, we will simply either build an ensemble that that combines points in here, or we'll build an ensemble that combines points in here, and so on. And you'll see this for all the different methods that we consider here, especially the Gaussian methods. And that's a hint to why even though Bayesian networks explicitly try to capture the entire distribution right here, what they'll end up doing is they'll simply end up capturing a single mode. And not, and that's important because the single mode is always functionally sort of equal. We saw that this is a trained training trajectory. And at the end of training after like this step right here, all the functions are pretty much the same, right, they pretty much agree with the end optimum. Whereas between the runs, they these functions completely disagree with each other. So it is important if we want to build an ensemble to capture as many of these modes as possible. And only the ensemble, the deep ensembles can do that. So far. So this is another experiment where they show this lost landscape. And I really like these kind of plots. So what you see here is a plane, it's a 2d plane. And the 2d plane is described by three points. So one point is the origin, you see right here, the origin, that's the origin of that's the zero in weight space. Okay, then what you have are the two optima. So you'd run an optimization two different times. Once it's initialized here, and it runs to here. And once it's initialized here, and it runs to here. Okay. So that defines the plane that we're going to look at. Now they for each single pixel in this plane or actually for each single pixel in this half circle right here, they're going to run the same thing. So for each half circle right here, they evaluated the networks. So what you'll do is simply you do linear combination of these weight of the weight vector here at this optimum, the weight vector here at this optimum. And you can for each point here defines a neural network with those weights. And you can evaluate it. And that's what you get. This is the accuracy of the model. So here you can see very, very clearly that there are these two different modes right here. So each even though they're initialized super close to each other, right, you can see this right here, they're initialized super close to each other, because they are this is the flat area right here that we saw before, because they are in the flat area. They're even though they're in the flat area, because the red one is a little bit more to this basin of attraction, the blue one is a little bit more to this basin of attraction. So they move over and as soon as they're in, it's like, boom, they go to the minimum of that basin. And this area is rather convex. And this area is rather convex. And in the middle, you can see is a less is more loss. So no solution will go there. That's how you get these different minima. That's how you get these different modes. So the blue stripe, as you can see, from the color is going to be the same in each of the in each of the valleys, consistent with our what we know so far. Now here, the pink stripe is a Gaussian exploration. So if you now do a Gaussian perturbation Gaussian exploration around this minimum, you basically you can see again, you don't get out of this valley, you don't, you don't get out of this basin. So you're going to get stuck in there. And you're going to get stuck in there. So the only chance almost you have is to initialize again, and hope that you end up in a different place. And I guess my hypothesis is that there are many, many more of these valleys of these basins than that you can you could ever capture. So basically, every single initialization that is different will lead you to a different one of these basins. I guess it's only a matter of the size. So here again, they do a function similarity. So in this case, it's the function similarity to optimum one. And this is again, how many of the labels agree with the optimum right here. And you can see that within this basin of attraction, you have fairly high overlap of the functional similarity. But here, none, right, so 15% or so, it's not going to be zero, because they're going to agree on like some of the examples, I guess there's still something like intrinsic hardness, but they agree on almost none of the labels. At least, I guess if you normalize by their base accuracy. So even though optimum two is performing as well, it is functionally extremely dissimilar to optimum one. So these describe really different functions. And I really don't know what to make of this other than, you know, this each one of these is maybe sort of deciding to look at different features in the in the data set, right to or to maybe build different high level features from the same low level features. And maybe we're still under parameterizing these models, because not a single model can sort of look at both features at the same time, as evidenced by the fact that each of these is always going to one of these things. Or it could be that in fact, that in fact, the task is way too simple. And it's it can be solved in like 500 different ways. And each of these optima is simply one way of solving the task one way of combining feature, and it's actually completely an over specified problem. That's another hypothesis, it would be, I guess, interesting to look at these things. And I'm sure there's work on this. So you can see the same thing for optimum two right here, where, okay, go away, where you can see that optimum one, it agrees almost nothing with optimum two, right? It doesn't, it doesn't agree, there's not even a hint of a valley right here, in the terms of functional similarity. That is very, very interesting. So it really means that these two things describe two different functions. They do these other plots right here that they call diversity versus accuracy plots. So what they'll do is, they are going to have different models, and they're going to look at them in terms of their diversity and their accuracy. So here, the y axis is going to be how different are these functions. And that's going to be again, in fraction of labels changed normalized by the base accuracy. So here you can see, we're always start from this baseline optimum, this baseline optimum has zero diversity zero, because it agrees with itself on all the on all the on all the different labels, of course, and then we're going to disturb that using our four methods that we defined before. So we're going to randomly subspace, we're going to drop out, we're going to Gaussian, perturb it and so on. And the more we perturb it, the more diverse our function is going to be naturally, right? Because we perturb the function, it starts disagreeing more and more and more and more with our original optimum. However, what we also expect is, you know, if we are in the local optimum, and maybe here, and you know, maybe the validation accuracy is sort of beside it, or a little bit larger and so on. So if we perturb it a little bit, you know, that might not make too much to our accuracy. But if we perturb it a lot, you know, we go actually up the loss landscape, and then we get less accuracy also on the validation set. So that's what you see right here in these in these this curve right here, as you make the function more diverse, so you perturb it a little bit, you see that your accuracy doesn't suffer too much, you kind of stay at the same accuracy. But as if you make it more and more and more diverse, you can see that the accuracy suffers until the diversity of one basically means that you disagree on the maximum amount of labels that you can. And so you're sort of sort of out of this valley right here. And also, you can see that your accuracy goes to zero. So the more these functions disagree, the less their accuracy is, that seems natural. However, you can see that these red stars right here, they seem to be also very different, they seem to not agree with the original baseline optimum, but they seem to be doing perfectly fine in terms of accuracy, be at the same accuracy. And those are the independent optima. Those are the optima from runs where we initialize at a different point and then also trained. And that, again, is evidence for the fact that there are probably other optima far away, where these different initializations find this here. So they are very different in terms of functional space, they're quite far apart, they predict different things. However, in terms of loss, they're almost the same or actually the same. So this is very, very cool experiments right here. And they do this for the different for different architectures. And you can see that, especially the larger architectures, this actually happens more pronounced. And they also make the point of saying, if you go to harder problems, like a CIFAR 100, or an ImageNet, this, this effect is more pronounced that you can see, these here are closer together as a curve. And these, these are the the independent optima. So I hope you're all you're already on board and still know why we're doing these things. We're doing these things because we want to build some sort of ensemble that captures the distribution of solutions in order to generalize better. Now, we have two options, either we start kind of from a an optimum and characterize the space around that optimum, which is what these methods do right here. And what also the Bayesian methods do this, even though they don't want to, because they do these approximations, because they're intractable, they're going to end up doing this. Or our other our other option is to restart training a bunch of times. And then we end up at different optima. And the point of the paper is it's better to do that, than to build the ensemble out of the of these Gaussian methods or of these perturbation methods. And the paper, I guess the main claim of the paper is why that happens. And it happens because the ensemble members obtain different minima that are functionally different. Okay, so exactly, that's what they do here. So they now build ensembles out of these different things. And you can see that here on the x axis of the ensemble size. So how many ensemble members do you have? And the dashed lines here are the baseline accuracies if you just have a single model. And the the test accuracy is plotted on the y axis. Now I actually was I was not, that's not correct. You always build the ensemble out of random initializations. But on top of that, you do these things. So what you can see right here is, if I have this classifier, which is my original classifier, and I add on top of that, this PCA Gaussian, you know, perturbation stuff, I increase in accuracy, okay. However, if I build an ensemble, I increase in accuracy, if I build an ensemble out of 10 members, I increase in accuracy this much. Okay. And then if because I can do both things. So if I increase if I do an ensemble, and then on top of that to the PCA Gaussian, I gain another this much right here. So that's sort of evidence for the fact that you'd rather build an ensemble than do this, these other methods of approximating the Bayesian posterior of weights. So yes, I'm, I'm sort of convinced. I hope you are too. And they do a lot of they do some more experiments right here where you can see that the difference between so this is single mode, sorry, this is, I guess, here, accuracy. Oh, yeah, if you this is the out of distribution test. So you can take a data set, and you can corrupt it by corruption. So there are predefined data sets, but you can also do it yourself, you crop it, you can do luminosity, whatever, you can destroy parts of the image, you can see that having more ensemble members. So this is your original models. Here is how they sync with increasing corruption. It almost doesn't matter which ones of these methods you do, you see the bottom one is the original model and you gain a little bit by doing these things, but not nearly as much by building an ensemble and going here or actually an ensemble of two members or a five members, in which case you jump this much in accuracy. So these ensembles from different initializations are also very, very, are also very good at countering corruption, which you see also here. Yeah, so this is the JS divergence. Okay, I've read that. But let's not go here, videos already too long. And this is the last thing is on image net test set and the image net corrupted set, where they pretty much show the same thing. It's not as pronounced here. But you can see pretty much how the different if you go from single model to ensemble with two members to ensemble of four members, there is a general upwards trend. And the general upwards trend is much less pronounced within each ensemble. So if you go just go from method to method, then it is between the different groups of ensembles, meaning that the ensemble is a much more pronounced effect that these other effects. So I hope I have convinced you a little bit of how these subspaces look like how the lost landscape of neural networks look like, especially the fact that there are these different minima. And the random initializations will almost always hit these different minima. And the interesting part is that even though these different minima perform equally well, they are functionally very different. And an ensemble of differently initialized and independently optimized models can actually capture these different modes of the functional space. And therefore, if you build an ensemble out of that, it will generalize better because it kind of can draw information from all of those different modes, rather than if you do some sort of Bayesian network, which will, because you have to approximate usually with Gaussians, will end up only covering one of these modes. That was that is sort of a, a good summary of what this paper says. I again, I enjoy research like this, because it's easy and it gives, it kind of makes you thinks, right. So I'll be thinking about these things for a while now and thinking of new kind of experiments that walk do. And yeah, as I said, this research is still wide open. We don't know so many things about neural network. And you know, tell me, tell me what you think is going on. Actually, that would be very interesting. And yeah, I'll see you next time. Bye bye.
[{"start": 0.64, "end": 6.0, "text": " Hi there, today we'll look at deep ensembles, a loss landscape perspective by Stanislav Fort,"}, {"start": 6.0, "end": 13.6, "text": " Hui Hu and Balaji Lakshminarayanan. This paper on a high level explains the loss landscape of deep"}, {"start": 13.6, "end": 19.76, "text": " ensemble models, so ensembles of deep neural network. And it hypothesizes and it shows through"}, {"start": 19.76, "end": 25.84, "text": " experiments that each member of the ensemble by means of being initialized at a random point"}, {"start": 25.84, "end": 33.28, "text": " will go and through optimization, go and end up at a different place in weight space. And therefore,"}, {"start": 33.28, "end": 38.4, "text": " the deep ensemble is able to capture different modes of the functional space of the space of"}, {"start": 38.4, "end": 44.32, "text": " solutions. They compare this to Bayesian networks, which are sort of promised to do the same thing,"}, {"start": 44.32, "end": 49.04, "text": " but they often only characterize a single mode and therefore they don't generalize as well."}, {"start": 49.92, "end": 55.28, "text": " So join me exploring this paper, I think it's pretty cool paper, the experiments are cleverly"}, {"start": 55.28, "end": 61.92, "text": " designed to show what they're supposed to show. And I generally enjoy this type of research because"}, {"start": 61.92, "end": 67.28, "text": " it's kind of an explanatory research that shows you what's going on inside of these networks rather"}, {"start": 67.28, "end": 72.32, "text": " than you know, chasing the next state of the art number. It's also an example of research that you"}, {"start": 72.32, "end": 80.24000000000001, "text": " can still do while you're you don't have, you know, giant resources of compute, even though this is by"}, {"start": 80.24, "end": 86.24, "text": " deep mind. But I do believe that this kind of research is still, you know, wide open and"}, {"start": 86.24, "end": 94.96, "text": " available to academia. And whereas the other kinds, the state of the art kind, slowly goes"}, {"start": 94.96, "end": 101.36, "text": " into more and more of the money game. Alright, in any case, join me in reading this paper. If you"}, {"start": 101.36, "end": 108.56, "text": " like it, share it out, leave a comment to think to tell me what you think, and leave a like if you"}, {"start": 108.56, "end": 116.96000000000001, "text": " enjoyed it. Alright, so we'll start off the abstract says deep ensembles have been empirically shown to"}, {"start": 116.96000000000001, "end": 122.32000000000001, "text": " be a promising approach for improving accuracy, uncertainty and out of distribution robustness"}, {"start": 122.32000000000001, "end": 129.52, "text": " of deep learning models. So what are deep ensembles really quick and an ensemble model and"}, {"start": 129.52, "end": 133.76, "text": " we're in the classification setting. So in the classification setting, we have data points and"}, {"start": 133.76, "end": 140.79999999999998, "text": " each data point has features. So which are the x x is some kind of D dimensional feature. And then"}, {"start": 140.79999999999998, "end": 149.44, "text": " you have y which is the label. So that's in some, let's say that's some natural number or something"}, {"start": 149.44, "end": 157.51999999999998, "text": " like this or is element of a class set. Now that's the complex numbers. It's its element of some,"}, {"start": 157.51999999999998, "end": 162.95999999999998, "text": " some some bounded set of class labels. So it's either a cat or a dog or, you know, what, what"}, {"start": 162.96, "end": 170.24, "text": " whatever you want. So you have a data set of these things and your plan is to use x to predict y."}, {"start": 171.12, "end": 175.60000000000002, "text": " If you build an ons, if you build a model, a deep neural network, for example, for this task,"}, {"start": 175.60000000000002, "end": 180.48000000000002, "text": " you would simply characterize this function here, you would parameterize it as a deep neural"}, {"start": 180.48000000000002, "end": 186.56, "text": " networks of many, many layers. If you build an ensemble, now, what you would do is you would"}, {"start": 186.56, "end": 193.84, "text": " take the data set and simply train multiple different ones of these deep neural networks. So"}, {"start": 193.84, "end": 199.2, "text": " you'll train multiple different ones. And if you now want to classify data point, you'll input that"}, {"start": 199.2, "end": 204.88, "text": " data point into all of these three. And at the end, you would somehow aggregate and there are"}, {"start": 204.88, "end": 209.84, "text": " different methods of doing this. But the most obvious one is simply either to aggregate by"}, {"start": 209.84, "end": 218.48000000000002, "text": " the mean or the mode. Median, whatever you want, you could also kind of also learn something here,"}, {"start": 218.48000000000002, "end": 224.48000000000002, "text": " but you can just average the predictions. And that will usually give you a better prediction than if"}, {"start": 224.48000000000002, "end": 230.4, "text": " you only have one model. So this is called an ensemble model. And if the ensemble members,"}, {"start": 230.4, "end": 236.64000000000001, "text": " these thing here are neural networks or deep networks, this is called a deep ensemble. So"}, {"start": 236.64, "end": 245.11999999999998, "text": " why do we hope to become better? That's the point of this paper is to show what happens in the lost"}, {"start": 245.11999999999998, "end": 252.72, "text": " landscape of these deep neural networks. And why do they perform better than other methods that"}, {"start": 252.72, "end": 258.47999999999996, "text": " are supposed to achieve the same thing. So usually, when you build an ensemble model, what are you"}, {"start": 258.47999999999996, "end": 265.59999999999997, "text": " hoping for, you're hoping to sort of learn a generalizable function, and they have this"}, {"start": 265.6, "end": 273.44, "text": " drawing right here, where it's a bit of a you have to sort of think differently than you usually do."}, {"start": 273.44, "end": 281.36, "text": " So on the x axis, you have the space of solutions. So imagine that your your neural network only has"}, {"start": 281.36, "end": 289.28000000000003, "text": " a single weight. So this axis here is that single weight, or you can project or whatnot, this is the"}, {"start": 289.28, "end": 296.4, "text": " space of different solutions. So after you optimize, you land somewhere on this axis. And you"}, {"start": 296.4, "end": 302.88, "text": " can see that there is a solid line, which represents the accuracy on the training set. And"}, {"start": 302.88, "end": 308.08, "text": " then there is a dashed line, which represents the accuracy of the validation set for a given parameter."}, {"start": 308.08, "end": 316.79999999999995, "text": " So what you usually do is you optimize one neural network to its very best training accuracy. So"}, {"start": 316.8, "end": 323.12, "text": " let's say you start off here, what you would do is you would see my training accuracy is this high,"}, {"start": 323.12, "end": 329.04, "text": " I need a different color right here is this high. And you calculate the gradient and you could do"}, {"start": 329.04, "end": 335.36, "text": " gradient descent. And that means you go down the loss up the accuracy. So you go over and over and"}, {"start": 335.36, "end": 341.28000000000003, "text": " over until you reach this point right here, where you have maximum training accuracy. And then you'll"}, {"start": 341.28, "end": 346.79999999999995, "text": " suffer some generalization loss like you know, so right here, it suffers some generalization loss"}, {"start": 346.79999999999995, "end": 351.35999999999996, "text": " because the validation accuracy at that point isn't as high. But generally, it's correlated as"}, {"start": 351.35999999999996, "end": 358.55999999999995, "text": " you can see, by the general overlap of these two lines of these two shapes right here. Okay, so"}, {"start": 358.55999999999995, "end": 365.91999999999996, "text": " this is called a maximum a posteriori estimate, you simply optimize one neural network until the best"}, {"start": 365.92, "end": 373.44, "text": " the best training error. There are different approaches right here, there are approaches that"}, {"start": 373.44, "end": 380.32, "text": " say, okay, we can do we could do better. So first of all, what you see right here is rather peculiar."}, {"start": 380.32, "end": 385.44, "text": " And you might not be used to this, that there are different peaks right here, there are different"}, {"start": 385.44, "end": 391.36, "text": " peaks, as you can see in the training and the validation error. So they're correlated. And"}, {"start": 391.36, "end": 397.36, "text": " the idea is that neural networks are very nonlinear. And we've known from other papers"}, {"start": 397.36, "end": 403.2, "text": " that they have many, many local minima. And in fact, so this is one of the astounding things"}, {"start": 403.2, "end": 409.92, "text": " about neural network, most of these minima are performing equally well. So even though the neural"}, {"start": 409.92, "end": 417.68, "text": " network has different local minima, they all perform about equally well. And other papers even"}, {"start": 417.68, "end": 424.40000000000003, "text": " say they're all sort of connected on a low loss landscape. So there are many, many things that"}, {"start": 424.40000000000003, "end": 430.88, "text": " are still mysterious about neural network. But we know that there are multiple minima. And we know"}, {"start": 430.88, "end": 436.4, "text": " that we basically need to find one of them. And it doesn't really matter which one it they all"}, {"start": 436.4, "end": 445.92, "text": " perform sort of equally well. Now, as you can, as you might imagine, there are people who aren't"}, {"start": 445.92, "end": 452.88, "text": " really satisfied with this. And their approach is to say, why don't we just capture this entire"}, {"start": 452.88, "end": 458.64000000000004, "text": " curve right here. So if we could build a model that could not only, you know, not only tell us"}, {"start": 458.64000000000004, "end": 465.92, "text": " at this point right here, you're this good, but could tell us that at any point, right? How good"}, {"start": 465.92, "end": 471.6, "text": " we are capture the entire distribution of solutions. And these are usually in the category"}, {"start": 471.6, "end": 476.72, "text": " of the Bayesian neural networks, they try to capture the entire distribution. Of course,"}, {"start": 476.72, "end": 481.20000000000005, "text": " that's not really feasible, because, you know, you always have to calculate that posterior."}, {"start": 483.76000000000005, "end": 488.08000000000004, "text": " So what they end up doing is they do some approximation. And usually they do some sort"}, {"start": 488.08000000000004, "end": 493.84000000000003, "text": " of a multivariate Gaussian approximation, because you can calculate posteriors in closed form and"}, {"start": 493.84000000000003, "end": 500.8, "text": " so on. And this paper, this paper's hypothesis is that these can only usually capture the"}, {"start": 500.8, "end": 507.76, "text": " only usually capture one of these peaks. So they are very able to capture the surrounding right"}, {"start": 507.76, "end": 513.28, "text": " here, they're taking capture very accurately, what happens around this particular peak,"}, {"start": 514.16, "end": 519.44, "text": " they are very aware of the shape of the curvature here, and can tell you a lot of things about it."}, {"start": 519.44, "end": 525.28, "text": " So they can tell you, for example, that the validation so that you might want to be a bit"}, {"start": 525.28, "end": 534.0, "text": " over here, rather than over here. But they cannot, they don't generally know about these other modes,"}, {"start": 534.0, "end": 540.16, "text": " because they are only approximations. They generally don't produce multimodal solutions."}, {"start": 541.12, "end": 548.8, "text": " Another approach is a deep ensemble. Now, this paper shows that in general, if you train a deep"}, {"start": 548.8, "end": 555.76, "text": " ensemble, what will happen is because you randomly initialize the deep ensemble, at some points, it"}, {"start": 555.76, "end": 561.76, "text": " will happen that if you do gradient descent on all of them, they will end up sort of covering"}, {"start": 561.76, "end": 566.24, "text": " all these different modes, they still they don't have an idea of you know, the curvature, oh,"}, {"start": 566.24, "end": 571.04, "text": " sorry, this one shouldn't go here, this one should go here, the curve, they don't really"}, {"start": 571.04, "end": 576.8, "text": " know about the curvature, but they will give you these different minima right here. And therefore,"}, {"start": 576.8, "end": 582.7199999999999, "text": " they can capture the landscape much, much more easily. If you know that these three are minima,"}, {"start": 582.7199999999999, "end": 589.4399999999999, "text": " you sort of, it might look something like this. And that's a hell of a lot better than simply the"}, {"start": 589.4399999999999, "end": 593.92, "text": " Bayesian approximation that only is able to capture one of the peaks, but really accurately."}, {"start": 594.64, "end": 603.12, "text": " So their hypothesis here is that deep ensembles do this job of capturing the different modes of"}, {"start": 603.12, "end": 611.52, "text": " the functional space much better than the Bayesian methods. And it is why the deep methods sorry,"}, {"start": 611.52, "end": 618.32, "text": " why the deep ensembles work so well, because they end up in different minima. And that is,"}, {"start": 618.32, "end": 624.64, "text": " it's really interesting proposition. And what I find really interesting as well are the experiments"}, {"start": 624.64, "end": 629.84, "text": " that they do to show this. So they have a lot of these experiments right here. First of all,"}, {"start": 629.84, "end": 637.6800000000001, "text": " to the setup, they use c4 10 c4 100, and so on. And on c4 10, you can see right here, they use a"}, {"start": 637.6800000000001, "end": 644.96, "text": " small CNN, medium CNN, and a resnet. Now the small and medium CNNs, their accuracy is really, really"}, {"start": 644.96, "end": 653.0400000000001, "text": " subpar. So take the results here with some grain of salt, because there are effects in these neural"}, {"start": 653.04, "end": 659.8399999999999, "text": " network that are really qualitatively different. If you are seriously underperforming, like this"}, {"start": 659.8399999999999, "end": 666.48, "text": " one, like if you have a seriously too small network rather than a large network. Now they do verify"}, {"start": 666.48, "end": 674.0799999999999, "text": " all of their things also with this large network and 90% accuracy is acceptable for c4 10. I don't"}, {"start": 674.0799999999999, "end": 681.28, "text": " think there's the big qualitative difference between 90 and 95 and so on. But the 64 if it were"}, {"start": 681.28, "end": 688.48, "text": " only this, I would be rather critical of this work. But it's fine to if you if you see the effect at"}, {"start": 688.48, "end": 695.68, "text": " 64 and then some of the effects you check to carry over to the 90% one, I'm going to generally believe"}, {"start": 695.68, "end": 705.1999999999999, "text": " you. Okay. So first of all, what they do here is they look at a training trajectory of just a single"}, {"start": 705.2, "end": 714.88, "text": " run. So this paper is half about ensembles, but also half generally about what what does training"}, {"start": 714.88, "end": 719.6, "text": " of neural networks do and they reach some very, very cool conclusions that even are independent"}, {"start": 719.6, "end": 726.1600000000001, "text": " of deep ensembles. So here, the first thing we do is we have some initial random initialization"}, {"start": 726.1600000000001, "end": 731.6800000000001, "text": " in weight spades of your weight. And then you do gradient descent and you run and you run right and"}, {"start": 731.68, "end": 740.9599999999999, "text": " you get to some minima right here, some minimum right here. And then you do a second one. So you"}, {"start": 741.52, "end": 746.7199999999999, "text": " initialize somewhere else. And because you initialize somewhere else, you run, you run,"}, {"start": 746.7199999999999, "end": 752.8, "text": " you run, you end up at a different minimum. Okay, this is a property. So these are not convex"}, {"start": 752.8, "end": 758.0799999999999, "text": " functions, right? We know about neural networks, you'll end up a different minima. But the minima,"}, {"start": 758.08, "end": 765.36, "text": " they will, they will perform about equally well. So the question is, do those different minima"}, {"start": 765.36, "end": 771.2, "text": " that perform equally well, describe the same function? Or are they fundamentally different"}, {"start": 771.2, "end": 779.44, "text": " functions that just happen to reach the same accuracy? And the question is very interesting."}, {"start": 779.44, "end": 787.12, "text": " And this paper attempts to answer that. So here you can see in the description, on the left,"}, {"start": 787.12, "end": 792.72, "text": " cosine similarity between checkpoints to measure weight space alignment, along optimization"}, {"start": 792.72, "end": 799.68, "text": " trajectory. So we only consider one of these runs only consider the left one, for example,"}, {"start": 800.24, "end": 808.08, "text": " and you plot it here. And here, this later one comes later, sorry. So you plot the left only a"}, {"start": 808.08, "end": 816.32, "text": " single run and you ask yourself, the checkpoint that I have after epoch 20, how similar is it"}, {"start": 816.32, "end": 824.8000000000001, "text": " to the checkpoint that I have after epoch five, that will be right here. Now, we have to read up"}, {"start": 824.8000000000001, "end": 831.2800000000001, "text": " how they compare the checkpoints. And this is weight space alignment. Okay, so weight space"}, {"start": 831.2800000000001, "end": 836.8000000000001, "text": " alignment, it basically means how much do the weights align in the cosine fashion, as you can"}, {"start": 836.8000000000001, "end": 842.08, "text": " see right here, this is simply the cosine between the weights, this is one way of comparing two"}, {"start": 842.08, "end": 848.32, "text": " functions. If two functions align in weight space, there's a decent chance that they describe the"}, {"start": 848.32, "end": 855.12, "text": " same thing. So as you can see here, we go as we go down the optimization trajectory, of course,"}, {"start": 855.12, "end": 862.48, "text": " each one is similar to themselves. But you can see that there is kind of a shift right here. So"}, {"start": 862.48, "end": 869.6, "text": " at the beginning, the zero of checkpoint is very dissimilar to the checkpoint at the end. But after"}, {"start": 869.6, "end": 875.9200000000001, "text": " very short while you kind of cross over, and then all these checkpoints right here are sort of"}, {"start": 875.9200000000001, "end": 883.84, "text": " similar. So the if you just look at two rows, you look at the bottom row, and you look at the top"}, {"start": 883.84, "end": 889.6800000000001, "text": " row, the bottom row tells you how similar are the checkpoints during training to the initial"}, {"start": 889.6800000000001, "end": 896.88, "text": " checkpoint. And you can see pretty quickly, they are very dissimilar. So at this point right here,"}, {"start": 896.88, "end": 903.04, "text": " there's kind of a dissimilarity happening where the checkpoint goes away from its initialization"}, {"start": 903.04, "end": 908.96, "text": " to something else. And the top row tells you how similar are they to where the network ends up."}, {"start": 909.92, "end": 918.32, "text": " And you can see that there appears to be a period in, let's say here where this shift away starts"}, {"start": 918.32, "end": 926.24, "text": " up until here, where it's kind of not similar to anything. But then after that, after here,"}, {"start": 926.24, "end": 933.52, "text": " everything is similar to the final checkpoint. Okay, so this is sort of tells us a hypothesis"}, {"start": 933.52, "end": 940.08, "text": " is that you initialize randomly somewhere you have this last landscape, right? initialize randomly"}, {"start": 940.08, "end": 945.84, "text": " somewhere here, and then you go go go and at some point you fall into one of one of those valleys,"}, {"start": 945.84, "end": 952.0, "text": " and then you simply go to that to that valley. If you initialize somewhere differently, you can see"}, {"start": 952.0, "end": 958.08, "text": " that at the beginning, you might be here somewhere, and then you fall into that valley over here. And"}, {"start": 958.08, "end": 964.56, "text": " after that, you're pretty much set. So this is going to be our hypothesis from now on that"}, {"start": 964.56, "end": 971.12, "text": " in these neural networks, you the initialization is basically you you're somewhere and you kind of"}, {"start": 971.12, "end": 976.4, "text": " meander around a bit until you happen to go into one of these directions, which happens pretty"}, {"start": 976.4, "end": 984.0, "text": " quickly. And then you fall into a hole basically. And that's that's rather a convex setting in that"}, {"start": 984.0, "end": 993.4399999999999, "text": " thing. Okay, a really interesting thing that they do is a really interesting thing is that they"}, {"start": 993.4399999999999, "end": 1003.28, "text": " check the disagreement of predictions. So you might think that if a neural network achieves 65 or 90,"}, {"start": 1003.28, "end": 1009.04, "text": " let's call it 90% accuracy on c410, right, that there are just you know, there there this data set"}, {"start": 1009.92, "end": 1016.4, "text": " that's 100%. And there are just these 10% over here, they're just the hardest, right. And the"}, {"start": 1016.4, "end": 1022.64, "text": " more you train, the more are you you're able to push this boundary to the right. So if you train"}, {"start": 1022.64, "end": 1027.68, "text": " more, if you have a better network, you're just able to explain more and more of the samples."}, {"start": 1027.68, "end": 1033.68, "text": " However, this this experiment here is going to show that this is not the case, what they measure"}, {"start": 1033.68, "end": 1039.2, "text": " is the disagreement in predictions, which basically means that if I there is this data set,"}, {"start": 1039.2, "end": 1045.8400000000001, "text": " the validation data set, and if I have one random initialization, and I train it to 90% accuracy,"}, {"start": 1046.3200000000002, "end": 1053.44, "text": " it will have it will say these, it will not be able to classify these here. But if I have the"}, {"start": 1053.44, "end": 1060.3200000000002, "text": " same network, but a different initialization, it might not be able to classify these over here,"}, {"start": 1060.3200000000002, "end": 1066.64, "text": " but will be perfectly able to classify these over here. Right? This is a very also very interesting"}, {"start": 1066.64, "end": 1074.0800000000002, "text": " property. And you can see right here, the disagreement of predictions as you go through"}, {"start": 1074.0800000000002, "end": 1079.6000000000001, "text": " the training. So again, we're going to look at the bottom and the top row. So the bottom row"}, {"start": 1079.6, "end": 1087.9199999999998, "text": " and the top row red is very disagreeing. Blue is very agreeing. You can see again, that"}, {"start": 1090.48, "end": 1095.28, "text": " Oh, I introduced again, I introduced the different runs. I'm already taking this away from later."}, {"start": 1095.9199999999998, "end": 1100.9599999999998, "text": " We are just looking at one single run for now. This this is a result that's going to come up"}, {"start": 1100.9599999999998, "end": 1105.28, "text": " later when we look at two different runs of the same neural network. And that's the astounding"}, {"start": 1105.28, "end": 1111.04, "text": " part. Okay, here, we're just going to look at one run again during training. So we can see right"}, {"start": 1111.04, "end": 1116.8799999999999, "text": " here at the beginning, of course, every checkpoint agrees with itself on the predictions. However,"}, {"start": 1118.16, "end": 1123.68, "text": " you can see that pretty quickly, the checkpoints start disagreeing very quickly, everything is red"}, {"start": 1123.68, "end": 1132.16, "text": " right here. However, on the top, you can see how much how much do these checkpoints agree with the"}, {"start": 1132.16, "end": 1139.52, "text": " end with the 30th epoch checkpoint, and see that there is a period that is red right from here to"}, {"start": 1139.52, "end": 1147.2, "text": " let's say here. And then after that, they all start agreeing. So from here on out, it's all pretty"}, {"start": 1147.2, "end": 1158.3200000000002, "text": " blue, which basically means that that they agree with the last checkpoint. So with the that all of"}, {"start": 1158.32, "end": 1166.0, "text": " these agree with the end of the training. Again, this is our hypothesis here that once you're in"}, {"start": 1166.0, "end": 1172.48, "text": " this valley, that the function kind of stays the same and you only sort of micro optimize the"}, {"start": 1172.48, "end": 1178.08, "text": " function. However, at the beginning, you decide into which of those valleys you want to go. And"}, {"start": 1178.08, "end": 1182.08, "text": " these are different initializations will lead you to different valleys. And that's what they"}, {"start": 1182.08, "end": 1188.48, "text": " show right here. So they do a t-SNE plot of predictions t-SNE is a method to project to down"}, {"start": 1188.48, "end": 1197.04, "text": " project high dimensional vectors. And this is the weight space projected to two dimensions. So t-SNE"}, {"start": 1197.04, "end": 1203.6799999999998, "text": " axis one and two, these are rather arbitrary. It's just the if you think of a PCA, it's the"}, {"start": 1203.6799999999998, "end": 1210.24, "text": " directions of maximum variance. And you can see the three different runs, they immediately at the"}, {"start": 1210.24, "end": 1215.36, "text": " beginning right here, they immediately go, you can see they have they do large distances at the"}, {"start": 1215.36, "end": 1222.4, "text": " beginning, between the steps of optimization. And they do in very different directions just by means"}, {"start": 1222.4, "end": 1228.8, "text": " of being initialized at different points and having maybe a bit of noise in the training process. But"}, {"start": 1228.8, "end": 1235.52, "text": " once they are at the particular location, they sort of just kind of bounce around right here and"}, {"start": 1235.52, "end": 1246.24, "text": " right here and try to find the best minima in that region. So this is our first indication that the"}, {"start": 1246.24, "end": 1251.76, "text": " if we train the same network multiple times with random initializations, it's going to end up at"}, {"start": 1251.76, "end": 1260.08, "text": " multi at different places. And what we're wondering is we already know that a single network is very"}, {"start": 1260.08, "end": 1267.28, "text": " different at the end than at the beginning of training. What we want to know is, are two networks"}, {"start": 1267.28, "end": 1272.48, "text": " also very different even though they're trained on the same objective? Just because they are at"}, {"start": 1272.48, "end": 1276.6399999999999, "text": " different places in the weight space doesn't mean they are functionally that different, there are"}, {"start": 1276.6399999999999, "end": 1284.0, "text": " symmetries. And it's going to turn out yes, they actually are very, very different. So this is"}, {"start": 1284.0, "end": 1292.0, "text": " right here. Here you can see two different things. And we're going to read the plot along with it."}, {"start": 1293.36, "end": 1299.76, "text": " Just so I remember what I'm seeing here. So using two different architectures, okay, for each of"}, {"start": 1299.76, "end": 1305.04, "text": " these architectures, the left subplot shows the cosine similarity between the different solution"}, {"start": 1305.04, "end": 1309.44, "text": " weight space. And the right subplot shows the fraction of labels on which the predictions from"}, {"start": 1309.44, "end": 1314.8, "text": " different solutions disagree. Okay, so it's the same as before, the left is the alignment. And"}, {"start": 1314.8, "end": 1321.44, "text": " now it's not during training. Now we restart independently, we train the same network 10"}, {"start": 1321.44, "end": 1328.3200000000002, "text": " different times. And after that, we're going to compare the 10 different solutions. Remember,"}, {"start": 1328.3200000000002, "end": 1335.1200000000001, "text": " these all achieve roughly the same accuracy on the data sets. And this is the same whether you go to"}, {"start": 1335.12, "end": 1342.32, "text": " a big architecture like this ResNet 20, or to a small architecture like this small CNN right here,"}, {"start": 1342.8799999999999, "end": 1349.1999999999998, "text": " you can see that every single solution, of course, agrees a lot with itself, that's the diagonal"}, {"start": 1349.1999999999998, "end": 1355.52, "text": " right here, but it's completely not aligned, it's completely orthogonal to all the other solutions."}, {"start": 1355.52, "end": 1360.32, "text": " So all the solutions in weight space are orthogonal. Now, there's still the chance that"}, {"start": 1360.32, "end": 1366.1599999999999, "text": " there's you know, some symmetry in weight space. Because, you know, if I if I have a neural network,"}, {"start": 1366.1599999999999, "end": 1372.96, "text": " I can just exchange the exchange the connections. And if I also exchange the neurons, then it will"}, {"start": 1372.96, "end": 1379.4399999999998, "text": " be the same function. However, you can see right here that they completely disagree. So this small"}, {"start": 1379.4399999999998, "end": 1388.1599999999999, "text": " CNN, remember, it had like a 65% accuracy, the solutions, the red here, they disagree on 25%"}, {"start": 1388.16, "end": 1395.0400000000002, "text": " of the labels. So that this is exactly this effect we saw before, we train one solution,"}, {"start": 1395.0400000000002, "end": 1401.0400000000002, "text": " and it will not be able to classify these parts of the validation data set. And we train the same"}, {"start": 1401.0400000000002, "end": 1406.16, "text": " network with the same data set with the same loss with everything the same, again, just from a random"}, {"start": 1406.16, "end": 1412.24, "text": " initialization that's different, it will end up equally performing equally well, but it will make"}, {"start": 1412.24, "end": 1419.36, "text": " the mistakes on an entirely different set of the validation data points. This is rather astounding,"}, {"start": 1419.36, "end": 1426.4, "text": " I feel because I think most people are of the of the idea that all the kind of data points have an"}, {"start": 1426.4, "end": 1434.16, "text": " intrinsic hardness. And if if we get to 70% accuracy, it will always be the same 70% of data"}, {"start": 1434.16, "end": 1441.36, "text": " points that we miss classify or sorry, that we correctly classify. This is not the case. And this"}, {"start": 1441.36, "end": 1446.32, "text": " is one thing I think this paper and this line of research does pretty cool is to look at these"}, {"start": 1446.32, "end": 1456.4799999999998, "text": " networks in terms of their prediction agreement. So they go further and they compare this to four"}, {"start": 1456.4799999999998, "end": 1464.1599999999999, "text": " different methods. So they say, okay, ensembles, ensembles are one method of kind of doing these"}, {"start": 1464.1599999999999, "end": 1469.36, "text": " getting different solutions, which means we start from random initializations, but there are other"}, {"start": 1469.36, "end": 1477.6, "text": " ones. So for example, there is just place this correctly or random subspace sampling. So what"}, {"start": 1477.6, "end": 1482.32, "text": " does it mean? They say we start at an optimized solution. So you train a network one single"}, {"start": 1482.32, "end": 1488.4799999999998, "text": " network. And then we choose a random direction at v in weight space, we step in that direction by"}, {"start": 1488.4799999999998, "end": 1493.9199999999998, "text": " choosing different values of t, looking at the predictions at configurations, the theta zero plus"}, {"start": 1493.92, "end": 1500.3200000000002, "text": " TV, we repeat this from many different v, but always the same theta zero. So in our original"}, {"start": 1500.3200000000002, "end": 1507.44, "text": " kind of drawing of this thing, we optimize one single network, let's say that's here."}, {"start": 1508.0800000000002, "end": 1513.52, "text": " And then we sort of wiggle around in here into different random directions. Now, of course,"}, {"start": 1513.52, "end": 1520.0800000000002, "text": " there's only one random direction right here. If maybe we can look at this at at the so if here,"}, {"start": 1520.08, "end": 1526.3999999999999, "text": " we have the loss landscape, and maybe over here, there is a bit of a of a thing. And over here,"}, {"start": 1526.3999999999999, "end": 1535.1999999999998, "text": " there is a bit of a you you thought I was gonna draw. Okay, so we start here, and maybe that"}, {"start": 1535.1999999999998, "end": 1540.32, "text": " converges to somewhere here. So what we're going to do is we're going to select random directions"}, {"start": 1540.32, "end": 1545.84, "text": " in that space. And we're just going to go a few steps into this direction and compare the weights"}, {"start": 1545.84, "end": 1552.1599999999999, "text": " now here, you can already see by the way, I'm drawing it that this will probably make you stay"}, {"start": 1552.1599999999999, "end": 1558.9599999999998, "text": " in the same region. And our hope with ensembles is, of course, is that they are able to capture"}, {"start": 1558.9599999999998, "end": 1566.48, "text": " all of the three different modes right here. But it is a way to obtain different solutions that all"}, {"start": 1566.48, "end": 1573.1999999999998, "text": " also perform quite well, if you only perturb your solution by a little bit, it also works quite well,"}, {"start": 1573.2, "end": 1578.56, "text": " and you can build an ensemble out of these methods right here, you can build an ensemble out of"}, {"start": 1578.56, "end": 1585.76, "text": " these. In fact, these Bayesian methods, if you do these approximations with Gaussians, that's pretty"}, {"start": 1585.76, "end": 1592.56, "text": " much what they will end up doing is they will end up characterizing the local, the local landscape"}, {"start": 1592.56, "end": 1598.0800000000002, "text": " around one of these minimum. But here, we simply do it by randomly stepping into a direction."}, {"start": 1598.08, "end": 1603.9199999999998, "text": " That's the first method that we're going to investigate to obtain an ensemble of different"}, {"start": 1603.9199999999998, "end": 1612.24, "text": " solutions. So deep ensembles means we initially random, we randomly initialize many times and then"}, {"start": 1612.24, "end": 1620.0, "text": " train from scratch each member. This method here means we start from an hour from a solution and"}, {"start": 1620.0, "end": 1627.12, "text": " we simply perturb it into random directions. The next thing we can do is we can do dropouts."}, {"start": 1627.12, "end": 1634.08, "text": " Subspace dropout. We again start at an optimized solution, apply dropout with randomly chosen"}, {"start": 1634.08, "end": 1640.8799999999999, "text": " probability. Again, our hypothesis is going to be that this is going to keep the network rather in"}, {"start": 1640.8799999999999, "end": 1648.7199999999998, "text": " the sort of same kind of functional mode and not switch over. Diagonal Gaussian subspace. Again,"}, {"start": 1648.7199999999998, "end": 1653.84, "text": " we start from an optimized solution, you can see the pattern. And here we actually do some sort of"}, {"start": 1653.84, "end": 1660.72, "text": " a Gaussian approximation to the functional space, we calculate a mean and a standard deviation,"}, {"start": 1660.72, "end": 1668.0, "text": " and we draw samples of the parameters from that distribution, and then the same in a low rank"}, {"start": 1668.0, "end": 1676.1599999999999, "text": " regime. And here you see what happens. So here is these things. For example, the random subspaces."}, {"start": 1676.16, "end": 1682.4, "text": " Here is this overlapped with the plot we saw before. So here we have three different trajectories"}, {"start": 1682.4, "end": 1688.3200000000002, "text": " of runs. And then at the end of each trajectory, we take the best solution. And we do this random"}, {"start": 1688.3200000000002, "end": 1695.68, "text": " exploration around it. And this here is the t-SNE, the t-SNE projection. Now this isn't,"}, {"start": 1695.68, "end": 1700.96, "text": " I have to say this isn't a projection of the weights itself. Sorry, I did not say that before."}, {"start": 1700.96, "end": 1708.96, "text": " This is a projection of the predictions, I believe, of a subset of data points. So this is"}, {"start": 1708.96, "end": 1717.76, "text": " the prediction projection of that. And you can see that if we perturb the solutions like this,"}, {"start": 1717.76, "end": 1726.32, "text": " all of these solutions, all of these ensembles, they rather they stay in their basin of attraction,"}, {"start": 1726.32, "end": 1731.6799999999998, "text": " as you can see right here. So with a deep ensemble, we would build an ensemble that,"}, {"start": 1732.8799999999999, "end": 1739.9199999999998, "text": " sorry, sorry, sorry, we would build an ensemble that combines this point and this point and this"}, {"start": 1739.9199999999998, "end": 1747.04, "text": " point. Whereas here, we will simply either build an ensemble that that combines points in here,"}, {"start": 1747.04, "end": 1751.6799999999998, "text": " or we'll build an ensemble that combines points in here, and so on. And you'll see this for all"}, {"start": 1751.68, "end": 1757.8400000000001, "text": " the different methods that we consider here, especially the Gaussian methods. And that's a"}, {"start": 1757.8400000000001, "end": 1764.72, "text": " hint to why even though Bayesian networks explicitly try to capture the entire distribution"}, {"start": 1764.72, "end": 1772.5600000000002, "text": " right here, what they'll end up doing is they'll simply end up capturing a single mode. And not,"}, {"start": 1772.5600000000002, "end": 1778.72, "text": " and that's important because the single mode is always functionally sort of equal. We saw that"}, {"start": 1778.72, "end": 1785.52, "text": " this is a trained training trajectory. And at the end of training after like this step right here,"}, {"start": 1785.52, "end": 1790.72, "text": " all the functions are pretty much the same, right, they pretty much agree with the end optimum."}, {"start": 1791.28, "end": 1798.08, "text": " Whereas between the runs, they these functions completely disagree with each other. So it is"}, {"start": 1798.08, "end": 1802.72, "text": " important if we want to build an ensemble to capture as many of these modes as possible. And"}, {"start": 1802.72, "end": 1810.96, "text": " only the ensemble, the deep ensembles can do that. So far. So this is another experiment where they"}, {"start": 1810.96, "end": 1817.92, "text": " show this lost landscape. And I really like these kind of plots. So what you see here is a plane,"}, {"start": 1817.92, "end": 1825.28, "text": " it's a 2d plane. And the 2d plane is described by three points. So one point is the origin,"}, {"start": 1825.28, "end": 1830.4, "text": " you see right here, the origin, that's the origin of that's the zero in weight space. Okay,"}, {"start": 1830.4, "end": 1838.88, "text": " then what you have are the two optima. So you'd run an optimization two different times. Once it's"}, {"start": 1838.88, "end": 1845.76, "text": " initialized here, and it runs to here. And once it's initialized here, and it runs to here. Okay."}, {"start": 1846.8000000000002, "end": 1853.44, "text": " So that defines the plane that we're going to look at. Now they for each single pixel in this"}, {"start": 1853.44, "end": 1858.8000000000002, "text": " plane or actually for each single pixel in this half circle right here, they're going to run"}, {"start": 1858.8, "end": 1866.6399999999999, "text": " the same thing. So for each half circle right here, they evaluated the networks. So what you'll"}, {"start": 1866.6399999999999, "end": 1873.04, "text": " do is simply you do linear combination of these weight of the weight vector here at this optimum,"}, {"start": 1873.04, "end": 1879.52, "text": " the weight vector here at this optimum. And you can for each point here defines a neural network"}, {"start": 1879.52, "end": 1885.76, "text": " with those weights. And you can evaluate it. And that's what you get. This is the accuracy of the"}, {"start": 1885.76, "end": 1895.36, "text": " model. So here you can see very, very clearly that there are these two different modes right here."}, {"start": 1895.36, "end": 1900.56, "text": " So each even though they're initialized super close to each other, right, you can see this"}, {"start": 1900.56, "end": 1905.28, "text": " right here, they're initialized super close to each other, because they are this is the flat"}, {"start": 1905.28, "end": 1913.6, "text": " area right here that we saw before, because they are in the flat area. They're even though they're"}, {"start": 1913.6, "end": 1919.76, "text": " in the flat area, because the red one is a little bit more to this basin of attraction, the blue"}, {"start": 1919.76, "end": 1923.28, "text": " one is a little bit more to this basin of attraction. So they move over and as soon as"}, {"start": 1923.28, "end": 1928.7199999999998, "text": " they're in, it's like, boom, they go to the minimum of that basin. And this area is rather convex."}, {"start": 1928.7199999999998, "end": 1937.36, "text": " And this area is rather convex. And in the middle, you can see is a less is more loss. So no solution"}, {"start": 1937.36, "end": 1941.9199999999998, "text": " will go there. That's how you get these different minima. That's how you get these different modes."}, {"start": 1941.92, "end": 1948.64, "text": " So the blue stripe, as you can see, from the color is going to be the same in each of the"}, {"start": 1949.68, "end": 1957.76, "text": " in each of the valleys, consistent with our what we know so far. Now here, the pink stripe"}, {"start": 1957.76, "end": 1964.72, "text": " is a Gaussian exploration. So if you now do a Gaussian perturbation Gaussian exploration around"}, {"start": 1964.72, "end": 1969.92, "text": " this minimum, you basically you can see again, you don't get out of this valley, you don't,"}, {"start": 1969.92, "end": 1974.16, "text": " you don't get out of this basin. So you're going to get stuck in there. And you're going to get"}, {"start": 1974.16, "end": 1980.0800000000002, "text": " stuck in there. So the only chance almost you have is to initialize again, and hope that you end up"}, {"start": 1980.0800000000002, "end": 1986.5600000000002, "text": " in a different place. And I guess my hypothesis is that there are many, many more of these valleys"}, {"start": 1986.5600000000002, "end": 1993.52, "text": " of these basins than that you can you could ever capture. So basically, every single initialization"}, {"start": 1993.52, "end": 2001.76, "text": " that is different will lead you to a different one of these basins. I guess it's only a matter"}, {"start": 2001.76, "end": 2009.6, "text": " of the size. So here again, they do a function similarity. So in this case, it's the function"}, {"start": 2009.6, "end": 2018.08, "text": " similarity to optimum one. And this is again, how many of the labels agree with the optimum right"}, {"start": 2018.08, "end": 2024.08, "text": " here. And you can see that within this basin of attraction, you have fairly high overlap of the"}, {"start": 2024.08, "end": 2032.32, "text": " functional similarity. But here, none, right, so 15% or so, it's not going to be zero, because they're"}, {"start": 2032.32, "end": 2037.52, "text": " going to agree on like some of the examples, I guess there's still something like intrinsic"}, {"start": 2037.52, "end": 2046.3999999999999, "text": " hardness, but they agree on almost none of the labels. At least, I guess if you normalize by"}, {"start": 2046.4, "end": 2057.2000000000003, "text": " their base accuracy. So even though optimum two is performing as well, it is functionally extremely"}, {"start": 2057.2000000000003, "end": 2062.96, "text": " dissimilar to optimum one. So these describe really different functions. And I really don't know"}, {"start": 2063.52, "end": 2070.64, "text": " what to make of this other than, you know, this each one of these is maybe sort of deciding to"}, {"start": 2070.64, "end": 2077.3599999999997, "text": " look at different features in the in the data set, right to or to maybe build different high level"}, {"start": 2077.3599999999997, "end": 2084.0, "text": " features from the same low level features. And maybe we're still under parameterizing these"}, {"start": 2084.0, "end": 2090.7999999999997, "text": " models, because not a single model can sort of look at both features at the same time, as evidenced"}, {"start": 2090.7999999999997, "end": 2097.7599999999998, "text": " by the fact that each of these is always going to one of these things. Or it could be that in fact,"}, {"start": 2097.76, "end": 2105.36, "text": " that in fact, the task is way too simple. And it's it can be solved in like 500 different ways."}, {"start": 2105.36, "end": 2111.5200000000004, "text": " And each of these optima is simply one way of solving the task one way of combining feature,"}, {"start": 2111.5200000000004, "end": 2116.6400000000003, "text": " and it's actually completely an over specified problem. That's another hypothesis, it would be,"}, {"start": 2117.2000000000003, "end": 2122.0800000000004, "text": " I guess, interesting to look at these things. And I'm sure there's work on this. So you can see the"}, {"start": 2122.08, "end": 2132.24, "text": " same thing for optimum two right here, where, okay, go away, where you can see that optimum one,"}, {"start": 2133.2, "end": 2140.48, "text": " it agrees almost nothing with optimum two, right? It doesn't, it doesn't agree, there's not even a"}, {"start": 2140.48, "end": 2147.2, "text": " hint of a valley right here, in the terms of functional similarity. That is very, very interesting."}, {"start": 2147.2, "end": 2151.2799999999997, "text": " So it really means that these two things describe two different functions."}, {"start": 2153.2, "end": 2159.7599999999998, "text": " They do these other plots right here that they call diversity versus accuracy plots. So"}, {"start": 2160.96, "end": 2167.3599999999997, "text": " what they'll do is, they are going to have different models, and they're going to look at"}, {"start": 2167.3599999999997, "end": 2174.7999999999997, "text": " them in terms of their diversity and their accuracy. So here, the y axis is going to be how"}, {"start": 2174.8, "end": 2182.0800000000004, "text": " different are these functions. And that's going to be again, in fraction of labels changed normalized"}, {"start": 2182.0800000000004, "end": 2189.04, "text": " by the base accuracy. So here you can see, we're always start from this baseline optimum, this"}, {"start": 2189.04, "end": 2198.1600000000003, "text": " baseline optimum has zero diversity zero, because it agrees with itself on all the on all the"}, {"start": 2198.16, "end": 2204.7999999999997, "text": " on all the different labels, of course, and then we're going to disturb that using our four methods"}, {"start": 2204.7999999999997, "end": 2210.64, "text": " that we defined before. So we're going to randomly subspace, we're going to drop out, we're going to"}, {"start": 2211.2, "end": 2217.04, "text": " Gaussian, perturb it and so on. And the more we perturb it, the more diverse our function is"}, {"start": 2217.04, "end": 2222.72, "text": " going to be naturally, right? Because we perturb the function, it starts disagreeing more and more"}, {"start": 2222.72, "end": 2229.6, "text": " and more and more with our original optimum. However, what we also expect is, you know, if we"}, {"start": 2229.6, "end": 2237.4399999999996, "text": " are in the local optimum, and maybe here, and you know, maybe the validation accuracy is sort of"}, {"start": 2237.4399999999996, "end": 2243.2, "text": " beside it, or a little bit larger and so on. So if we perturb it a little bit, you know, that might"}, {"start": 2243.2, "end": 2248.9599999999996, "text": " not make too much to our accuracy. But if we perturb it a lot, you know, we go actually up the"}, {"start": 2248.96, "end": 2255.2, "text": " loss landscape, and then we get less accuracy also on the validation set. So that's what you see right"}, {"start": 2255.2, "end": 2263.92, "text": " here in these in these this curve right here, as you make the function more diverse, so you perturb"}, {"start": 2263.92, "end": 2268.0, "text": " it a little bit, you see that your accuracy doesn't suffer too much, you kind of stay at the"}, {"start": 2268.0, "end": 2275.52, "text": " same accuracy. But as if you make it more and more and more diverse, you can see that the accuracy"}, {"start": 2275.52, "end": 2282.16, "text": " suffers until the diversity of one basically means that you disagree on the maximum amount of labels"}, {"start": 2282.16, "end": 2290.72, "text": " that you can. And so you're sort of sort of out of this valley right here. And also, you can see that"}, {"start": 2290.72, "end": 2299.2, "text": " your accuracy goes to zero. So the more these functions disagree, the less their accuracy is,"}, {"start": 2299.2, "end": 2306.96, "text": " that seems natural. However, you can see that these red stars right here, they seem to be also"}, {"start": 2306.96, "end": 2312.56, "text": " very different, they seem to not agree with the original baseline optimum, but they seem to be"}, {"start": 2312.56, "end": 2319.04, "text": " doing perfectly fine in terms of accuracy, be at the same accuracy. And those are the independent"}, {"start": 2319.04, "end": 2325.7599999999998, "text": " optima. Those are the optima from runs where we initialize at a different point and then also"}, {"start": 2325.76, "end": 2333.92, "text": " trained. And that, again, is evidence for the fact that there are probably other optima far away,"}, {"start": 2335.0400000000004, "end": 2341.44, "text": " where these different initializations find this here. So they are very different in terms of"}, {"start": 2341.44, "end": 2347.28, "text": " functional space, they're quite far apart, they predict different things. However, in terms of"}, {"start": 2347.28, "end": 2356.2400000000002, "text": " loss, they're almost the same or actually the same. So this is very, very cool experiments"}, {"start": 2356.2400000000002, "end": 2363.36, "text": " right here. And they do this for the different for different architectures. And you can see that,"}, {"start": 2363.36, "end": 2368.48, "text": " especially the larger architectures, this actually happens more pronounced. And they also make the"}, {"start": 2368.48, "end": 2375.6800000000003, "text": " point of saying, if you go to harder problems, like a CIFAR 100, or an ImageNet, this, this effect is"}, {"start": 2375.68, "end": 2384.16, "text": " more pronounced that you can see, these here are closer together as a curve. And these, these are"}, {"start": 2384.16, "end": 2393.9199999999996, "text": " the the independent optima. So I hope you're all you're already on board and still know why we're"}, {"start": 2393.9199999999996, "end": 2399.52, "text": " doing these things. We're doing these things because we want to build some sort of ensemble"}, {"start": 2399.52, "end": 2406.0, "text": " that captures the distribution of solutions in order to generalize better. Now, we have two"}, {"start": 2406.0, "end": 2414.96, "text": " options, either we start kind of from a an optimum and characterize the space around that optimum,"}, {"start": 2414.96, "end": 2420.96, "text": " which is what these methods do right here. And what also the Bayesian methods do this,"}, {"start": 2420.96, "end": 2425.68, "text": " even though they don't want to, because they do these approximations, because they're intractable,"}, {"start": 2425.68, "end": 2435.2799999999997, "text": " they're going to end up doing this. Or our other our other option is to restart training a bunch"}, {"start": 2435.2799999999997, "end": 2442.24, "text": " of times. And then we end up at different optima. And the point of the paper is it's better to do"}, {"start": 2442.8799999999997, "end": 2450.3999999999996, "text": " that, than to build the ensemble out of the of these Gaussian methods or of these perturbation"}, {"start": 2450.4, "end": 2456.0, "text": " methods. And the paper, I guess the main claim of the paper is why that happens. And it happens"}, {"start": 2456.0, "end": 2463.2000000000003, "text": " because the ensemble members obtain different minima that are functionally different. Okay, so"}, {"start": 2466.7200000000003, "end": 2472.48, "text": " exactly, that's what they do here. So they now build ensembles out of these different things."}, {"start": 2472.48, "end": 2481.36, "text": " And you can see that here on the x axis of the ensemble size. So how many ensemble members do"}, {"start": 2481.36, "end": 2486.72, "text": " you have? And the dashed lines here are the baseline accuracies if you just have a single"}, {"start": 2486.72, "end": 2497.6, "text": " model. And the the test accuracy is plotted on the y axis. Now I actually was I was not,"}, {"start": 2497.6, "end": 2504.3199999999997, "text": " that's not correct. You always build the ensemble out of random initializations. But on top of that,"}, {"start": 2504.3199999999997, "end": 2512.0, "text": " you do these things. So what you can see right here is, if I have this classifier, which is my"}, {"start": 2512.0, "end": 2521.2799999999997, "text": " original classifier, and I add on top of that, this PCA Gaussian, you know, perturbation stuff,"}, {"start": 2521.28, "end": 2529.44, "text": " I increase in accuracy, okay. However, if I build an ensemble, I increase in accuracy,"}, {"start": 2529.44, "end": 2536.48, "text": " if I build an ensemble out of 10 members, I increase in accuracy this much. Okay. And then"}, {"start": 2536.48, "end": 2543.36, "text": " if because I can do both things. So if I increase if I do an ensemble, and then on top of that to"}, {"start": 2543.36, "end": 2551.1200000000003, "text": " the PCA Gaussian, I gain another this much right here. So that's sort of evidence for the fact that"}, {"start": 2551.1200000000003, "end": 2559.1200000000003, "text": " you'd rather build an ensemble than do this, these other methods of approximating the Bayesian"}, {"start": 2559.1200000000003, "end": 2570.08, "text": " posterior of weights. So yes, I'm, I'm sort of convinced. I hope you are too. And they do a lot"}, {"start": 2570.08, "end": 2575.52, "text": " of they do some more experiments right here where you can see that the difference between so this"}, {"start": 2575.52, "end": 2585.2799999999997, "text": " is single mode, sorry, this is, I guess, here, accuracy. Oh, yeah, if you this is the out of"}, {"start": 2585.2799999999997, "end": 2591.2799999999997, "text": " distribution test. So you can take a data set, and you can corrupt it by corruption. So there"}, {"start": 2591.2799999999997, "end": 2597.12, "text": " are predefined data sets, but you can also do it yourself, you crop it, you can do luminosity,"}, {"start": 2597.12, "end": 2607.04, "text": " whatever, you can destroy parts of the image, you can see that having more ensemble members. So this"}, {"start": 2607.04, "end": 2614.4, "text": " is your original models. Here is how they sync with increasing corruption. It almost doesn't"}, {"start": 2614.4, "end": 2618.4, "text": " matter which ones of these methods you do, you see the bottom one is the original model and you"}, {"start": 2618.4, "end": 2624.48, "text": " gain a little bit by doing these things, but not nearly as much by building an ensemble and going"}, {"start": 2624.48, "end": 2631.2, "text": " here or actually an ensemble of two members or a five members, in which case you jump this much"}, {"start": 2631.2, "end": 2640.08, "text": " in accuracy. So these ensembles from different initializations are also very, very, are also very"}, {"start": 2641.12, "end": 2652.32, "text": " good at countering corruption, which you see also here. Yeah, so this is the JS divergence. Okay,"}, {"start": 2652.32, "end": 2658.56, "text": " I've read that. But let's not go here, videos already too long. And this is the last thing is"}, {"start": 2658.56, "end": 2665.52, "text": " on image net test set and the image net corrupted set, where they pretty much show the same thing."}, {"start": 2665.52, "end": 2673.04, "text": " It's not as pronounced here. But you can see pretty much how the different if you go from"}, {"start": 2673.04, "end": 2678.6400000000003, "text": " single model to ensemble with two members to ensemble of four members, there is a general"}, {"start": 2678.64, "end": 2685.12, "text": " upwards trend. And the general upwards trend is much less pronounced within each ensemble. So if"}, {"start": 2685.12, "end": 2691.68, "text": " you go just go from method to method, then it is between the different groups of ensembles, meaning"}, {"start": 2691.68, "end": 2699.12, "text": " that the ensemble is a much more pronounced effect that these other effects. So I hope I have"}, {"start": 2699.12, "end": 2706.96, "text": " convinced you a little bit of how these subspaces look like how the lost landscape of neural networks"}, {"start": 2706.96, "end": 2714.08, "text": " look like, especially the fact that there are these different minima. And the random initializations"}, {"start": 2714.08, "end": 2718.88, "text": " will almost always hit these different minima. And the interesting part is that even though these"}, {"start": 2718.88, "end": 2725.84, "text": " different minima perform equally well, they are functionally very different. And an ensemble of"}, {"start": 2725.84, "end": 2732.7200000000003, "text": " differently initialized and independently optimized models can actually capture these different modes"}, {"start": 2732.72, "end": 2738.3199999999997, "text": " of the functional space. And therefore, if you build an ensemble out of that, it will generalize"}, {"start": 2738.3199999999997, "end": 2744.08, "text": " better because it kind of can draw information from all of those different modes, rather than if"}, {"start": 2744.08, "end": 2748.72, "text": " you do some sort of Bayesian network, which will, because you have to approximate usually with"}, {"start": 2748.72, "end": 2758.3199999999997, "text": " Gaussians, will end up only covering one of these modes. That was that is sort of a, a good summary"}, {"start": 2758.32, "end": 2766.32, "text": " of what this paper says. I again, I enjoy research like this, because it's easy and it gives, it kind"}, {"start": 2766.32, "end": 2772.2400000000002, "text": " of makes you thinks, right. So I'll be thinking about these things for a while now and thinking of"}, {"start": 2772.2400000000002, "end": 2778.4, "text": " new kind of experiments that walk do. And yeah, as I said, this research is still wide open. We"}, {"start": 2778.4, "end": 2784.4, "text": " don't know so many things about neural network. And you know, tell me, tell me what you think is"}, {"start": 2784.4, "end": 2789.2000000000003, "text": " going on. Actually, that would be very interesting. And yeah, I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=v-ZxzTSpmk4
Gradient Origin Networks (Paper Explained w/ Live Coding)
Neural networks for implicit representations, such as SIRENs, have been very successful at modeling natural signals. However, in the classical approach, each data point requires its own neural network to be fit. This paper extends implicit representations to an entire dataset by introducing latent vectors of data points to SIRENs. Interestingly, the paper shows that such latent vectors can be obtained without the need for an explicit encoder, by simply looking at the negative gradient of the zero-vector through the representation function. OUTLINE: 0:00 - Intro & Overview 2:10 - Implicit Generative Models 5:30 - Implicitly Represent a Dataset 11:00 - Gradient Origin Networks 23:55 - Relation to Gradient Descent 28:05 - Messing with their Code 37:40 - Implicit Encoders 38:50 - Using GONs as classifiers 40:55 - Experiments & Conclusion Paper: https://arxiv.org/abs/2007.02798 Code: https://github.com/cwkx/GON Project Page: https://cwkx.github.io/data/GON/ My Video on SIREN: https://youtu.be/Q5g3p9Zwjrk Abstract: This paper proposes a new type of implicit generative model that is able to quickly learn a latent representation without an explicit encoder. This is achieved with an implicit neural network that takes as inputs points in the coordinate space alongside a latent vector initialised with zeros. The gradients of the data fitting loss with respect to this zero vector are jointly optimised to act as latent points that capture the data manifold. The results show similar characteristics to autoencoders, but with fewer parameters and the advantages of implicit representation networks. Authors: Sam Bond-Taylor, Chris G. Willcocks Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher
Hi there, today we'll look at gradient origin networks by Sam Bond Taylor and Chris G. Wilcox of Durham University. So on a high level, this paper trains implicit representation networks, but not on single data points, but on entire data set. It does so by using a latent encoding of each data point. And it doesn't obtain that encoding through an explicit encoder. But by simply looking at the gradient of the latent variable with when initialized at the origin. So it's a bit of a weird formulation. And I've seen this paper uploaded on Reddit. And the top comments would also would always say like, I don't really get it, I don't really get it. And I thought, you know, maybe I'm completely wrong. But I can just give my opinion kind of what's going on in this paper. Now also, most people on Reddit or a lot did say, I don't really get it. But here is what I think is going on. And then listing something and that's there is where I stopped reading. So as to not be kind of as to form my own opinion, I like to kind of understand papers by myself. So again, maybe I'm completely wrong. But here is my opinion. If you like opinions, hit the like button and subscribe if you aren't yet. And yeah, share this video out, maybe that helps someone else understand. So this paper is a very short paper, it is four pages. And it's a dense paper, it definitely can warrant, it definitely can warrant making a longer paper out of it. Though that being said, it's an archive paper for now. So you know, there's nothing wrong with archiving kind of unfinished work. But we'll just gonna look at it and try to understand it. Okay. So the abstract says this paper proposes a new type of implicit generative model that is able to quickly learn a latent representation without an explicit encoder. So for that you need to know what an implicit generative model is. And I've covered one type of implicit generative model specifically the type that they're using here, what they're called a siren. So sirens are implicit representation networks. And I've made a video about sirens. So if you don't know what that is, go look it up. But very quickly, a siren will is a neural network to represent a single data point. So each data point in a data set is represented by its own neural network, and the neural network. So this might be a bit foreign to you. But usually you have some kind of image, right? And it's simply represented as an as an array of RGB coordinates, right? It's, it's simply an array of this is like one 0.5, and so on. So all the pixels are in this array, this is the explicit representation of that data point. Now, this here is a long list, and it has some regularities to it. So that's why you can also think of an implicit representation of the data point, the implicit representation works as follows. You imagine again, your image, your image is made up of pixels, and these pixels are on x and y coordinates. So this pixel right here would be 00. This pixel right here would be 01. And so on. Yes, a siren is or a generally an implicit representation network is a network that takes in any x and y coordinate as the input. So the input itself is the numerical x and y coordinate of that picture. And it passes it through a neural network and outcomes the RGB value. Okay, so an entire picture is represented by this neural network, the neural network maps each coordinate to its RGB value. And here you can see that the single a single picture can become an entire data set for this neural network. In fact, it has to, because for a different picture, of course, there is a different mapping from x and y coordinates to RGB coordinates. But this allows you to do multiple things. So first of all, this neural network can be smaller than the explicit representation. Second of all, you can capture some regularity in the data, specifically, sirens have sine waves as nonlinearities in the in the neural network here, which is also a bit special, but lends itself very well to capture natural signals, because natural signals are often, you know, repeated at different scales and derivatives of themselves and so on. So I've covered this all in my in my video. And also, this allows you to have a continuous representation rather than a discrete representation, like here, you just have each pixel, now, you have a continuous representation. Alright, so these are implicit representation models, or implicit generative models are these neural networks right here, that map from coordinates to two colors. Now, what's the problem with this is, as we said, you need one neural network per data point. Now, the idea that these people here go with is that can't we do kind of the same thing, but except we have one neural network per data point, we want to have the same neural network for the entire data set. So again, they want to have a neural network that somehow outputs RGB coordinates. But now it's not for a single image. Now we have a data set, okay, and the data set has many images like this is image i, this is image j, this is image k. So what we could do is we could simply tell the neural network, the x and y coordinate that we where we would like the RGB values to know. And we could also tell it which image it is right, k, or i or j. And this will give us a neural network right here that can represent the entire data set, because it always can see, ah, I want of image j, I want these these x y coordinate doesn't help you very much, though, because it still has to learn for each image individually, how to encode it, how to produce it. What's much more interesting is, if you kind of mix this with the kind of old style, the kind of old style generative model. So in old style generative models, let's consider, for example, an auto encoder. So in an auto encoder, what you would do is you would take your image and you would put it through an encoder. And this encoder will give you a latent variable z. And then you would put it through a decoder again. And that would give you an image. So your generative model now is this part right here. And this z variable is your latent encoding of this data point. Now, if you train these models correctly, be this a be this a, an auto encoder, or a variational auto encoder, or the green part can actually just be a GAN, right? If you train this correctly, then this z right here will be sort of a a latent encoding of the what the what of the information in the image itself, okay, and that can generalize. So now I can input a picture that the model has never seen during training. And the encoder will map it to a latent representation that sort of makes sense that is able to reconstruct the image that I've put in. Okay, so the your hope with these latent representation is, is that there is some kind of data manifold somewhere in hidden in the in the entire space of parameters. And as long as you're on that data manifold, you will produce a sensible data point. And this is kind of a continuous and so on. So even though you've only seen a few during training, if you have a new one during testing, then you can sort of, it will be mapped to a correct place on the data manifold, and it will produce a data point again. And you've seen this, right, you've seen these interpolations in GANs, where you can interpolate in latent space, and, and so on. The problem here is that, you know, in so in GANs, we sample these things right here. So that's a different story. But in VAEs, we need this encoder or in auto encoders, we need this encoder to obtain a latent representation for a given data point. In GANs, there is no way if we have an image, there is no way to obtain the corresponding z variable, if we don't have an encoder, right. And that's the problem we're tackling right here. So here, what we want to do is we want to give the x and y we want to give the z, we we say we have some way of obtaining a latent representation of one of the image right here. And from that, we want to generate the RGB variables. Now the question is, think of again, the question is, how do we obtain the z variable without having without having access to the encoder? And that's, that's the problem of this paper. And this paper proposes a solution. So they say, this is achieved with an implicit neural network that takes as inputs points in the coordinate space alongside a latent vector initialized with zero. So that's the model that we saw. That's this, this is sorry about that. This is this right here, it takes in the coordinates, this is the coordinates, and it takes in the latent vector z. Now, this whole point with it being initialized at zeros will get will get to that in one second, okay. For the fact right now is just that the represent the implicit neural network also takes the identity of the image. So each image, the image is always going to have the same z. And then we sort of say which x and y coordinate of that image we want. So the z is per image. And then each image has all the x and y coordinates of, you know, itself. So yeah. So if Yeah, you you, I think you can follow. They go on, they say the gradients of the data fitting loss with respect to this zero vector are jointly optimized to act as latent points that capture the data manifold. So this is where this is where I already got lost reading the first time through. The results show similar characteristics to auto encoders, but with fewer parameters and the advantages of implicit representation networks. Okay, so we'll actually we'll, we'll jump to this right here. So this is the, this is the comparison between a variational auto encoder and the gradient origin network. So in a variational auto encoder, what you would do is you would have this explicit encoder right here, as we said, and in the variational auto encoder, you don't obtain the latent representation directly, you actually obtain the distribution in terms of the mean and standard deviation of the latent representation, and then you sample from that distribution to obtain that latent representation, I think the point here is simply to show that you first of all, you do need an encoder, which you do need to train. And second of all, it's kind of a complicated process to get that latent representation for the data point x. And then you need to decoder that generates an image, and then you have the loss right here that compares the two that is used to train the encoder and the decoder. Whereas in the gradient origin networks, what you do is you start, you basically have a function f and the function f, it's a bit weird right here, the function f uses two things. So this here is that z, which is termed zero here. But in fact, it's the latent representation of the image, which is derived from the image itself. And I don't really know. So I guess you can hear you can input this x is derived from the image itself by some way that doesn't require parameters that is not learned. And it also takes in these coordinates, and it produces that image. Now let's disentangle two things right here. What we're going to see is that z is equally applicable to non implicit neural networks. So for the rest of this paper, now, I'm not saying it's going to work as well, maybe it's going to work specifically well with implicit neural networks. But we need to differentiate the these two things. So the first thing is explicit versus implicit. Okay, we're simply going to view these as functions that take a z and give you an x. Okay, if this is, this is most notably the explicit version, the implicit version is simply that we're going to take a z along with all the x and y of the image. And we're going to obtain the r, g and b values of all the images, right, which is equal to the x. So this this entire set of RGB values is equal to the x, and we input the entire set right here. But essentially, it's simply a function that takes in a latent representation of an image and gives you back a image. The second thing, which is an entirely different thing, in my opinion, is how do we obtain a z from an x? So how do we get to have an image? How do we obtain the corresponding latent representation? And such that such that so this must be such that this function right here, the function that gives you the x from the z will reproduce the x. Okay. So how do we obtain the correct latent representation for any for any input data points? Two different things. Don't so I think they're not dependent on each other. Except, as I said, they might work especially well together or something like this. Alright, so this becomes a lot easier right now in this formula. So this is the thing ultimately that they optimize, they optimize the this thing, and it's introduced, like, I don't know why they limited themselves to four pages here. And again, this is work in progress, as I understand it, but it is it is not it's like cold water. It's like, you know, an expressive neural network can be trained in this space to mimic this by minimizing the gradient origin network loss function. That's that's it. That's what you that's what you get. And then you get the loss thrown in your face. Well, let's deconstruct it. So this G thing right here. What's it? This is the this is the loss that you minimize, okay, you can see that this is simply an integral of this loss function over your entire coordinate space. So see here is the entire coordinate space. So this is for a given for a given image, right for a given image f x, you would minimize this actually across your across your entire data set. So you would minimize the parameters of f, f here is going to be your generator neural network, your siren, whatever you minimize over the parameters of f across your entire data set. Okay, so this is your standard loss function. That is a sum across your entire data set. Cool. So what are you going to minimize, you're going to minimize each data point consists of an integral over the coordinate space, which you can see of this loss function right here. Now, this is simply due to the fact that this is an implicit representation. If this were an explicit representation, it would simply be the loss function of that data point. Okay, so don't don't be scared by the integral. I'm usually scared by integrals, I never get them. And then I try to talk to them and be people be like, do you think you know, a Riemannian integral or a Lebesgue integral? And I'm like, okay, but in in this case, this is this simply means that you want the loss of each of the coordinates and you want to sum them up, right? Which is the same as simply the the normal loss function with respect to a data point. This right here is the data point itself. As you can see, this is the this is your natural signal. So this is the function that you don't know. This is the true image function that maps the coordinate to the RGB space. In the case of explicit representation, this here is simply x. Okay. And forget about this integral for now. Cool. So we have a loss between x and whatever this is right here. This is a bit too long. And whatever this is right here, you can see the loss function between two things. So what is this thing? The loss function, I can tell you the one they use in this particular paper is the L two loss. So this is simply the reconstruction loss between a data point and its its reconstruction. Okay, so this part on the right is what's going to make the reconstruction you can see yes, our F here is going to be our siren, our neural network that will take in a z. So f is one of these function explicit or implicit that takes in a z and gives you x, the the reconstruction. Now the question is what does f take in f takes in two things. First of all, the coordinates concatenated with the thing on the right. And you remember, we said that instead of giving x y to the implicit representation, we now give x y and z where z is the latent vector of the image we're trying to reconstruct. So if we were to see this as a non implicit method, we can simply leave away this right. So we as we leave away the x and y coordinates in a in a GAN or a VAE, we simply give it this thing right here. Again, we're trying to disentangle the implicit network, the implicit generator from how we are going to obtain the z. So this is not important. So what remains is this quantity right here. So this must be our z for the image, okay, this thing. So what's this thing? I'm running slowly out of colors. This thing is going to be somehow the negative gradient of something again, you have the integral right here of the loss function. This again is x. This here again, we can leave this away. We can leave away the integral and you'll start to see kind of a repetitive thing. So this is going to be the gradient somehow of your loss function. With that, again, there is x and then there is f of z zero. So this is somehow an x hat as well. But this is a special x hat, let's call it x hat prime, or x hat zero, because the input is not z, but the input is now z zero. Okay, this is kind of a complicated thing. So I'm going to explain what's going on right here. Maybe in drawing. So what you want to do is you want to start out with z zero, which is an initial guess of what your latent representation is, you do it without looking even at the image at the data point, you simply start with one. And there are multiple ways to do this. And this paper right here simply says we're going to see zero is just going to be a constant value, zero, the constant value zero. That's why it's called gradient origin networks, because you always start with your z zero, your initial guess of your latent representation is the origin. Okay, then you use f, your neural network to obtain a estimate, a first estimate of what your image could look like, again, you have not looked at the image, you're simply taking the z zero and you produce an image. Then you somehow somehow obtain a better representation z. And that you use your f again to obtain x hat. And then from that x hat, you can now compare this to your x and that will give you your loss that you back propagate. So two things here, you can see you use f twice, which means that your loss if you back propagated, you must somehow back propagate to both of these things. Okay, so this is the first, the first thing if you back propagate. The second thing is what's this thing right here? How are we going to obtain somehow a better z. And the better the better z is going to be obtained by basically looking at the gradient. So you've seen that we have a gradient of z zero of the loss of x and f of z zero. That's that thing here is going to be your z, z equals that. What does it mean? It basically means that so you've tried to produce an image, but this is the real image that you want to get. And the loss measures how far apart you are from that real image. How would you need to change your initial guess in order to make that loss go down. So the negative here is to make the loss go down, because otherwise it will make the loss go up. Okay, so it basically simply says, how do you need to change your z zero in order to decrease the loss in order to get a better z for representing this particular image right here. And in the paper, here is where I kind of disagree. Because in the paper, they say that they that this in a single step, they give this gives you a this gives you the correct z or something like this. And I don't, I don't agree. They say, with respect to the origin, we obtain a latent vector that minimizes the reconstruction loss is obtained in a single step, thereby playing the similar role to an explicit encoder. So this is true, this is kind of like an encoder, right? You simply ask what z would I need to put in in order to make this representation be a better sorry, in order to make the latent representation be a better latent representation for the particular image x. However, if you compare, so what is this, this is essentially gradient descent in the latent space, right? And the fact that we look at the explicit gradient is only because they started at the zero point right here. The fact that they started at the zero point means that here they can just leave away the following what if you were to do gradient descent, what you would do is you would say this my z is going to be equal to z zero minus this thing, right now it looks much more like gradient descent in the latent space, because you have some initial guests, and then you update it using the gradient. Now there is no learning rate right here. So the learning rate is one in this case. So this is and again, the z zero, because it's zero, you can just leave it away. So this is simply one single step of gradient descent in the latent space. In order to get a better z right here. However, this is not a this is doesn't it doesn't guarantee you that in this single step, you're actually going to find the correct z or even an appropriate z simply means that you're going to find a better z than z zero for that particular image. And this can work, right. And again, because you back propagate to both of the F's, you say, you basically say, I want my neural network, first of all, to reconstruct the data point better from a given latent representation. And I also want my neural network to give me a latent representation, basically to help my latent to help this procedure, you back propagate through the gradient descent procedure. So you say I want my neural network to help me obtain a better latent representation if I do one step of gradient descent. So therefore, it's not just pure gradient descent in that space, it actually the back propagation makes it such that your neural network also supports that supports obtaining a good representation in one step. Okay, now that we've disentangled this, basically, you can see two things. First of all, you could probably get an even better representation by doing multiple steps of gradient descent right here, maybe adjusting the learning rate a bit, it depends, right, because you have to back propagate through all the gradient descent steps. But pretty sure you could probably improve this by doing multiple steps. Second of all, it doesn't really matter that this is a constant zero, it gives you know, there's a cool name gradient origin networks, but you could probably start with any constant or even here's the thing even non constant initial points, you could sample them from a distribution and so on. And okay, so let's change like let's imagine changing z zero to be sampled from some normal distribution. And then it looks much more like a GAN, right? Alright, so here we go. I've cloned the repo and I've ran the code once just to make sure that the data is downloaded and everything. And the code is, you know, pretty, pretty easy. So there is one file. And I didn't do it in the colab because the colab was, I think a bit slow for me. But I don't know if I caught a wrong runtime. But essentially, there is a bunch of setup code, they know these siren layers and so on. And then you have the real deal thing right here. So you have the step. So we do 500 steps. And in each step, we as you can see right here, we start with zeros as z, then we put this into F concatenated with the coordinates. So the coordinates is like a kind of a mesh grid type thing. We obtain the inner loss right here, we do a gradient with respect so of the inner loss with respect to z, and then the negative gradient that's going to become our outer z. So this z up here is z zero. And this z down here is going to be our true z is going to be our true z from the paper, we are going to concatenate that again, with the coordinates to obtain the G, which is the kind of reconstruction of x. And then our outer loss is going to be simply this reconstruction loss right here. And then we're going to backward to all of the parameters. Okay, so first hypothesis is that this here is simply kind of gradient descent. So what we should be able to do is first let's run let's run this. So I've run this like that. So this is shipping it to a GPU server. And as you will be able to see, the loss will be output, and it's going to kind of decrease the loss over the course of 500 steps. And we can also look at the samples. So while that's happening, what we can do is we can actually already prepare what we want to do. So if this is really gradient descent, we should be basically just able to do this z minus this gradient right here, because it's zeros, we would simply expect this to yield the same loss. So we're going to do this. And then we're going to ship this off to the server again, sorry. So we were here. And okay, the logs failed. Alright, so this is called images. I have this thing set up such that it's called logs. But you can basically see that the loss right here was from 24 going to down to about 13 or so over the course of training. So by subtracting z minus the gradient, we there really shouldn't be any change, right? Because z is zero at the beginning. So again, we're going to run this. And while it's running, we're going to prepare the different things. So my hypothesis is that we can maybe we could make this z here pretty much anything. So let's do it. Let's put it into ones. Again, you see that the loss, I guess, you know, we get an idea of kind of the noisiness of this thing. And 2119 and so on. We can in fact, over here, we might be able to if we ship it to a different GPU might be able to run two things in parallel. So this now is when we just start with ones instead of zeros. So let's see how that happens. While that's the case. So you can see right here that we ended up at also about 1413. This pretty much is the same if you you can we can look at the images that it's produced. So the reconstructions look kind of like this a fashion amnesty, the samples kind of look like this. And the interval interpolations, you can look at those as well. But we're mainly interested also in the in the kind of loss right here, you can see that with the ones pretty much the same thing is happening. So let's say we actually change this to a normal distribution. Okay. What does that do? And while that's happening, we're going to revert this to the original zeros. And we're going to investigate what happens if we just do more than one step of gradient descent. So in order to do that, it's actually pretty easy. So this here is the gradient descent step, what we can do is we can simply double that. Right? So now, if this is correct, I'm pretty sure this is correct. Okay, the so the normal initialized isn't really the the hit right here, as you can see the lot Wow. Okay. The normal isn't maybe it's because it's, you know, too large. I'm not sure. I mean, the other thing is deterministic. So that's going to be like a lot easier. We can quickly go back and let's go ones, let's go to normal. And let's like multiply it with like a tiny like point zero one or so. I just want to see whether this works. I have no big hopes. Okay, so we are here again, and we're going to make this into two different things. So let's say we're going to do this with a different things, two steps of gradient descent. All right, so now we have two steps of gradient descent. And let's see whether that helps. Ah, okay, so the normal distribution already helps, or is not worse. We simply initialize it with too big of a variance. The point zero one seems to be some kind of magic number for normal distributions and neural networks. So on the right side over here, and you can see we're a bit we're a bit, it's a bit off, but I guess with a bit of tuning, you could do that. And it gets down to about the same loss as you saw. If we look at the images that this produced, I'm going to guess it's, you know, they seem a bit worse, but it kind of works. On the right side, however, if you do more than one step of gradient descent, wow, wow, we were you see, we already started lower losses. And since this is gradient descent, we can also you know, there's no need why the learning rate should be one. So let's try to are divided by a generous three, and then by maybe six, like a decreasing learning rate seems like a rather good idea. And yeah, let's just take the two steps with the decreasing learning rate. Oops. So you can see that the loss now is way down, just because we did two steps of gradient descent. And the reconstructions, I'm going to guess they're almost perfect. So we're now I guess we're overfitting a bit. So this is now trading off kind of power of the encoder decoder and so on. But ultimately, yeah, so let's just for the last part, just try to have this gradient descent with the decreasing step size and see where that gets us if that gets us to even a lower reconstruction loss. And that will be our investigation into the code right here. Okay, do do do do. Okay, we start with 19. Maybe we're, we're as good as before. That's fine, you know. But I hope I hope that kind of gives a bit of evidence to my point that this is basically reversing a generator by using gradient descent, which has been around for a while. And I happen to know someone who who once attempted to write a paper about it. So yeah, but it's it's with implicit networks, which are pretty cool. So, you know, maybe this might work especially well with them, given that the gradient of a siren is a gradient and is a siren, and so on. Yep, as you can see, this works as well decreasing learning rate. And now you can go nuts. Oh, nine. Wow. This is the lowest loss we've gotten so far. Right? Yeah. So pretty cool. reconstructions look like things. Well, these are the best samples. I think these are the best samples we've seen today. Maybe not. I'm not sure. Let's look at the interpolations quickly. Yeah, this looks like interpolations. I mean, if you squint. Okay, this was it for coding. See ya. Now, GANs have come with encoders before, or it much more looks like a variational auto encoder as well. The difference here is we replace the encoder. So this here is our encoder, right? This is our implicit encoder is simply gradient descent. This has also been done before for GANs. So people train GANs, and then they try to find the latent representation by back propagating. And some people even do this while some people do this while training, they do gradient descent, and then either do or do not back prop through the GAN the through the gradient descent procedure. So in a way or another, this is kind of sort of like those ideas, not saying it is equal. And again, there could be like some special interaction because you actually back prop through both these things. And there could be some special interaction because these are implicit neural networks. However, I very much view these as two different things. The cool, there is a rather cool derivation of that, where you can say, okay, you can also use it as a classifier by basically doing this. And now hope you can understand this much better. So what we'll have is we'll have the classification loss for sample x is going to be your cross entropy loss between two things. Okay, well, can you please go down again? Thanks. So your cross, your loss between two things is going to be the loss between your label y. So that's one thing. And usually, you have the feature the logits on this side, right? Now you can see right here, you have an F, that's probably that something that gives you the logits from your features. And here, your features aren't going to be the data point itself, but your features are going to be the Z variable that comes with the data points. So basically, you use this as a feature producer. And the feature producer is made by again, minimizing this reconstruction loss. Now, I'm not sure this is going to work really well for classifiers, because classifiers generally don't require you to reconstruct things. And we know this, you know, people try to, this is like you were to have a variational autoencoder, and then simply use that encoder as a feature producer for a classifier, which generally doesn't work very well. But you know, you can you can do it right here. And the the cool thing is that you can actually use the implicit representation network F to give you features for the entire data sample Z. So you kind of freed from the coordinate representation here, and you get kind of a latent, a latent vector back. So this is how you would use an implicit neural network in order to do classification. That's, I think, you know, pretty, pretty cool derivation of this. So here, they make some empirical claims, which I don't, I don't want to go too much into. But there are certain advantages, certain practical advantages of doing things like this, like you can have very, very few parameters to represent an entire set of data, the interpolations here work nicely. As you can see, and I think generally, they make the claim that this trains fast. And you can see after three seconds, it already has a lot of information about the data set. And it does some sensible things. Okay, so the code is available. And in fact, I'll probably enter into parse into this video. A let's actually test our hypotheses, right? Let's test these hypotheses that I said. So first hypothesis is probably we can start with something else than the constant zero. And second hypothesis is we can probably improve by doing multiple steps of gradient descent in the inner loop. Yes, I this might be somewhere in this video. And if not, it comes at the end, like right now. Okay, so I'll see you next time. Bye bye.
[{"start": 0.72, "end": 6.96, "text": " Hi there, today we'll look at gradient origin networks by Sam Bond Taylor and Chris G. Wilcox"}, {"start": 6.96, "end": 13.92, "text": " of Durham University. So on a high level, this paper trains implicit representation networks,"}, {"start": 13.92, "end": 19.84, "text": " but not on single data points, but on entire data set. It does so by using a latent encoding"}, {"start": 19.84, "end": 25.52, "text": " of each data point. And it doesn't obtain that encoding through an explicit encoder."}, {"start": 25.52, "end": 32.16, "text": " But by simply looking at the gradient of the latent variable with when initialized at the"}, {"start": 32.16, "end": 38.24, "text": " origin. So it's a bit of a weird formulation. And I've seen this paper uploaded on Reddit."}, {"start": 38.24, "end": 43.2, "text": " And the top comments would also would always say like, I don't really get it, I don't really get it."}, {"start": 44.0, "end": 49.36, "text": " And I thought, you know, maybe I'm completely wrong. But I can just give my opinion kind of"}, {"start": 49.36, "end": 56.24, "text": " what's going on in this paper. Now also, most people on Reddit or a lot did say, I don't really"}, {"start": 56.24, "end": 61.84, "text": " get it. But here is what I think is going on. And then listing something and that's there is where I"}, {"start": 61.84, "end": 68.16, "text": " stopped reading. So as to not be kind of as to form my own opinion, I like to kind of understand"}, {"start": 68.16, "end": 76.56, "text": " papers by myself. So again, maybe I'm completely wrong. But here is my opinion. If you like"}, {"start": 76.56, "end": 84.08, "text": " opinions, hit the like button and subscribe if you aren't yet. And yeah, share this video out,"}, {"start": 84.08, "end": 91.28, "text": " maybe that helps someone else understand. So this paper is a very short paper, it is four pages."}, {"start": 92.4, "end": 101.12, "text": " And it's a dense paper, it definitely can warrant, it definitely can warrant making a longer paper"}, {"start": 101.12, "end": 107.28, "text": " out of it. Though that being said, it's an archive paper for now. So you know, there's nothing wrong"}, {"start": 107.28, "end": 115.28, "text": " with archiving kind of unfinished work. But we'll just gonna look at it and try to understand it."}, {"start": 115.28, "end": 122.96000000000001, "text": " Okay. So the abstract says this paper proposes a new type of implicit generative model that is"}, {"start": 122.96000000000001, "end": 130.56, "text": " able to quickly learn a latent representation without an explicit encoder. So for that you"}, {"start": 130.56, "end": 136.8, "text": " need to know what an implicit generative model is. And I've covered one type of implicit generative"}, {"start": 136.8, "end": 143.92000000000002, "text": " model specifically the type that they're using here, what they're called a siren. So sirens are"}, {"start": 143.92000000000002, "end": 148.72, "text": " implicit representation networks. And I've made a video about sirens. So if you don't know what"}, {"start": 148.72, "end": 155.76, "text": " that is, go look it up. But very quickly, a siren will is a neural network to represent a single"}, {"start": 155.76, "end": 163.6, "text": " data point. So each data point in a data set is represented by its own neural network, and the"}, {"start": 163.6, "end": 169.51999999999998, "text": " neural network. So this might be a bit foreign to you. But usually you have some kind of image,"}, {"start": 169.51999999999998, "end": 176.32, "text": " right? And it's simply represented as an as an array of RGB coordinates, right? It's, it's simply"}, {"start": 176.32, "end": 182.56, "text": " an array of this is like one 0.5, and so on. So all the pixels are in this array, this is the"}, {"start": 182.56, "end": 190.88, "text": " explicit representation of that data point. Now, this here is a long list, and it has some regularities"}, {"start": 190.88, "end": 196.64000000000001, "text": " to it. So that's why you can also think of an implicit representation of the data point, the"}, {"start": 196.64000000000001, "end": 202.24, "text": " implicit representation works as follows. You imagine again, your image, your image is made up"}, {"start": 202.24, "end": 207.76, "text": " of pixels, and these pixels are on x and y coordinates. So this pixel right here would be"}, {"start": 207.76, "end": 215.67999999999998, "text": " 00. This pixel right here would be 01. And so on. Yes, a siren is or a generally an implicit"}, {"start": 215.67999999999998, "end": 222.88, "text": " representation network is a network that takes in any x and y coordinate as the input. So the input"}, {"start": 222.88, "end": 230.0, "text": " itself is the numerical x and y coordinate of that picture. And it passes it through a neural"}, {"start": 230.0, "end": 239.52, "text": " network and outcomes the RGB value. Okay, so an entire picture is represented by this neural"}, {"start": 239.52, "end": 245.68, "text": " network, the neural network maps each coordinate to its RGB value. And here you can see that the"}, {"start": 246.56, "end": 252.56, "text": " single a single picture can become an entire data set for this neural network. In fact, it has to,"}, {"start": 252.56, "end": 257.76, "text": " because for a different picture, of course, there is a different mapping from x and y coordinates to"}, {"start": 257.76, "end": 263.52, "text": " RGB coordinates. But this allows you to do multiple things. So first of all, this neural network can"}, {"start": 263.52, "end": 269.59999999999997, "text": " be smaller than the explicit representation. Second of all, you can capture some regularity"}, {"start": 269.59999999999997, "end": 278.0, "text": " in the data, specifically, sirens have sine waves as nonlinearities in the in the neural network"}, {"start": 278.0, "end": 283.84, "text": " here, which is also a bit special, but lends itself very well to capture natural signals,"}, {"start": 283.84, "end": 288.96, "text": " because natural signals are often, you know, repeated at different scales and derivatives"}, {"start": 288.96, "end": 295.76, "text": " of themselves and so on. So I've covered this all in my in my video. And also, this allows you to"}, {"start": 295.76, "end": 301.03999999999996, "text": " have a continuous representation rather than a discrete representation, like here, you just have"}, {"start": 301.03999999999996, "end": 307.52, "text": " each pixel, now, you have a continuous representation. Alright, so these are implicit"}, {"start": 307.52, "end": 314.4, "text": " representation models, or implicit generative models are these neural networks right here,"}, {"start": 314.4, "end": 321.35999999999996, "text": " that map from coordinates to two colors. Now, what's the problem with this is, as we said,"}, {"start": 321.35999999999996, "end": 330.47999999999996, "text": " you need one neural network per data point. Now, the idea that these people here go with is that"}, {"start": 330.47999999999996, "end": 336.24, "text": " can't we do kind of the same thing, but except we have one neural network per data point,"}, {"start": 336.24, "end": 343.36, "text": " we want to have the same neural network for the entire data set. So again, they want to have a"}, {"start": 343.36, "end": 351.52, "text": " neural network that somehow outputs RGB coordinates. But now it's not for a single image. Now we have"}, {"start": 351.52, "end": 358.0, "text": " a data set, okay, and the data set has many images like this is image i, this is image j, this is"}, {"start": 358.0, "end": 365.76, "text": " image k. So what we could do is we could simply tell the neural network, the x and y coordinate"}, {"start": 365.76, "end": 372.24, "text": " that we where we would like the RGB values to know. And we could also tell it which image it is"}, {"start": 372.24, "end": 383.03999999999996, "text": " right, k, or i or j. And this will give us a neural network right here that can represent the entire"}, {"start": 383.03999999999996, "end": 388.88, "text": " data set, because it always can see, ah, I want of image j, I want these these x y coordinate doesn't"}, {"start": 388.88, "end": 395.36, "text": " help you very much, though, because it still has to learn for each image individually, how to encode"}, {"start": 395.36, "end": 403.84000000000003, "text": " it, how to produce it. What's much more interesting is, if you kind of mix this with the kind of old"}, {"start": 403.84000000000003, "end": 409.92, "text": " style, the kind of old style generative model. So in old style generative models, let's consider,"}, {"start": 409.92, "end": 415.2, "text": " for example, an auto encoder. So in an auto encoder, what you would do is you would take"}, {"start": 415.2, "end": 421.36, "text": " your image and you would put it through an encoder. And this encoder will give you a latent"}, {"start": 421.36, "end": 427.68, "text": " variable z. And then you would put it through a decoder again. And that would give you an image."}, {"start": 428.48, "end": 435.6, "text": " So your generative model now is this part right here. And this z variable is your latent encoding"}, {"start": 435.6, "end": 443.44, "text": " of this data point. Now, if you train these models correctly, be this a be this a, an auto encoder,"}, {"start": 443.44, "end": 450.96000000000004, "text": " or a variational auto encoder, or the green part can actually just be a GAN, right? If you train"}, {"start": 450.96, "end": 461.28, "text": " this correctly, then this z right here will be sort of a a latent encoding of the what the what"}, {"start": 461.28, "end": 468.4, "text": " of the information in the image itself, okay, and that can generalize. So now I can input a picture"}, {"start": 468.96, "end": 476.24, "text": " that the model has never seen during training. And the encoder will map it to a latent representation"}, {"start": 476.24, "end": 484.0, "text": " that sort of makes sense that is able to reconstruct the image that I've put in. Okay, so"}, {"start": 484.96000000000004, "end": 490.16, "text": " the your hope with these latent representation is, is that there is some kind of data manifold"}, {"start": 490.16, "end": 498.08, "text": " somewhere in hidden in the in the entire space of parameters. And as long as you're on that data"}, {"start": 498.08, "end": 504.16, "text": " manifold, you will produce a sensible data point. And this is kind of a continuous and so on. So"}, {"start": 504.16, "end": 512.0, "text": " even though you've only seen a few during training, if you have a new one during testing, then you can"}, {"start": 512.88, "end": 518.48, "text": " sort of, it will be mapped to a correct place on the data manifold, and it will produce a data"}, {"start": 518.48, "end": 523.9200000000001, "text": " point again. And you've seen this, right, you've seen these interpolations in GANs, where you can"}, {"start": 523.9200000000001, "end": 530.96, "text": " interpolate in latent space, and, and so on. The problem here is that, you know, in so in GANs,"}, {"start": 530.96, "end": 539.44, "text": " we sample these things right here. So that's a different story. But in VAEs, we need this encoder"}, {"start": 539.44, "end": 546.64, "text": " or in auto encoders, we need this encoder to obtain a latent representation for a given data point."}, {"start": 546.64, "end": 552.8000000000001, "text": " In GANs, there is no way if we have an image, there is no way to obtain the corresponding"}, {"start": 552.8000000000001, "end": 559.84, "text": " z variable, if we don't have an encoder, right. And that's the problem we're tackling right here. So"}, {"start": 559.84, "end": 565.2, "text": " here, what we want to do is we want to give the x and y we want to give the z, we we say we have"}, {"start": 565.2, "end": 572.0, "text": " some way of obtaining a latent representation of one of the image right here. And from that,"}, {"start": 572.0, "end": 579.6, "text": " we want to generate the RGB variables. Now the question is, think of again, the question is,"}, {"start": 579.6, "end": 587.12, "text": " how do we obtain the z variable without having without having access to the encoder?"}, {"start": 587.12, "end": 595.92, "text": " And that's, that's the problem of this paper. And this paper proposes a solution. So they say,"}, {"start": 595.92, "end": 602.8, "text": " this is achieved with an implicit neural network that takes as inputs points in the coordinate"}, {"start": 602.8, "end": 609.2, "text": " space alongside a latent vector initialized with zero. So that's the model that we saw. That's this,"}, {"start": 609.2, "end": 617.2800000000001, "text": " this is sorry about that. This is this right here, it takes in the coordinates, this is the"}, {"start": 617.2800000000001, "end": 624.96, "text": " coordinates, and it takes in the latent vector z. Now, this whole point with it being initialized"}, {"start": 624.96, "end": 631.76, "text": " at zeros will get will get to that in one second, okay. For the fact right now is just that the"}, {"start": 631.76, "end": 637.44, "text": " represent the implicit neural network also takes the identity of the image. So each image, the"}, {"start": 637.44, "end": 643.84, "text": " image is always going to have the same z. And then we sort of say which x and y coordinate of"}, {"start": 643.84, "end": 650.5600000000001, "text": " that image we want. So the z is per image. And then each image has all the x and y coordinates"}, {"start": 650.5600000000001, "end": 657.5200000000001, "text": " of, you know, itself. So yeah. So if Yeah, you you, I think you can follow."}, {"start": 660.1600000000001, "end": 665.6800000000001, "text": " They go on, they say the gradients of the data fitting loss with respect to this zero vector"}, {"start": 665.68, "end": 671.12, "text": " are jointly optimized to act as latent points that capture the data manifold. So this is where"}, {"start": 671.12, "end": 676.4, "text": " this is where I already got lost reading the first time through. The results show similar"}, {"start": 676.4, "end": 681.04, "text": " characteristics to auto encoders, but with fewer parameters and the advantages of implicit"}, {"start": 681.04, "end": 689.3599999999999, "text": " representation networks. Okay, so we'll actually we'll, we'll jump to this right here. So this is"}, {"start": 689.36, "end": 696.16, "text": " the, this is the comparison between a variational auto encoder and the gradient origin network. So"}, {"start": 696.16, "end": 703.6, "text": " in a variational auto encoder, what you would do is you would have this explicit encoder right here,"}, {"start": 703.6, "end": 708.5600000000001, "text": " as we said, and in the variational auto encoder, you don't obtain the latent representation"}, {"start": 708.5600000000001, "end": 714.8000000000001, "text": " directly, you actually obtain the distribution in terms of the mean and standard deviation of the"}, {"start": 714.8, "end": 720.3199999999999, "text": " latent representation, and then you sample from that distribution to obtain that latent"}, {"start": 720.3199999999999, "end": 725.68, "text": " representation, I think the point here is simply to show that you first of all, you do need an"}, {"start": 725.68, "end": 730.4799999999999, "text": " encoder, which you do need to train. And second of all, it's kind of a complicated process to get"}, {"start": 730.4799999999999, "end": 736.4799999999999, "text": " that latent representation for the data point x. And then you need to decoder that generates an"}, {"start": 736.4799999999999, "end": 743.28, "text": " image, and then you have the loss right here that compares the two that is used to train the"}, {"start": 743.28, "end": 750.9599999999999, "text": " encoder and the decoder. Whereas in the gradient origin networks, what you do is you start,"}, {"start": 750.9599999999999, "end": 760.88, "text": " you basically have a function f and the function f, it's a bit weird right here, the function f"}, {"start": 760.88, "end": 768.48, "text": " uses two things. So this here is that z, which is termed zero here. But in fact, it's the latent"}, {"start": 768.48, "end": 775.36, "text": " representation of the image, which is derived from the image itself. And I don't really know. So I"}, {"start": 775.36, "end": 781.9200000000001, "text": " guess you can hear you can input this x is derived from the image itself by some way that doesn't"}, {"start": 781.9200000000001, "end": 789.9200000000001, "text": " require parameters that is not learned. And it also takes in these coordinates, and it produces"}, {"start": 789.9200000000001, "end": 797.44, "text": " that image. Now let's disentangle two things right here. What we're going to see is that"}, {"start": 797.44, "end": 804.8000000000001, "text": " z is equally applicable to non implicit neural networks. So for the rest of this paper, now,"}, {"start": 804.8000000000001, "end": 809.36, "text": " I'm not saying it's going to work as well, maybe it's going to work specifically well with implicit"}, {"start": 809.36, "end": 816.6400000000001, "text": " neural networks. But we need to differentiate the these two things. So the first thing is explicit"}, {"start": 816.6400000000001, "end": 827.0400000000001, "text": " versus implicit. Okay, we're simply going to view these as functions that take a z and give you an"}, {"start": 827.04, "end": 834.0, "text": " x. Okay, if this is, this is most notably the explicit version, the implicit version is simply"}, {"start": 834.0, "end": 840.56, "text": " that we're going to take a z along with all the x and y of the image. And we're going to obtain"}, {"start": 841.36, "end": 851.12, "text": " the r, g and b values of all the images, right, which is equal to the x. So this this entire set"}, {"start": 851.12, "end": 857.04, "text": " of RGB values is equal to the x, and we input the entire set right here. But essentially, it's simply"}, {"start": 857.04, "end": 866.08, "text": " a function that takes in a latent representation of an image and gives you back a image. The second"}, {"start": 866.08, "end": 873.84, "text": " thing, which is an entirely different thing, in my opinion, is how do we obtain a z from an x? So"}, {"start": 874.5600000000001, "end": 880.32, "text": " how do we get to have an image? How do we obtain the corresponding latent representation?"}, {"start": 880.32, "end": 889.44, "text": " And such that such that so this must be such that this function right here, the function that gives"}, {"start": 889.44, "end": 896.5600000000001, "text": " you the x from the z will reproduce the x. Okay. So how do we obtain the correct latent"}, {"start": 896.5600000000001, "end": 904.96, "text": " representation for any for any input data points? Two different things. Don't so I think they're not"}, {"start": 904.96, "end": 910.48, "text": " dependent on each other. Except, as I said, they might work especially well together or something"}, {"start": 910.48, "end": 917.36, "text": " like this. Alright, so this becomes a lot easier right now in this formula. So this is the thing"}, {"start": 917.36, "end": 924.96, "text": " ultimately that they optimize, they optimize the this thing, and it's introduced, like, I don't"}, {"start": 924.96, "end": 929.6, "text": " know why they limited themselves to four pages here. And again, this is work in progress, as I"}, {"start": 929.6, "end": 938.5600000000001, "text": " understand it, but it is it is not it's like cold water. It's like, you know, an expressive neural"}, {"start": 938.5600000000001, "end": 942.8000000000001, "text": " network can be trained in this space to mimic this by minimizing the gradient origin network"}, {"start": 942.8000000000001, "end": 947.84, "text": " loss function. That's that's it. That's what you that's what you get. And then you get the loss"}, {"start": 947.84, "end": 956.1600000000001, "text": " thrown in your face. Well, let's deconstruct it. So this G thing right here. What's it? This is the"}, {"start": 956.16, "end": 963.68, "text": " this is the loss that you minimize, okay, you can see that this is simply an integral of this loss"}, {"start": 963.68, "end": 970.24, "text": " function over your entire coordinate space. So see here is the entire coordinate space. So this is"}, {"start": 970.24, "end": 977.52, "text": " for a given for a given image, right for a given image f x, you would minimize this actually across"}, {"start": 977.52, "end": 984.9599999999999, "text": " your across your entire data set. So you would minimize the parameters of f, f here is going to"}, {"start": 984.96, "end": 991.12, "text": " be your generator neural network, your siren, whatever you minimize over the parameters of f"}, {"start": 991.76, "end": 998.88, "text": " across your entire data set. Okay, so this is your standard loss function. That is a sum across your"}, {"start": 998.88, "end": 1007.2800000000001, "text": " entire data set. Cool. So what are you going to minimize, you're going to minimize each data point"}, {"start": 1007.2800000000001, "end": 1014.48, "text": " consists of an integral over the coordinate space, which you can see of this loss function"}, {"start": 1014.48, "end": 1020.4, "text": " right here. Now, this is simply due to the fact that this is an implicit representation. If this"}, {"start": 1020.4, "end": 1026.72, "text": " were an explicit representation, it would simply be the loss function of that data point. Okay,"}, {"start": 1027.6, "end": 1032.96, "text": " so don't don't be scared by the integral. I'm usually scared by integrals, I never get them."}, {"start": 1032.96, "end": 1037.92, "text": " And then I try to talk to them and be people be like, do you think you know, a Riemannian integral"}, {"start": 1037.92, "end": 1046.64, "text": " or a Lebesgue integral? And I'm like, okay, but in in this case, this is this simply means that"}, {"start": 1046.64, "end": 1053.92, "text": " you want the loss of each of the coordinates and you want to sum them up, right? Which is the same"}, {"start": 1053.92, "end": 1062.64, "text": " as simply the the normal loss function with respect to a data point. This right here is the data point"}, {"start": 1062.64, "end": 1071.2800000000002, "text": " itself. As you can see, this is the this is your natural signal. So this is the function that you"}, {"start": 1071.2800000000002, "end": 1079.1200000000001, "text": " don't know. This is the true image function that maps the coordinate to the RGB space. In the case"}, {"start": 1079.1200000000001, "end": 1087.0400000000002, "text": " of explicit representation, this here is simply x. Okay. And forget about this integral for now."}, {"start": 1087.04, "end": 1095.84, "text": " Cool. So we have a loss between x and whatever this is right here. This is a bit too long. And"}, {"start": 1095.84, "end": 1100.48, "text": " whatever this is right here, you can see the loss function between two things. So what is this thing?"}, {"start": 1101.04, "end": 1106.3999999999999, "text": " The loss function, I can tell you the one they use in this particular paper is the L two loss. So"}, {"start": 1106.3999999999999, "end": 1114.48, "text": " this is simply the reconstruction loss between a data point and its its reconstruction. Okay,"}, {"start": 1114.48, "end": 1120.4, "text": " so this part on the right is what's going to make the reconstruction you can see yes, our F here is"}, {"start": 1120.4, "end": 1127.52, "text": " going to be our siren, our neural network that will take in a z. So f is one of these function"}, {"start": 1127.52, "end": 1135.76, "text": " explicit or implicit that takes in a z and gives you x, the the reconstruction. Now the question is"}, {"start": 1135.76, "end": 1146.0, "text": " what does f take in f takes in two things. First of all, the coordinates concatenated with the thing"}, {"start": 1146.0, "end": 1153.6, "text": " on the right. And you remember, we said that instead of giving x y to the implicit representation,"}, {"start": 1153.6, "end": 1163.36, "text": " we now give x y and z where z is the latent vector of the image we're trying to reconstruct. So if we"}, {"start": 1163.36, "end": 1171.04, "text": " were to see this as a non implicit method, we can simply leave away this right. So we as we leave"}, {"start": 1171.04, "end": 1177.12, "text": " away the x and y coordinates in a in a GAN or a VAE, we simply give it this thing right here."}, {"start": 1177.12, "end": 1184.3999999999999, "text": " Again, we're trying to disentangle the implicit network, the implicit generator from how we are"}, {"start": 1184.3999999999999, "end": 1192.3999999999999, "text": " going to obtain the z. So this is not important. So what remains is this quantity right here. So"}, {"start": 1192.4, "end": 1202.96, "text": " this must be our z for the image, okay, this thing. So what's this thing? I'm running slowly"}, {"start": 1202.96, "end": 1209.0400000000002, "text": " out of colors. This thing is going to be somehow the negative gradient of something again, you have"}, {"start": 1209.0400000000002, "end": 1216.72, "text": " the integral right here of the loss function. This again is x. This here again, we can leave this"}, {"start": 1216.72, "end": 1225.28, "text": " away. We can leave away the integral and you'll start to see kind of a repetitive thing. So this"}, {"start": 1225.28, "end": 1234.72, "text": " is going to be the gradient somehow of your loss function. With that, again, there is x and then"}, {"start": 1234.72, "end": 1242.16, "text": " there is f of z zero. So this is somehow an x hat as well. But this is a special x hat, let's call"}, {"start": 1242.16, "end": 1252.64, "text": " it x hat prime, or x hat zero, because the input is not z, but the input is now z zero. Okay,"}, {"start": 1253.6000000000001, "end": 1260.5600000000002, "text": " this is kind of a complicated thing. So I'm going to explain what's going on right here."}, {"start": 1262.4, "end": 1268.8000000000002, "text": " Maybe in drawing. So what you want to do is you want to start out with z zero, which is an initial"}, {"start": 1268.8, "end": 1274.08, "text": " guess of what your latent representation is, you do it without looking even at the image"}, {"start": 1274.08, "end": 1281.04, "text": " at the data point, you simply start with one. And there are multiple ways to do this. And this"}, {"start": 1281.04, "end": 1287.04, "text": " paper right here simply says we're going to see zero is just going to be a constant value,"}, {"start": 1287.9199999999998, "end": 1293.44, "text": " zero, the constant value zero. That's why it's called gradient origin networks, because"}, {"start": 1293.44, "end": 1299.2, "text": " you always start with your z zero, your initial guess of your latent representation is the origin."}, {"start": 1299.8400000000001, "end": 1309.04, "text": " Okay, then you use f, your neural network to obtain a estimate, a first estimate of what your"}, {"start": 1309.04, "end": 1314.96, "text": " image could look like, again, you have not looked at the image, you're simply taking the z zero and"}, {"start": 1314.96, "end": 1328.72, "text": " you produce an image. Then you somehow somehow obtain a better representation z. And that you"}, {"start": 1328.72, "end": 1338.72, "text": " use your f again to obtain x hat. And then from that x hat, you can now compare this to your x"}, {"start": 1338.72, "end": 1345.04, "text": " and that will give you your loss that you back propagate. So two things here, you can see you use"}, {"start": 1345.04, "end": 1351.44, "text": " f twice, which means that your loss if you back propagated, you must somehow back propagate to"}, {"start": 1351.44, "end": 1358.08, "text": " both of these things. Okay, so this is the first, the first thing if you back propagate. The second"}, {"start": 1358.08, "end": 1365.3600000000001, "text": " thing is what's this thing right here? How are we going to obtain somehow a better z. And the better"}, {"start": 1365.36, "end": 1372.7199999999998, "text": " the better z is going to be obtained by basically looking at the gradient. So you've seen that we"}, {"start": 1372.7199999999998, "end": 1387.12, "text": " have a gradient of z zero of the loss of x and f of z zero. That's that thing here is going to be"}, {"start": 1387.12, "end": 1397.52, "text": " your z, z equals that. What does it mean? It basically means that so you've tried to produce"}, {"start": 1397.52, "end": 1403.84, "text": " an image, but this is the real image that you want to get. And the loss measures how far apart you are"}, {"start": 1403.84, "end": 1412.8, "text": " from that real image. How would you need to change your initial guess in order to make that loss go"}, {"start": 1412.8, "end": 1417.76, "text": " down. So the negative here is to make the loss go down, because otherwise it will make the loss go"}, {"start": 1417.76, "end": 1425.68, "text": " up. Okay, so it basically simply says, how do you need to change your z zero in order to decrease"}, {"start": 1425.68, "end": 1435.36, "text": " the loss in order to get a better z for representing this particular image right here. And in the paper,"}, {"start": 1435.36, "end": 1442.6399999999999, "text": " here is where I kind of disagree. Because in the paper, they say that they that this in a single"}, {"start": 1442.6399999999999, "end": 1452.08, "text": " step, they give this gives you a this gives you the correct z or something like this. And I don't,"}, {"start": 1453.04, "end": 1461.9199999999998, "text": " I don't agree. They say, with respect to the origin, we obtain a latent vector that minimizes"}, {"start": 1461.92, "end": 1468.16, "text": " the reconstruction loss is obtained in a single step, thereby playing the similar role to an"}, {"start": 1468.16, "end": 1473.8400000000001, "text": " explicit encoder. So this is true, this is kind of like an encoder, right? You simply ask what z"}, {"start": 1473.8400000000001, "end": 1479.04, "text": " would I need to put in in order to make this representation be a better sorry, in order to"}, {"start": 1479.04, "end": 1486.0800000000002, "text": " make the latent representation be a better latent representation for the particular image x. However,"}, {"start": 1486.08, "end": 1493.76, "text": " if you compare, so what is this, this is essentially gradient descent in the latent space,"}, {"start": 1493.76, "end": 1501.1999999999998, "text": " right? And the fact that we look at the explicit gradient is only because they started at the zero"}, {"start": 1501.1999999999998, "end": 1508.48, "text": " point right here. The fact that they started at the zero point means that here they can just leave"}, {"start": 1508.48, "end": 1513.04, "text": " away the following what if you were to do gradient descent, what you would do is you would say this"}, {"start": 1513.04, "end": 1519.84, "text": " my z is going to be equal to z zero minus this thing, right now it looks much more like gradient"}, {"start": 1519.84, "end": 1526.48, "text": " descent in the latent space, because you have some initial guests, and then you update it using the"}, {"start": 1526.48, "end": 1532.32, "text": " gradient. Now there is no learning rate right here. So the learning rate is one in this case."}, {"start": 1533.2, "end": 1540.56, "text": " So this is and again, the z zero, because it's zero, you can just leave it away."}, {"start": 1540.56, "end": 1546.32, "text": " So this is simply one single step of gradient descent in the latent space."}, {"start": 1548.48, "end": 1555.6799999999998, "text": " In order to get a better z right here. However, this is not a this is doesn't it doesn't guarantee"}, {"start": 1555.6799999999998, "end": 1561.04, "text": " you that in this single step, you're actually going to find the correct z or even an appropriate z"}, {"start": 1561.04, "end": 1568.56, "text": " simply means that you're going to find a better z than z zero for that particular image. And"}, {"start": 1568.56, "end": 1576.1599999999999, "text": " this can work, right. And again, because you back propagate to both of the F's, you say,"}, {"start": 1576.1599999999999, "end": 1583.84, "text": " you basically say, I want my neural network, first of all, to reconstruct the data point better from"}, {"start": 1583.84, "end": 1592.0, "text": " a given latent representation. And I also want my neural network to give me a latent representation,"}, {"start": 1592.0, "end": 1598.64, "text": " basically to help my latent to help this procedure, you back propagate through the gradient descent"}, {"start": 1598.64, "end": 1607.6, "text": " procedure. So you say I want my neural network to help me obtain a better latent representation if"}, {"start": 1607.6, "end": 1614.0, "text": " I do one step of gradient descent. So therefore, it's not just pure gradient descent in that space,"}, {"start": 1614.0, "end": 1620.0, "text": " it actually the back propagation makes it such that your neural network also supports that"}, {"start": 1620.0, "end": 1627.2, "text": " supports obtaining a good representation in one step. Okay, now that we've disentangled this,"}, {"start": 1628.08, "end": 1633.04, "text": " basically, you can see two things. First of all, you could probably get an even better"}, {"start": 1633.04, "end": 1639.04, "text": " representation by doing multiple steps of gradient descent right here, maybe adjusting"}, {"start": 1639.04, "end": 1642.72, "text": " the learning rate a bit, it depends, right, because you have to back propagate through all"}, {"start": 1642.72, "end": 1648.0, "text": " the gradient descent steps. But pretty sure you could probably improve this by"}, {"start": 1648.0, "end": 1653.76, "text": " doing multiple steps. Second of all, it doesn't really matter that this is a constant zero,"}, {"start": 1654.32, "end": 1659.68, "text": " it gives you know, there's a cool name gradient origin networks, but you could probably start with"}, {"start": 1659.68, "end": 1667.92, "text": " any constant or even here's the thing even non constant initial points, you could sample them"}, {"start": 1667.92, "end": 1675.28, "text": " from a distribution and so on. And okay, so let's change like let's imagine changing z zero"}, {"start": 1675.28, "end": 1682.3999999999999, "text": " to be sampled from some normal distribution. And then it looks much more like a GAN, right?"}, {"start": 1683.44, "end": 1689.92, "text": " Alright, so here we go. I've cloned the repo and I've ran the code once just to make sure that the"}, {"start": 1689.92, "end": 1696.6399999999999, "text": " data is downloaded and everything. And the code is, you know, pretty, pretty easy. So there is one"}, {"start": 1696.6399999999999, "end": 1703.04, "text": " file. And I didn't do it in the colab because the colab was, I think a bit slow for me. But"}, {"start": 1703.04, "end": 1710.1599999999999, "text": " I don't know if I caught a wrong runtime. But essentially, there is a bunch of setup code,"}, {"start": 1710.1599999999999, "end": 1718.8, "text": " they know these siren layers and so on. And then you have the real deal thing right here. So you"}, {"start": 1718.8, "end": 1725.44, "text": " have the step. So we do 500 steps. And in each step, we as you can see right here, we start with"}, {"start": 1725.44, "end": 1733.04, "text": " zeros as z, then we put this into F concatenated with the coordinates. So the coordinates is like"}, {"start": 1733.04, "end": 1740.8, "text": " a kind of a mesh grid type thing. We obtain the inner loss right here, we do a gradient with"}, {"start": 1740.8, "end": 1746.0, "text": " respect so of the inner loss with respect to z, and then the negative gradient that's going to"}, {"start": 1746.0, "end": 1753.44, "text": " become our outer z. So this z up here is z zero. And this z down here is going to be our true z"}, {"start": 1753.44, "end": 1760.88, "text": " is going to be our true z from the paper, we are going to concatenate that again, with the coordinates"}, {"start": 1760.88, "end": 1768.48, "text": " to obtain the G, which is the kind of reconstruction of x. And then our outer loss is going to be"}, {"start": 1769.6000000000001, "end": 1774.88, "text": " simply this reconstruction loss right here. And then we're going to backward to all of the"}, {"start": 1774.88, "end": 1782.72, "text": " parameters. Okay, so first hypothesis is that this here is simply kind of gradient descent. So what"}, {"start": 1782.72, "end": 1790.08, "text": " we should be able to do is first let's run let's run this. So I've run this like that."}, {"start": 1791.92, "end": 1801.52, "text": " So this is shipping it to a GPU server. And as you will be able to see, the loss will be output,"}, {"start": 1802.08, "end": 1808.72, "text": " and it's going to kind of decrease the loss over the course of 500 steps. And we can also look at"}, {"start": 1808.72, "end": 1822.4, "text": " the samples. So while that's happening, what we can do is we can actually already prepare what we"}, {"start": 1822.4, "end": 1827.2, "text": " want to do. So if this is really gradient descent, we should be basically just able to do this z"}, {"start": 1827.2, "end": 1834.0, "text": " minus this gradient right here, because it's zeros, we would simply expect this to yield the same"}, {"start": 1834.0, "end": 1841.36, "text": " loss. So we're going to do this. And then we're going to ship this off to the server again, sorry."}, {"start": 1843.12, "end": 1853.44, "text": " So we were here. And okay, the logs failed. Alright, so this is called images. I have this"}, {"start": 1853.44, "end": 1860.8, "text": " thing set up such that it's called logs. But you can basically see that the loss right here was"}, {"start": 1860.8, "end": 1871.12, "text": " from 24 going to down to about 13 or so over the course of training. So by subtracting z minus the"}, {"start": 1871.12, "end": 1876.72, "text": " gradient, we there really shouldn't be any change, right? Because z is zero at the beginning."}, {"start": 1878.24, "end": 1883.04, "text": " So again, we're going to run this. And while it's running, we're going to prepare"}, {"start": 1883.04, "end": 1889.6, "text": " the different things. So my hypothesis is that we can maybe we could make this z here pretty much"}, {"start": 1889.6, "end": 1898.1599999999999, "text": " anything. So let's do it. Let's put it into ones. Again, you see that the loss, I guess, you know,"}, {"start": 1898.1599999999999, "end": 1907.84, "text": " we get an idea of kind of the noisiness of this thing. And 2119 and so on. We can in fact, over"}, {"start": 1907.84, "end": 1913.9199999999998, "text": " here, we might be able to if we ship it to a different GPU might be able to run two things in"}, {"start": 1913.9199999999998, "end": 1923.9199999999998, "text": " parallel. So this now is when we just start with ones instead of zeros. So let's see how that"}, {"start": 1923.9199999999998, "end": 1931.6, "text": " happens. While that's the case. So you can see right here that we ended up at also about 1413."}, {"start": 1931.6, "end": 1937.4399999999998, "text": " This pretty much is the same if you you can we can look at the images that it's produced. So the"}, {"start": 1937.4399999999998, "end": 1943.6, "text": " reconstructions look kind of like this a fashion amnesty, the samples kind of look like this."}, {"start": 1946.1599999999999, "end": 1951.4399999999998, "text": " And the interval interpolations, you can look at those as well. But we're mainly interested also"}, {"start": 1951.4399999999998, "end": 1957.28, "text": " in the in the kind of loss right here, you can see that with the ones pretty much the same thing is"}, {"start": 1957.28, "end": 1967.84, "text": " happening. So let's say we actually change this to a normal distribution. Okay. What does that do?"}, {"start": 1969.28, "end": 1975.84, "text": " And while that's happening, we're going to revert this to the original zeros. And we're going to"}, {"start": 1975.84, "end": 1982.8799999999999, "text": " investigate what happens if we just do more than one step of gradient descent. So in order to do"}, {"start": 1982.88, "end": 1987.5200000000002, "text": " that, it's actually pretty easy. So this here is the gradient descent step, what we can do is we can"}, {"start": 1987.5200000000002, "end": 1994.16, "text": " simply double that. Right? So now, if this is correct, I'm pretty sure this is correct. Okay,"}, {"start": 1994.16, "end": 2002.4, "text": " the so the normal initialized isn't really the the hit right here, as you can see the lot Wow. Okay."}, {"start": 2002.4, "end": 2012.64, "text": " The normal isn't maybe it's because it's, you know, too large. I'm not sure. I mean, the other thing"}, {"start": 2012.64, "end": 2020.64, "text": " is deterministic. So that's going to be like a lot easier. We can quickly go back and let's go"}, {"start": 2020.64, "end": 2031.68, "text": " ones, let's go to normal. And let's like multiply it with like a tiny like point zero one or so."}, {"start": 2032.48, "end": 2039.5200000000002, "text": " I just want to see whether this works. I have no big hopes. Okay, so we are here again, and we're"}, {"start": 2039.5200000000002, "end": 2048.6400000000003, "text": " going to make this into two different things. So let's say we're going to do this with a"}, {"start": 2048.64, "end": 2057.12, "text": " different things, two steps of gradient descent. All right, so now we have two steps of gradient"}, {"start": 2057.12, "end": 2064.7999999999997, "text": " descent. And let's see whether that helps. Ah, okay, so the normal distribution already helps,"}, {"start": 2065.52, "end": 2074.96, "text": " or is not worse. We simply initialize it with too big of a variance. The point zero one seems to be"}, {"start": 2074.96, "end": 2081.76, "text": " some kind of magic number for normal distributions and neural networks. So on the right side over here,"}, {"start": 2081.76, "end": 2087.04, "text": " and you can see we're a bit we're a bit, it's a bit off, but I guess with a bit of tuning, you"}, {"start": 2087.04, "end": 2093.84, "text": " could do that. And it gets down to about the same loss as you saw. If we look at the images that this"}, {"start": 2093.84, "end": 2101.52, "text": " produced, I'm going to guess it's, you know, they seem a bit worse, but it kind of works. On the"}, {"start": 2101.52, "end": 2106.56, "text": " right side, however, if you do more than one step of gradient descent, wow, wow, we were you see,"}, {"start": 2106.56, "end": 2113.6, "text": " we already started lower losses. And since this is gradient descent, we can also you know, there's no"}, {"start": 2113.6, "end": 2123.12, "text": " need why the learning rate should be one. So let's try to are divided by a generous three, and then"}, {"start": 2123.12, "end": 2132.16, "text": " by maybe six, like a decreasing learning rate seems like a rather good idea. And yeah, let's"}, {"start": 2132.16, "end": 2138.24, "text": " just take the two steps with the decreasing learning rate. Oops. So you can see that the"}, {"start": 2138.24, "end": 2144.56, "text": " loss now is way down, just because we did two steps of gradient descent. And the reconstructions,"}, {"start": 2144.56, "end": 2150.24, "text": " I'm going to guess they're almost perfect. So we're now I guess we're overfitting a bit. So this is"}, {"start": 2150.24, "end": 2156.72, "text": " now trading off kind of power of the encoder decoder and so on. But ultimately, yeah, so let's"}, {"start": 2156.72, "end": 2163.12, "text": " just for the last part, just try to have this gradient descent with the decreasing step size"}, {"start": 2163.12, "end": 2171.9199999999996, "text": " and see where that gets us if that gets us to even a lower reconstruction loss. And that will be our"}, {"start": 2171.92, "end": 2185.04, "text": " investigation into the code right here. Okay, do do do do. Okay, we start with 19. Maybe we're,"}, {"start": 2185.04, "end": 2194.16, "text": " we're as good as before. That's fine, you know. But I hope I hope that kind of gives a bit of"}, {"start": 2194.16, "end": 2202.64, "text": " evidence to my point that this is basically reversing a generator by using gradient descent,"}, {"start": 2202.64, "end": 2209.2799999999997, "text": " which has been around for a while. And I happen to know someone who who once attempted to write"}, {"start": 2209.2799999999997, "end": 2216.64, "text": " a paper about it. So yeah, but it's it's with implicit networks, which are pretty cool. So,"}, {"start": 2216.64, "end": 2220.64, "text": " you know, maybe this might work especially well with them, given that the gradient of a siren is"}, {"start": 2220.64, "end": 2228.24, "text": " a gradient and is a siren, and so on. Yep, as you can see, this works as well decreasing learning"}, {"start": 2228.24, "end": 2234.48, "text": " rate. And now you can go nuts. Oh, nine. Wow. This is the lowest loss we've gotten so far. Right?"}, {"start": 2234.48, "end": 2243.04, "text": " Yeah. So pretty cool. reconstructions look like things. Well, these are the best samples. I think"}, {"start": 2243.04, "end": 2248.3199999999997, "text": " these are the best samples we've seen today. Maybe not. I'm not sure. Let's look at the"}, {"start": 2248.32, "end": 2256.96, "text": " interpolations quickly. Yeah, this looks like interpolations. I mean, if you squint. Okay,"}, {"start": 2256.96, "end": 2267.04, "text": " this was it for coding. See ya. Now, GANs have come with encoders before, or it much more looks"}, {"start": 2267.04, "end": 2273.2000000000003, "text": " like a variational auto encoder as well. The difference here is we replace the encoder. So"}, {"start": 2273.2, "end": 2280.8799999999997, "text": " this here is our encoder, right? This is our implicit encoder is simply gradient descent. This"}, {"start": 2280.8799999999997, "end": 2287.2, "text": " has also been done before for GANs. So people train GANs, and then they try to find the latent"}, {"start": 2287.2, "end": 2294.3199999999997, "text": " representation by back propagating. And some people even do this while some people do this"}, {"start": 2294.3199999999997, "end": 2300.72, "text": " while training, they do gradient descent, and then either do or do not back prop through the GAN"}, {"start": 2300.72, "end": 2310.16, "text": " the through the gradient descent procedure. So in a way or another, this is kind of sort of like"}, {"start": 2310.16, "end": 2315.52, "text": " those ideas, not saying it is equal. And again, there could be like some special interaction"}, {"start": 2315.52, "end": 2319.2, "text": " because you actually back prop through both these things. And there could be some special"}, {"start": 2319.2, "end": 2326.3999999999996, "text": " interaction because these are implicit neural networks. However, I very much view these as two"}, {"start": 2326.4, "end": 2334.08, "text": " different things. The cool, there is a rather cool derivation of that, where you can say, okay,"}, {"start": 2334.08, "end": 2340.56, "text": " you can also use it as a classifier by basically doing this. And now hope you can understand this"}, {"start": 2340.56, "end": 2346.96, "text": " much better. So what we'll have is we'll have the classification loss for sample x is going to be"}, {"start": 2346.96, "end": 2356.96, "text": " your cross entropy loss between two things. Okay, well, can you please go down again? Thanks. So"}, {"start": 2358.4, "end": 2364.56, "text": " your cross, your loss between two things is going to be the loss between your label y. So that's one"}, {"start": 2364.56, "end": 2370.96, "text": " thing. And usually, you have the feature the logits on this side, right? Now you can see right"}, {"start": 2370.96, "end": 2376.4, "text": " here, you have an F, that's probably that something that gives you the logits from your"}, {"start": 2376.4, "end": 2383.28, "text": " features. And here, your features aren't going to be the data point itself, but your features are"}, {"start": 2383.28, "end": 2389.84, "text": " going to be the Z variable that comes with the data points. So basically, you use this as a"}, {"start": 2389.84, "end": 2398.56, "text": " feature producer. And the feature producer is made by again, minimizing this reconstruction loss. Now,"}, {"start": 2398.56, "end": 2404.48, "text": " I'm not sure this is going to work really well for classifiers, because classifiers generally don't"}, {"start": 2404.48, "end": 2411.76, "text": " require you to reconstruct things. And we know this, you know, people try to, this is like you"}, {"start": 2411.76, "end": 2418.72, "text": " were to have a variational autoencoder, and then simply use that encoder as a feature producer for"}, {"start": 2418.72, "end": 2424.4, "text": " a classifier, which generally doesn't work very well. But you know, you can you can do it right"}, {"start": 2424.4, "end": 2432.08, "text": " here. And the the cool thing is that you can actually use the implicit representation network"}, {"start": 2432.08, "end": 2441.04, "text": " F to give you features for the entire data sample Z. So you kind of freed from the coordinate"}, {"start": 2441.04, "end": 2448.16, "text": " representation here, and you get kind of a latent, a latent vector back. So this is how you would use"}, {"start": 2448.16, "end": 2453.7599999999998, "text": " an implicit neural network in order to do classification. That's, I think, you know,"}, {"start": 2453.7599999999998, "end": 2461.2799999999997, "text": " pretty, pretty cool derivation of this. So here, they make some empirical claims, which I don't,"}, {"start": 2461.28, "end": 2466.96, "text": " I don't want to go too much into. But there are certain advantages, certain practical advantages"}, {"start": 2466.96, "end": 2472.1600000000003, "text": " of doing things like this, like you can have very, very few parameters to represent an entire"}, {"start": 2473.2000000000003, "end": 2483.0400000000004, "text": " set of data, the interpolations here work nicely. As you can see, and I think generally, they make"}, {"start": 2483.0400000000004, "end": 2489.28, "text": " the claim that this trains fast. And you can see after three seconds, it already has a lot of"}, {"start": 2489.28, "end": 2497.92, "text": " information about the data set. And it does some sensible things. Okay, so the code is available."}, {"start": 2498.5600000000004, "end": 2508.88, "text": " And in fact, I'll probably enter into parse into this video. A let's actually test our hypotheses,"}, {"start": 2508.88, "end": 2514.2400000000002, "text": " right? Let's test these hypotheses that I said. So first hypothesis is probably we can start with"}, {"start": 2514.24, "end": 2519.8399999999997, "text": " something else than the constant zero. And second hypothesis is we can probably improve by doing"}, {"start": 2519.8399999999997, "end": 2527.04, "text": " multiple steps of gradient descent in the inner loop. Yes, I this might be somewhere in this video."}, {"start": 2527.04, "end": 2543.52, "text": " And if not, it comes at the end, like right now. Okay, so I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=x6T1zMSE4Ts
NVAE: A Deep Hierarchical Variational Autoencoder (Paper Explained)
VAEs have been traditionally hard to train at high resolutions and unstable when going deep with many layers. In addition, VAE samples are often more blurry and less crisp than those from GANs. This paper details all the engineering choices necessary to successfully train a deep hierarchical VAE that exhibits global consistency and astounding sharpness at high resolutions. OUTLINE: 0:00 - Intro & Overview 1:55 - Variational Autoencoders 8:25 - Hierarchical VAE Decoder 12:45 - Output Samples 15:00 - Hierarchical VAE Encoder 17:20 - Engineering Decisions 22:10 - KL from Deltas 26:40 - Experimental Results 28:40 - Appendix 33:00 - Conclusion Paper: https://arxiv.org/abs/2007.03898 Abstract: Normalizing flows, autoregressive models, variational autoencoders (VAEs), and deep energy-based models are among competing likelihood-based frameworks for deep generative learning. Among them, VAEs have the advantage of fast and tractable sampling and easy-to-access encoding networks. However, they are currently outperformed by other models such as normalizing flows and autoregressive models. While the majority of the research in VAEs is focused on the statistical challenges, we explore the orthogonal direction of carefully designing neural architectures for hierarchical VAEs. We propose Nouveau VAE (NVAE), a deep hierarchical VAE built for image generation using depth-wise separable convolutions and batch normalization. NVAE is equipped with a residual parameterization of Normal distributions and its training is stabilized by spectral regularization. We show that NVAE achieves state-of-the-art results among non-autoregressive likelihood-based models on the MNIST, CIFAR-10, and CelebA HQ datasets and it provides a strong baseline on FFHQ. For example, on CIFAR-10, NVAE pushes the state-of-the-art from 2.98 to 2.91 bits per dimension, and it produces high-quality images on CelebA HQ as shown in Fig. 1. To the best of our knowledge, NVAE is the first successful VAE applied to natural images as large as 256×256 pixels. Authors: Arash Vahdat, Jan Kautz Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher
Alright, hi there, have a look at these faces right here. So you're probably used by now to seeing computer generated faces of really high quality, but probably you're used to seeing these faces coming from a generative adversarial network. However, these faces right here are from a variational auto encoder. Now variational auto encoders are fundamentally different than GANs. And traditionally, they've been a bit harder to scale up to high resolution images and give sort of very detailed sharp output. This paper right here attempts to build such a VAE for these high resolution large data set. And it basically details everything you need to do to get a VAE like this. So the paper is called NVAE or the I don't know how to pronounce that a deep hierarchical variational auto encoder by Arash Vadat and Jan Kautz of NVIDIA. As I said on a high level, this paper is about how to build a deep hierarchical variational auto encoder, which is sort of a combination of already existing techniques combined in a clever way, and then listing all the engineering efforts that you need to do to actually make this work. And there is not one thing where you can say, ah, this is the thing that really made it work. But each of these techniques is going to stack and stack and stack until they reach a model that's surpasses the state of the art on these data sets. And they are also able to apply this to an entirely new high quality image data set. So these again, are some of the samples from that model. And as you can see, they look very, very crisp, very sharp, and also very, let's say, real. Yeah. So really briefly, variational auto encoders. So this paper attempts to build a variational auto encoder, what is it? For that you need to start with a what an auto encoder is. So an auto encoder traditionally, let's say you have an image data set, and you take an image and you train a model that consists of an encoder that maps your image to a lower dimensional space, a compressed space, which you call the latent space z. And then you train a decoder to again, go from the latent space back to the image space. And then you train those two models such that the distance between the output and the input is minimized. Okay, this is called the reconstruction loss. And you train the encoder and the decoder to minimize that reconstruction loss. And thereby, you hope that this latent space will learn something about the data. Now, sort of advanced version of this and a probabilistic version of this is the variational auto encoder, where we say, what we want to do is we don't want the encoder to just output the directly the latent code, but we interpret this in a probabilistic fashion. So the encoder is now a probabilistic function that outputs a distribution over latent codes. So we take our same image. And what we want to do is we want a Bayesian basically, it's a Bayesian way of thinking of it, we want a distribution over latent codes corresponding to that image. So our encoder here is not going to output z, but it's going to output mu and sigma. So it would be ideal if it could output an entire distribution, but we're going to make some assumptions here that that is a normal distribution. And it's going to output the mean and the standard deviation of that normal distribution. And then you actually in because now you how you're going to feed this into the decoder, if you just feed mu, you are back to the normal auto encoder. So that doesn't work. What you do is you actually instantiate that normal distribution with the mu and the sigma. So you plug that in here, you sample one sample from that normal distribution. And then you feed that sample into your decoder. Again, your decoder outputs an image from that sample. And you compare this with the reconstruction loss. And now you train the entire process. So you train the the encoder and the decoder to produce to reproduce these images correctly. Now, if you only do that, then your then the model will basically regress to a standard auto encoder. Why is that? Well, what's pretty easy for the you can see that estimating the distribution is harder than estimating just the latent code, at least for the training data set, right. So if you don't pay attention, what's going to what the encoder is going to do is it's going to say, Oh, well, I if I just make this here, my latent code, and if I just make this as small as possible, like zero, or like one to the minus 10, the 10, that that's still one, 10 to the minus one, that's not that small, 10 to the minus 10, 11, 12, okay, a very small number, then that normal distribution will basically be just spiky around my around the thing around my mean. And so this here will always be kind of the same z. So it won't be a distribution at all, it will just be this Dirac. And I'm back to the original auto encoder, which I don't want, I want my probabilistic framework, so I can compute likelihoods, and so on, there are various advantages to having a probabilistic view of the data, rather than just a model that produces it. Okay, and that's why in the VAE, there is not only the objective, not only this objective, the reconstruction objective, but there is a second objective, where we say that we impose a regularization. And the regularization is that this here is as close as possible to a standard normal distribution. And I guess you can you can choose that the prior but in regularly you say, okay, this here, I don't, I don't want you encoder, I don't want you to go far away from a standard normal distribution, like do what you have to do to make the loss small, but don't go away too far. Alright, so that's the kind of balance in the VAE. And as you can imagine, if you have a normal distribution, and you sample these z vectors here, and the reconstruction loss is always the same. So if you input the same x here a bunch of times, you'll get different z's, right, you get z one, z two, z three, because it's sampled from this distribution, there's a sampling procedure right here. So if your discriminator here is kind of smooth, then it will output different images. Now, these images will always be compared to that same input image, right. So you're training this whole architecture to always reconstruct that input image from different images. So the there is an interaction, I think, I think that's what's happening, I guess, I'm not an expert on on VAE's. But this here usually is something like the L two loss. So in terms of how this affects the images, if I have different images that are sort of the same, but sort of different, and I have to make it L two loss close to this image right here, then one option I have is to make them kind of blurry. So if I make all of them kind of blurry in the L two loss, that will give me a lower penalty. So that's, I believe that's one of the explanations I heard at some point why VAE's produce usually blurry images. And that's been a problem for a long time that everything's kind of kind of blurry. So here, the VAE, the hierarchical VAE comes to the rescue. So how they are going to battle this problem is by doing a hierarchical variational auto encoder. And this is how it works. So you start off, this is your your generator, by the way, once you've trained your VAE, right, once you've trained it, you can simply sample from your prior from this year, because that's, you know, close enough to this, or you can, I guess, learn the prior of your data distribution, and so on. And you can just use the generator right here, the generative part, this part right here is your generator in order to produce images. So you can sample from a VAE, like you could sample from a GAN. Okay, so here, we'll look at a model that could combat those things. On the right side, you can see the model that you would ultimately sample from. So this is going to be your decoder, okay, this generative model right here. And what they do is it's very similar to if you, NVIDIA also had this paper about this, this GAN where they are on different scales, like progressive, I think, Prog GAN, which was the first that introduced actually this high quality phase data sets, I believe, at least. So here, we're going to do a very, very similar trick. So the idea is that we start out, this is a learned quantity, but you can also view it as just kind of the zero vector, we start out with our noise, we sample our noise, but our noise is going to be, it's going to be, let's say it's in the shape of an image, we can do that we can reshape images, right. So it's going to just be a 16 entry vector. And it's going to be shaped like this, okay, we sample noise like this. And then we produce an image of 16 by 16 from it, I think they start with eight by eight or something like this. But in conceptually, you do that, then you have a neural network, this is a residual neural network produce an image out of that noise, right, it maps the noise to the image. So this is your, this is your D, your discriminator part. But then you're not done. What you do is you would actually upscale that image or that can happen in the neural network, I believe, or you are up sampled from the beginning and you enlarge these things. But what you would do is you would upscale your neural network and you go higher. And so on. So you go higher and higher and higher in the hierarchy of noises. So this is a hierarchical model. Oh, yeah, down here. So they start, they start from, as you can see, it consists of 36 groups, in their case, of latent variables starting from eight by eight scaled up to 128 to 128, with two residual cells per latent variable groups. Okay, so you continuously scale and scale and scale up your, your, your images. And each time you add another bunch of these noises right here. So that means that in this model, you can, the uppermost residual model can sort of get the course details of the image. And that's going to be blurry because it's a VAE, but it's going to be blurry in that course scale. And then you up sample it and you let another model add on top of that the next layer of the next layer of features. You can see this is kind of a residual connection right here. And you again, sample and you let another neural network up sample, sorry, let another neural network add more features in a higher resolution. So even though each VAE can be blurry in its own scale, it will be upscaled and there, there will be additional details added. And that's why in their samples, you will see that they're not super blurry at all. Though, I have to say something right here, if you look at these images, and you compare them, so later they compare them, they, like, they're almost look like puppets, right? So here you compare it to these are these are previous methods down there. Now, you know, to say that they're pretty, they're, you can see they're clearly kind of worse in that you can get the symmetry of the faces aren't really given also the symmetries. Here, there are no long range dependencies. The hair details are often missing as compared to like here, this is pretty crisp. But if you look at like the skin of people, and can just kind of the image composition in shadows, it looks like these, these people are like cardboard cutouts here, they have like these multiple layers where I mean, am I the only one that that just sees this, this is like a plastic cutout. And then the face is again, like a plastic cutout. And the faces are so smooth. I mean, look at this. These are like, too pretty. Like, you can just look at this for hours. This is so like the diff. It maybe it just seems like this to me, but the difference if you kind of look at the skin and it almost feels like the bottom ones are actual real photographs in just in terms of the faces and the the kind of the color, just the smoothness is just all look like porcelain. This might actually be an effect of the VAE, right? Because it's not blurry, right as a you know, the lines and so on. But the the skin texture might just be one one scale too much here. And that's where we now see the blurriness or it might just be that I don't I don't know. Okay, I have no idea. This just this just somehow whereas was popping out to me as the main difference like they are much more crisp and so on and much more beautiful, but also they look like puppets. Yeah. All right. So let's get back to the model right here because so once we decided that we want such a hierarchical model, what we need to do is we need to simply build a VAE for each of these hierarchies, right? So the the uppermost thing here is a regular VAE noise, right? We have a noise, we sample from it and we generate this particular scale of image. Okay, so how do we get that noise? We simply this is this around here is our this is our encoder and this is our decoder. We simply have our encoder. This is a series of neural networks, and we get our latent encoding, right? So the Z is obtained through the kind of VAE encoding method. Okay, now the interesting part is how do we get Z two? And you might just think, well, we'll just go like one layer up here. But Z two, as you can see here, it depends on Z one during sampling. So during inference, we have also have to have that Z two depends on Z one. And that's why we first need to go to Z one and actually produce a sample. So our method of inferring the latent codes includes already sampling from those latent codes, right? So you sample and you do the same thing as you would do in the right. In fact, these models are shared. And then you can see that Z two now depends on Z one in this procedure, because you go here, and you go here and here. So Z two depends on Z one, Z three, in turn would depend on Z two and Z one. And you have a proper the hierarchically factorized model right here. Okay, so this, this is called a hierarchical VAE, it pretty much works like a VAE, except that it is hierarchical. And you need to do you need to have this bottom up and this top down model in order in your encoder. And so now there are a bunch of questions with respect to the hierarchical VAE. The problem here is that you have not only one sampling procedure, but you have sampling procedure upon sampling procedure upon sampling procedure. And this can get pretty unstable, I guess pretty quickly. So the rest of the paper is going to be how to get this to work. So the main, I think one of the main parts they do in order to get this to work in order to get this to train our residual connections. So we know that residual connections are kind of a sort of a gradient flow highway in order in order to to train very deep networks. And we've already seen this with residual networks and CNNs, where you have an input, and you have some computation in form of a neural network, or in this case, a sampling procedure through a distribution, and you have an output and the residual connection would allow you to skip part of that, as you can see, used here in both the encoders and the decoders. So in the encoders, you have residual connections. And also in the decoders, right here, you can see you have residual connections. In fact, you always take that lower scale, and you don't transform it into an upper scale, you actually sample noise, and then you add the lower scale and the upper scale together. So it's really an additive model in a hierarchical fashion, even okay, the pluses might actually not be okay, the pluses can also be combination, I guess. I guess that that I might be wrong, and they can actually be combinations. In any case, they use residual networks in in a in a lot of cases in their generative and in their generator and in their encoder, you can see right here, there is a residual cell for the generative model and a residual cell for the encoder. Now, the exact method of these residual cell, you can see that they use batch norm, then they use one by one convolutions in order to go to a higher to a higher channel number before they do the depth separated five by five convolutions. So five by five, because you need a larger receptive field, they make that clear, they need a large receptive field. However, the large receptive field means many parameters means their model would be too big and too much memory. So they do the depth separated convolutions, which simply means that you don't mix the channels during convolutions. So you go up the channels, you do a depth separated convolution and go down the channels again, all of these are kind of hacks to make it work, right? Then also they have batch norm and a swish non linearity, as you can see here. And then here as well in the encoder, they also say in the text, like they stress the importance, we found that first the batch norm and then the convolution is better than the other way around and so on. So this, there's a lot of engineering work that went into this right here. So you see there's batch norm. And also, you have to kind of hack the batch norm. Because in batch norm, you have these training parameters, and people have observed that in VA ease, if you during inference during sampling, if you use the training way, where you only regularize within the batch, it's better than if you use the running averages. So you kind of have to hack that we modify the momentum parameter of batch norm such that running statistic can catch up faster with the batch statistics. There's a there's a lot of engineering in here, like there's a lot of things that you have to get right to get something like this to work apparently. And yeah, this the paper, the paper just goes on in this style. So you can see they use the swish activation, they use squeeze and excitation blocks, which are another form of residual blocks that were introduced quite a long time ago, but still being used, as you can see. And yeah, so that's the architecture. So you can see they have residual cells, their residual cells here, reducing the memory requirements, they say they use two tricks. First of all, we they do mixed precision using a cool new video library. And given that they're from an video, they get to try these things out first. And second of all, they also to reduce them and refuse batch norm and swish, and we store only one feature map for the backward pass instead of two. And they have to then recompute. This trick is known as gradient checkpointing and cries, recomputing batch norm in the backward pass. I believe like future deep learning frameworks should just take care of that for you, instead of you having to do this kind of stuff. Honestly, so they also need to they hear they say taming the unbounded KL term. So the KL term is what makes the distribution that the encoder outputs close to that distribution that you want like that normal distribution. So this is the regularization term, you can see here, it's a KL divergence between q, which is what your encoder outputs, you can see that's the the latent code for the image x between that and between your prior, which you say it should be, it should be a like a normal distribution. In this case, it should be a hierarchical normal distribution. And they have a special characterization here where they say, because it's hierarchical, right? So what does it mean to have hierarchical normal distribution? So I'm going to have a hierarchy of normal distributions, this is my top hierarchy. And then I'm going to sample one sample right here, right? And then in the next layer, I'm going to have a normal distribution around that sample right here. And I'm going to sample from that and so on. So my hierarchical normal distribution is going to be always where the next distribution in the next layer is dependent on the distribution in the higher up the hierarchy. And they have a special parameterization where, in order for the encoder to produce that, so the encoder has to produce a z of the first layer, and then a z of the second layer, and so on. In order for the encoder to reproduce that, and to be close, it must match this distribution, and it must match this distribution. So if it doesn't match this distribution correctly, it will kind of sample somewhere else a bit, right? And then that distribution, that base will already be shifted right here. So it thinks that the distribution to match is now this normal distribution. So you can see that the base is already shifted. And that's why their encoder only outputs the delta to the as you can see here, there, it only outputs the delta to the prior. We define here, we define the q of the z in a given layer as the normal distribution of the mu i with mu i, that's your prior, see, that's your prior of that layer, plus a delta mu. And also the sigma is the sigma from the prior times a delta sigma that you output. So you're kind of saying you're not supposed to output the actual distribution, you're supposed to output the difference of distribution to the prior. Now in layer zero, that's the same thing, right? Because the prior is going to be zero mean and unit variance. So that's this here, this here will be zero, and this here will be one. But in all the upper layers, this is going to make it easier. So that's one trick you have to make this repeated sampling not hurt you as much. The other trick they employ here is special regular sorry, spectral regularization, which is a regularization where you regularize the top singular value per layer. You can use that you can compute that with a power iteration. People have been done doing this before. And also you can build in some normalizing flows, which so here, if we sample the different if we sample the different layers, what we're going to do is we're going to sample all of these things at once, right, they're dependent on the upper layer in the hierarchy, but we'll sample them all at once. And that means they are not sort of connected to each other. Now in a if we introduce a flow, we'll basically make them all connected to each other and build like a singular distribution of them. But I don't I don't want to go too much into this because it doesn't gain that much they say you can just build that in if you want. Okay, so these are all the things that at least they list in the method section. Now there are like a lot more that they are they have to do. But ultimately, as you can see right here, on on these on four of these five data sets, they achieve state of the art in fact, okay, on this data set, no one else has tried, but at least on the other data sets, they are very, very competitive, as you can see right here. And they compare this to first of all to other models, and even other models with and with and without auto regressive flows. And they come pretty close to these auto regressive models. So an auto regressive model would be one that generates like one pixel at a time, conditioned on the other pixels, that this model doesn't do that this model generates all pixels at once. So it's not auto regressive. But as you can see, it beats all the other all the other non or auto regressive models, and it gets pretty close to the best auto regressive models, which are down here, they're still better, but the gap is kind of shrinking is what they say. Cool. So that's the main result, then they have ablations where they basically, as I said, all of these things kind of contribute a little bit a little bit a little bit a little bit to building this bigger and bigger and deeper variational auto encoder. So it's hard to say what exactly makes this work, because all of it makes it work. And I guess they just kept going until they beat state of the art or until, you know, they ran out of tricks. Again, these are the samples that we looked at. And I do want to spend some time in the appendix right here, because I think it's pretty, pretty interesting what they do. So first of all, they show that their model doesn't remember the training samples. As you can see right here, these are always the nearest neighbor from the training sample. So the model is fairly, you know, fairly far away from the training samples. But yeah, I mean, okay, maybe it's just me, but the left, they just look like more kind of more ideal idealized humans, like, very smooth humans, like designer babies. Here, they show that if you use batch norm, as you would use it, I think, regularly where you keep these running stats, or you do the batch norm from training, then you get into this kind of degenerate case, if you sample at lower temperatures. So the temperature that you sample from describes the width of the Gaussian that you ultimately want to sample from. And if you do, they have this method to readjust the batch norm statistics, which I don't want to go into here, but you can you can read it up to basically fix that problem. It is a problem that apparently other people have observed as well. And their method apparently is, you know, is a is one that manages to do that. Okay, lastly, there are some more samples right here. And yet this right here, this is honestly, this is one of the I think one of the most interesting things where they go and since they have this hierarchical model, right, so here is like z one, it gives right and so that give gets you like an image and then there's z two and that gets you an image and then there's the three and so on and you continuously upscale and hierarchically add the features. Here they say what if what happens if we if we sample z one once and then we fix it and then we only sample the other ones conditioned on z one. And here see where you see top scale fixed. And you can see there is considerable variation in the image. But there is there is not really a large scale variation. Okay, so the general face keeps constant but there are details changing as you can see. So here the hair is kind of going over the image, the color is changing. Here are a lot of changes. The mouth looks slightly different as far as I can see. But I might be hallucinating here. And then if you fix continuously the top two scales or the top three scales right here top four scales, you can see that there are more and more just little details that change more and more. So yeah, so this is we they are operating at five scales starting from eight by eight up to 128 to 128. In each row we fix the samples at a number of top scales. And we sample from the rest of the hierarchy. As we can see the long range global structure is mostly recorded at the top of the hierarchy in the eight by eight dimensional groups. The second scale does apply at some global motive does apply some global modifications such as changing eyes hair color skin tone, the shape of the face, the bottom groups capture mostly low level variations. However, the lowest scale can still still make some subtle long range modifications. For example, the hair color is slightly modified when we are only sampling from the lowest scale in the last row. This is potentially enabled because of the larger receptive field in our depth wise separable residual cell. Yeah, I don't the hair color changes. Okay, slightly maybe. I don't know my my eyes are too many faces. Okay. But, you know, what's certainly the case is that their models exhibit much better kind of global unity compared to these other samples where you can pretty clearly see like the different sides of the faces have little to do with each other and so on. And this is the benefit that you get from doing this hierarchically. So you have part of your model that's responsible for kind of the global shape of the image, and then that keeps it consistent. And then you have other parts that are responsible for the details. Okay, so I hope this was something to you know, that interested you. I myself it's as I said, it's it's an engineering paper. So there is lots of things described. There's not like one jumping idea, I guess residual connections are pretty important. And these depth wise convolutions, save memory. And but also all of the all of the other things that you have to do to build something like this are pretty, pretty interesting. Yeah, I hope you gained something from it. And I'll see you next time.
[{"start": 0.0, "end": 5.16, "text": " Alright, hi there, have a look at these faces right here. So you're probably used by now"}, {"start": 5.16, "end": 10.120000000000001, "text": " to seeing computer generated faces of really high quality, but probably you're used to"}, {"start": 10.120000000000001, "end": 15.84, "text": " seeing these faces coming from a generative adversarial network. However, these faces"}, {"start": 15.84, "end": 22.2, "text": " right here are from a variational auto encoder. Now variational auto encoders are fundamentally"}, {"start": 22.2, "end": 27.76, "text": " different than GANs. And traditionally, they've been a bit harder to scale up to high resolution"}, {"start": 27.76, "end": 34.68, "text": " images and give sort of very detailed sharp output. This paper right here attempts to"}, {"start": 34.68, "end": 43.14, "text": " build such a VAE for these high resolution large data set. And it basically details everything"}, {"start": 43.14, "end": 49.6, "text": " you need to do to get a VAE like this. So the paper is called NVAE or the I don't know"}, {"start": 49.6, "end": 54.900000000000006, "text": " how to pronounce that a deep hierarchical variational auto encoder by Arash Vadat and"}, {"start": 54.9, "end": 62.239999999999995, "text": " Jan Kautz of NVIDIA. As I said on a high level, this paper is about how to build a deep hierarchical"}, {"start": 62.239999999999995, "end": 68.6, "text": " variational auto encoder, which is sort of a combination of already existing techniques"}, {"start": 68.6, "end": 74.52, "text": " combined in a clever way, and then listing all the engineering efforts that you need"}, {"start": 74.52, "end": 80.56, "text": " to do to actually make this work. And there is not one thing where you can say, ah, this"}, {"start": 80.56, "end": 84.64, "text": " is the thing that really made it work. But each of these techniques is going to stack"}, {"start": 84.64, "end": 92.04, "text": " and stack and stack until they reach a model that's surpasses the state of the art on these"}, {"start": 92.04, "end": 97.68, "text": " data sets. And they are also able to apply this to an entirely new high quality image"}, {"start": 97.68, "end": 103.64, "text": " data set. So these again, are some of the samples from that model. And as you can see,"}, {"start": 103.64, "end": 114.6, "text": " they look very, very crisp, very sharp, and also very, let's say, real. Yeah. So really"}, {"start": 114.6, "end": 120.56, "text": " briefly, variational auto encoders. So this paper attempts to build a variational auto"}, {"start": 120.56, "end": 125.04, "text": " encoder, what is it? For that you need to start with a what an auto encoder is. So an"}, {"start": 125.04, "end": 129.4, "text": " auto encoder traditionally, let's say you have an image data set, and you take an image"}, {"start": 129.4, "end": 136.0, "text": " and you train a model that consists of an encoder that maps your image to a lower dimensional"}, {"start": 136.0, "end": 142.04000000000002, "text": " space, a compressed space, which you call the latent space z. And then you train a decoder"}, {"start": 142.04000000000002, "end": 148.36, "text": " to again, go from the latent space back to the image space. And then you train those"}, {"start": 148.36, "end": 155.84, "text": " two models such that the distance between the output and the input is minimized. Okay,"}, {"start": 155.84, "end": 162.04, "text": " this is called the reconstruction loss. And you train the encoder and the decoder to minimize"}, {"start": 162.04, "end": 167.38, "text": " that reconstruction loss. And thereby, you hope that this latent space will learn something"}, {"start": 167.38, "end": 174.24, "text": " about the data. Now, sort of advanced version of this and a probabilistic version of this"}, {"start": 174.24, "end": 180.16, "text": " is the variational auto encoder, where we say, what we want to do is we don't want the"}, {"start": 180.16, "end": 187.52, "text": " encoder to just output the directly the latent code, but we interpret this in a probabilistic"}, {"start": 187.52, "end": 193.56, "text": " fashion. So the encoder is now a probabilistic function that outputs a distribution over"}, {"start": 193.56, "end": 200.92, "text": " latent codes. So we take our same image. And what we want to do is we want a Bayesian basically,"}, {"start": 200.92, "end": 205.68, "text": " it's a Bayesian way of thinking of it, we want a distribution over latent codes corresponding"}, {"start": 205.68, "end": 212.04000000000002, "text": " to that image. So our encoder here is not going to output z, but it's going to output"}, {"start": 212.04000000000002, "end": 218.28, "text": " mu and sigma. So it would be ideal if it could output an entire distribution, but we're going"}, {"start": 218.28, "end": 223.14000000000001, "text": " to make some assumptions here that that is a normal distribution. And it's going to output"}, {"start": 223.14000000000001, "end": 230.36, "text": " the mean and the standard deviation of that normal distribution. And then you actually"}, {"start": 230.36, "end": 235.84, "text": " in because now you how you're going to feed this into the decoder, if you just feed mu,"}, {"start": 235.84, "end": 240.92000000000002, "text": " you are back to the normal auto encoder. So that doesn't work. What you do is you actually"}, {"start": 240.92000000000002, "end": 245.92000000000002, "text": " instantiate that normal distribution with the mu and the sigma. So you plug that in"}, {"start": 245.92000000000002, "end": 253.08, "text": " here, you sample one sample from that normal distribution. And then you feed that sample"}, {"start": 253.08, "end": 259.46000000000004, "text": " into your decoder. Again, your decoder outputs an image from that sample. And you compare"}, {"start": 259.46, "end": 264.91999999999996, "text": " this with the reconstruction loss. And now you train the entire process. So you train"}, {"start": 264.91999999999996, "end": 274.58, "text": " the the encoder and the decoder to produce to reproduce these images correctly. Now,"}, {"start": 274.58, "end": 281.59999999999997, "text": " if you only do that, then your then the model will basically regress to a standard auto"}, {"start": 281.59999999999997, "end": 286.96, "text": " encoder. Why is that? Well, what's pretty easy for the you can see that estimating the"}, {"start": 286.96, "end": 292.76, "text": " distribution is harder than estimating just the latent code, at least for the training"}, {"start": 292.76, "end": 299.03999999999996, "text": " data set, right. So if you don't pay attention, what's going to what the encoder is going"}, {"start": 299.03999999999996, "end": 307.08, "text": " to do is it's going to say, Oh, well, I if I just make this here, my latent code, and"}, {"start": 307.08, "end": 313.71999999999997, "text": " if I just make this as small as possible, like zero, or like one to the minus 10, the"}, {"start": 313.72, "end": 320.88000000000005, "text": " 10, that that's still one, 10 to the minus one, that's not that small, 10 to the minus"}, {"start": 320.88000000000005, "end": 328.38000000000005, "text": " 10, 11, 12, okay, a very small number, then that normal distribution will basically be"}, {"start": 328.38000000000005, "end": 337.70000000000005, "text": " just spiky around my around the thing around my mean. And so this here will always be kind"}, {"start": 337.7, "end": 344.32, "text": " of the same z. So it won't be a distribution at all, it will just be this Dirac. And I'm"}, {"start": 344.32, "end": 349.2, "text": " back to the original auto encoder, which I don't want, I want my probabilistic framework,"}, {"start": 349.2, "end": 353.71999999999997, "text": " so I can compute likelihoods, and so on, there are various advantages to having a probabilistic"}, {"start": 353.71999999999997, "end": 361.48, "text": " view of the data, rather than just a model that produces it. Okay, and that's why in"}, {"start": 361.48, "end": 367.64000000000004, "text": " the VAE, there is not only the objective, not only this objective, the reconstruction"}, {"start": 367.64000000000004, "end": 374.44, "text": " objective, but there is a second objective, where we say that we impose a regularization."}, {"start": 374.44, "end": 383.0, "text": " And the regularization is that this here is as close as possible to a standard normal"}, {"start": 383.0, "end": 389.16, "text": " distribution. And I guess you can you can choose that the prior but in regularly you"}, {"start": 389.16, "end": 395.64000000000004, "text": " say, okay, this here, I don't, I don't want you encoder, I don't want you to go far away"}, {"start": 395.64000000000004, "end": 400.46000000000004, "text": " from a standard normal distribution, like do what you have to do to make the loss small,"}, {"start": 400.46000000000004, "end": 407.8, "text": " but don't go away too far. Alright, so that's the kind of balance in the VAE. And as you"}, {"start": 407.8, "end": 413.8, "text": " can imagine, if you have a normal distribution, and you sample these z vectors here, and the"}, {"start": 413.8, "end": 418.88, "text": " reconstruction loss is always the same. So if you input the same x here a bunch of times,"}, {"start": 418.88, "end": 424.12, "text": " you'll get different z's, right, you get z one, z two, z three, because it's sampled"}, {"start": 424.12, "end": 430.08, "text": " from this distribution, there's a sampling procedure right here. So if your discriminator"}, {"start": 430.08, "end": 436.88, "text": " here is kind of smooth, then it will output different images. Now, these images will always"}, {"start": 436.88, "end": 444.15999999999997, "text": " be compared to that same input image, right. So you're training this whole architecture"}, {"start": 444.16, "end": 451.92, "text": " to always reconstruct that input image from different images. So the there is an interaction,"}, {"start": 451.92, "end": 456.84000000000003, "text": " I think, I think that's what's happening, I guess, I'm not an expert on on VAE's. But"}, {"start": 456.84000000000003, "end": 463.88, "text": " this here usually is something like the L two loss. So in terms of how this affects"}, {"start": 463.88, "end": 469.46000000000004, "text": " the images, if I have different images that are sort of the same, but sort of different,"}, {"start": 469.46, "end": 476.76, "text": " and I have to make it L two loss close to this image right here, then one option I have"}, {"start": 476.76, "end": 483.68, "text": " is to make them kind of blurry. So if I make all of them kind of blurry in the L two loss,"}, {"start": 483.68, "end": 489.79999999999995, "text": " that will give me a lower penalty. So that's, I believe that's one of the explanations I"}, {"start": 489.79999999999995, "end": 495.44, "text": " heard at some point why VAE's produce usually blurry images. And that's been a problem for"}, {"start": 495.44, "end": 504.68, "text": " a long time that everything's kind of kind of blurry. So here, the VAE, the hierarchical"}, {"start": 504.68, "end": 511.8, "text": " VAE comes to the rescue. So how they are going to battle this problem is by doing a hierarchical"}, {"start": 511.8, "end": 517.76, "text": " variational auto encoder. And this is how it works. So you start off, this is your your"}, {"start": 517.76, "end": 523.0, "text": " generator, by the way, once you've trained your VAE, right, once you've trained it, you"}, {"start": 523.0, "end": 527.76, "text": " can simply sample from your prior from this year, because that's, you know, close enough"}, {"start": 527.76, "end": 533.0, "text": " to this, or you can, I guess, learn the prior of your data distribution, and so on. And"}, {"start": 533.0, "end": 538.4, "text": " you can just use the generator right here, the generative part, this part right here"}, {"start": 538.4, "end": 545.24, "text": " is your generator in order to produce images. So you can sample from a VAE, like you could"}, {"start": 545.24, "end": 554.1, "text": " sample from a GAN. Okay, so here, we'll look at a model that could combat those things."}, {"start": 554.1, "end": 559.2, "text": " On the right side, you can see the model that you would ultimately sample from. So this"}, {"start": 559.2, "end": 565.86, "text": " is going to be your decoder, okay, this generative model right here. And what they do is it's"}, {"start": 565.86, "end": 572.64, "text": " very similar to if you, NVIDIA also had this paper about this, this GAN where they are"}, {"start": 572.64, "end": 578.0, "text": " on different scales, like progressive, I think, Prog GAN, which was the first that introduced"}, {"start": 578.0, "end": 583.8199999999999, "text": " actually this high quality phase data sets, I believe, at least. So here, we're going"}, {"start": 583.8199999999999, "end": 591.52, "text": " to do a very, very similar trick. So the idea is that we start out, this is a learned quantity,"}, {"start": 591.52, "end": 596.68, "text": " but you can also view it as just kind of the zero vector, we start out with our noise,"}, {"start": 596.68, "end": 603.0, "text": " we sample our noise, but our noise is going to be, it's going to be, let's say it's in"}, {"start": 603.0, "end": 607.7199999999999, "text": " the shape of an image, we can do that we can reshape images, right. So it's going to just"}, {"start": 607.7199999999999, "end": 615.3599999999999, "text": " be a 16 entry vector. And it's going to be shaped like this, okay, we sample noise like"}, {"start": 615.3599999999999, "end": 622.0799999999999, "text": " this. And then we produce an image of 16 by 16 from it, I think they start with eight"}, {"start": 622.08, "end": 629.08, "text": " by eight or something like this. But in conceptually, you do that, then you have a neural network,"}, {"start": 629.08, "end": 633.86, "text": " this is a residual neural network produce an image out of that noise, right, it maps"}, {"start": 633.86, "end": 640.4000000000001, "text": " the noise to the image. So this is your, this is your D, your discriminator part. But then"}, {"start": 640.4000000000001, "end": 646.5600000000001, "text": " you're not done. What you do is you would actually upscale that image or that can happen"}, {"start": 646.56, "end": 652.56, "text": " in the neural network, I believe, or you are up sampled from the beginning and you enlarge"}, {"start": 652.56, "end": 661.68, "text": " these things. But what you would do is you would upscale your neural network and you"}, {"start": 661.68, "end": 671.4799999999999, "text": " go higher. And so on. So you go higher and higher and higher in the hierarchy of noises."}, {"start": 671.48, "end": 677.84, "text": " So this is a hierarchical model. Oh, yeah, down here. So they start, they start from,"}, {"start": 677.84, "end": 685.64, "text": " as you can see, it consists of 36 groups, in their case, of latent variables starting"}, {"start": 685.64, "end": 693.58, "text": " from eight by eight scaled up to 128 to 128, with two residual cells per latent variable"}, {"start": 693.58, "end": 702.12, "text": " groups. Okay, so you continuously scale and scale and scale up your, your, your images."}, {"start": 702.12, "end": 709.84, "text": " And each time you add another bunch of these noises right here. So that means that in this"}, {"start": 709.84, "end": 716.32, "text": " model, you can, the uppermost residual model can sort of get the course details of the"}, {"start": 716.32, "end": 720.88, "text": " image. And that's going to be blurry because it's a VAE, but it's going to be blurry in"}, {"start": 720.88, "end": 726.84, "text": " that course scale. And then you up sample it and you let another model add on top of"}, {"start": 726.84, "end": 733.82, "text": " that the next layer of the next layer of features. You can see this is kind of a residual connection"}, {"start": 733.82, "end": 741.76, "text": " right here. And you again, sample and you let another neural network up sample, sorry,"}, {"start": 741.76, "end": 748.16, "text": " let another neural network add more features in a higher resolution. So even though each"}, {"start": 748.16, "end": 756.1999999999999, "text": " VAE can be blurry in its own scale, it will be upscaled and there, there will be additional"}, {"start": 756.1999999999999, "end": 762.66, "text": " details added. And that's why in their samples, you will see that they're not super blurry"}, {"start": 762.66, "end": 769.28, "text": " at all. Though, I have to say something right here, if you look at these images, and you"}, {"start": 769.28, "end": 776.24, "text": " compare them, so later they compare them, they, like, they're almost look like puppets,"}, {"start": 776.24, "end": 782.84, "text": " right? So here you compare it to these are these are previous methods down there. Now,"}, {"start": 782.84, "end": 789.0, "text": " you know, to say that they're pretty, they're, you can see they're clearly kind of worse"}, {"start": 789.0, "end": 795.34, "text": " in that you can get the symmetry of the faces aren't really given also the symmetries. Here,"}, {"start": 795.34, "end": 800.98, "text": " there are no long range dependencies. The hair details are often missing as compared"}, {"start": 800.98, "end": 807.8000000000001, "text": " to like here, this is pretty crisp. But if you look at like the skin of people, and can"}, {"start": 807.8000000000001, "end": 812.5600000000001, "text": " just kind of the image composition in shadows, it looks like these, these people are like"}, {"start": 812.5600000000001, "end": 819.2, "text": " cardboard cutouts here, they have like these multiple layers where I mean, am I the only"}, {"start": 819.2, "end": 824.74, "text": " one that that just sees this, this is like a plastic cutout. And then the face is again,"}, {"start": 824.74, "end": 831.2, "text": " like a plastic cutout. And the faces are so smooth. I mean, look at this. These are like,"}, {"start": 831.2, "end": 838.98, "text": " too pretty. Like, you can just look at this for hours. This is so like the diff. It maybe"}, {"start": 838.98, "end": 845.48, "text": " it just seems like this to me, but the difference if you kind of look at the skin and it almost"}, {"start": 845.48, "end": 851.5600000000001, "text": " feels like the bottom ones are actual real photographs in just in terms of the faces"}, {"start": 851.56, "end": 860.28, "text": " and the the kind of the color, just the smoothness is just all look like porcelain. This might"}, {"start": 860.28, "end": 867.76, "text": " actually be an effect of the VAE, right? Because it's not blurry, right as a you know, the"}, {"start": 867.76, "end": 874.92, "text": " lines and so on. But the the skin texture might just be one one scale too much here."}, {"start": 874.92, "end": 879.88, "text": " And that's where we now see the blurriness or it might just be that I don't I don't know."}, {"start": 879.88, "end": 888.84, "text": " Okay, I have no idea. This just this just somehow whereas was popping out to me as the"}, {"start": 888.84, "end": 894.02, "text": " main difference like they are much more crisp and so on and much more beautiful, but also"}, {"start": 894.02, "end": 903.52, "text": " they look like puppets. Yeah. All right. So let's get back to the model right here because"}, {"start": 903.52, "end": 908.82, "text": " so once we decided that we want such a hierarchical model, what we need to do is we need to simply"}, {"start": 908.82, "end": 916.0200000000001, "text": " build a VAE for each of these hierarchies, right? So the the uppermost thing here is"}, {"start": 916.0200000000001, "end": 923.0400000000001, "text": " a regular VAE noise, right? We have a noise, we sample from it and we generate this particular"}, {"start": 923.0400000000001, "end": 929.0200000000001, "text": " scale of image. Okay, so how do we get that noise? We simply this is this around here"}, {"start": 929.0200000000001, "end": 933.8000000000001, "text": " is our this is our encoder and this is our decoder. We simply have our encoder. This"}, {"start": 933.8, "end": 942.12, "text": " is a series of neural networks, and we get our latent encoding, right? So the Z is obtained"}, {"start": 942.12, "end": 948.0799999999999, "text": " through the kind of VAE encoding method. Okay, now the interesting part is how do we get"}, {"start": 948.0799999999999, "end": 955.14, "text": " Z two? And you might just think, well, we'll just go like one layer up here. But Z two,"}, {"start": 955.14, "end": 960.28, "text": " as you can see here, it depends on Z one during sampling. So during inference, we have also"}, {"start": 960.28, "end": 965.42, "text": " have to have that Z two depends on Z one. And that's why we first need to go to Z one"}, {"start": 965.42, "end": 973.16, "text": " and actually produce a sample. So our method of inferring the latent codes includes already"}, {"start": 973.16, "end": 980.24, "text": " sampling from those latent codes, right? So you sample and you do the same thing as you"}, {"start": 980.24, "end": 985.9, "text": " would do in the right. In fact, these models are shared. And then you can see that Z two"}, {"start": 985.9, "end": 993.3, "text": " now depends on Z one in this procedure, because you go here, and you go here and here. So"}, {"start": 993.3, "end": 999.64, "text": " Z two depends on Z one, Z three, in turn would depend on Z two and Z one. And you have a"}, {"start": 999.64, "end": 1007.36, "text": " proper the hierarchically factorized model right here. Okay, so this, this is called"}, {"start": 1007.36, "end": 1012.96, "text": " a hierarchical VAE, it pretty much works like a VAE, except that it is hierarchical. And"}, {"start": 1012.96, "end": 1018.52, "text": " you need to do you need to have this bottom up and this top down model in order in your"}, {"start": 1018.52, "end": 1025.64, "text": " encoder. And so now there are a bunch of questions with respect to the hierarchical VAE. The"}, {"start": 1025.64, "end": 1029.96, "text": " problem here is that you have not only one sampling procedure, but you have sampling"}, {"start": 1029.96, "end": 1035.8400000000001, "text": " procedure upon sampling procedure upon sampling procedure. And this can get pretty unstable,"}, {"start": 1035.8400000000001, "end": 1042.2, "text": " I guess pretty quickly. So the rest of the paper is going to be how to get this to work."}, {"start": 1042.2, "end": 1047.88, "text": " So the main, I think one of the main parts they do in order to get this to work in order"}, {"start": 1047.88, "end": 1054.02, "text": " to get this to train our residual connections. So we know that residual connections are kind"}, {"start": 1054.02, "end": 1062.72, "text": " of a sort of a gradient flow highway in order in order to to train very deep networks. And"}, {"start": 1062.72, "end": 1069.28, "text": " we've already seen this with residual networks and CNNs, where you have an input, and you"}, {"start": 1069.28, "end": 1074.32, "text": " have some computation in form of a neural network, or in this case, a sampling procedure"}, {"start": 1074.32, "end": 1079.68, "text": " through a distribution, and you have an output and the residual connection would allow you"}, {"start": 1079.68, "end": 1087.8, "text": " to skip part of that, as you can see, used here in both the encoders and the decoders."}, {"start": 1087.8, "end": 1092.08, "text": " So in the encoders, you have residual connections. And also in the decoders, right here, you"}, {"start": 1092.08, "end": 1098.0, "text": " can see you have residual connections. In fact, you always take that lower scale, and"}, {"start": 1098.0, "end": 1105.12, "text": " you don't transform it into an upper scale, you actually sample noise, and then you add"}, {"start": 1105.12, "end": 1113.64, "text": " the lower scale and the upper scale together. So it's really an additive model in a hierarchical"}, {"start": 1113.64, "end": 1121.24, "text": " fashion, even okay, the pluses might actually not be okay, the pluses can also be combination,"}, {"start": 1121.24, "end": 1128.24, "text": " I guess. I guess that that I might be wrong, and they can actually be combinations. In"}, {"start": 1128.24, "end": 1136.32, "text": " any case, they use residual networks in in a in a lot of cases in their generative and"}, {"start": 1136.32, "end": 1142.1200000000001, "text": " in their generator and in their encoder, you can see right here, there is a residual cell"}, {"start": 1142.1200000000001, "end": 1148.52, "text": " for the generative model and a residual cell for the encoder. Now, the exact method of"}, {"start": 1148.52, "end": 1153.8799999999999, "text": " these residual cell, you can see that they use batch norm, then they use one by one convolutions"}, {"start": 1153.8799999999999, "end": 1161.56, "text": " in order to go to a higher to a higher channel number before they do the depth separated"}, {"start": 1161.56, "end": 1169.08, "text": " five by five convolutions. So five by five, because you need a larger receptive field,"}, {"start": 1169.08, "end": 1173.92, "text": " they make that clear, they need a large receptive field. However, the large receptive field"}, {"start": 1173.92, "end": 1180.52, "text": " means many parameters means their model would be too big and too much memory. So they do"}, {"start": 1180.52, "end": 1184.8000000000002, "text": " the depth separated convolutions, which simply means that you don't mix the channels during"}, {"start": 1184.8000000000002, "end": 1191.04, "text": " convolutions. So you go up the channels, you do a depth separated convolution and go down"}, {"start": 1191.04, "end": 1196.18, "text": " the channels again, all of these are kind of hacks to make it work, right? Then also"}, {"start": 1196.18, "end": 1202.04, "text": " they have batch norm and a swish non linearity, as you can see here. And then here as well"}, {"start": 1202.04, "end": 1207.0, "text": " in the encoder, they also say in the text, like they stress the importance, we found"}, {"start": 1207.0, "end": 1212.52, "text": " that first the batch norm and then the convolution is better than the other way around and so"}, {"start": 1212.52, "end": 1217.84, "text": " on. So this, there's a lot of engineering work that went into this right here. So you"}, {"start": 1217.84, "end": 1224.78, "text": " see there's batch norm. And also, you have to kind of hack the batch norm. Because in"}, {"start": 1224.78, "end": 1229.72, "text": " batch norm, you have these training parameters, and people have observed that in VA ease,"}, {"start": 1229.72, "end": 1236.96, "text": " if you during inference during sampling, if you use the training way, where you only regularize"}, {"start": 1236.96, "end": 1241.64, "text": " within the batch, it's better than if you use the running averages. So you kind of have"}, {"start": 1241.64, "end": 1247.0, "text": " to hack that we modify the momentum parameter of batch norm such that running statistic"}, {"start": 1247.0, "end": 1251.56, "text": " can catch up faster with the batch statistics. There's a there's a lot of engineering in"}, {"start": 1251.56, "end": 1256.28, "text": " here, like there's a lot of things that you have to get right to get something like this"}, {"start": 1256.28, "end": 1263.08, "text": " to work apparently. And yeah, this the paper, the paper just goes on in this style. So you"}, {"start": 1263.08, "end": 1268.76, "text": " can see they use the swish activation, they use squeeze and excitation blocks, which are"}, {"start": 1268.76, "end": 1275.52, "text": " another form of residual blocks that were introduced quite a long time ago, but still"}, {"start": 1275.52, "end": 1284.72, "text": " being used, as you can see. And yeah, so that's the architecture. So you can see they have"}, {"start": 1284.72, "end": 1291.16, "text": " residual cells, their residual cells here, reducing the memory requirements, they say"}, {"start": 1291.16, "end": 1296.68, "text": " they use two tricks. First of all, we they do mixed precision using a cool new video"}, {"start": 1296.68, "end": 1302.24, "text": " library. And given that they're from an video, they get to try these things out first. And"}, {"start": 1302.24, "end": 1307.92, "text": " second of all, they also to reduce them and refuse batch norm and swish, and we store"}, {"start": 1307.92, "end": 1314.22, "text": " only one feature map for the backward pass instead of two. And they have to then recompute."}, {"start": 1314.22, "end": 1318.52, "text": " This trick is known as gradient checkpointing and cries, recomputing batch norm in the backward"}, {"start": 1318.52, "end": 1324.84, "text": " pass. I believe like future deep learning frameworks should just take care of that for"}, {"start": 1324.84, "end": 1332.88, "text": " you, instead of you having to do this kind of stuff. Honestly, so they also need to they"}, {"start": 1332.88, "end": 1342.04, "text": " hear they say taming the unbounded KL term. So the KL term is what makes the distribution"}, {"start": 1342.04, "end": 1348.48, "text": " that the encoder outputs close to that distribution that you want like that normal distribution."}, {"start": 1348.48, "end": 1353.8799999999999, "text": " So this is the regularization term, you can see here, it's a KL divergence between q,"}, {"start": 1353.8799999999999, "end": 1359.24, "text": " which is what your encoder outputs, you can see that's the the latent code for the image"}, {"start": 1359.24, "end": 1366.8999999999999, "text": " x between that and between your prior, which you say it should be, it should be a like"}, {"start": 1366.9, "end": 1374.88, "text": " a normal distribution. In this case, it should be a hierarchical normal distribution. And"}, {"start": 1374.88, "end": 1380.24, "text": " they have a special characterization here where they say, because it's hierarchical,"}, {"start": 1380.24, "end": 1387.0600000000002, "text": " right? So what does it mean to have hierarchical normal distribution? So I'm going to have"}, {"start": 1387.0600000000002, "end": 1391.16, "text": " a hierarchy of normal distributions, this is my top hierarchy. And then I'm going to"}, {"start": 1391.16, "end": 1398.0800000000002, "text": " sample one sample right here, right? And then in the next layer, I'm going to have a normal"}, {"start": 1398.0800000000002, "end": 1404.96, "text": " distribution around that sample right here. And I'm going to sample from that and so on."}, {"start": 1404.96, "end": 1410.96, "text": " So my hierarchical normal distribution is going to be always where the next distribution"}, {"start": 1410.96, "end": 1418.3200000000002, "text": " in the next layer is dependent on the distribution in the higher up the hierarchy. And they have"}, {"start": 1418.32, "end": 1425.52, "text": " a special parameterization where, in order for the encoder to produce that, so the encoder"}, {"start": 1425.52, "end": 1431.72, "text": " has to produce a z of the first layer, and then a z of the second layer, and so on. In"}, {"start": 1431.72, "end": 1437.26, "text": " order for the encoder to reproduce that, and to be close, it must match this distribution,"}, {"start": 1437.26, "end": 1443.6599999999999, "text": " and it must match this distribution. So if it doesn't match this distribution correctly,"}, {"start": 1443.66, "end": 1449.24, "text": " it will kind of sample somewhere else a bit, right? And then that distribution, that base"}, {"start": 1449.24, "end": 1454.64, "text": " will already be shifted right here. So it thinks that the distribution to match is now"}, {"start": 1454.64, "end": 1461.1200000000001, "text": " this normal distribution. So you can see that the base is already shifted. And that's why"}, {"start": 1461.1200000000001, "end": 1468.24, "text": " their encoder only outputs the delta to the as you can see here, there, it only outputs"}, {"start": 1468.24, "end": 1478.1200000000001, "text": " the delta to the prior. We define here, we define the q of the z in a given layer as"}, {"start": 1478.1200000000001, "end": 1484.56, "text": " the normal distribution of the mu i with mu i, that's your prior, see, that's your prior"}, {"start": 1484.56, "end": 1492.56, "text": " of that layer, plus a delta mu. And also the sigma is the sigma from the prior times a"}, {"start": 1492.56, "end": 1500.1599999999999, "text": " delta sigma that you output. So you're kind of saying you're not supposed to output the"}, {"start": 1500.1599999999999, "end": 1506.3, "text": " actual distribution, you're supposed to output the difference of distribution to the prior."}, {"start": 1506.3, "end": 1511.32, "text": " Now in layer zero, that's the same thing, right? Because the prior is going to be zero"}, {"start": 1511.32, "end": 1519.44, "text": " mean and unit variance. So that's this here, this here will be zero, and this here will"}, {"start": 1519.44, "end": 1525.64, "text": " be one. But in all the upper layers, this is going to make it easier. So that's one"}, {"start": 1525.64, "end": 1532.3600000000001, "text": " trick you have to make this repeated sampling not hurt you as much. The other trick they"}, {"start": 1532.3600000000001, "end": 1538.92, "text": " employ here is special regular sorry, spectral regularization, which is a regularization"}, {"start": 1538.92, "end": 1545.3200000000002, "text": " where you regularize the top singular value per layer. You can use that you can compute"}, {"start": 1545.32, "end": 1551.48, "text": " that with a power iteration. People have been done doing this before. And also you can build"}, {"start": 1551.48, "end": 1558.6799999999998, "text": " in some normalizing flows, which so here, if we sample the different if we sample the"}, {"start": 1558.6799999999998, "end": 1563.2, "text": " different layers, what we're going to do is we're going to sample all of these things"}, {"start": 1563.2, "end": 1569.2, "text": " at once, right, they're dependent on the upper layer in the hierarchy, but we'll sample them"}, {"start": 1569.2, "end": 1575.68, "text": " all at once. And that means they are not sort of connected to each other. Now in a if we"}, {"start": 1575.68, "end": 1580.6000000000001, "text": " introduce a flow, we'll basically make them all connected to each other and build like"}, {"start": 1580.6000000000001, "end": 1587.48, "text": " a singular distribution of them. But I don't I don't want to go too much into this because"}, {"start": 1587.48, "end": 1594.0800000000002, "text": " it doesn't gain that much they say you can just build that in if you want. Okay, so these"}, {"start": 1594.08, "end": 1599.8799999999999, "text": " are all the things that at least they list in the method section. Now there are like"}, {"start": 1599.8799999999999, "end": 1607.36, "text": " a lot more that they are they have to do. But ultimately, as you can see right here,"}, {"start": 1607.36, "end": 1614.3999999999999, "text": " on on these on four of these five data sets, they achieve state of the art in fact, okay,"}, {"start": 1614.3999999999999, "end": 1620.08, "text": " on this data set, no one else has tried, but at least on the other data sets, they are"}, {"start": 1620.08, "end": 1628.76, "text": " very, very competitive, as you can see right here. And they compare this to first of all"}, {"start": 1628.76, "end": 1639.0, "text": " to other models, and even other models with and with and without auto regressive flows."}, {"start": 1639.0, "end": 1643.4399999999998, "text": " And they come pretty close to these auto regressive models. So an auto regressive model would"}, {"start": 1643.44, "end": 1650.3600000000001, "text": " be one that generates like one pixel at a time, conditioned on the other pixels, that"}, {"start": 1650.3600000000001, "end": 1656.68, "text": " this model doesn't do that this model generates all pixels at once. So it's not auto regressive."}, {"start": 1656.68, "end": 1667.14, "text": " But as you can see, it beats all the other all the other non or auto regressive models,"}, {"start": 1667.14, "end": 1673.8400000000001, "text": " and it gets pretty close to the best auto regressive models, which are down here, they're"}, {"start": 1673.8400000000001, "end": 1683.1200000000001, "text": " still better, but the gap is kind of shrinking is what they say. Cool. So that's the main"}, {"start": 1683.1200000000001, "end": 1688.5400000000002, "text": " result, then they have ablations where they basically, as I said, all of these things"}, {"start": 1688.5400000000002, "end": 1693.4, "text": " kind of contribute a little bit a little bit a little bit a little bit to building this"}, {"start": 1693.4, "end": 1699.88, "text": " bigger and bigger and deeper variational auto encoder. So it's hard to say what exactly"}, {"start": 1699.88, "end": 1706.3200000000002, "text": " makes this work, because all of it makes it work. And I guess they just kept going until"}, {"start": 1706.3200000000002, "end": 1712.0800000000002, "text": " they beat state of the art or until, you know, they ran out of tricks. Again, these are the"}, {"start": 1712.0800000000002, "end": 1717.94, "text": " samples that we looked at. And I do want to spend some time in the appendix right here,"}, {"start": 1717.94, "end": 1725.8, "text": " because I think it's pretty, pretty interesting what they do. So first of all, they show that"}, {"start": 1725.8, "end": 1731.1200000000001, "text": " their model doesn't remember the training samples. As you can see right here, these"}, {"start": 1731.1200000000001, "end": 1737.28, "text": " are always the nearest neighbor from the training sample. So the model is fairly, you know,"}, {"start": 1737.28, "end": 1746.88, "text": " fairly far away from the training samples. But yeah, I mean, okay, maybe it's just me,"}, {"start": 1746.88, "end": 1755.88, "text": " but the left, they just look like more kind of more ideal idealized humans, like, very"}, {"start": 1755.88, "end": 1767.16, "text": " smooth humans, like designer babies. Here, they show that if you use batch norm, as you"}, {"start": 1767.16, "end": 1774.16, "text": " would use it, I think, regularly where you keep these running stats, or you do the batch"}, {"start": 1774.16, "end": 1780.4, "text": " norm from training, then you get into this kind of degenerate case, if you sample at"}, {"start": 1780.4, "end": 1784.92, "text": " lower temperatures. So the temperature that you sample from describes the width of the"}, {"start": 1784.92, "end": 1790.42, "text": " Gaussian that you ultimately want to sample from. And if you do, they have this method"}, {"start": 1790.42, "end": 1796.28, "text": " to readjust the batch norm statistics, which I don't want to go into here, but you can"}, {"start": 1796.28, "end": 1802.4, "text": " you can read it up to basically fix that problem. It is a problem that apparently other people"}, {"start": 1802.4, "end": 1809.92, "text": " have observed as well. And their method apparently is, you know, is a is one that manages to"}, {"start": 1809.92, "end": 1821.3200000000002, "text": " do that. Okay, lastly, there are some more samples right here. And yet this right here,"}, {"start": 1821.3200000000002, "end": 1826.8200000000002, "text": " this is honestly, this is one of the I think one of the most interesting things where they"}, {"start": 1826.82, "end": 1833.36, "text": " go and since they have this hierarchical model, right, so here is like z one, it gives right"}, {"start": 1833.36, "end": 1839.12, "text": " and so that give gets you like an image and then there's z two and that gets you an image"}, {"start": 1839.12, "end": 1844.6, "text": " and then there's the three and so on and you continuously upscale and hierarchically add"}, {"start": 1844.6, "end": 1852.3799999999999, "text": " the features. Here they say what if what happens if we if we sample z one once and then we"}, {"start": 1852.38, "end": 1859.44, "text": " fix it and then we only sample the other ones conditioned on z one. And here see where you"}, {"start": 1859.44, "end": 1867.72, "text": " see top scale fixed. And you can see there is considerable variation in the image. But"}, {"start": 1867.72, "end": 1874.96, "text": " there is there is not really a large scale variation. Okay, so the general face keeps"}, {"start": 1874.96, "end": 1881.0800000000002, "text": " constant but there are details changing as you can see. So here the hair is kind of going"}, {"start": 1881.08, "end": 1888.6799999999998, "text": " over the image, the color is changing. Here are a lot of changes. The mouth looks slightly"}, {"start": 1888.6799999999998, "end": 1895.02, "text": " different as far as I can see. But I might be hallucinating here. And then if you fix"}, {"start": 1895.02, "end": 1901.36, "text": " continuously the top two scales or the top three scales right here top four scales, you"}, {"start": 1901.36, "end": 1907.6799999999998, "text": " can see that there are more and more just little details that change more and more."}, {"start": 1907.68, "end": 1915.8400000000001, "text": " So yeah, so this is we they are operating at five scales starting from eight by eight"}, {"start": 1915.8400000000001, "end": 1922.48, "text": " up to 128 to 128. In each row we fix the samples at a number of top scales. And we sample from"}, {"start": 1922.48, "end": 1928.5600000000002, "text": " the rest of the hierarchy. As we can see the long range global structure is mostly recorded"}, {"start": 1928.5600000000002, "end": 1934.0, "text": " at the top of the hierarchy in the eight by eight dimensional groups. The second scale"}, {"start": 1934.0, "end": 1938.88, "text": " does apply at some global motive does apply some global modifications such as changing"}, {"start": 1938.88, "end": 1943.84, "text": " eyes hair color skin tone, the shape of the face, the bottom groups capture mostly low"}, {"start": 1943.84, "end": 1949.08, "text": " level variations. However, the lowest scale can still still make some subtle long range"}, {"start": 1949.08, "end": 1954.2, "text": " modifications. For example, the hair color is slightly modified when we are only sampling"}, {"start": 1954.2, "end": 1959.08, "text": " from the lowest scale in the last row. This is potentially enabled because of the larger"}, {"start": 1959.08, "end": 1971.3999999999999, "text": " receptive field in our depth wise separable residual cell. Yeah, I don't the hair color"}, {"start": 1971.3999999999999, "end": 1982.76, "text": " changes. Okay, slightly maybe. I don't know my my eyes are too many faces. Okay. But,"}, {"start": 1982.76, "end": 1988.32, "text": " you know, what's certainly the case is that their models exhibit much better kind of global"}, {"start": 1988.32, "end": 1994.2, "text": " unity compared to these other samples where you can pretty clearly see like the different"}, {"start": 1994.2, "end": 1999.6399999999999, "text": " sides of the faces have little to do with each other and so on. And this is the benefit"}, {"start": 1999.6399999999999, "end": 2003.8799999999999, "text": " that you get from doing this hierarchically. So you have part of your model that's responsible"}, {"start": 2003.8799999999999, "end": 2009.96, "text": " for kind of the global shape of the image, and then that keeps it consistent. And then"}, {"start": 2009.96, "end": 2017.3999999999999, "text": " you have other parts that are responsible for the details. Okay, so I hope this was"}, {"start": 2017.4, "end": 2024.16, "text": " something to you know, that interested you. I myself it's as I said, it's it's an engineering"}, {"start": 2024.16, "end": 2030.0800000000002, "text": " paper. So there is lots of things described. There's not like one jumping idea, I guess"}, {"start": 2030.0800000000002, "end": 2036.3600000000001, "text": " residual connections are pretty important. And these depth wise convolutions, save memory."}, {"start": 2036.3600000000001, "end": 2041.92, "text": " And but also all of the all of the other things that you have to do to build something like"}, {"start": 2041.92, "end": 2049.76, "text": " this are pretty, pretty interesting. Yeah, I hope you gained something from it. And I'll"}, {"start": 2049.76, "end": 2072.76, "text": " see you next time."}]
Yannic Kilchner
https://www.youtube.com/watch?v=Jqvb7jp4Nm8
Addendum for Supermasks in Superposition: A Closer Look (Paper Explained)
I take a closer look at "Supermasks in Superposition" after I've already done a video on it. Specifically, I look at: 1. The intuition and theoretical justification behind the G objective, 2. Whether Supermasks and Superposition can be viewed as two distinct ideas and 3. The Paper's Broader Impact Statement. OUTLINE: 0:00 - Intro & Overview 2:00 - SupSup Recap 4:00 - In-Depth Analysis of the G Objective 20:30 - Superposition without Supermasks 25:40 - Broader Impact Statement 36:40 - Conclusion 37:20 - Live Coding Part 1 on SupSup: https://youtu.be/3jT1qJ8ETzk My Code: https://colab.research.google.com/drive/1bEcppdN6qZRpEFplIiv41ZI3vDwDjcvC?usp=sharing Paper: https://arxiv.org/abs/2006.14769 Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher
Hi there, today we'll look at super masks in superposition again. So this is part two of this paper by Mitchell Wurzman and Vivek Ramanujan. And here's the reason why there's a part two. So after yesterday's video on this paper, I like I couldn't sleep because I really felt that I had left out some important aspects that I wanted to touch on during the video. Now sometimes during videos, I look at the clock and I realize like, oh, crap, the video is already like an hour long. And I know people are watching on 2x speed anyway. But still, it's like too long. And I need to wrap it up really soon. And what I felt were pretty important messages about this paper got lost. So specifically, I want to address three different things. First of all, they have like a formal analysis, not a formal, but a kind of more rigorous analysis of what their modified G objective does. And I also want to give some intuition in that because I felt I felt I really hadn't done a good job at that. The second part is that the the two different ideas right here being the super masks and the superposition. And I think my opinion is sort of that these are two separate things. And they really have nothing to do with each other. And I think that didn't really come through last video. And the third one being the broader impact statement of this paper, which I you know, I usually kind of gloss over it and go like, haha, but I hear there is an important point to it. So yeah, we'll get to that. Alright, so again, not a new paper today, I realized this, but I think it's worth kind of diving deeper into this paper, which is a very cool paper. You know, so so don't don't get me wrong right here. And I feel mostly I haven't done a good part at explaining it like, literally lying awake. Okay, so let's go to the first point. We had this. So if you hadn't seen the first video, super masks and superposition basically says that we want to do lifelong learning. And we want to do lifelong learning by lifelong learning is the task where you have a bunch of tasks in sequence and you learn them in sequence. So one after the other. And basically, the goal is to not forget tasks. Once new, you learn new tasks. And this model does it by always building one of these super masks for each task that is applied to the same randomly initialized base neural network each time. And you know, by by keeping the super mask around, you won't forget the task. And then at inference time, if you're given the task and just retrieve the mask, if you're not given the task, you can do this superposition trick where you apply all the masks in a superposition. And then you look at sort of the gradient of an entropy function in order to decide which task reduces the entropy the most. So which task is the most certain about a particular data point, and that you you kind of infer that that's the task you're going to go with. So instead of the entropy, which is, you know, well reasoned, they had this other objective they call a G, and G basically looks at the it's really strange, it looks at the superfluous neurons. So they also add the superfluous neurons, these s neurons right here. And they, they did g objective will only look at the s neurons in order to decide whether or not that's the correct task. And it's basically just the log sum x of the s neurons. And we had some intuition about them being, you know, all small and so on them being like outlier detectors. But there is an entire chapter in the appendix where the authors do a sort of more in depth theoretical analysis of that, which, you know, I, it's not not necessary to do this for them. So I really enjoy, I enjoyed reading that. And that gave me sort of the better intuition of what this g objective does. So here they say, the aim is not to formally prove properties of the algorithm. Rather, we hope that a more mathematical language may prove useful in extending intuition. Okay. So again, that's, that's pretty cool. So they start off by saying, you have your neural network is basically W, and the, the sorry, the it's, it's this phi right here. And the W are the last layers weights, which compute your logits. So y is going not to be your class, but y is going to be your logits. And p is going to be the probability vector over your class, which if the you calculate this via a softmax is going to be the following expression right here. If you have a mask, right, then at least in the last layer, you can in you can infer it as this right here. So you multiply the mask by the last these weights, and then that gives you your logits. So they say here with they initialize the weights right here, actually, they initialize the they have no bias term and initialize the weights by this constant. So plus minus this constant, it's not really necessary to do that, but they do it right here makes the analysis also a bit easier. I guess it just works more well. If you have these masks in superposition, of course, you want to add all of these masks with the respective alpha weighting factor, then multiply by the weights, and that gives you your logits. So note that this this doesn't necessarily only only have to be the last layer's weights right here. You can view that as any sort of weights of the neural network if you formulate this phi correctly. So you don't think that they only apply the mask to the last layer, they do apply the mask to the entire thing. Alright, now the the important part here is what happens if we look at the derivative of G with respect to one of the alphas and take the maximum negative derivative of that G, which is that mysterious function that only looks at the at the at the superfluous neurons. So what they want, they kind of construct this G by principle. What they say is, we want a function g that mimics the supervised loss, right? We want a function g that is kind of equal like the supervised loss if we had the task ID, right? And that's, that's pretty cool. Because, you know, the, the supervised loss, you sort of need all the information you need the label, you need, you need all the all the you need the task ID. So the supervised loss is unavailable. But we want a function g that in its gradient mimics the supervised loss. So they go about constructing this right here. They say, lemma first lemma, it's possible to construct a function g such that the gradient matches the gradient from the supervised loss for all the supervised loss for all s neurons. So for all the superfluous neurons, specifically, we want that the gradient with respect to the logits, if the gradient to the logits is equal, that means the gradient to all the rest of the network is equal because the rest of the network goes through the logits, right? The gradient through the logits is equal to the gradient of the supervised loss to the logits for all the superfluous neurons and zero otherwise. So they say the zero otherwise is pretty easily done in math, you know, simply set it to zero, and in the actual code, which you can achieve like this, where m indicates the superfluous neurons. So this is just, this is just multiplied here, and the other ones are detached. So there is no gradient flowing. This is the property that we only look at the superfluous neurons. And now we are going to show that the gradient is going to be equal. So they say if you had the supervised loss, which means if you have the label, then this would be your cross entropy loss, okay, so you cross it divides into this part where you need the label, and then this part here, you don't need the label. Now, you can pretty say pretty much say, look, the label is certainly going to be one of not the superfluous neurons, because the superfluous neurons are superfluous, they are never the correct neuron. So this is always going to be, you know, not the not the neurons we look at. So the gradient certainly, this is always going to be zero, because we never we, wherever the gradient is flowing, that's not where the where this is one. So the gradient of any superfluous neuron is just this thing right here. And that's exactly why they build the function g. So the function g has this exact gradient, the function g, if you derive it has that same gradient as the supervised loss for the superfluous neurons. Okay, so it's sort of magic, but it's not, you know, it's not magic. So they need two more assumptions here to have to get the following properties. So the for the first property, now because now we want to have g be identifying the correct task. So we've already constructed g, now we want to show that if we really do this, the gradient with respect to the alphas, then if we do it for a wrong task for the tasks that it's not the task of that particular data point that goes into computing g, then we'll get a value that's probably lower than zero. However, if we plug in if we derive, but with respect to the alpha of the correct task, then we get a gradient, a negative gradient that's higher than zero. Okay, so we're now going to prove that this with high probability really allows us to distinguish the correct task from the wrong task. We need two assumptions right here. Assumption one is we assume that the mask learn on the task i will be independent from the data from task j. If the task data is from task j, then this are independent random variables. Okay, so it sort of means that the the tasks themselves are kind of independent. But it's not it's it's not the same requirement. But you can think of in in the case of permuted MNIST or so this is some it's given except if you consider this kind of frequency of brightness and so on. But if you have independent tasks, I think that this is given. That means that the features right here and the masks are independent variable. If if the data is from task j, then the features and the mask from task i are independent variables, sorry. The second assumption you need is that we assume that a negative weight and the positive weight are equally likely to be masked out. Okay, so this again, you can think of with some regularity. This is certainly going to be to be given in a randomly initialized neural network. Note that when the features are zero, which will be the case for zero mean random features. Yeah, so yeah, before I said this was your neural network, this is your random neural network, right? And then you mask that and so on. If this is a randomly initialized neural network, then you can make a case that the expected features of those will be zero. It doesn't need to be the case, but you can you can construct it such that it is so if you have the two things, right, if you have those two things, then you can prove the following. If the data x comes from task j, then when you derive by an alpha, that's not of task j, you get a number that's smaller than zero in expectation. And here, the crucial part is you reframe this gradient, you reframe, reframe, reframe. And what you'll see is that this here comes out. So this is a sum and each element of the sum is going to be greater or equal to zero, which means that this thing is greater or equal to zero, which means the negative thing is smaller than zero in lemma h1. Now we're going to look at lemma h1 to get an intuition of what's going on right here. So lemma h1 says if j is the true task and i is not equal to j, then this quantity here is greater than zero. So lemma h1 is the greater than zero. Alright, I restarted my tablet and we are back. So what's kind of the the intuition behind why this quantity here would be greater or equal to zero. And honestly, in order to make it a bit easier, I first want to look at whenever i equals j. So whenever j is the true task, and then i equals j, then we can sort of think of the opposite, like why, why this should be smaller or equal to zero. So consider this, this is the run the feature of the network of u, right. And then the uv connects that to the to the masket point v and the masket point at that point uv is either zero or one depending on the training. So this, this zi right here, that's going to be the from the initialization, but the mask is going to be zero or one depending on whether that feature contributes, sorry, whether this entire thing here contributes positively to the task or not. So the secret right here, why we can make a claim that this is greater or lower than zero is going to be that the mask can only be zero or one, it cannot be negative one, right. So if the mask is zero, then obviously this thing is going to be zero. However, if the mask is one, what does it mean? If the mask is one, that means that this this entire feature right here, let's call it f is positively impacting is positively contributing to this particular neuron right here. So if the mask is one, this is this, it means the addition of that feature, more of that feature makes that logit go up. Okay, so if the mask is one during training, it means that the feature positively contributes to the task. So if we look at the gradient with respect to this function with respect to the logit, and the function basically means it's just measures, measures how high these superfluous logits are, then what, why do we find a negative interaction there? Because if you look at the neural network, and you forward pass, and this particular feature is important. And you look at the loss G and you backward pass through the logits. If it is smaller than zero, that means that there is a negative interaction right here. So that basically means that if we make this feature higher, then in this case, we make this g function go lower, okay. And that is the case for the correct task. Because if this is the correct task, and the mask is learned adequately, that means it should assign a low weight to the superfluous neuron whenever the input features, you know, are of that task. And so it makes sense that this here would be a negative number. Because what we want if the mask deems the feature is small, we want that if the feature goes up, G goes down. And that's exactly why we have the negative interaction right here, right? So the negative comes from this being negative. I hope this sort of makes sense. So if the mask is one, the mask says, basically, if that feature goes up, the loss goes down. Now G is a measure of the superfluous neurons, the superfluous neurons small if the loss is small. So if this is really from the task, and this feature is really useful, that means if we increase the feature, the g function should go down. And therefore, this product here is going to be most likely negative, okay. And the contrary is, you know, analogous right here, if this is not of this task, the mass can either be zero or one, right? If it's zero, then this quantity is zero. However, if it's one, it's more likely that the that there, the feature here, because it's i is not the correct task, which basically means that this feature, it is for a different task, it is good for a different task. So the mask of that different task says it's good right here. And we have no reason to believe that this would decrease the loss of the loss of this particular data point in this task. So it's kind of the inverse reasoning. If you look at the actual derivation here, it's fairly long. And it goes over the cases of the interactions between actually this initialization and the mask. So the initialization can be positive or negative, as you can see right here. And I think, I just think that the, the intuition here is that the superfluous neurons react differently to a data point of the trained task, because they have been kind of made to decrease for that task. And for that particular mask, as they do for when the data point doesn't match the mask, when the data point doesn't match the mask, there is no reason for the logits of the superfluous neurons to be low. And if the data point task does match the mask, there is ample reasons for those to be low. I hope that sort of makes sense. It is sort of it's a bit more of an intuition. But if you really want to dig into it, look at the derivation right here. Okay. Second point is the fact that the masks and the superpositions don't really have to do anything with each other. And that's, you know, I've said throughout the video, like, remember, these tasks are super easy, yada, yada, yada. So let me make it clear. In this in this diagram right here, the super masks, these are simply a way to train a neural network in a crude way, right? I don't think there is, you know, this distinction between mask and network. I don't really like that much, because ultimately, what you're doing is simply you're training a neural network in a kind of weird way. Okay, the fact that you always use the same underlying, you know, gray neural network doesn't really matter right here. It's still, what you do in the super mask training is you provide a severely over parameterized network, and then the mask simply gets to choose which weights to mix, rather than you get to adjust the weights. If you adjust the weights, you usually get more accurate than with the mask, but it's sort of like a quantized neural network that you train right here. So that's the super mask thing. Again, I don't think it's important that the underlying network is always the same. The only advantage you have is it saves space, because these masks are very small. The super masks, on the other hand, this idea that you overlay all of the masks together, and then you look at where this at the gradient of the entropy, and you look at which of the of the mixing factors the gradient pulls the most. That's a different idea. And the question here is, wouldn't that isn't that independent does really depend on the masks, or doesn't it? And the you know, the hypothesis would be that if I simply train, you know, three different neural networks for three different tasks, could I not do the same superposition trick? Like, could I not just add all of them with a respective alpha, look at the entropy, calculate the gradient with respect to each of the alphas of the entropy and then decide which task it is, you know, don't need masks, simply mix neural networks in superposition. So I did it. And I actually tried their code is available. So big props for their code being available. I tried their code. It's actually very few changes. And I'm going to append my live coding of this at the end of this video. So if you want to, if you are interested in watching that you can do so. But you know, the outcome is if I train neural networks, and I have, I've, you know, done super quick, and initialize them wrongly, probably in all, but if I train these neural net, if I train the masks, you get to like 92% accuracy in their tasks, in each of the tasks, and then also in the average, if I train the actual neural networks, I get to a higher accuracy, like 93 something, it doesn't matter, it's just higher, okay. So that's hypothesis one is the training masks is just a way of training neural networks, the fact that the masks and the network training itself are that close, I think is a testament to how easy these tasks are, like how easy MNIST is. I'm going to also hypothesize that if the task gets harder and harder, and I don't mean 10 class ImageNet, I mean, 1000 class ImageNet, then these masks are going to degrade severely versus training the actual neural network. I might be wrong. I mean, you can overparameterize really heavily, and they will still work. Okay, but in any case, I trained the train these neural networks, and they reached higher accuracy. And then I did the exact same thing, I laid them in superposition to determine what task it is. And I could achieve the exact same result. So here in their example, they have 100% task classification accuracy, and I reached the exact same thing code worked. I'm not going to try to scale this up to 250 or 2500 tasks, but I'm going to assume that with, you know, tuning and stuff, that it's going to work about equally well, you could make an argument that the masks being sparser, they might be differentiated from each other more accurately. But I'm not sure, maybe, but it's not a cool, it's not a qualitative difference, right? So these two things are really two separate ideas that find their way together in this paper, but ultimately have not much to do with each other. Okay. At least that's from what I can tell, I might I might be wrong here. And I might be wrong with respect to their G objective and whatnot. And, you know, but I think that that these are two cool ideas, but they can be applied independently. So the last thing I want to look at is their broader impact statement right here. Now, there is a reason. So usually, I kind of track these broader impact statement, because I think this this is this here is sort of fundamental research, right? This is fundamental machine learning research, we do architecture, we do multitask learning task isn't really important, as long as we have kind of the same tasks right here on correlated and so on the same hardness. And I've also made the point that it's really important for these tasks to be the same hard for this to work in this place a role right here. So they do they do describe some of this in this conclusion with, you know, limitation that we observed has to do with task identity inference, when models are not well calibrated models that are overly confident for the wrong task. Okay. So in order for them to infer the correct task, they the sort of, so if you look at your entropy of the models for the tasks, that means you're going to select the model that is the most sure about the task. This only works if the tasks are equally hard, okay, if one task is much, much harder than the other task, this other task is always going to say, well, I'm really confident about this one, because the task is just easier, it's going to be, it's going to train a neural network is generally more confident, and you're going to misclassify a lot of the tasks. So, so here, what does this have to do with the broader impact statement? If you look at the broader impact statement, what they say right here. So they say, a goal of continue learning self-many tasks with a single model, however, it is not exactly clear what qualifies as a single model, therefore, a concrete objective has become to learn many tasks as efficiently as possible. We believe that sub-sub is a useful step in this direction. However, there are consequences to more efficient models, both positive and negative. So this is sort of what the community does. So there are three things that I've seen so far in broader impact statement. First, some people say this is not applicable to us, which I agree for most fundamental research, broader, like the broader impact statement is supposed to be what does this particular method? How will this influence broader society? So not applicable, completely valid for most of these research papers, because guess what you can use any method to do good or to do bad. And that's, that's the second, second part. Second method is basically, you just say generic statements, how you can do good and bad. And usually, you can't relate it to your particular method in the paper, right? Because your method is, I don't know, like my faster convergence rate of SGD. But, and so what you do is you just go one level up, you go up the levels. So it's like optimization can be used for good and for bad. I mean, that's still kind of a bit vague. And then you go up further, well, optimization can do more machine learning. And machine learning can be used to do good and bad, for example, face recognition and things like this. So you just go up the levels. And that's what they essentially do here. And that's what, you know, most people have defaulted to. It's like, okay, so, you know, our model here is, you know, we, it basically one can train more efficient models, and then they simply highlight what more efficient models can do. Efficient models require less compute. Efficient model by rerun on the end device. If models are more efficient, then large scale research is not limited to wealthier institutions. By the way, I also the broader impact statement, I believe, should be the impact on society, and not really on the research community itself. So I also, this, this is a bit shaky with respect to I'm really regarding what the broader impact statement should be. This is not my opinion. I'm, I'm trying to reflect everything I've read of guidance about what the broader impact statement should be. By the way, there is also method, method three, which is to simply tell me more about your paper in the broader impact statement, which I guess is the smart method, because the broader impact statement can be before the before the references. So it's in the main part, and people are required to read it, not like the appendix reviewers are not required to read the appendix reviewers are required to read the broader impact statement. So I guess the smart authors will just try to cloak more information about their model in terms of a broader impact statement, I guess, well, whether that's smart is a different discussion. But here, they just, it's already defaulting, right? These, it's already the default people simply go level up, level up, level up until we can, you know, say something generic. And we will also highlight and discuss the negative consequences of models, which can efficiently learn many tasks and efficient models in general, when models are more efficient, they're also more available, and less subject to regularization as a study of result. For instance, when a high impact model is released, an institution will hopefully be accompanied by a model card, analyzing the bias and intended use of the model. By contrast, if anyone is able to train a powerful model, this may no longer be the case, resulting in a proliferation of model with harmful biases or intended use. Taking the United States, for instance, bias can be harmful as models show disproportionately more errors for already marginalized groups furthering existing deeply rooted structural racism. This, this is like, well, technology, this is basically a statement about technology. And so why why do I have a particular not issue, but why do I pick this broader impact statement, they even read this here, this is this gender shades paper, right, where people went and they looked at these commercial API's for face recognition, I think that's the paper. Yeah, gender shades. So if you have a face recognizer, they realize they divided people up by I think, gender and race. So, you know, like they built four groups, or I haven't, I haven't, I've just looked at the paper, but in my understanding that they divided people up into groups, which I find arbitrary to have the these two axis race and gender, but okay, you can do that. And they discovered that these commercial API's have different accuracy for the different groups, right. And that basically our point is that, you know, these commercial API's, if they're offered for all humans, they should work equally well for all humans. Now, now you may be see what it has to do with this paper. Well, this paper is in the business of doing multi task learning. So it is very viable to actually frame the the task for example, like this is an example. If you frame the task of multitask learning, like face recognition on different groups of people as a multitask learning problem, you have, you know, group group one right here, group two, group three, and then if at inference time, so you can build, you know, good models for each of the group at inference time, you're given an image and you're trying to first which group is that from and then take the appropriate classifier, that would be, you know, that would be a good hypothetical classifier for this thing. Now, what do we know about this thing? This thing is fails if the tasks aren't equally hard. Also, in in specifically, if if for one group, let's say for group three, the the task is way harder because you have less data. I guess the one of the main problems there is that the data sets are not equally balanced. If you have less data for that, then the task becomes de facto harder, and the model is less sure about the task, which means that it's a double whammy. So not only is the model itself less accurate, but these the input data point if the person is actually of group three is less likely to be classified correctly into the correct model at to begin with. So, you know, for all the for all, I've had my share of comments on the video I made, and I still maintain that societal bias can comes about by data set. But for all the people saying there are models that exaggerate existing biases in models, this would be like if there is any ever any applicability of these broader impact statement guidelines, this would be the paper, right? It's this right here is an actual system that if I have different classifiers, and I combine them with this method, it will double punish the classifier that is less sure that is less accurate, because that is also going to be the one with the higher entropy, therefore not as much selected if I give a data point of that particular task. And so this is like a I'm not criticizing the method here, like by all means, like this is a cool method, where you can recognize that this happens and try to calibrate accordingly. But if there was ever any straight ball for a broader impact statement, I would, you know, this is it. And this, I'm not I'm not, I'm not saying that these these authors didn't do that for a reason. I believe that, look, it's been whatever, not even half a year since we've started with these general broader impact statements. And everybody is already defaulting to simply say technology, good technology, bad. That's, that's the people aren't even thinking. And so this, right, this is one of the reasons why I simply find these broader impact statements to be not that like not a good idea, because there is a default answer. And people are just putting it here, even in like when there is an actual, obvious, immensely obvious thing that they even they even cited, like the basis for that. So, you know, that's sort of my take on this. I, again, I enjoyed this paper, the code is is available, everything is good about this, this paper, I'm not even the fact that these are, you know, I think these are kind of two separate ideas, they're combined, cool, they're, they're combined, cool, they're analyzed formally in theory, there's intuition given all good. So don't get me wrong. This is not like trashing this paper. It's just, I felt I had some thing more to say. And I think that was it. So yeah, I'll see you next time with a new paper. Okay, so our goal here is going to be to change this code to not use masks as mixtures, but actually use neural networks with real weights as as mixtures and in superposition with each other. Okay, so what we're going to do is we're going to train the different neural networks, and then use this kind of superposition trick to figure out which task a data point came from. So, let's have a look at the code right here. And there's a bunch of helper code. And if we go down through everything, you'll see that this is the MNIST permuted data set. So each each task is basically a random permutation of MNIST. And if you execute, I believe this here, and then you train the model, and right now it's for five tasks, but I guess that's going to be enough for now. Yeah, so if we get some good signal here, I guess it's a matter of of doing kind of engineering and plumbing and tuning if until you get it up to whatever 200 or 2000 tasks, though, I might be wrong there. So this is training and I short certainly sort of had a look at the code, but I haven't actually tried this yet. So the thing the model is built here, you see this this multitask fully connected, which has these different layers right here. And it's built by these multitask mask linear models. Now the multitask mask linear models are defined right here. So it's basically a linear model, as you can see, it's derived from a linear from a linear module. And it has a parameter called num tasks, and then it has a parameter scores, which I guess is are these these masks right here. And the scores, I'm going to guess are always going to be multiplied by the weights here in the forward. So you can see, in the forward, you get the weights from the alphas. Yeah, this is the superimposed. Alright, so if we know the task ID down here, we get this subnet, and we are going to multiply it with the weights. If we don't know the task ID, we want to get these alphas. So the alphas are going to be one over the number of tasks at the beginning. We're then going to multiply each of the alphas with the weights. And with that, we're going to get this subnet mask with that we're going to get this subnet mask right here. So we need to know what this self dot stacked is. So the self dot stacked is getting right here in this cache mask, or simply stacking this this get subnet for all of the things. So our plan is going to be that this subnet right here is going to be the actual weights of the neural network, okay, and not just the not just the mask, and then we don't need to actually multiply it with the weight, we can just just forget about the weight, honestly, and just train the subnet. So for the subnet, as you can see here, you have this get subnet thing. And that's an autograd function, which basically means in the forward pass, you want to discretize it and in the backward pass, this is a straight through estimator. So our first task is going and this here should be done now my laptop has stopped breathing. So we've trained five tasks and now we can run inference on that. So this is when the task is given. Real quick, you can see task one 92% 92% 92% 92%. So we have a an overall performance of 92.44%. Then when the task is not given, we have two things to evaluate whether or not, basically, how good we are overall, and whether or not we get the tasks correct. Of course, the tasks are at this pre requirement. So we have 100% task inference accuracy. Okay, so we don't, we don't, okay, we can we could evaluate this here, but you can already see the output from last time, there's like no difference from the performance of the when the task is given, it's always being able to infer the task, we want to check out the same thing. So we want to change first of all this get subnet, this is where it's the scores are discretized. Now, given that these scores are going to be and to end up being our actual weights, we won't we don't do that we simply return the scores. Now this is this is pretty pointless right now, but we'll keep it just to be as close as possible to the to that. Now, mask in it. This is where we initialize the mask. Now, this is climbing uniform, and it has some thing but we want probably we want to train the neural initialized, you know, as we know it. So let's try what what are other initialized functions. So init dot, what do we have here? Do we have what's usual? I don't even know. Normal. Saviour that that sounds about right. That sounds about right. All right. All right. So scores and yeah, let's try this. This could this could like break everything right if you initialize wrongly you get like dumb results. So okay, signed constant, yada yada yada. Where is that used? Huh? Okay, that's also initializing something. So we calculate the gain and then Okay, this doesn't seem good. We'll just keep it. Hey, why not? Why not? Why not just keep it at that? All right. So cool. Oh, yeah, this is for the weight. Anyway, we won't use the weight at all of this layer, we'll just use our own weights. So here we have these stacked, okay, we get the scores. That's all good. Like, I'm pretty happy with that. I'm pretty happy with this mask in it that we make our parameters. So these are going to be our different neural networks that we train. This all looks good. The alphas look good. Now the only thing we need to do is to have not the weight times the subnet here, but the subnet as such like this. Is this it? Do we now train actual neural networks? I have my doubts, honestly. Like there should be no, this should be it. Hmm. Yeah, yeah. Let's just try it. Like we're gonna get a mistake somewhere like a crash. Nope, nope. Okay. All right. Actually training. So for real, like, these scores, right? So we're training. So for real, like, these scores, right here, the fact what made them a mask is that we discretize them right here. So we made them into a mask right here. We're not doing that anymore. So we're just training floats. And then we're also not multiplying it by the weight, we are just using those floats, which means that we are using the a basically a neural network. And then here, the bias, I was worried about the bias, but the bias is always zero, as you can see here. So the bias is always false. Yeah, so we're training five different neural networks for five different tasks. And, you know, according to my hypothesis, these mask things are just kind of crude, quantized ways of training neural networks. And if, if my hypothesis is correct, this here is going to turn out probably even better than this masked thing. Okay, so last task training right here, laptop starting to breathe. Good laptop, fast laptop. Very nice. Come on, come on, come on. And we're done. So again, we have an average top one performance of 92. Is this even did I even Oh, no, I ran this right here. Okay. Like, that's the exact same number it was last time. So we need to run inference again. And if we're given the task ID, then we are at 93.9%. So we increase slightly. Increase slightly, which might just be due to the fact that we initialize terribly, terribly. Okay. So what does it say about our task inference accuracy? Maybe there's some mask here. Set model task, the alphas are to one. Nope. No, we're good. We're good. Task inference accuracy, 100%. And I'm going to guess well, with the task inference accuracy being 100%. I'm going to guess this here will give us the exact same number. I like the 93 point some percent. So yeah, 93.9%. So I'm, you know, I'm going to say right here that the on the super masks and the superposition really are two separate ideas, right? You it's, it's because the paper is like, it sounds cool and all with the super mask and superposition. But this inference using the superposition, and then the entropy to decide is really one idea. And training different supermat, the advantage in using supermask is, of course, that the model is way smaller. So you can remember it much more easily. But also, you know, that it's really different. It there's, there's nothing to do with the superposition. Yeah. All right. So I'm going, I'm going to guess this also works for, you know, 200 tasks and whatnot, the higher order of tasks. So I think that's it. And we're done here. Yeah.
[{"start": 0.0, "end": 6.16, "text": " Hi there, today we'll look at super masks in superposition again. So this is part two of this"}, {"start": 6.16, "end": 13.32, "text": " paper by Mitchell Wurzman and Vivek Ramanujan. And here's the reason why there's a part two. So after"}, {"start": 13.32, "end": 20.8, "text": " yesterday's video on this paper, I like I couldn't sleep because I really felt that I had left out"}, {"start": 20.8, "end": 26.080000000000002, "text": " some important aspects that I wanted to touch on during the video. Now sometimes during videos,"}, {"start": 26.08, "end": 32.4, "text": " I look at the clock and I realize like, oh, crap, the video is already like an hour long. And I know"}, {"start": 32.4, "end": 38.36, "text": " people are watching on 2x speed anyway. But still, it's like too long. And I need to wrap it up really"}, {"start": 38.36, "end": 44.4, "text": " soon. And what I felt were pretty important messages about this paper got lost. So specifically,"}, {"start": 44.4, "end": 50.4, "text": " I want to address three different things. First of all, they have like a formal analysis, not a"}, {"start": 50.4, "end": 57.16, "text": " formal, but a kind of more rigorous analysis of what their modified G objective does. And I also"}, {"start": 57.16, "end": 62.519999999999996, "text": " want to give some intuition in that because I felt I felt I really hadn't done a good job at that."}, {"start": 62.519999999999996, "end": 71.36, "text": " The second part is that the the two different ideas right here being the super masks and the"}, {"start": 71.36, "end": 79.92, "text": " superposition. And I think my opinion is sort of that these are two separate things. And they really"}, {"start": 79.92, "end": 84.96000000000001, "text": " have nothing to do with each other. And I think that didn't really come through last video. And"}, {"start": 84.96000000000001, "end": 91.8, "text": " the third one being the broader impact statement of this paper, which I you know, I usually kind"}, {"start": 91.8, "end": 99.12, "text": " of gloss over it and go like, haha, but I hear there is an important point to it. So yeah,"}, {"start": 99.12, "end": 105.36, "text": " we'll get to that. Alright, so again, not a new paper today, I realized this, but I think it's"}, {"start": 105.36, "end": 112.64, "text": " worth kind of diving deeper into this paper, which is a very cool paper. You know, so so don't don't"}, {"start": 112.64, "end": 118.08, "text": " get me wrong right here. And I feel mostly I haven't done a good part at explaining it like,"}, {"start": 118.08, "end": 127.44, "text": " literally lying awake. Okay, so let's go to the first point. We had this. So if you hadn't seen"}, {"start": 127.44, "end": 132.88, "text": " the first video, super masks and superposition basically says that we want to do lifelong"}, {"start": 132.88, "end": 138.64, "text": " learning. And we want to do lifelong learning by lifelong learning is the task where you have a"}, {"start": 138.64, "end": 144.24, "text": " bunch of tasks in sequence and you learn them in sequence. So one after the other. And basically,"}, {"start": 144.24, "end": 151.51999999999998, "text": " the goal is to not forget tasks. Once new, you learn new tasks. And this model does it by always"}, {"start": 151.51999999999998, "end": 158.07999999999998, "text": " building one of these super masks for each task that is applied to the same randomly initialized"}, {"start": 158.08, "end": 165.20000000000002, "text": " base neural network each time. And you know, by by keeping the super mask around, you won't forget"}, {"start": 165.20000000000002, "end": 170.0, "text": " the task. And then at inference time, if you're given the task and just retrieve the mask, if"}, {"start": 170.0, "end": 174.72000000000003, "text": " you're not given the task, you can do this superposition trick where you apply all the"}, {"start": 174.72000000000003, "end": 181.20000000000002, "text": " masks in a superposition. And then you look at sort of the gradient of an entropy function in"}, {"start": 181.2, "end": 188.32, "text": " order to decide which task reduces the entropy the most. So which task is the most certain about a"}, {"start": 188.95999999999998, "end": 194.0, "text": " particular data point, and that you you kind of infer that that's the task you're going to go with."}, {"start": 194.88, "end": 201.92, "text": " So instead of the entropy, which is, you know, well reasoned, they had this other objective they"}, {"start": 201.92, "end": 211.44, "text": " call a G, and G basically looks at the it's really strange, it looks at the superfluous neurons. So"}, {"start": 211.44, "end": 220.48, "text": " they also add the superfluous neurons, these s neurons right here. And they, they did g objective"}, {"start": 220.48, "end": 227.44, "text": " will only look at the s neurons in order to decide whether or not that's the correct task. And it's"}, {"start": 227.44, "end": 232.96, "text": " basically just the log sum x of the s neurons. And we had some intuition about them being, you know,"}, {"start": 232.96, "end": 238.24, "text": " all small and so on them being like outlier detectors. But there is an entire chapter in"}, {"start": 238.24, "end": 245.6, "text": " the appendix where the authors do a sort of more in depth theoretical analysis of that, which,"}, {"start": 245.6, "end": 254.64, "text": " you know, I, it's not not necessary to do this for them. So I really enjoy, I enjoyed reading that."}, {"start": 254.64, "end": 262.71999999999997, "text": " And that gave me sort of the better intuition of what this g objective does. So here they say,"}, {"start": 263.44, "end": 269.12, "text": " the aim is not to formally prove properties of the algorithm. Rather, we hope that a more"}, {"start": 269.12, "end": 275.84, "text": " mathematical language may prove useful in extending intuition. Okay. So again, that's,"}, {"start": 275.84, "end": 281.91999999999996, "text": " that's pretty cool. So they start off by saying, you have your neural network is basically W, and"}, {"start": 281.92, "end": 290.64000000000004, "text": " the, the sorry, the it's, it's this phi right here. And the W are the last layers weights, which"}, {"start": 290.64000000000004, "end": 296.48, "text": " compute your logits. So y is going not to be your class, but y is going to be your logits. And p is"}, {"start": 296.48, "end": 303.68, "text": " going to be the probability vector over your class, which if the you calculate this via a softmax is"}, {"start": 303.68, "end": 313.2, "text": " going to be the following expression right here. If you have a mask, right, then at least in the"}, {"start": 313.2, "end": 320.48, "text": " last layer, you can in you can infer it as this right here. So you multiply the mask by the last"}, {"start": 320.48, "end": 329.68, "text": " these weights, and then that gives you your logits. So they say here with they initialize"}, {"start": 329.68, "end": 335.2, "text": " the weights right here, actually, they initialize the they have no bias term and initialize the"}, {"start": 335.2, "end": 341.12, "text": " weights by this constant. So plus minus this constant, it's not really necessary to do that,"}, {"start": 341.12, "end": 347.52, "text": " but they do it right here makes the analysis also a bit easier. I guess it just works more well."}, {"start": 347.52, "end": 352.48, "text": " If you have these masks in superposition, of course, you want to add all of these masks with"}, {"start": 352.48, "end": 358.08, "text": " the respective alpha weighting factor, then multiply by the weights, and that gives you"}, {"start": 358.08, "end": 367.12, "text": " your logits. So note that this this doesn't necessarily only only have to be the last"}, {"start": 367.12, "end": 373.68, "text": " layer's weights right here. You can view that as any sort of weights of the neural network if you"}, {"start": 373.68, "end": 379.84, "text": " formulate this phi correctly. So you don't think that they only apply the mask to the last layer,"}, {"start": 379.84, "end": 385.84, "text": " they do apply the mask to the entire thing. Alright, now the the important part here is"}, {"start": 385.84, "end": 392.56, "text": " what happens if we look at the derivative of G with respect to one of the alphas and take the"}, {"start": 392.56, "end": 399.12, "text": " maximum negative derivative of that G, which is that mysterious function that only looks at the"}, {"start": 399.12, "end": 407.52, "text": " at the at the superfluous neurons. So what they want, they kind of construct this G by principle."}, {"start": 407.52, "end": 417.59999999999997, "text": " What they say is, we want a function g that mimics the supervised loss, right? We want a function g"}, {"start": 417.59999999999997, "end": 424.15999999999997, "text": " that is kind of equal like the supervised loss if we had the task ID, right? And that's, that's"}, {"start": 424.15999999999997, "end": 431.59999999999997, "text": " pretty cool. Because, you know, the, the supervised loss, you sort of need all the information you"}, {"start": 431.6, "end": 439.36, "text": " need the label, you need, you need all the all the you need the task ID. So the supervised loss"}, {"start": 439.36, "end": 449.28000000000003, "text": " is unavailable. But we want a function g that in its gradient mimics the supervised loss. So they"}, {"start": 449.28000000000003, "end": 454.96000000000004, "text": " go about constructing this right here. They say, lemma first lemma, it's possible to construct a"}, {"start": 454.96000000000004, "end": 460.08000000000004, "text": " function g such that the gradient matches the gradient from the supervised loss for all the"}, {"start": 460.08, "end": 467.35999999999996, "text": " supervised loss for all s neurons. So for all the superfluous neurons, specifically, we want that"}, {"start": 467.35999999999996, "end": 472.47999999999996, "text": " the gradient with respect to the logits, if the gradient to the logits is equal, that means the"}, {"start": 472.47999999999996, "end": 477.52, "text": " gradient to all the rest of the network is equal because the rest of the network goes through the"}, {"start": 477.52, "end": 482.4, "text": " logits, right? The gradient through the logits is equal to the gradient of the supervised loss"}, {"start": 482.4, "end": 489.84, "text": " to the logits for all the superfluous neurons and zero otherwise. So they say the zero otherwise is"}, {"start": 489.84, "end": 498.08, "text": " pretty easily done in math, you know, simply set it to zero, and in the actual code, which you can"}, {"start": 498.08, "end": 504.88, "text": " achieve like this, where m indicates the superfluous neurons. So this is just, this is just"}, {"start": 504.88, "end": 513.12, "text": " multiplied here, and the other ones are detached. So there is no gradient flowing. This is the"}, {"start": 513.12, "end": 519.04, "text": " property that we only look at the superfluous neurons. And now we are going to show that the"}, {"start": 519.04, "end": 529.04, "text": " gradient is going to be equal. So they say if you had the supervised loss, which means if you have"}, {"start": 529.04, "end": 537.12, "text": " the label, then this would be your cross entropy loss, okay, so you cross it divides into this part"}, {"start": 537.12, "end": 542.7199999999999, "text": " where you need the label, and then this part here, you don't need the label. Now, you can pretty say"}, {"start": 542.72, "end": 550.1600000000001, "text": " pretty much say, look, the label is certainly going to be one of not the superfluous neurons,"}, {"start": 550.1600000000001, "end": 556.24, "text": " because the superfluous neurons are superfluous, they are never the correct neuron. So this is"}, {"start": 556.24, "end": 562.4, "text": " always going to be, you know, not the not the neurons we look at. So the gradient certainly,"}, {"start": 562.4, "end": 568.5600000000001, "text": " this is always going to be zero, because we never we, wherever the gradient is flowing,"}, {"start": 568.56, "end": 578.4, "text": " that's not where the where this is one. So the gradient of any superfluous neuron is just"}, {"start": 579.1199999999999, "end": 586.7199999999999, "text": " this thing right here. And that's exactly why they build the function g. So the function g"}, {"start": 586.7199999999999, "end": 593.68, "text": " has this exact gradient, the function g, if you derive it has that same gradient as the supervised"}, {"start": 593.68, "end": 602.4, "text": " loss for the superfluous neurons. Okay, so it's sort of magic, but it's not, you know, it's not"}, {"start": 602.4, "end": 609.92, "text": " magic. So they need two more assumptions here to have to get the following properties. So the for"}, {"start": 609.92, "end": 618.8, "text": " the first property, now because now we want to have g be identifying the correct task. So we've"}, {"start": 618.8, "end": 624.3199999999999, "text": " already constructed g, now we want to show that if we really do this, the gradient with respect to"}, {"start": 624.3199999999999, "end": 634.16, "text": " the alphas, then if we do it for a wrong task for the tasks that it's not the task of that particular"}, {"start": 634.16, "end": 640.4799999999999, "text": " data point that goes into computing g, then we'll get a value that's probably lower than zero."}, {"start": 640.48, "end": 648.24, "text": " However, if we plug in if we derive, but with respect to the alpha of the correct task, then we"}, {"start": 648.24, "end": 655.36, "text": " get a gradient, a negative gradient that's higher than zero. Okay, so we're now going to prove that"}, {"start": 655.36, "end": 662.88, "text": " this with high probability really allows us to distinguish the correct task from the wrong task."}, {"start": 663.9200000000001, "end": 668.48, "text": " We need two assumptions right here. Assumption one is we assume that the mask learn on the"}, {"start": 668.48, "end": 676.24, "text": " task i will be independent from the data from task j. If the task data is from task j, then"}, {"start": 676.24, "end": 684.96, "text": " this are independent random variables. Okay, so it sort of means that the the tasks themselves are"}, {"start": 684.96, "end": 692.24, "text": " kind of independent. But it's not it's it's not the same requirement. But you can think of in in"}, {"start": 692.24, "end": 700.16, "text": " the case of permuted MNIST or so this is some it's given except if you consider this kind of"}, {"start": 700.16, "end": 706.96, "text": " frequency of brightness and so on. But if you have independent tasks, I think that this is given."}, {"start": 708.0, "end": 715.2, "text": " That means that the features right here and the masks are independent variable. If if the data"}, {"start": 715.2, "end": 721.9200000000001, "text": " is from task j, then the features and the mask from task i are independent variables, sorry. The"}, {"start": 721.9200000000001, "end": 726.5600000000001, "text": " second assumption you need is that we assume that a negative weight and the positive weight are"}, {"start": 726.5600000000001, "end": 733.76, "text": " equally likely to be masked out. Okay, so this again, you can think of with some regularity."}, {"start": 734.32, "end": 739.36, "text": " This is certainly going to be to be given in a randomly initialized neural network."}, {"start": 739.36, "end": 747.04, "text": " Note that when the features are zero, which will be the case for zero mean random features. Yeah,"}, {"start": 747.04, "end": 752.48, "text": " so yeah, before I said this was your neural network, this is your random neural network,"}, {"start": 752.48, "end": 759.92, "text": " right? And then you mask that and so on. If this is a randomly initialized neural network, then you"}, {"start": 759.92, "end": 769.28, "text": " can make a case that the expected features of those will be zero. It doesn't need to be the case,"}, {"start": 769.28, "end": 775.5999999999999, "text": " but you can you can construct it such that it is so if you have the two things, right, if you have"}, {"start": 775.5999999999999, "end": 784.3199999999999, "text": " those two things, then you can prove the following. If the data x comes from task j, then when you"}, {"start": 784.32, "end": 791.0400000000001, "text": " derive by an alpha, that's not of task j, you get a number that's smaller than zero in expectation."}, {"start": 791.84, "end": 799.12, "text": " And here, the crucial part is you reframe this gradient, you reframe, reframe, reframe."}, {"start": 800.32, "end": 810.4000000000001, "text": " And what you'll see is that this here comes out. So this is a sum and each element of the sum"}, {"start": 810.4, "end": 815.1999999999999, "text": " is going to be greater or equal to zero, which means that this thing is greater or equal to zero,"}, {"start": 815.1999999999999, "end": 820.72, "text": " which means the negative thing is smaller than zero in lemma h1. Now we're going to look at"}, {"start": 820.72, "end": 830.8, "text": " lemma h1 to get an intuition of what's going on right here. So lemma h1 says if j is the true task"}, {"start": 830.8, "end": 839.6, "text": " and i is not equal to j, then this quantity here is greater than zero. So lemma h1 is the"}, {"start": 839.6, "end": 846.24, "text": " greater than zero. Alright, I restarted my tablet and we are back. So what's kind of the the"}, {"start": 846.24, "end": 855.2, "text": " intuition behind why this quantity here would be greater or equal to zero. And honestly, in order"}, {"start": 855.2, "end": 864.08, "text": " to make it a bit easier, I first want to look at whenever i equals j. So whenever j is the true"}, {"start": 864.08, "end": 871.44, "text": " task, and then i equals j, then we can sort of think of the opposite, like why, why this should"}, {"start": 871.44, "end": 880.96, "text": " be smaller or equal to zero. So consider this, this is the run the feature of the network of u,"}, {"start": 880.96, "end": 892.5600000000001, "text": " right. And then the uv connects that to the to the masket point v and the masket point at that point"}, {"start": 892.56, "end": 899.4399999999999, "text": " uv is either zero or one depending on the training. So this, this zi right here,"}, {"start": 900.9599999999999, "end": 906.88, "text": " that's going to be the from the initialization, but the mask is going to be zero or one depending"}, {"start": 906.88, "end": 913.3599999999999, "text": " on whether that feature contributes, sorry, whether this entire thing here contributes"}, {"start": 913.3599999999999, "end": 920.9599999999999, "text": " positively to the task or not. So the secret right here, why we can make a claim that this is greater"}, {"start": 920.96, "end": 928.96, "text": " or lower than zero is going to be that the mask can only be zero or one, it cannot be negative one,"}, {"start": 928.96, "end": 938.0, "text": " right. So if the mask is zero, then obviously this thing is going to be zero. However, if the mask is"}, {"start": 938.0, "end": 944.4000000000001, "text": " one, what does it mean? If the mask is one, that means that this this entire feature right here,"}, {"start": 944.4, "end": 955.36, "text": " let's call it f is positively impacting is positively contributing to this particular"}, {"start": 955.36, "end": 963.4399999999999, "text": " neuron right here. So if the mask is one, this is this, it means the addition of that feature,"}, {"start": 963.4399999999999, "end": 972.56, "text": " more of that feature makes that logit go up. Okay, so if the mask is one during training,"}, {"start": 972.56, "end": 978.8, "text": " it means that the feature positively contributes to the task. So if we look at the gradient with"}, {"start": 978.8, "end": 984.56, "text": " respect to this function with respect to the logit, and the function basically means it's just"}, {"start": 984.56, "end": 995.4399999999999, "text": " measures, measures how high these superfluous logits are, then what, why do we find a negative"}, {"start": 995.44, "end": 1002.4000000000001, "text": " interaction there? Because if you look at the neural network, and you forward pass, and this"}, {"start": 1002.4000000000001, "end": 1010.0, "text": " particular feature is important. And you look at the loss G and you backward pass through the"}, {"start": 1010.0, "end": 1017.2, "text": " logits. If it is smaller than zero, that means that there is a negative interaction right here."}, {"start": 1017.2, "end": 1027.44, "text": " So that basically means that if we make this feature higher, then in this case, we make this"}, {"start": 1027.44, "end": 1037.68, "text": " g function go lower, okay. And that is the case for the correct task. Because if this is the correct"}, {"start": 1037.68, "end": 1049.44, "text": " task, and the mask is learned adequately, that means it should assign a low weight to the"}, {"start": 1049.44, "end": 1057.6000000000001, "text": " superfluous neuron whenever the input features, you know, are of that task. And so it makes sense"}, {"start": 1057.6000000000001, "end": 1066.0, "text": " that this here would be a negative number. Because what we want if the mask deems the feature"}, {"start": 1066.0, "end": 1074.32, "text": " is small, we want that if the feature goes up, G goes down. And that's exactly why we have the"}, {"start": 1074.32, "end": 1081.12, "text": " negative interaction right here, right? So the negative comes from this being negative. I hope"}, {"start": 1081.12, "end": 1086.88, "text": " this sort of makes sense. So if the mask is one, the mask says, basically, if that feature goes"}, {"start": 1086.88, "end": 1092.96, "text": " up, the loss goes down. Now G is a measure of the superfluous neurons, the superfluous neurons"}, {"start": 1092.96, "end": 1100.0, "text": " small if the loss is small. So if this is really from the task, and this feature is really useful,"}, {"start": 1100.0, "end": 1105.8400000000001, "text": " that means if we increase the feature, the g function should go down. And therefore,"}, {"start": 1105.8400000000001, "end": 1114.48, "text": " this product here is going to be most likely negative, okay. And the contrary is, you know,"}, {"start": 1114.48, "end": 1122.64, "text": " analogous right here, if this is not of this task, the mass can either be zero or one, right? If it's"}, {"start": 1122.64, "end": 1129.68, "text": " zero, then this quantity is zero. However, if it's one, it's more likely that the that there,"}, {"start": 1130.24, "end": 1138.72, "text": " the feature here, because it's i is not the correct task, which basically means that this feature,"}, {"start": 1139.76, "end": 1145.2800000000002, "text": " it is for a different task, it is good for a different task. So the mask of that different"}, {"start": 1145.2800000000002, "end": 1150.3200000000002, "text": " task says it's good right here. And we have no reason to believe that this would decrease the"}, {"start": 1150.32, "end": 1157.36, "text": " loss of the loss of this particular data point in this task. So it's kind of the inverse reasoning."}, {"start": 1158.56, "end": 1167.52, "text": " If you look at the actual derivation here, it's fairly long. And it goes over the cases of the"}, {"start": 1167.52, "end": 1172.6399999999999, "text": " interactions between actually this initialization and the mask. So the initialization can be"}, {"start": 1172.64, "end": 1183.0400000000002, "text": " positive or negative, as you can see right here. And I think, I just think that the, the intuition"}, {"start": 1183.0400000000002, "end": 1191.6000000000001, "text": " here is that the superfluous neurons react differently to a data point of the trained task,"}, {"start": 1191.6000000000001, "end": 1200.64, "text": " because they have been kind of made to decrease for that task. And for that particular mask,"}, {"start": 1200.64, "end": 1206.24, "text": " as they do for when the data point doesn't match the mask, when the data point doesn't match the"}, {"start": 1206.24, "end": 1213.3600000000001, "text": " mask, there is no reason for the logits of the superfluous neurons to be low. And if the data"}, {"start": 1213.3600000000001, "end": 1220.88, "text": " point task does match the mask, there is ample reasons for those to be low. I hope that sort of"}, {"start": 1220.88, "end": 1226.64, "text": " makes sense. It is sort of it's a bit more of an intuition. But if you really want to dig into it,"}, {"start": 1226.64, "end": 1234.4, "text": " look at the derivation right here. Okay. Second point is the fact that the masks and the"}, {"start": 1234.4, "end": 1239.76, "text": " superpositions don't really have to do anything with each other. And that's, you know, I've said"}, {"start": 1239.76, "end": 1245.1200000000001, "text": " throughout the video, like, remember, these tasks are super easy, yada, yada, yada. So let me make"}, {"start": 1245.1200000000001, "end": 1253.68, "text": " it clear. In this in this diagram right here, the super masks, these are simply a way to train a"}, {"start": 1253.68, "end": 1260.0, "text": " neural network in a crude way, right? I don't think there is, you know, this distinction between mask"}, {"start": 1260.0, "end": 1266.4, "text": " and network. I don't really like that much, because ultimately, what you're doing is simply"}, {"start": 1266.4, "end": 1273.1200000000001, "text": " you're training a neural network in a kind of weird way. Okay, the fact that you always use the"}, {"start": 1273.1200000000001, "end": 1279.76, "text": " same underlying, you know, gray neural network doesn't really matter right here. It's still,"}, {"start": 1279.76, "end": 1284.56, "text": " what you do in the super mask training is you provide a severely over parameterized network,"}, {"start": 1284.56, "end": 1289.2, "text": " and then the mask simply gets to choose which weights to mix, rather than you get to adjust"}, {"start": 1289.2, "end": 1295.12, "text": " the weights. If you adjust the weights, you usually get more accurate than with the mask, but"}, {"start": 1295.12, "end": 1300.56, "text": " it's sort of like a quantized neural network that you train right here. So that's the super mask"}, {"start": 1300.56, "end": 1305.44, "text": " thing. Again, I don't think it's important that the underlying network is always the same. The"}, {"start": 1305.44, "end": 1313.3600000000001, "text": " only advantage you have is it saves space, because these masks are very small. The super masks, on"}, {"start": 1313.3600000000001, "end": 1321.28, "text": " the other hand, this idea that you overlay all of the masks together, and then you look at where"}, {"start": 1321.28, "end": 1329.1200000000001, "text": " this at the gradient of the entropy, and you look at which of the of the mixing factors the gradient"}, {"start": 1329.12, "end": 1335.4399999999998, "text": " pulls the most. That's a different idea. And the question here is, wouldn't that isn't that"}, {"start": 1335.4399999999998, "end": 1342.1599999999999, "text": " independent does really depend on the masks, or doesn't it? And the you know, the hypothesis would"}, {"start": 1342.1599999999999, "end": 1347.52, "text": " be that if I simply train, you know, three different neural networks for three different"}, {"start": 1347.52, "end": 1353.04, "text": " tasks, could I not do the same superposition trick? Like, could I not just add all of them"}, {"start": 1353.04, "end": 1359.44, "text": " with a respective alpha, look at the entropy, calculate the gradient with respect to each of"}, {"start": 1359.44, "end": 1364.96, "text": " the alphas of the entropy and then decide which task it is, you know, don't need masks, simply mix"}, {"start": 1364.96, "end": 1372.32, "text": " neural networks in superposition. So I did it. And I actually tried their code is available. So big"}, {"start": 1372.32, "end": 1378.08, "text": " props for their code being available. I tried their code. It's actually very few changes. And"}, {"start": 1378.08, "end": 1385.4399999999998, "text": " I'm going to append my live coding of this at the end of this video. So if you want to, if you are"}, {"start": 1385.4399999999998, "end": 1391.28, "text": " interested in watching that you can do so. But you know, the outcome is if I train neural networks,"}, {"start": 1391.28, "end": 1396.24, "text": " and I have, I've, you know, done super quick, and initialize them wrongly, probably in all,"}, {"start": 1396.24, "end": 1402.72, "text": " but if I train these neural net, if I train the masks, you get to like 92% accuracy in their tasks,"}, {"start": 1402.72, "end": 1407.52, "text": " in each of the tasks, and then also in the average, if I train the actual neural networks,"}, {"start": 1407.52, "end": 1413.6000000000001, "text": " I get to a higher accuracy, like 93 something, it doesn't matter, it's just higher, okay. So that's"}, {"start": 1413.6000000000001, "end": 1419.76, "text": " hypothesis one is the training masks is just a way of training neural networks, the fact that"}, {"start": 1419.76, "end": 1426.8, "text": " the masks and the network training itself are that close, I think is a testament to how easy"}, {"start": 1426.8, "end": 1434.48, "text": " these tasks are, like how easy MNIST is. I'm going to also hypothesize that if the task gets harder"}, {"start": 1434.48, "end": 1442.56, "text": " and harder, and I don't mean 10 class ImageNet, I mean, 1000 class ImageNet, then these masks are"}, {"start": 1442.56, "end": 1447.52, "text": " going to degrade severely versus training the actual neural network. I might be wrong. I mean,"}, {"start": 1447.52, "end": 1453.9199999999998, "text": " you can overparameterize really heavily, and they will still work. Okay, but in any case, I trained"}, {"start": 1453.92, "end": 1458.5600000000002, "text": " the train these neural networks, and they reached higher accuracy. And then I did the exact same"}, {"start": 1458.5600000000002, "end": 1464.3200000000002, "text": " thing, I laid them in superposition to determine what task it is. And I could achieve the exact"}, {"start": 1464.3200000000002, "end": 1470.64, "text": " same result. So here in their example, they have 100% task classification accuracy, and I reached"}, {"start": 1470.64, "end": 1479.04, "text": " the exact same thing code worked. I'm not going to try to scale this up to 250 or 2500 tasks,"}, {"start": 1479.04, "end": 1486.8799999999999, "text": " but I'm going to assume that with, you know, tuning and stuff, that it's going to work about equally"}, {"start": 1486.8799999999999, "end": 1492.8, "text": " well, you could make an argument that the masks being sparser, they might be differentiated from"}, {"start": 1492.8, "end": 1501.36, "text": " each other more accurately. But I'm not sure, maybe, but it's not a cool, it's not a qualitative"}, {"start": 1501.36, "end": 1509.04, "text": " difference, right? So these two things are really two separate ideas that find their way together in"}, {"start": 1509.04, "end": 1521.36, "text": " this paper, but ultimately have not much to do with each other. Okay. At least that's from what I can"}, {"start": 1521.36, "end": 1527.9199999999998, "text": " tell, I might I might be wrong here. And I might be wrong with respect to their G objective and"}, {"start": 1527.92, "end": 1536.48, "text": " whatnot. And, you know, but I think that that these are two cool ideas, but they can be applied"}, {"start": 1536.48, "end": 1544.64, "text": " independently. So the last thing I want to look at is their broader impact statement right here."}, {"start": 1544.64, "end": 1550.8000000000002, "text": " Now, there is a reason. So usually, I kind of track these broader impact statement, because I"}, {"start": 1550.8000000000002, "end": 1555.76, "text": " think this this is this here is sort of fundamental research, right? This is fundamental machine"}, {"start": 1555.76, "end": 1560.72, "text": " learning research, we do architecture, we do multitask learning task isn't really important,"}, {"start": 1560.72, "end": 1566.32, "text": " as long as we have kind of the same tasks right here on correlated and so on the same hardness."}, {"start": 1566.32, "end": 1570.72, "text": " And I've also made the point that it's really important for these tasks to be the same hard"}, {"start": 1570.72, "end": 1579.2, "text": " for this to work in this place a role right here. So they do they do describe some of this in this"}, {"start": 1579.2, "end": 1586.0, "text": " conclusion with, you know, limitation that we observed has to do with task identity inference,"}, {"start": 1586.0, "end": 1592.0, "text": " when models are not well calibrated models that are overly confident for the wrong task. Okay. So"}, {"start": 1592.72, "end": 1603.52, "text": " in order for them to infer the correct task, they the sort of, so if you look at your entropy of the"}, {"start": 1603.52, "end": 1609.92, "text": " models for the tasks, that means you're going to select the model that is the most sure about the"}, {"start": 1609.92, "end": 1617.12, "text": " task. This only works if the tasks are equally hard, okay, if one task is much, much harder than"}, {"start": 1617.12, "end": 1622.16, "text": " the other task, this other task is always going to say, well, I'm really confident about this one,"}, {"start": 1622.16, "end": 1626.4, "text": " because the task is just easier, it's going to be, it's going to train a neural network is"}, {"start": 1626.4, "end": 1634.16, "text": " generally more confident, and you're going to misclassify a lot of the tasks. So, so here, what"}, {"start": 1634.16, "end": 1638.88, "text": " does this have to do with the broader impact statement? If you look at the broader impact"}, {"start": 1638.88, "end": 1648.48, "text": " statement, what they say right here. So they say, a goal of continue learning self-many tasks with a"}, {"start": 1648.48, "end": 1652.72, "text": " single model, however, it is not exactly clear what qualifies as a single model, therefore,"}, {"start": 1652.72, "end": 1658.72, "text": " a concrete objective has become to learn many tasks as efficiently as possible. We believe that"}, {"start": 1658.72, "end": 1663.76, "text": " sub-sub is a useful step in this direction. However, there are consequences to more efficient"}, {"start": 1663.76, "end": 1669.52, "text": " models, both positive and negative. So this is sort of what the community does. So there are"}, {"start": 1669.52, "end": 1674.4, "text": " three things that I've seen so far in broader impact statement. First, some people say this is"}, {"start": 1674.4, "end": 1681.3600000000001, "text": " not applicable to us, which I agree for most fundamental research, broader, like the broader"}, {"start": 1681.36, "end": 1687.36, "text": " impact statement is supposed to be what does this particular method? How will this influence broader"}, {"start": 1687.36, "end": 1696.1599999999999, "text": " society? So not applicable, completely valid for most of these research papers, because guess what"}, {"start": 1696.1599999999999, "end": 1705.4399999999998, "text": " you can use any method to do good or to do bad. And that's, that's the second, second part. Second"}, {"start": 1705.44, "end": 1711.68, "text": " method is basically, you just say generic statements, how you can do good and bad. And"}, {"start": 1711.68, "end": 1718.0800000000002, "text": " usually, you can't relate it to your particular method in the paper, right? Because your method is,"}, {"start": 1718.0800000000002, "end": 1726.0, "text": " I don't know, like my faster convergence rate of SGD. But, and so what you do is you just go one"}, {"start": 1726.0, "end": 1731.04, "text": " level up, you go up the levels. So it's like optimization can be used for good and for bad."}, {"start": 1731.04, "end": 1735.76, "text": " I mean, that's still kind of a bit vague. And then you go up further, well, optimization can do more"}, {"start": 1735.76, "end": 1741.28, "text": " machine learning. And machine learning can be used to do good and bad, for example, face recognition"}, {"start": 1741.28, "end": 1745.36, "text": " and things like this. So you just go up the levels. And that's what they essentially do here. And"}, {"start": 1745.36, "end": 1751.52, "text": " that's what, you know, most people have defaulted to. It's like, okay, so, you know, our model here"}, {"start": 1751.52, "end": 1757.84, "text": " is, you know, we, it basically one can train more efficient models, and then they simply highlight"}, {"start": 1757.84, "end": 1763.36, "text": " what more efficient models can do. Efficient models require less compute. Efficient model by"}, {"start": 1763.36, "end": 1768.8, "text": " rerun on the end device. If models are more efficient, then large scale research is not"}, {"start": 1768.8, "end": 1774.3999999999999, "text": " limited to wealthier institutions. By the way, I also the broader impact statement, I believe,"}, {"start": 1774.3999999999999, "end": 1781.28, "text": " should be the impact on society, and not really on the research community itself. So I also,"}, {"start": 1781.28, "end": 1788.16, "text": " this, this is a bit shaky with respect to I'm really regarding what the broader impact statement"}, {"start": 1788.16, "end": 1795.12, "text": " should be. This is not my opinion. I'm, I'm trying to reflect everything I've read of guidance about"}, {"start": 1795.12, "end": 1801.92, "text": " what the broader impact statement should be. By the way, there is also method, method three, which"}, {"start": 1801.92, "end": 1805.92, "text": " is to simply tell me more about your paper in the broader impact statement, which I guess is the"}, {"start": 1805.92, "end": 1812.0, "text": " smart method, because the broader impact statement can be before the before the references. So it's"}, {"start": 1812.0, "end": 1817.1200000000001, "text": " in the main part, and people are required to read it, not like the appendix reviewers are not"}, {"start": 1817.1200000000001, "end": 1820.8000000000002, "text": " required to read the appendix reviewers are required to read the broader impact statement."}, {"start": 1820.8000000000002, "end": 1827.68, "text": " So I guess the smart authors will just try to cloak more information about their model in terms of a"}, {"start": 1827.68, "end": 1833.68, "text": " broader impact statement, I guess, well, whether that's smart is a different discussion. But here,"}, {"start": 1833.68, "end": 1840.5600000000002, "text": " they just, it's already defaulting, right? These, it's already the default people simply go level"}, {"start": 1840.5600000000002, "end": 1846.96, "text": " up, level up, level up until we can, you know, say something generic. And we will also highlight and"}, {"start": 1846.96, "end": 1852.0800000000002, "text": " discuss the negative consequences of models, which can efficiently learn many tasks and efficient"}, {"start": 1852.0800000000002, "end": 1857.76, "text": " models in general, when models are more efficient, they're also more available, and less subject to"}, {"start": 1857.76, "end": 1864.72, "text": " regularization as a study of result. For instance, when a high impact model is released, an institution"}, {"start": 1864.72, "end": 1871.2, "text": " will hopefully be accompanied by a model card, analyzing the bias and intended use of the model."}, {"start": 1871.2, "end": 1877.92, "text": " By contrast, if anyone is able to train a powerful model, this may no longer be the case, resulting"}, {"start": 1877.92, "end": 1883.12, "text": " in a proliferation of model with harmful biases or intended use. Taking the United States, for"}, {"start": 1883.12, "end": 1888.0, "text": " instance, bias can be harmful as models show disproportionately more errors for already"}, {"start": 1888.4799999999998, "end": 1895.36, "text": " marginalized groups furthering existing deeply rooted structural racism. This, this is like,"}, {"start": 1895.36, "end": 1904.6399999999999, "text": " well, technology, this is basically a statement about technology. And so why why do I have a"}, {"start": 1904.64, "end": 1913.2800000000002, "text": " particular not issue, but why do I pick this broader impact statement, they even read this here,"}, {"start": 1913.2800000000002, "end": 1918.24, "text": " this is this gender shades paper, right, where people went and they looked at these commercial"}, {"start": 1918.64, "end": 1927.76, "text": " API's for face recognition, I think that's the paper. Yeah, gender shades. So if you have a"}, {"start": 1927.76, "end": 1937.92, "text": " face recognizer, they realize they divided people up by I think, gender and race. So, you know,"}, {"start": 1937.92, "end": 1943.92, "text": " like they built four groups, or I haven't, I haven't, I've just looked at the paper, but in my"}, {"start": 1943.92, "end": 1949.36, "text": " understanding that they divided people up into groups, which I find arbitrary to have the these"}, {"start": 1949.36, "end": 1955.36, "text": " two axis race and gender, but okay, you can do that. And they discovered that these commercial"}, {"start": 1955.36, "end": 1962.1599999999999, "text": " API's have different accuracy for the different groups, right. And that basically our point is"}, {"start": 1962.56, "end": 1967.04, "text": " that, you know, these commercial API's, if they're offered for all humans, they should work equally"}, {"start": 1967.04, "end": 1976.6399999999999, "text": " well for all humans. Now, now you may be see what it has to do with this paper. Well, this paper is"}, {"start": 1976.6399999999999, "end": 1984.32, "text": " in the business of doing multi task learning. So it is very viable to actually frame the"}, {"start": 1984.32, "end": 1992.0, "text": " the task for example, like this is an example. If you frame the task of multitask learning,"}, {"start": 1992.0, "end": 1997.6, "text": " like face recognition on different groups of people as a multitask learning problem, you have,"}, {"start": 1997.6, "end": 2004.32, "text": " you know, group group one right here, group two, group three, and then if at inference time,"}, {"start": 2005.12, "end": 2009.4399999999998, "text": " so you can build, you know, good models for each of the group at inference time, you're given an"}, {"start": 2009.44, "end": 2014.72, "text": " image and you're trying to first which group is that from and then take the appropriate classifier,"}, {"start": 2014.72, "end": 2020.8, "text": " that would be, you know, that would be a good hypothetical classifier for this thing. Now,"}, {"start": 2020.8, "end": 2028.88, "text": " what do we know about this thing? This thing is fails if the tasks aren't equally hard."}, {"start": 2029.6000000000001, "end": 2038.0, "text": " Also, in in specifically, if if for one group, let's say for group three, the the task is way"}, {"start": 2038.0, "end": 2043.84, "text": " harder because you have less data. I guess the one of the main problems there is that the data sets"}, {"start": 2043.84, "end": 2050.4, "text": " are not equally balanced. If you have less data for that, then the task becomes de facto harder,"}, {"start": 2050.4, "end": 2060.24, "text": " and the model is less sure about the task, which means that it's a double whammy. So not only is"}, {"start": 2060.24, "end": 2067.3599999999997, "text": " the model itself less accurate, but these the input data point if the person is actually of"}, {"start": 2067.3599999999997, "end": 2074.64, "text": " group three is less likely to be classified correctly into the correct model at to begin with."}, {"start": 2074.64, "end": 2082.7999999999997, "text": " So, you know, for all the for all, I've had my share of comments on the video I made, and I still"}, {"start": 2082.7999999999997, "end": 2088.56, "text": " maintain that societal bias can comes about by data set. But for all the people saying there"}, {"start": 2088.56, "end": 2096.0, "text": " are models that exaggerate existing biases in models, this would be like if there is any"}, {"start": 2096.0, "end": 2102.32, "text": " ever any applicability of these broader impact statement guidelines, this would be the paper,"}, {"start": 2102.32, "end": 2108.24, "text": " right? It's this right here is an actual system that if I have different classifiers, and I"}, {"start": 2108.24, "end": 2115.92, "text": " combine them with this method, it will double punish the classifier that is less sure that is"}, {"start": 2115.92, "end": 2121.44, "text": " less accurate, because that is also going to be the one with the higher entropy, therefore not as"}, {"start": 2121.44, "end": 2128.32, "text": " much selected if I give a data point of that particular task. And so this is like a I'm not"}, {"start": 2128.32, "end": 2133.6, "text": " criticizing the method here, like by all means, like this is a cool method, where you can recognize"}, {"start": 2133.6, "end": 2140.56, "text": " that this happens and try to calibrate accordingly. But if there was ever any straight ball for a"}, {"start": 2140.56, "end": 2148.88, "text": " broader impact statement, I would, you know, this is it. And this, I'm not I'm not, I'm not saying"}, {"start": 2148.88, "end": 2155.2, "text": " that these these authors didn't do that for a reason. I believe that, look, it's been whatever,"}, {"start": 2155.2, "end": 2160.72, "text": " not even half a year since we've started with these general broader impact statements. And"}, {"start": 2160.72, "end": 2168.4, "text": " everybody is already defaulting to simply say technology, good technology, bad. That's, that's"}, {"start": 2168.4, "end": 2178.96, "text": " the people aren't even thinking. And so this, right, this is one of the reasons why I simply"}, {"start": 2178.96, "end": 2184.88, "text": " find these broader impact statements to be not that like not a good idea, because there is a"}, {"start": 2184.88, "end": 2190.4, "text": " default answer. And people are just putting it here, even in like when there is an actual,"}, {"start": 2190.4, "end": 2199.2000000000003, "text": " obvious, immensely obvious thing that they even they even cited, like the basis for that. So,"}, {"start": 2200.4, "end": 2209.2000000000003, "text": " you know, that's sort of my take on this. I, again, I enjoyed this paper, the code is is"}, {"start": 2209.2000000000003, "end": 2214.8, "text": " available, everything is good about this, this paper, I'm not even the fact that these are, you"}, {"start": 2214.8, "end": 2218.96, "text": " know, I think these are kind of two separate ideas, they're combined, cool, they're, they're"}, {"start": 2218.96, "end": 2226.7200000000003, "text": " combined, cool, they're analyzed formally in theory, there's intuition given all good. So"}, {"start": 2226.7200000000003, "end": 2235.04, "text": " don't get me wrong. This is not like trashing this paper. It's just, I felt I had some thing"}, {"start": 2235.04, "end": 2241.84, "text": " more to say. And I think that was it. So yeah, I'll see you next time with a new paper."}, {"start": 2241.84, "end": 2248.96, "text": " Okay, so our goal here is going to be to change this code to not use masks as mixtures, but"}, {"start": 2248.96, "end": 2256.2400000000002, "text": " actually use neural networks with real weights as as mixtures and in superposition with each other."}, {"start": 2256.2400000000002, "end": 2262.6400000000003, "text": " Okay, so what we're going to do is we're going to train the different neural networks, and then use"}, {"start": 2262.6400000000003, "end": 2268.96, "text": " this kind of superposition trick to figure out which task a data point came from. So,"}, {"start": 2268.96, "end": 2277.6, "text": " let's have a look at the code right here. And there's a bunch of helper code. And if we go down"}, {"start": 2277.6, "end": 2284.32, "text": " through everything, you'll see that this is the MNIST permuted data set. So each each task is"}, {"start": 2284.32, "end": 2292.96, "text": " basically a random permutation of MNIST. And if you execute, I believe this here, and then you"}, {"start": 2292.96, "end": 2299.04, "text": " train the model, and right now it's for five tasks, but I guess that's going to be enough for now."}, {"start": 2301.28, "end": 2309.44, "text": " Yeah, so if we get some good signal here, I guess it's a matter of of doing kind of engineering and"}, {"start": 2309.44, "end": 2316.56, "text": " plumbing and tuning if until you get it up to whatever 200 or 2000 tasks, though, I might be"}, {"start": 2316.56, "end": 2323.04, "text": " wrong there. So this is training and I short certainly sort of had a look at the code, but I"}, {"start": 2323.04, "end": 2332.24, "text": " haven't actually tried this yet. So the thing the model is built here, you see this this multitask"}, {"start": 2332.24, "end": 2338.88, "text": " fully connected, which has these different layers right here. And it's built by these multitask"}, {"start": 2338.88, "end": 2348.6400000000003, "text": " mask linear models. Now the multitask mask linear models are defined right here. So it's basically"}, {"start": 2348.6400000000003, "end": 2356.1600000000003, "text": " a linear model, as you can see, it's derived from a linear from a linear module. And it has a"}, {"start": 2356.1600000000003, "end": 2363.44, "text": " parameter called num tasks, and then it has a parameter scores, which I guess is are these"}, {"start": 2363.44, "end": 2372.16, "text": " these masks right here. And the scores, I'm going to guess are always going to be multiplied by the"}, {"start": 2372.16, "end": 2380.08, "text": " weights here in the forward. So you can see, in the forward, you get the weights from the alphas."}, {"start": 2382.08, "end": 2389.76, "text": " Yeah, this is the superimposed. Alright, so if we know the task ID down here, we get this subnet,"}, {"start": 2389.76, "end": 2395.92, "text": " and we are going to multiply it with the weights. If we don't know the task ID, we want to get these"}, {"start": 2395.92, "end": 2404.5600000000004, "text": " alphas. So the alphas are going to be one over the number of tasks at the beginning. We're then going"}, {"start": 2404.5600000000004, "end": 2414.6400000000003, "text": " to multiply each of the alphas with the weights. And with that, we're going to get this subnet mask"}, {"start": 2414.64, "end": 2422.56, "text": " with that we're going to get this subnet mask right here. So we need to know what this self dot"}, {"start": 2422.56, "end": 2430.24, "text": " stacked is. So the self dot stacked is getting right here in this cache mask, or simply stacking"}, {"start": 2430.24, "end": 2437.2, "text": " this this get subnet for all of the things. So our plan is going to be that this subnet right here is"}, {"start": 2437.2, "end": 2444.8799999999997, "text": " going to be the actual weights of the neural network, okay, and not just the not just the"}, {"start": 2445.4399999999996, "end": 2451.3599999999997, "text": " mask, and then we don't need to actually multiply it with the weight, we can just just forget about"}, {"start": 2451.3599999999997, "end": 2459.04, "text": " the weight, honestly, and just train the subnet. So for the subnet, as you can see here, you have"}, {"start": 2459.04, "end": 2465.68, "text": " this get subnet thing. And that's an autograd function, which basically means in the forward"}, {"start": 2465.68, "end": 2471.8399999999997, "text": " pass, you want to discretize it and in the backward pass, this is a straight through estimator. So our"}, {"start": 2471.8399999999997, "end": 2477.7599999999998, "text": " first task is going and this here should be done now my laptop has stopped breathing. So we've"}, {"start": 2477.7599999999998, "end": 2483.12, "text": " trained five tasks and now we can run inference on that. So this is when the task is given."}, {"start": 2483.12, "end": 2496.72, "text": " Real quick, you can see task one 92% 92% 92% 92%. So we have a an overall performance of 92.44%."}, {"start": 2496.72, "end": 2505.04, "text": " Then when the task is not given, we have two things to evaluate whether or not, basically,"}, {"start": 2505.04, "end": 2510.72, "text": " how good we are overall, and whether or not we get the tasks correct. Of course, the tasks are"}, {"start": 2510.72, "end": 2519.52, "text": " at this pre requirement. So we have 100% task inference accuracy. Okay, so we don't, we don't,"}, {"start": 2519.52, "end": 2524.24, "text": " okay, we can we could evaluate this here, but you can already see the output from last time, there's"}, {"start": 2524.24, "end": 2530.16, "text": " like no difference from the performance of the when the task is given, it's always being able to"}, {"start": 2530.16, "end": 2536.3999999999996, "text": " infer the task, we want to check out the same thing. So we want to change first of all this get"}, {"start": 2536.4, "end": 2541.92, "text": " subnet, this is where it's the scores are discretized. Now, given that these scores are"}, {"start": 2541.92, "end": 2547.44, "text": " going to be and to end up being our actual weights, we won't we don't do that we simply"}, {"start": 2547.44, "end": 2553.84, "text": " return the scores. Now this is this is pretty pointless right now, but we'll keep it just to be"}, {"start": 2553.84, "end": 2568.4, "text": " as close as possible to the to that. Now, mask in it. This is where we initialize the mask. Now,"}, {"start": 2569.84, "end": 2577.36, "text": " this is climbing uniform, and it has some thing but we want probably we want to train the neural"}, {"start": 2577.36, "end": 2585.76, "text": " initialized, you know, as we know it. So let's try what what are other initialized functions. So"}, {"start": 2585.76, "end": 2594.1600000000003, "text": " init dot, what do we have here? Do we have what's usual? I don't even know. Normal."}, {"start": 2595.92, "end": 2602.32, "text": " Saviour that that sounds about right. That sounds about right. All right. All right. So"}, {"start": 2602.32, "end": 2610.1600000000003, "text": " scores and yeah, let's try this. This could this could like break everything right if you initialize"}, {"start": 2610.1600000000003, "end": 2618.32, "text": " wrongly you get like dumb results. So okay, signed constant, yada yada yada."}, {"start": 2621.52, "end": 2622.7200000000003, "text": " Where is that used?"}, {"start": 2622.72, "end": 2629.8399999999997, "text": " Huh? Okay, that's also initializing something. So we calculate the gain and then"}, {"start": 2631.2, "end": 2641.12, "text": " Okay, this doesn't seem good. We'll just keep it. Hey, why not? Why not? Why not just keep it at that?"}, {"start": 2641.8399999999997, "end": 2649.52, "text": " All right. So cool. Oh, yeah, this is for the weight. Anyway, we won't use the weight"}, {"start": 2649.52, "end": 2655.68, "text": " at all of this layer, we'll just use our own weights. So here we have these stacked, okay,"}, {"start": 2655.68, "end": 2663.52, "text": " we get the scores. That's all good. Like, I'm pretty happy with that. I'm pretty happy with this"}, {"start": 2663.52, "end": 2668.0, "text": " mask in it that we make our parameters. So these are going to be our different neural networks that"}, {"start": 2668.0, "end": 2676.88, "text": " we train. This all looks good. The alphas look good. Now the only thing we need to do is to"}, {"start": 2676.88, "end": 2687.12, "text": " have not the weight times the subnet here, but the subnet as such like this. Is this it? Do we now"}, {"start": 2687.12, "end": 2697.76, "text": " train actual neural networks? I have my doubts, honestly. Like there should be no, this should be"}, {"start": 2697.76, "end": 2710.7200000000003, "text": " it. Hmm. Yeah, yeah. Let's just try it. Like we're gonna get a mistake somewhere like a crash. Nope,"}, {"start": 2710.7200000000003, "end": 2721.5200000000004, "text": " nope. Okay. All right. Actually training. So for real, like, these scores, right? So we're"}, {"start": 2721.52, "end": 2732.32, "text": " training. So for real, like, these scores, right here, the fact what made them a mask is that we"}, {"start": 2732.32, "end": 2737.28, "text": " discretize them right here. So we made them into a mask right here. We're not doing that anymore."}, {"start": 2737.28, "end": 2742.16, "text": " So we're just training floats. And then we're also not multiplying it by the weight, we are just"}, {"start": 2742.16, "end": 2749.68, "text": " using those floats, which means that we are using the a basically a neural network. And then here,"}, {"start": 2749.68, "end": 2755.6, "text": " the bias, I was worried about the bias, but the bias is always zero, as you can see here. So the"}, {"start": 2755.6, "end": 2762.96, "text": " bias is always false. Yeah, so we're training five different neural networks for five different"}, {"start": 2762.96, "end": 2771.04, "text": " tasks. And, you know, according to my hypothesis, these mask things are just kind of crude,"}, {"start": 2771.9199999999996, "end": 2779.6, "text": " quantized ways of training neural networks. And if, if my hypothesis is correct, this here is"}, {"start": 2779.6, "end": 2789.04, "text": " going to turn out probably even better than this masked thing. Okay, so last task training right"}, {"start": 2789.04, "end": 2798.48, "text": " here, laptop starting to breathe. Good laptop, fast laptop. Very nice. Come on, come on, come on."}, {"start": 2798.48, "end": 2809.52, "text": " And we're done. So again, we have an average top one performance of 92. Is this even did I even Oh,"}, {"start": 2809.52, "end": 2816.08, "text": " no, I ran this right here. Okay. Like, that's the exact same number it was last time. So we need to"}, {"start": 2816.08, "end": 2826.8, "text": " run inference again. And if we're given the task ID, then we are at 93.9%. So we increase slightly."}, {"start": 2826.8, "end": 2833.76, "text": " Increase slightly, which might just be due to the fact that we initialize terribly, terribly. Okay."}, {"start": 2834.32, "end": 2839.6000000000004, "text": " So what does it say about our task inference accuracy? Maybe there's some mask here."}, {"start": 2839.6000000000004, "end": 2849.92, "text": " Set model task, the alphas are to one. Nope. No, we're good. We're good. Task inference accuracy,"}, {"start": 2849.92, "end": 2857.44, "text": " 100%. And I'm going to guess well, with the task inference accuracy being 100%. I'm going to guess"}, {"start": 2857.44, "end": 2865.52, "text": " this here will give us the exact same number. I like the 93 point some percent. So yeah, 93.9%."}, {"start": 2866.48, "end": 2875.44, "text": " So I'm, you know, I'm going to say right here that the on the super masks and the superposition"}, {"start": 2875.44, "end": 2885.28, "text": " really are two separate ideas, right? You it's, it's because the paper is like, it sounds cool"}, {"start": 2885.28, "end": 2891.04, "text": " and all with the super mask and superposition. But this inference using the superposition,"}, {"start": 2891.04, "end": 2897.28, "text": " and then the entropy to decide is really one idea. And training different supermat,"}, {"start": 2898.16, "end": 2902.32, "text": " the advantage in using supermask is, of course, that the model is way smaller."}, {"start": 2902.32, "end": 2909.52, "text": " So you can remember it much more easily. But also, you know, that it's really different."}, {"start": 2909.52, "end": 2915.04, "text": " It there's, there's nothing to do with the superposition. Yeah. All right. So I'm going,"}, {"start": 2915.04, "end": 2921.36, "text": " I'm going to guess this also works for, you know, 200 tasks and whatnot, the higher order of tasks."}, {"start": 2921.36, "end": 2930.48, "text": " So I think that's it. And we're done here. Yeah."}]
Yannic Kilchner
https://www.youtube.com/watch?v=3jT1qJ8ETzk
SupSup: Supermasks in Superposition (Paper Explained)
Supermasks are binary masks of a randomly initialized neural network that result in the masked network performing well on a particular task. This paper considers the problem of (sequential) Lifelong Learning and trains one Supermask per Task, while keeping the randomly initialized base network constant. By minimizing the output entropy, the system can automatically derive the Task ID of a data point at inference time and distinguish up to 2500 tasks automatically. OUTLINE: 0:00 - Intro & Overview 1:20 - Catastrophic Forgetting 5:20 - Supermasks 9:35 - Lifelong Learning using Supermasks 11:15 - Inference Time Task Discrimination by Entropy 15:05 - Mask Superpositions 24:20 - Proof-of-Concept, Task Given at Inference 30:15 - Binary Maximum Entropy Search 32:00 - Task Not Given at Inference 37:15 - Task Not Given at Training 41:35 - Ablations 45:05 - Superfluous Neurons 51:10 - Task Selection by Detecting Outliers 57:40 - Encoding Masks in Hopfield Networks 59:40 - Conclusion Paper: https://arxiv.org/abs/2006.14769 Code: https://github.com/RAIVNLab/supsup My Video about Lottery Tickets: https://youtu.be/ZVVnvZdUMUk My Video about Supermasks: https://youtu.be/jhCInVFE2sc Abstract: We present the Supermasks in Superposition (SupSup) model, capable of sequentially learning thousands of tasks without catastrophic forgetting. Our approach uses a randomly initialized, fixed base network and for each task finds a subnetwork (supermask) that achieves good performance. If task identity is given at test time, the correct subnetwork can be retrieved with minimal memory usage. If not provided, SupSup can infer the task using gradient-based optimization to find a linear superposition of learned supermasks which minimizes the output entropy. In practice we find that a single gradient step is often sufficient to identify the correct mask, even among 2500 tasks. We also showcase two promising extensions. First, SupSup models can be trained entirely without task identity information, as they may detect when they are uncertain about new data and allocate an additional supermask for the new training distribution. Finally the entire, growing set of supermasks can be stored in a constant-sized reservoir by implicitly storing them as attractors in a fixed-sized Hopfield network. Authors: Mitchell Wortsman, Vivek Ramanujan, Rosanne Liu, Aniruddha Kembhavi, Mohammad Rastegari, Jason Yosinski, Ali Farhadi Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher
Hi there, today we'll look at super masks in superposition by Mitchell Wirtzman, Vivek Ramanujan et al. So on a high level, this paper tackles the problem of sequentially learning many, many tasks without catastrophic forgetting by leveraging these things called super masks. A super mask is basically a binary mask that you unlace over a randomly initialized neural network to make the mask network perform better than a random initialization. They will train these masks for each of the tasks that they consider. And then at inference time, they can recover the task that the data is from, and therefore kind of do this lifelong multitask learning better than the baselines that they compare against. In fact, they can do better without knowing the task than the baselines can with knowing the task. So that's pretty, pretty cool. This is a pretty dense paper in terms of content. And we won't go over everything in the paper, but we'll go over the ideas and what kind of what I think makes them work. So yeah, stick around if you want to know that. Also consider sharing this video out, tell your friends about it and subscribe if you haven't, it helps. So yeah, cool. So let's dive in. We present the super masks in superposition model capable of sequentially learning 1000s of tasks without catastrophic forgetting. So the term catastrophic forgetting comes from the world of this kind of sequential multitask learning, where you have a model, let's call say this is your model, the black box, and you let it learn on a tasks. Let's say this is an image recognition task. So you have a data set, and you let it run on this data set, you learn the data set, it's set, maybe it's c far 10, right? So this is c far 10. Cool. And now the model can do c far 10 pretty well, then you also want to learn a different task, you want to learn MNIST. Okay, so you have MNIST, and you want to learn MNIST, and you want to learn that one. So your hope is that your final model can do both. So you'll take this one, and you simply train it on MNIST as well. And then, you know, we know there's this kind of fine tuning, pre training, and so on. So your hope would be that at the end, it can do both. But then you want another one, you want ImageNet. Okay, now ImageNet is a pretty big data set. So you take your model and you also train it on ImageNet. And with time, the model is always going to be very good at the task you just learned. But it is going to forget the tasks that you learned previously. This is the catastrophic forgetting problem. You might ask, why don't I just train on all the tasks equally, like at the same time? And that's a valid question, you can do that. But this in the task description here, it's necessary that we learn the task one after another, because, you know, maybe we get this data in this year, and then it's pretty big data, we can't just form a four to retrain on all the data all the time, we want to kind of continuously integrate our knowledge, this is very important in the fields of like lifelong learning, where you want to kind of the hope is you can build a system that continuously integrates experience, but doesn't forget the old experience. Okay, and the experience might come from new data sets and so on. But you don't want to forget the old ones. So catastrophic forgetting is one of the main problems in these types of research in this field of research of lifelong learning. And this paper is going to tackle this, how it's sort of. So if you think of what could you do right here, what you could do is you could simply not use the same model, right? You can simply train the different models for each task and just keep them around, right? And at, you know, test time, you need some way of deciding. So there are two different scenarios in at test time. So you learn all of these models. And then at test time, there's an image. And it could be that I tell you that this image, by the way, that's an MNIST image, right? So you just grab this model, and you apply it. Very cool. Or it could be that I don't tell you what image it is, like, you have no clue, then you need a way to decide where it comes from. But once you do decide where it comes from, it's again, pretty easy. Once you think, I think this is an MNIST, the thing, you can apply this one. So you could technically do that, but it's very unhelpful, because these models, they can be large, right? First of all, they can be large. So that means it costs you to store those. And second of all, there might actually be some overlap, like C410 and ImageNet are both natural images. So they might benefit from each other's feature in some way. Now what we're going to do here is we're sort of going to do this separate models approach. Namely, we're going to use these, we're going to build these super masks. So super masks are the second thing that we're going to combine here. Our approach uses a randomly initialized fixed base network and for each task, find a sub network, a super mask that achieves good performance. So what's a super mask? A super mask comes from these kind of papers about lottery ticket hypothesis. And one of these papers discovered basically, or conjectured and then showed in evidence that if you have a network that is randomly initialized, just like this is your neural network, the gray thing, and there is a way to mask it, which means masking basically means that you either activate or inactivate connections. So you have your network and you simply multiply it by a binary mask that for each connection is a one or a zero. So the one, so here is like 00000. This is a one, this is a 000. This is a one. So the network isn't going to be zeros and ones, but it's going to be multiplied. Each connection is going to be multiplied by a zero or a one, which means wherever there's a one, whatever weight that connection had, that will be the value of the weight of the connection. If it is a zero, whatever weight that connection had, it will be pinned to zero. So there will be no signal flowing. So this paper established that if you take a randomly initialized neural network, there is a way to mask it and you can find those masks where if you mask it in a particular way, the network will already perform better than random on a given task. So there is a way to solve MNIST by using a randomly initialized neural network and then simply masking it cleverly. And then the mask network will have a good accuracy on MNIST. And they found that and I have made a video about that and the sort of intuition behind the super masks is, this is just my intuition, is that, you know, MNIST, this is what I'm guessing MNIST is a relatively easy task. In fact, most of the tasks they're considering in these papers are relatively easy. And if you have a randomly initialized neural network, basically what you have around is a bunch of weight, right? So if, if I have my two layers right here, and then each connection here is a number like point two, five, this is, you know, seven, this is negative three, and so on. Now they're going to consider, they here are going to consider weights that are initialized in a very special way. But ultimately, you just have a bunch of random weights lying around. And if the task is super easy, let's say, and the the neural network is sufficiently over parameterized, there might be many, many ways of achieving your goal. So rather than being able to adjust the weights, like you would do when you train the neural network, you would actually change those numbers, you get away with simply selecting the combination of weights that will, you know, give you a good performance. So in its kind of, it's sort of a mix of dropout and vector quantization. So in vector quantization, you also you get away with quantizing the vectors to given precision. And here, the task is easy enough such that by simple over parameterization and selecting of the weights that you have around mixing them correctly by simply so you can't mix arbitrarily, but you can mix with zero or one, you get good enough. Okay, so this is sort of my hypothesis, my hypothesis would be that the harder task, the the harder it gets to find super masks that perform well. That's what I think is going on. But nevertheless, to say for the tasks they're considering here, you can find these super masks, and there is a way to do that by using gradient descent, even though the super masks are discrete. So what we're going to do is we're going to use the same randomly initialized neural network for each of the tasks, right. So this is like c410. This is MNIST, this is ImageNet, we're going to use the same gray network, but we're going to find an individual mask for each of those networks for each of those tasks on top of the same network. And they're all going to perform relatively well according to the super mask conjecture. Now again, this is not surprising. And the fact that we always use the same randomly initialized network, you know, isn't really it's not really necessary that we always use the same. But in this case, they say, okay, we always use the same. And then we only need to store the mask for each task. The mask is much simpler than the weights, because, you know, a 32 bit floating point number is 32 bits, while a masking bit is only one bit. So we save basically a factor of 32 in our models. But essentially, essentially, right, it's not the case that we are training the same model and continue learning. It's much more akin to training a sink a training one model per task, and then inferring the task, and just that we do it in a much more crude way. So it's more like learning a compressed model per task, I find it's a better way to look at it, then, then continuous learning. In any case, you learn the super masks. And then here is the the the hard bit of the easy bit is if I tell you which tasks the inference data point the test data point comes from, you have a pretty easy time classifying it, you simply select the mask accordingly, you run forward pass, and that's it. If I don't tell you where the test data point comes from, that's the hard part. Now, they need a way to decide where the data point comes from. And the the idea that they have right here, they have sort of multiple ideas. But the main idea, the first idea is that if you have trained these individual models for the individual tasks, then okay, there's not good explanation here, then the correct model should be very confident, right? This is an assumption that you make. So I'm going to take my image of the test set, and I'm going to feed it through the model one, which, you know, you have to separate that this idea is separate from the masks. At its core, it's simply saying, if I have three different models that I've trained for three different tasks, and now I get an input, I don't know which one it's from, I can simply feed it to each one of them. And I can look at the output distribution. So maybe my output put distribution right here, this is as you can see, three output neurons, it's a three class classifier right here. My output distribution is somewhat here like this. And here, it's like this. And here, it's like, I shouldn't do that. I got a comment, you know who you are. And here, it's like this. So which one would you pick? And their answer here is, we should pick this one, because of it has very low entropy. So this middle model here is very, very sure about this data point, it's very sure about its prediction, because it the distance basically of the top prediction to all the other predictions is so high, it's very confident in its prediction. Whereas here, you can see that the distance is not too high. Also here, the distance between the highest and the others is not too high. So they say, we are going to pick the model or the mask in this case, for which the output entropy is the highest. And that is a heuristic for now, but it tends to work pretty well. It has a bit to do with how relatively difficult your tasks are. So your tasks need to be kind of equally difficult. Otherwise it's not otherwise this can get a little bit a little bit out of hand. But there are ways to solve it. And they allude to that in the kind of future work section. But in this case, if the tasks are equally hard, and they consider tasks that are equally hard, then the entropy is a good measure of how confident these things are. And therefore, we can check which task it is by using the entropy as a heuristic. Alright, so we're left with simply trying each of the masks and then decide taking the one that has the highest entropy. Now they say this is costly, because if we've learned, you know, 1000 tasks, we need to try each of the 1000 masks in order to do that. So they go for something else. And this is the second word in the title, this superposition word. So instead of doing that, what they'll do is they'll use a superposition of masks. And actually, the picture also I find more descriptive than the formula, I can write down the formula down here. So what they'll do is they'll say, why don't we just overlap all of the masks. So we'll have all of these masks mi for one for each tasks, and we'll initialize them with coefficients alpha, I will just mix them like this, and alpha here, it's initialized in one over k, where k is the number of tasks, okay, we'll just mix them. And then we'll multiply them by the weight of the neural network. And that's will that neural network is where we input our image into. Okay. So what does that give us that basically gives us a mix of all the networks that like it's it's pretty safe to say that the entire network is going to be in there. And maybe sometimes, you know, multiple times, like if multiple masks use the same weight, it's going to be in there with a higher weight and so on. So that's what you see right here, you can see that all the masks are overlapped in superposition with each other. Now what does the output give you the output gives you nothing that gives you kind of the average prediction of the network. So this here is going to give you kind of the sort of the average prediction of all of the networks, which isn't very helpful. But of course, what we can do is we can look at the gradients of this. So if we from this calculate the entropy, which is here denoted h, and we calculate we back propagate this. So we back propagate this to the alphas. And we calculate the gradient of the entropy with respect to each of the alphas. What does that give us? So what's the intuition here? The intuition is if I change my alpha a bit, how does the entropy change? So basically, this gives you the sensitivity of the entropy to these alpha parameters. So if this is high, what does it mean? It means that this mask right here has a big influence on the entropy. Specifically, if I were to increase the alpha, then the entropy would increase, okay. And if I were to decrease the alpha, then the entropy would decrease. That's the kind of what what the gradient gives you. Now, did I say before, we want the one with the highest entropy? I'm pretty sure we want the one with the with the lowest entropy. We want the one where we're very, very, very sure, right? I might have said that absolutely wrong. So if you see right here, this is the formalism. First we associate each of the k learned supermasks with a coefficient alpha initially set to one over k. Each alpha can be interpreted as the belief that supermask m is the correct mask, equivalently the belief that the current unknown task is task i. The model output is then computed with a weighted superposition of all learned tasks, which is this thing right here. The correct mask should produce a confidence low entropy output. Therefore we recover the correct mask, we find the coefficients alpha which minimize the output entropy h. Okay, so yes, we want the task with the lowest entropy, of course, not with the highest entropy. So, if we look at the gradient right here, the gradient basically tells us how each of the masks will influence the different the entropy. And if we simply select the alpha, where the gradient here is the most negative number, so we want this to be as low as possible, not zero, but you know, negative as high as possible, then we know that if we increase this, the contribution of this mask, then the entropy will go down the most. Okay, and again, our hypothesis here is that maximum entropy, sorry, minimum entropy means most confidence prediction means that the if all tasks are equally hard, it probably means that the data point is from the task where we have the lowest entropy. So what's the deal here? They show in this graph right here, they show this is much faster. So if we were to evaluate each mask individually and measure its entropy, of course, with the number of tasks, we'll simply linearly increase our time in the forward pass because we need to try out each of these masks. However, if we do what they're doing here, we simply run one, we mix these ones, we run one forward pass, we do backprop, and they consider two strategies. So what you can do is you can do gradient descent on these alphas, which takes, you know, a number of steps to converge, or you can actually do a single step. So you just observe the gradient and by the gradient, you recognize which one has the lowest gradient, and that's the one you pick. So where's the catch here? The catch is that if you do something like this, if you do something like this, there are two catches, actually. First of all, this here is a a convex combination, right? This is convex combination. And the problem isn't convex at all. But if you simply take this convex combination, multiply it, and then look at the gradient, you sort of assume that the problem is a kind of a convex, nicely shaped problem. And if you then observe these, the gradients with respect to the alphas, you make assumptions about the problem that might not be true. So you lose, you kind of heuristically approximate the importance of these masks. That's the first thing. The second thing, of course, is that you still are implicitly saving, you still are implicitly trying all the models, but you're just not trying them explicitly. You're implicitly trying all the models because when you do this combination right here, your auto differentiation library will actually keep track of what the individual models contribute. It's just that per layer. So of course, this here, this W is multi layer perceptron, which means that if you have multiple layers, you know, there's w one, and there's w two. And you have your alphas, and your alphas are also, you know, you can distribute them into these, sorry, your masks are also mask for layer one mask for layer two, and so on. So your auto differentiation package needs to keep track of okay, mask one goes here with this alpha mask to the layer two goes here with this alpha. And there is there, so it needs to keep track of this graph. It's just that this is highly optimized. And you also need to you only need to do it layer by layer. So the contribution of alpha of mask one, this is maybe alpha i of mask i one mask i two, the contribution of the alpha i will not be explicit in this layer, it will be implicit as an average across the layer, right. So again, this is you assume in each layer, you assume a convex combination of all the alphas and propagate that forward. And therefore, if you look at the next layer, you can only view what mask two does mask of layer two does as in terms of a convex combination of layer one. So you make multiple approximations, and you rely on the optimization of your auto differentiation library to keep track of these different things and do operations in parallel. And in the case where you do it linearly, I'm going to guess you simply do it as a sequential operation. But it's going to be exact. So that's the trade off. Alright, so we now know how we can figure out where the task is from. And let's see how that works. So in this first task, we are looking at split image net, split image net, simply it takes the image net data set, which is a thousand class data set, and it distributes it into 100 different tasks, each is a 10 class classification task. Now note two things. First thing is that split image net, each task is approximately as hard as each other as as the other tasks, right? It's still image net classification, and it's the same number of the of it's the same number of labels. And each task is about, you know, the same hardness, you can make that assumption. And second of all, the tasks are actually pretty, pretty easy, right? It's hard to distinguish image net into 1000 classes. But if you split that task, I'm going to bet that you have these high resolution images, and you have a 10 class classification, it's going to be relatively easy. So all our conditions are met for at least for my hypothesis to hold. And you can see on the right side, you can see split CIFAR 100, which does the same thing to CIFAR 100, it subdivides it into different, very small class classification tasks. You can see the results. The upper bound here is where you train a single model for each of the tasks that gets you to an average accuracy of 92%. So on image net 92%, you know, it's pretty, it's pretty good. Of course, this is again, this is 10 class, which makes the numbers a lot different. With the sub sub sub sub sub, you get to this pretty good 88% accuracy. This is this super masks in superposition. This here is a baseline that also does lifelong learning. Now they have these annotations right here, GG, which yes, GG, haha. But so the first letter will always tell you whether the task ID is given during training. And the second letter will tell you whether the task ID is given during testing. So this here simply evaluates whether or not this masking is feasible, which you can see here it is so this will we know which mask to train during training, and we know which masks to retrieve during testing. So there is nothing of this entropy gradients here, none of it, this simply evaluates the viability of the masking approach, which, as you can see, it's pretty viable, and it's more viable than these baselines. This same thing on the CIFAR 100 right here. So you can see they also evaluate since I guess it's an easier problem, they also evaluate the number of bytes, which they can control. So they can control the number of bytes in their model by simply increasing or decreasing the required sparsity of their mask. So you can change your mask by saying how sparse you want it. And of course, if you want it more sparse, you get a worse model because you have less less ones in your budget to make your model perform well. But you can see that if they do it with these baseline model is batch E, you severely underperform with regard to the upper bound right here, the upper bound again is where you train a model per task. And separate heads here is another kind of dummy baseline, where you train a different head for each of the tasks with a common trunk that gets you pretty much nowhere. With the sub sub algorithm, you do get almost to the performance of the upper bound. And in fact, if you do this transfer approach right here, you do get there. The transfer approach simply means that so you do these tasks in succession, right, you do task one, okay, done, you do task two, okay, done. And for each one, you train a mask, okay, for each one you train, this is mask one, mask two, the transfer approach simply says, if I start task three, I'm going to start the mask three, my initial weights basically, are going to be a running average of the masks that I have already considered or an average, there is some amount of transfer going on, simply to initialize the weights, it's actually astounding that this helps you so much. But with this, if you look at the actual numbers, I believe you can get like a tiny bit higher than the training a single model for each of the tasks. Okay, so this sort of establishes the viability of training the different masks for the different tasks, which I, again, I think it is not surprising because essentially, you're training a different model per task. And it's just the fact that you do a very crude model, and that you can store very efficiently, you might object and say, hey, don't I need to store the underlying randomly initialized network? And the answer is yes and no, actually, you only need to store the random seed to produce it. So checkmate. Yeah, they do. So here they explain this one shot algorithm where they simply look at the gradient of the entropy, you can see with the maximum negative gradient of the entropy. They also have this binary algorithm, if the task where they say with the task is harder to differentiate this kind of assumption of the convex combination thing does might not hold. So what they do is they have this binary algorithm, where they do a binary search, where so they simply want to circumvent the necessity to evaluate each of the masks by itself, because that takes long. So they do something in between where they do this binary algorithm. This is right here, where they do this convex combination, they evaluate the gradient, but then they don't just take the highest of the negative gradients, they eliminate half of them. So basically, whenever it's lower than the median, they eliminate it, and then they start off with this new set of reduced alphas. So in each of these steps, they eliminate half of the masks, and then they recompute again, because because it is not a convex problem, the the order might actually be different in the second and third and fourth step. Of course, this is simply this is like halfway towards between this one shot algorithm and trying each mask by itself. It's kind of a compromise. I mean, they make it, they really try to not not try each mask once because it's one of their contributions, right? But then they probably realized if we just do it one shot, sometimes it doesn't work. So they're going between which is, you know, it's a pretty cool idea. All right, next experiments. We're now in this situation, and you see, you see a number of things. So first of all, we have a new added a new baseline, this PSP. And you can see that the baselines operate in this GG regime. So the baselines are given the task during training, and given the task during evaluation. You see the upper bound here in gray is where we train a model for each task. And you assume that's an upper bound, because you assume the tasks are kind of unrelated to each other, which is not the case. So there is actually potential to beat the to beat the upper bound baseline. And subs up here you see operates in a different regime. Namely, there's this regime of you're given the task during training, but then during testing, you're not given the task. Okay. And this you here, it basically means that the labels you assume that the labels of the tasks are not shared. So in in this case, if you predict, if you predict, like if you split MNIST into always that two class, if you split MNIST into two tasks, you predict the first task is 01234. The second task is 56789. Okay. And you have the same amount of labels. So you always have five output neurons, right? So you have 12345 output neurons. If you if the image here is like a five, that would be task, task one, label zero, right? If your network now predicts label zero correctly, but predicts the the image to come from task one, you count it as a mistake, you say, Well, you know, you've predicted the right output neuron, but you've told me it comes from task zero from from the zero to four. So I'm going to count that as a mistake. So it really there isn't there isn't a way for the network to kind of go get around. Predicting the wrong tasks are kind of share information. So you assume that the labels are not shared or on shared. Yeah, so it's the sub sub here has a significantly harder task than the baseline. Keep keep that in mind. And now we're applying our because we we are not given the task at inference time. Now we're applying our heuristic, where we go and look at which of the mask entropies is the lowest, respectively, we use this actually this one shot algorithm, where we look at the gradients. And you can see this is on permuted MNIST in permuted MNIST, what you do is you take MNIST, and you simply permute the pixels. And this, it sounds crazy, but you simply permute the pixels. And that gives you a new task. So you can come up with like almost an infinite number of tasks because there are what 28 times 28 pixels, so you can commute them 784, you know, factorial times, which gives you like infinitely many tasks. And so you can modulate. So here you can see the number of tasks learned increases. And at the beginning, this baselines, especially this baseline is doing fairly well actually on par with the upper bound when you only have 10 different tasks. However, after that quickly degrades, however, this sub sub here, it, you know, keeps it keeps its performance, which it so this doesn't only mean that it correctly predicts the output neuron, it also correctly predicts which task which permutation was applied to the digit, simply by looking where the entropy is high, right. So that's pretty cool. And you know, it's it's actually kind of surprising to be to be honest. So on the left, this is a lunette architecture on the on the right, it's a fully connected network. So the fully connected network here performing better is sort of expected. First of all, amnest is really easy and can actually be solved with a fully connected network. And second of all, especially permuted amnest, I guess doesn't really conform to the to the assumptions of convolutional neural networks anymore. Again, keep in mind, these tasks are very easy. Yeah. So so especially for the fully connected network, of course, each permutation kind of looks the same because it's it doesn't care at the beginning that pixels are next to each other simply each pixel is a different thing. It's just the fact that it cannot it cannot learn from one tasks much about the other tasks. That's why you that's the nature of permuted amnest. All right, and then in this experiment right here, and this is the sort of crown experiment, they learn they do this permuted amnest, but they go up to 2500 tasks, right 2500 different permutations. But so but now they have an additional thing right here. So again, they have this sub sub where it needs to predict the correct permutation. But also they compare it with a an algorithm that needs that is this n n right here. So in this n n, not not only are you not given the task label at testing time, you are actually not even given the task label at training time. But here the outputs are shared. So you know, since since you have no way of knowing which task it is, you've never given it as long as you predict the correct class, you good. So it's always it's always a 10 class classification problem. It's just no permuted. You're not given the task label here. So first of all, I want to say that this here, the shared labels, it could actually contribute to the success of this algorithm right here. Because even though you permute the pixels, you can still sort of do things like count the frequency of light pixels versus dark pixels in MNIST. And that might already give you a very, very big hint, right? Or, you know, simple correlation of of two pixels, though that's that's a task specific thing. But that the frequency of light pixels versus dark pixels will already give you a big boost in accuracy. And now you can actually share that feature, that feature will always be the same for every permutation. So this is something you can share between tasks. And I would like so one way I guess you could eliminate that. Well, I don't know. I'm not sure is you kind of have to randomize the number of light pixels, but keep the classes the same. Yeah, it's it's going to be complicated, right? But just keep that in mind. So how, how does the algorithm even decide? So they have a heuristic right here as well. Namely, they say, okay, if we don't have no task identity during training or inference, where task identity is entirely unknown, even during training, if sub sub is uncertain about the current task identity, it is likely that the data does not do not belong to any tasks seen so far. When this occurs, a new super mask is allocated, and the number of tasks learned so far is incremented. Okay, so the they go with the same principle right here, they say, if we get a new training sample, we just evaluated against all the masks that we had so far, or we do our, you know, one shot algorithm to to approximate which masks gets it gets us a low entropy. If none of the mask gets us a low entropy, then we decide this must be some kind of unseen tasks. So we're going to allocate a new mask for this unseen tasks. And that heuristic, as you can see, it performs fairly, fairly well, where was our graph, our graph was down here. In fact, it performs pretty much on par with where you know the task during training, and just not during during inference, up until like here, the very last bit, if you really get into the high task regime, where I guess it starts getting it starts getting confusing. So this this heuristic might start to break down, but it might just be a fact how they tune their constants, like they have to define a threshold where they say, okay, if the end entropy is somehow higher than this threshold, then we allocate a new a new task. And this might be optimized in order to solve this. Again, these tasks are very, very, very, very easy. So keep keep that in mind. Yeah. Okay, so this basically was the experimental part of that paper. Now they consider different extensions to that. And I'm not sure they also considered some ablations, which are pretty interesting. So here, they say, we are going to up the kind of the hardness of the task with with rotated MNIST and also their model does pretty well on the rotated MNIST task where the differences of between the the differences between the tasks are simply some of them are rotated by 10 degrees. So that's a tiny rotation in the right if you have a number three, you kind of rotate it by 10. I can't even draw that subtle of a rotation by 10 degrees. And you know, the sub sub must correctly predict which task the image is from, or it will not get the it will not get a correct reward. And the fact that it performs pretty well. And the fact that it has, you know, rotation degrees where it outperforms the baseline that is all actually given the rotation. So it's given the task at inference time is pretty, pretty remarkable. Again, I believe this is due to the fact that these tasks are so easy, and therefore, this entropy, it just spikes when you get the correct thing, because it it sort of, it sort of latches on to very easy features for each task. So I'm going to guess that the tasks are, you know, generally solvable by maybe correlating two pixels, right? If like this pixel correlated with this pixel, if the correlation is high, it's a three, the correlations low, it's something else, okay. And then if you rotate it, it's just not the case anymore that this pixel and this pixel, the correlation is very high. So if you predict using this correlation, you'll get a pretty low confidence. And I'm going to guess that yeah, if you have discrete tasks, and it's in this task, then your confidence will just spike because the task is so easy. And because all the tasks are about equally hard, because if you can find this correlation here, you can find it over here, it's simply going to be two different two different pixels in this task, and then what as you try the masks, whenever you hit the one where you can predict pretty confidently with those two pixels, then your confidence is going to spike your entropy is going to get down and you know, it's that task, right? They also here they compare. Where is it? The one shot algorithm. So they, they, they use their one shot algorithm to and and they put it on a baseline. So this baseline, where they always actually have to give it the the task, they augmented by by their, their one shot algorithm to select the task. And it turns out they can, you know, make it perform fairly well, not on par with them, interestingly, but they can make it perform also fairly well actually better than it was performing before. So they have different extensions right here. And that's some of them are pretty important. The one important thing they do is they have these superfluous neurons. And that's sort of hidden. And it's always a bit. So here, for example, you see, in the output, they say, we have a lunette model using output size 500. Now there there are only 10 different labels in the MNIST task, right, also in the permuted MNIST task, there are 10 different labels that I mean, there are a total of 25,000 labels if you have 2500 tasks, but the neural network has output size 10. However, their neural network here has output size 500, which is surprising. So they say right here, and we're going to get to the hopfield network at the very end. For those who are still around, because that's, I think that should be its own paper, but you know, they say it could use an output of size L, where L is the actual number of labels per task, though we find in practice that it helps significantly to add extra neurons to the final layer. Specifically, we consider outputs p in our s, so s is higher than L, and refer to the neurons that are past L as superfluous neurons. So let's try to make sense of this. So they have a neural network. And let's say it's a three class classification task, right? So you have three classes, and that's what you would do, they simply add a bunch of neurons right here. That means they also they, you know, they add all of the connections from the previous layer to those neurons. But still, the classes can only be either 01 or two, these classes never appear during training. So they claim this helps during during their procedure. And I, I thought about it a bit, and we might be able to try to guess why it makes sense. They say they simply say we observe that helps. And I mean, you know, let's, let's try to make sense of it. Okay, so if we train, if we train our model using these too many neurons, what happens? Well, our label is always going to be of the top three neurons. So let's say our label is one, this is going to result in a one hot vector like this. Now, what are we training in this layer here in this layer here, we're training logits. Okay, so pre pre softmax outputs. So our, our algorithm, our cross entropy loss is going to push all of these here down during every single training point is going to push this one up and all of these down. Now these three here are going to be pushed up and down depending on the label. However, all of these down here are going to be only pushed down during the entire training. So they are going to be exceptionally low numbers. Okay. Now if we then come and we look at the at the entropy of this, the the entropy, I think honestly, this is simply you could achieve the same thing by using a different temperature parameter in the softmax or in the entropy that you consider, because why can this help and this helps with inferring which task it's coming from, right? So if you consider a task where you only have three outputs, so you don't have this bit down here, and you look at the entropy, it's going to be you know, it's going to be something something. Sorry, I have to draw this right here. It's going to be like this, you know, it's fairly confident. But if and maybe for the other tasks, it's not going to be as confident, you know, it's maybe going to be like this a bit. However, if you have those, and if it's of the correct tasks, I'm going to guess this kind of stays the same because they're really low. But if it's of the incorrect tasks, then you're not sure. And you not being sure about the output also means that you allocate a lot more to these things right here. Because you've sort of never seen this particular kind of training examples. So you're not sure. You're just going to distribute your kind of your probability mass across these things right here. Because you've not been trained on that kind of input, right? It's very important to see that this is task, this is the correct task, which they always label J. And for for any other incorrect task, you've never seen data like this. So these things here sort of act like an outlier class without you explicitly training an outlier class, you simply train these things. During training, you make them small. But you it's important to notice you always make them small from a data point that comes from their particular task. Okay, that's what you train them for. And now if you input a data point from a different task, they have less reason to be small, because this is an outlier data point. So you have much more fluctuations, so you have more fluctuations here, and therefore, the entropy is going to be even higher. All right, this is sort of how I make sense of the fact that these additional superfluous neurons help here, they act as kind of an outlier detector for the training data set of that particular task. Now, because you have different training data for each task, they go further and they say, it actually works even better, it works even better. If we instead of this entropy heuristic, we consider another heuristic. Accordingly, we consider an objective G, which encourages the S neurons to have large negative values and confused as an as an alternative to entropy in equation four. So G they analyze down in the appendix, and we're just quickly going to look at what G is sorry, this is about to load. Right here. And it's very interesting to see what G is. Or is it? Yes. So G is going to be this right here. So Y are the logits, and then G is this expression right here. So and in fact, it's this expression with the with a bit of a modification. So it's going to be G is going to be the log sum x of the logits, right? So it's, this is some, this is somewhat like the entropy. And what we're going to consider is the gradient of G. So what we want is the gradient of G with respect to our alphas. And the condition here with this detach operation is that the gradient of G should be, you know, the gradient of the loss function for all v that are superfluous neurons, and zero otherwise. So we're going to detach the gradient of G for all the real neurons for all the actual logits of the output class. And we're only going to consider the gradient flowing through the superfluous neurons. So all of this here is if we take the gradient, it's only going to flow to in these in the last layer through the gradients of the superfluous neurons. Okay, and that's why we don't need the entropy, because the entropy always considers, you know, the difference sort of the difference between the correct label and the other labels. We are pretty sure that in our superfluous neurons, we don't have the correct label. Okay. So this log, the log sum x of our of these outputs here, what will they represent? Well, this is sort of a flatness measure, again, it's kind of like the entropy, except we don't have a correct label right here. If one of them is very high, and the other ones are very lower, if they're generally very high up, then this will be high. However, consider the difference between this and this, where they're all super small. And also, they're all pretty equal, the log sum x will be very small. So this is an alternative where we can basically only look at the superfluous neurons and say, is are the superfluous neurons all very small? And you know, none of them basically says I'm the correct label, then we can be pretty sure that over here, there is some confidence. However, if they are sort of kind of larger, and you know, generally kind of generally large, maybe unequal, that means we're not very confident because these are our outlier classes, they shouldn't be, they shouldn't be large at all. So an alternative to looking at the entropy of this distribution is to build such superfluous neurons, and then look at those and only those. And so the gradient of only those, in order to decide which task it's from. It's an interesting idea, I have to say, but I maybe one could achieve sort of the same thing with a with a temperature parameter here or by building an explicit outlier detection. But it's generally an interesting idea for outlier detection, I have to say, I've never really seen anything like this, though I also haven't really considered it. So here they show the importance and you've seen in the experiments before that there sometimes was this H objective and also this G objective. So you can either look at the entropy, but also you can look at the G, in both cases you have superfluous neurons. So before you actually saw you have 500 neurons for a task of for a task of 10 that needed 10 output classes, right. So this tells me that the superfluous neurons are pretty important for them. And it's, this is probably one of the things that makes this work, right, these superfluous neurons. So you're kind of setting up a trap where for the wrong models, you let it run into this trap of assigning a lot of weight into these outlier classes and only the correct model is trained to not do that on the particular data that you're considering. I don't think this comes through in the paper too much that this is one of I guess this is one of the main factors making this work. And you can see right here, they actually do an experiment, so I don't want to be too mean, where they say, look, if we train with just 25 classes, and this is permuted MNIST, so the necessary amount will be 10. So if we train with only 25, you can see how quickly we degrade right here. However, as we go up and train with 100 and 200, we get better and better. In fact, if we train with this G objective, it always sort of outperforms the H objective. Interestingly, the more output neurons you have, the less this difference seems to be, but maybe the percent difference is the same. The percent error difference is the same. I don't know, I can't tell from here. Yeah. So this isn't all. There is also this Hopfield network going on where they say, okay, okay. So essentially, we're actually training different models, right? We're not really superimposing all of these models, we're training a different mask for each of the tasks and kind of remembering the masks and so on. Can we also build a model where we actually only have one model? And that's what they do right here, where they build a Hopfield network, which is basically just a big matrix. This is the Hopfield network. And then they encode the masks in this Hopfield network. So specifically, the Hopfield network is of size d squared, where it is able to encode two to the d different binary strings. And it does so in a fuzzy way. But you know, you can prove that if you construct the Hopfield network like this, where z is a binary string, you can recover the binary strings by gradient descent in the Hopfield network. And as obviously, the more binary strings you encode, the less you get out like it's not magic, you can't store that many bits into the thing that doesn't have that many bits. But I believe, you know, again, this is using gradient descent, and it can do so with surprising accuracy. So remember that these here are bits, while these here are floating point numbers. So the comparison that I just made isn't entirely fair. But I don't want to go into the Hopfield networks, because I really feel this should be its own paper. I guess they just want to show that it's also possible to compress these masks into one thing such that I can't make the argument anymore that hey, all you're doing is training different models for different tasks. All right, all in all pretty cool paper, as I said, pretty dense paper, I invite you to read it, they have a big appendix where they have more experiments and so on, and explain everything in detail. All in all, I from this, I don't really take the method, but the ideas are very interesting. And I am excited to see where this goes in the future. All right, I'll see you next time. Bye bye.
[{"start": 0.0, "end": 6.0, "text": " Hi there, today we'll look at super masks in superposition by Mitchell Wirtzman, Vivek"}, {"start": 6.0, "end": 7.76, "text": " Ramanujan et al."}, {"start": 7.76, "end": 13.0, "text": " So on a high level, this paper tackles the problem of sequentially learning many, many"}, {"start": 13.0, "end": 18.240000000000002, "text": " tasks without catastrophic forgetting by leveraging these things called super masks."}, {"start": 18.240000000000002, "end": 24.400000000000002, "text": " A super mask is basically a binary mask that you unlace over a randomly initialized neural"}, {"start": 24.4, "end": 30.24, "text": " network to make the mask network perform better than a random initialization."}, {"start": 30.24, "end": 34.339999999999996, "text": " They will train these masks for each of the tasks that they consider."}, {"start": 34.339999999999996, "end": 40.879999999999995, "text": " And then at inference time, they can recover the task that the data is from, and therefore"}, {"start": 40.879999999999995, "end": 47.44, "text": " kind of do this lifelong multitask learning better than the baselines that they compare"}, {"start": 47.44, "end": 48.44, "text": " against."}, {"start": 48.44, "end": 53.72, "text": " In fact, they can do better without knowing the task than the baselines can with knowing"}, {"start": 53.72, "end": 54.72, "text": " the task."}, {"start": 54.72, "end": 58.92, "text": " So that's pretty, pretty cool."}, {"start": 58.92, "end": 62.0, "text": " This is a pretty dense paper in terms of content."}, {"start": 62.0, "end": 68.44, "text": " And we won't go over everything in the paper, but we'll go over the ideas and what kind"}, {"start": 68.44, "end": 70.88, "text": " of what I think makes them work."}, {"start": 70.88, "end": 74.16, "text": " So yeah, stick around if you want to know that."}, {"start": 74.16, "end": 78.88, "text": " Also consider sharing this video out, tell your friends about it and subscribe if you"}, {"start": 78.88, "end": 80.68, "text": " haven't, it helps."}, {"start": 80.68, "end": 82.72, "text": " So yeah, cool."}, {"start": 82.72, "end": 84.88, "text": " So let's dive in."}, {"start": 84.88, "end": 90.74, "text": " We present the super masks in superposition model capable of sequentially learning 1000s"}, {"start": 90.74, "end": 93.56, "text": " of tasks without catastrophic forgetting."}, {"start": 93.56, "end": 98.96000000000001, "text": " So the term catastrophic forgetting comes from the world of this kind of sequential"}, {"start": 98.96000000000001, "end": 103.96000000000001, "text": " multitask learning, where you have a model, let's call say this is your model, the black"}, {"start": 103.96000000000001, "end": 106.84, "text": " box, and you let it learn on a tasks."}, {"start": 106.84, "end": 108.52, "text": " Let's say this is an image recognition task."}, {"start": 108.52, "end": 112.68, "text": " So you have a data set, and you let it run on this data set, you learn the data set,"}, {"start": 112.68, "end": 114.56, "text": " it's set, maybe it's c far 10, right?"}, {"start": 114.56, "end": 116.64, "text": " So this is c far 10."}, {"start": 116.64, "end": 117.64, "text": " Cool."}, {"start": 117.64, "end": 123.72000000000001, "text": " And now the model can do c far 10 pretty well, then you also want to learn a different task,"}, {"start": 123.72000000000001, "end": 125.12, "text": " you want to learn MNIST."}, {"start": 125.12, "end": 132.42000000000002, "text": " Okay, so you have MNIST, and you want to learn MNIST, and you want to learn that one."}, {"start": 132.42000000000002, "end": 136.3, "text": " So your hope is that your final model can do both."}, {"start": 136.3, "end": 141.32, "text": " So you'll take this one, and you simply train it on MNIST as well."}, {"start": 141.32, "end": 145.44, "text": " And then, you know, we know there's this kind of fine tuning, pre training, and so on."}, {"start": 145.44, "end": 148.18, "text": " So your hope would be that at the end, it can do both."}, {"start": 148.18, "end": 150.56, "text": " But then you want another one, you want ImageNet."}, {"start": 150.56, "end": 153.4, "text": " Okay, now ImageNet is a pretty big data set."}, {"start": 153.4, "end": 157.4, "text": " So you take your model and you also train it on ImageNet."}, {"start": 157.4, "end": 163.0, "text": " And with time, the model is always going to be very good at the task you just learned."}, {"start": 163.0, "end": 167.0, "text": " But it is going to forget the tasks that you learned previously."}, {"start": 167.0, "end": 170.28, "text": " This is the catastrophic forgetting problem."}, {"start": 170.28, "end": 175.2, "text": " You might ask, why don't I just train on all the tasks equally, like at the same time?"}, {"start": 175.2, "end": 177.48, "text": " And that's a valid question, you can do that."}, {"start": 177.48, "end": 184.2, "text": " But this in the task description here, it's necessary that we learn the task one after"}, {"start": 184.2, "end": 189.32, "text": " another, because, you know, maybe we get this data in this year, and then it's pretty big"}, {"start": 189.32, "end": 194.76, "text": " data, we can't just form a four to retrain on all the data all the time, we want to kind"}, {"start": 194.76, "end": 200.12, "text": " of continuously integrate our knowledge, this is very important in the fields of like lifelong"}, {"start": 200.12, "end": 205.56, "text": " learning, where you want to kind of the hope is you can build a system that continuously"}, {"start": 205.56, "end": 209.92000000000002, "text": " integrates experience, but doesn't forget the old experience."}, {"start": 209.92000000000002, "end": 214.04, "text": " Okay, and the experience might come from new data sets and so on."}, {"start": 214.04, "end": 216.64000000000001, "text": " But you don't want to forget the old ones."}, {"start": 216.64000000000001, "end": 220.88, "text": " So catastrophic forgetting is one of the main problems in these types of research in this"}, {"start": 220.88, "end": 223.72, "text": " field of research of lifelong learning."}, {"start": 223.72, "end": 229.42000000000002, "text": " And this paper is going to tackle this, how it's sort of."}, {"start": 229.42, "end": 233.92, "text": " So if you think of what could you do right here, what you could do is you could simply"}, {"start": 233.92, "end": 235.98, "text": " not use the same model, right?"}, {"start": 235.98, "end": 242.7, "text": " You can simply train the different models for each task and just keep them around, right?"}, {"start": 242.7, "end": 247.0, "text": " And at, you know, test time, you need some way of deciding."}, {"start": 247.0, "end": 249.7, "text": " So there are two different scenarios in at test time."}, {"start": 249.7, "end": 251.29999999999998, "text": " So you learn all of these models."}, {"start": 251.29999999999998, "end": 254.32, "text": " And then at test time, there's an image."}, {"start": 254.32, "end": 259.8, "text": " And it could be that I tell you that this image, by the way, that's an MNIST image,"}, {"start": 259.8, "end": 260.8, "text": " right?"}, {"start": 260.8, "end": 263.08, "text": " So you just grab this model, and you apply it."}, {"start": 263.08, "end": 265.08, "text": " Very cool."}, {"start": 265.08, "end": 269.8, "text": " Or it could be that I don't tell you what image it is, like, you have no clue, then"}, {"start": 269.8, "end": 272.98, "text": " you need a way to decide where it comes from."}, {"start": 272.98, "end": 276.6, "text": " But once you do decide where it comes from, it's again, pretty easy."}, {"start": 276.6, "end": 281.88, "text": " Once you think, I think this is an MNIST, the thing, you can apply this one."}, {"start": 281.88, "end": 287.92, "text": " So you could technically do that, but it's very unhelpful, because these models, they"}, {"start": 287.92, "end": 289.84, "text": " can be large, right?"}, {"start": 289.84, "end": 291.26, "text": " First of all, they can be large."}, {"start": 291.26, "end": 297.52, "text": " So that means it costs you to store those."}, {"start": 297.52, "end": 302.0, "text": " And second of all, there might actually be some overlap, like C410 and ImageNet are both"}, {"start": 302.0, "end": 303.0, "text": " natural images."}, {"start": 303.0, "end": 307.65999999999997, "text": " So they might benefit from each other's feature in some way."}, {"start": 307.66, "end": 313.32000000000005, "text": " Now what we're going to do here is we're sort of going to do this separate models approach."}, {"start": 313.32000000000005, "end": 318.46000000000004, "text": " Namely, we're going to use these, we're going to build these super masks."}, {"start": 318.46000000000004, "end": 322.34000000000003, "text": " So super masks are the second thing that we're going to combine here."}, {"start": 322.34000000000003, "end": 327.78000000000003, "text": " Our approach uses a randomly initialized fixed base network and for each task, find a sub"}, {"start": 327.78000000000003, "end": 332.58000000000004, "text": " network, a super mask that achieves good performance."}, {"start": 332.58000000000004, "end": 334.16, "text": " So what's a super mask?"}, {"start": 334.16, "end": 339.72, "text": " A super mask comes from these kind of papers about lottery ticket hypothesis."}, {"start": 339.72, "end": 348.0, "text": " And one of these papers discovered basically, or conjectured and then showed in evidence"}, {"start": 348.0, "end": 354.04, "text": " that if you have a network that is randomly initialized, just like this is your neural"}, {"start": 354.04, "end": 360.96000000000004, "text": " network, the gray thing, and there is a way to mask it, which means masking basically"}, {"start": 360.96, "end": 365.34, "text": " means that you either activate or inactivate connections."}, {"start": 365.34, "end": 371.2, "text": " So you have your network and you simply multiply it by a binary mask that for each connection"}, {"start": 371.2, "end": 372.9, "text": " is a one or a zero."}, {"start": 372.9, "end": 376.88, "text": " So the one, so here is like 00000."}, {"start": 376.88, "end": 379.32, "text": " This is a one, this is a 000."}, {"start": 379.32, "end": 380.32, "text": " This is a one."}, {"start": 380.32, "end": 385.03999999999996, "text": " So the network isn't going to be zeros and ones, but it's going to be multiplied."}, {"start": 385.03999999999996, "end": 388.96, "text": " Each connection is going to be multiplied by a zero or a one, which means wherever there's"}, {"start": 388.96, "end": 395.64, "text": " a one, whatever weight that connection had, that will be the value of the weight of the"}, {"start": 395.64, "end": 396.64, "text": " connection."}, {"start": 396.64, "end": 404.41999999999996, "text": " If it is a zero, whatever weight that connection had, it will be pinned to zero."}, {"start": 404.41999999999996, "end": 406.7, "text": " So there will be no signal flowing."}, {"start": 406.7, "end": 412.65999999999997, "text": " So this paper established that if you take a randomly initialized neural network, there"}, {"start": 412.66, "end": 419.0, "text": " is a way to mask it and you can find those masks where if you mask it in a particular"}, {"start": 419.0, "end": 423.6, "text": " way, the network will already perform better than random on a given task."}, {"start": 423.6, "end": 427.92, "text": " So there is a way to solve MNIST by using a randomly initialized neural network and"}, {"start": 427.92, "end": 430.18, "text": " then simply masking it cleverly."}, {"start": 430.18, "end": 436.08000000000004, "text": " And then the mask network will have a good accuracy on MNIST."}, {"start": 436.08, "end": 443.68, "text": " And they found that and I have made a video about that and the sort of intuition behind"}, {"start": 443.68, "end": 451.32, "text": " the super masks is, this is just my intuition, is that, you know, MNIST, this is what I'm"}, {"start": 451.32, "end": 453.64, "text": " guessing MNIST is a relatively easy task."}, {"start": 453.64, "end": 459.71999999999997, "text": " In fact, most of the tasks they're considering in these papers are relatively easy."}, {"start": 459.71999999999997, "end": 465.12, "text": " And if you have a randomly initialized neural network, basically what you have around is"}, {"start": 465.12, "end": 466.56, "text": " a bunch of weight, right?"}, {"start": 466.56, "end": 473.36, "text": " So if, if I have my two layers right here, and then each connection here is a number"}, {"start": 473.36, "end": 479.24, "text": " like point two, five, this is, you know, seven, this is negative three, and so on."}, {"start": 479.24, "end": 485.08, "text": " Now they're going to consider, they here are going to consider weights that are initialized"}, {"start": 485.08, "end": 486.5, "text": " in a very special way."}, {"start": 486.5, "end": 489.72, "text": " But ultimately, you just have a bunch of random weights lying around."}, {"start": 489.72, "end": 495.70000000000005, "text": " And if the task is super easy, let's say, and the the neural network is sufficiently"}, {"start": 495.70000000000005, "end": 501.90000000000003, "text": " over parameterized, there might be many, many ways of achieving your goal."}, {"start": 501.90000000000003, "end": 508.0, "text": " So rather than being able to adjust the weights, like you would do when you train the neural"}, {"start": 508.0, "end": 514.28, "text": " network, you would actually change those numbers, you get away with simply selecting the combination"}, {"start": 514.28, "end": 517.84, "text": " of weights that will, you know, give you a good performance."}, {"start": 517.84, "end": 525.2800000000001, "text": " So in its kind of, it's sort of a mix of dropout and vector quantization."}, {"start": 525.2800000000001, "end": 530.02, "text": " So in vector quantization, you also you get away with quantizing the vectors to given"}, {"start": 530.02, "end": 532.08, "text": " precision."}, {"start": 532.08, "end": 538.08, "text": " And here, the task is easy enough such that by simple over parameterization and selecting"}, {"start": 538.08, "end": 543.38, "text": " of the weights that you have around mixing them correctly by simply so you can't mix"}, {"start": 543.38, "end": 550.08, "text": " arbitrarily, but you can mix with zero or one, you get good enough."}, {"start": 550.08, "end": 555.6, "text": " Okay, so this is sort of my hypothesis, my hypothesis would be that the harder task,"}, {"start": 555.6, "end": 561.88, "text": " the the harder it gets to find super masks that perform well."}, {"start": 561.88, "end": 562.92, "text": " That's what I think is going on."}, {"start": 562.92, "end": 568.98, "text": " But nevertheless, to say for the tasks they're considering here, you can find these super"}, {"start": 568.98, "end": 573.64, "text": " masks, and there is a way to do that by using gradient descent, even though the super masks"}, {"start": 573.64, "end": 575.32, "text": " are discrete."}, {"start": 575.32, "end": 581.46, "text": " So what we're going to do is we're going to use the same randomly initialized neural network"}, {"start": 581.46, "end": 583.6, "text": " for each of the tasks, right."}, {"start": 583.6, "end": 585.3000000000001, "text": " So this is like c410."}, {"start": 585.3000000000001, "end": 590.36, "text": " This is MNIST, this is ImageNet, we're going to use the same gray network, but we're going"}, {"start": 590.36, "end": 597.48, "text": " to find an individual mask for each of those networks for each of those tasks on top of"}, {"start": 597.48, "end": 599.24, "text": " the same network."}, {"start": 599.24, "end": 605.16, "text": " And they're all going to perform relatively well according to the super mask conjecture."}, {"start": 605.16, "end": 608.5, "text": " Now again, this is not surprising."}, {"start": 608.5, "end": 614.64, "text": " And the fact that we always use the same randomly initialized network, you know, isn't really"}, {"start": 614.64, "end": 617.38, "text": " it's not really necessary that we always use the same."}, {"start": 617.38, "end": 620.6, "text": " But in this case, they say, okay, we always use the same."}, {"start": 620.6, "end": 625.36, "text": " And then we only need to store the mask for each task."}, {"start": 625.36, "end": 630.2, "text": " The mask is much simpler than the weights, because, you know, a 32 bit floating point"}, {"start": 630.2, "end": 634.48, "text": " number is 32 bits, while a masking bit is only one bit."}, {"start": 634.48, "end": 638.44, "text": " So we save basically a factor of 32 in our models."}, {"start": 638.44, "end": 647.22, "text": " But essentially, essentially, right, it's not the case that we are training the same"}, {"start": 647.22, "end": 649.9, "text": " model and continue learning."}, {"start": 649.9, "end": 659.16, "text": " It's much more akin to training a sink a training one model per task, and then inferring the"}, {"start": 659.16, "end": 663.28, "text": " task, and just that we do it in a much more crude way."}, {"start": 663.28, "end": 668.66, "text": " So it's more like learning a compressed model per task, I find it's a better way to look"}, {"start": 668.66, "end": 672.48, "text": " at it, then, then continuous learning."}, {"start": 672.48, "end": 674.88, "text": " In any case, you learn the super masks."}, {"start": 674.88, "end": 680.52, "text": " And then here is the the the hard bit of the easy bit is if I tell you which tasks the"}, {"start": 680.52, "end": 686.28, "text": " inference data point the test data point comes from, you have a pretty easy time classifying"}, {"start": 686.28, "end": 691.52, "text": " it, you simply select the mask accordingly, you run forward pass, and that's it."}, {"start": 691.52, "end": 696.2, "text": " If I don't tell you where the test data point comes from, that's the hard part."}, {"start": 696.2, "end": 703.36, "text": " Now, they need a way to decide where the data point comes from."}, {"start": 703.36, "end": 710.76, "text": " And the the idea that they have right here, they have sort of multiple ideas."}, {"start": 710.76, "end": 719.12, "text": " But the main idea, the first idea is that if you have trained these individual models"}, {"start": 719.12, "end": 729.0, "text": " for the individual tasks, then okay, there's not good explanation here, then the correct"}, {"start": 729.0, "end": 732.04, "text": " model should be very confident, right?"}, {"start": 732.04, "end": 733.92, "text": " This is an assumption that you make."}, {"start": 733.92, "end": 739.38, "text": " So I'm going to take my image of the test set, and I'm going to feed it through the"}, {"start": 739.38, "end": 745.5999999999999, "text": " model one, which, you know, you have to separate that this idea is separate from the masks."}, {"start": 745.5999999999999, "end": 750.74, "text": " At its core, it's simply saying, if I have three different models that I've trained for"}, {"start": 750.74, "end": 756.3, "text": " three different tasks, and now I get an input, I don't know which one it's from, I can simply"}, {"start": 756.3, "end": 759.1999999999999, "text": " feed it to each one of them."}, {"start": 759.1999999999999, "end": 761.64, "text": " And I can look at the output distribution."}, {"start": 761.64, "end": 766.76, "text": " So maybe my output put distribution right here, this is as you can see, three output"}, {"start": 766.76, "end": 769.96, "text": " neurons, it's a three class classifier right here."}, {"start": 769.96, "end": 773.92, "text": " My output distribution is somewhat here like this."}, {"start": 773.92, "end": 777.88, "text": " And here, it's like this."}, {"start": 777.88, "end": 782.52, "text": " And here, it's like, I shouldn't do that."}, {"start": 782.52, "end": 787.62, "text": " I got a comment, you know who you are."}, {"start": 787.62, "end": 792.5600000000001, "text": " And here, it's like this."}, {"start": 792.5600000000001, "end": 794.46, "text": " So which one would you pick?"}, {"start": 794.46, "end": 803.58, "text": " And their answer here is, we should pick this one, because of it has very low entropy."}, {"start": 803.58, "end": 809.7, "text": " So this middle model here is very, very sure about this data point, it's very sure about"}, {"start": 809.7, "end": 816.5, "text": " its prediction, because it the distance basically of the top prediction to all the other predictions"}, {"start": 816.5, "end": 820.32, "text": " is so high, it's very confident in its prediction."}, {"start": 820.32, "end": 824.76, "text": " Whereas here, you can see that the distance is not too high."}, {"start": 824.76, "end": 828.74, "text": " Also here, the distance between the highest and the others is not too high."}, {"start": 828.74, "end": 836.76, "text": " So they say, we are going to pick the model or the mask in this case, for which the output"}, {"start": 836.76, "end": 839.68, "text": " entropy is the highest."}, {"start": 839.68, "end": 845.22, "text": " And that is a heuristic for now, but it tends to work pretty well."}, {"start": 845.22, "end": 849.48, "text": " It has a bit to do with how relatively difficult your tasks are."}, {"start": 849.48, "end": 854.88, "text": " So your tasks need to be kind of equally difficult."}, {"start": 854.88, "end": 860.9200000000001, "text": " Otherwise it's not otherwise this can get a little bit a little bit out of hand."}, {"start": 860.9200000000001, "end": 862.0600000000001, "text": " But there are ways to solve it."}, {"start": 862.0600000000001, "end": 864.88, "text": " And they allude to that in the kind of future work section."}, {"start": 864.88, "end": 870.72, "text": " But in this case, if the tasks are equally hard, and they consider tasks that are equally"}, {"start": 870.72, "end": 875.88, "text": " hard, then the entropy is a good measure of how confident these things are."}, {"start": 875.88, "end": 882.24, "text": " And therefore, we can check which task it is by using the entropy as a heuristic."}, {"start": 882.24, "end": 888.1, "text": " Alright, so we're left with simply trying each of the masks and then decide taking the"}, {"start": 888.1, "end": 890.46, "text": " one that has the highest entropy."}, {"start": 890.46, "end": 897.12, "text": " Now they say this is costly, because if we've learned, you know, 1000 tasks, we need to"}, {"start": 897.12, "end": 901.68, "text": " try each of the 1000 masks in order to do that."}, {"start": 901.68, "end": 903.9, "text": " So they go for something else."}, {"start": 903.9, "end": 908.96, "text": " And this is the second word in the title, this superposition word."}, {"start": 908.96, "end": 915.94, "text": " So instead of doing that, what they'll do is they'll use a superposition of masks."}, {"start": 915.94, "end": 921.82, "text": " And actually, the picture also I find more descriptive than the formula, I can write"}, {"start": 921.82, "end": 923.6, "text": " down the formula down here."}, {"start": 923.6, "end": 929.78, "text": " So what they'll do is they'll say, why don't we just overlap all of the masks."}, {"start": 929.78, "end": 935.58, "text": " So we'll have all of these masks mi for one for each tasks, and we'll initialize them"}, {"start": 935.58, "end": 942.78, "text": " with coefficients alpha, I will just mix them like this, and alpha here, it's initialized"}, {"start": 942.78, "end": 948.5600000000001, "text": " in one over k, where k is the number of tasks, okay, we'll just mix them."}, {"start": 948.5600000000001, "end": 952.64, "text": " And then we'll multiply them by the weight of the neural network."}, {"start": 952.64, "end": 961.16, "text": " And that's will that neural network is where we input our image into."}, {"start": 961.16, "end": 962.62, "text": " Okay."}, {"start": 962.62, "end": 969.6, "text": " So what does that give us that basically gives us a mix of all the networks that like it's"}, {"start": 969.6, "end": 974.3, "text": " it's pretty safe to say that the entire network is going to be in there."}, {"start": 974.3, "end": 980.06, "text": " And maybe sometimes, you know, multiple times, like if multiple masks use the same weight,"}, {"start": 980.06, "end": 984.3399999999999, "text": " it's going to be in there with a higher weight and so on."}, {"start": 984.3399999999999, "end": 989.3199999999999, "text": " So that's what you see right here, you can see that all the masks are overlapped in superposition"}, {"start": 989.3199999999999, "end": 990.4799999999999, "text": " with each other."}, {"start": 990.4799999999999, "end": 994.06, "text": " Now what does the output give you the output gives you nothing that gives you kind of the"}, {"start": 994.06, "end": 996.3199999999999, "text": " average prediction of the network."}, {"start": 996.3199999999999, "end": 1001.56, "text": " So this here is going to give you kind of the sort of the average prediction of all"}, {"start": 1001.56, "end": 1004.3199999999999, "text": " of the networks, which isn't very helpful."}, {"start": 1004.32, "end": 1010.4000000000001, "text": " But of course, what we can do is we can look at the gradients of this."}, {"start": 1010.4000000000001, "end": 1019.6800000000001, "text": " So if we from this calculate the entropy, which is here denoted h, and we calculate"}, {"start": 1019.6800000000001, "end": 1022.5, "text": " we back propagate this."}, {"start": 1022.5, "end": 1025.42, "text": " So we back propagate this to the alphas."}, {"start": 1025.42, "end": 1032.94, "text": " And we calculate the gradient of the entropy with respect to each of the alphas."}, {"start": 1032.94, "end": 1034.06, "text": " What does that give us?"}, {"start": 1034.06, "end": 1035.4199999999998, "text": " So what's the intuition here?"}, {"start": 1035.4199999999998, "end": 1042.74, "text": " The intuition is if I change my alpha a bit, how does the entropy change?"}, {"start": 1042.74, "end": 1049.3, "text": " So basically, this gives you the sensitivity of the entropy to these alpha parameters."}, {"start": 1049.3, "end": 1052.6599999999999, "text": " So if this is high, what does it mean?"}, {"start": 1052.6599999999999, "end": 1058.1799999999998, "text": " It means that this mask right here has a big influence on the entropy."}, {"start": 1058.18, "end": 1068.42, "text": " Specifically, if I were to increase the alpha, then the entropy would increase, okay."}, {"start": 1068.42, "end": 1073.26, "text": " And if I were to decrease the alpha, then the entropy would decrease."}, {"start": 1073.26, "end": 1077.1000000000001, "text": " That's the kind of what what the gradient gives you."}, {"start": 1077.1000000000001, "end": 1081.38, "text": " Now, did I say before, we want the one with the highest entropy?"}, {"start": 1081.38, "end": 1087.46, "text": " I'm pretty sure we want the one with the with the lowest entropy."}, {"start": 1087.46, "end": 1091.42, "text": " We want the one where we're very, very, very sure, right?"}, {"start": 1091.42, "end": 1095.6000000000001, "text": " I might have said that absolutely wrong."}, {"start": 1095.6000000000001, "end": 1106.1000000000001, "text": " So if you see right here, this is the formalism."}, {"start": 1106.1000000000001, "end": 1110.78, "text": " First we associate each of the k learned supermasks with a coefficient alpha initially set to"}, {"start": 1110.78, "end": 1111.78, "text": " one over k."}, {"start": 1111.78, "end": 1117.3600000000001, "text": " Each alpha can be interpreted as the belief that supermask m is the correct mask, equivalently"}, {"start": 1117.36, "end": 1121.34, "text": " the belief that the current unknown task is task i."}, {"start": 1121.34, "end": 1126.2199999999998, "text": " The model output is then computed with a weighted superposition of all learned tasks, which"}, {"start": 1126.2199999999998, "end": 1129.08, "text": " is this thing right here."}, {"start": 1129.08, "end": 1133.62, "text": " The correct mask should produce a confidence low entropy output."}, {"start": 1133.62, "end": 1138.12, "text": " Therefore we recover the correct mask, we find the coefficients alpha which minimize"}, {"start": 1138.12, "end": 1140.1799999999998, "text": " the output entropy h."}, {"start": 1140.1799999999998, "end": 1147.3, "text": " Okay, so yes, we want the task with the lowest entropy, of course, not with the highest entropy."}, {"start": 1147.3, "end": 1153.58, "text": " So, if we look at the gradient right here, the gradient basically tells us how each of"}, {"start": 1153.58, "end": 1157.98, "text": " the masks will influence the different the entropy."}, {"start": 1157.98, "end": 1165.9199999999998, "text": " And if we simply select the alpha, where the gradient here is the most negative number,"}, {"start": 1165.9199999999998, "end": 1171.5, "text": " so we want this to be as low as possible, not zero, but you know, negative as high as"}, {"start": 1171.5, "end": 1179.26, "text": " possible, then we know that if we increase this, the contribution of this mask, then"}, {"start": 1179.26, "end": 1182.82, "text": " the entropy will go down the most."}, {"start": 1182.82, "end": 1191.34, "text": " Okay, and again, our hypothesis here is that maximum entropy, sorry, minimum entropy means"}, {"start": 1191.34, "end": 1198.12, "text": " most confidence prediction means that the if all tasks are equally hard, it probably"}, {"start": 1198.12, "end": 1203.9399999999998, "text": " means that the data point is from the task where we have the lowest entropy."}, {"start": 1203.9399999999998, "end": 1207.8999999999999, "text": " So what's the deal here?"}, {"start": 1207.8999999999999, "end": 1211.6999999999998, "text": " They show in this graph right here, they show this is much faster."}, {"start": 1211.6999999999998, "end": 1217.9799999999998, "text": " So if we were to evaluate each mask individually and measure its entropy, of course, with the"}, {"start": 1217.9799999999998, "end": 1222.7199999999998, "text": " number of tasks, we'll simply linearly increase our time in the forward pass because we need"}, {"start": 1222.7199999999998, "end": 1225.6599999999999, "text": " to try out each of these masks."}, {"start": 1225.66, "end": 1232.8200000000002, "text": " However, if we do what they're doing here, we simply run one, we mix these ones, we run"}, {"start": 1232.8200000000002, "end": 1238.3400000000001, "text": " one forward pass, we do backprop, and they consider two strategies."}, {"start": 1238.3400000000001, "end": 1243.46, "text": " So what you can do is you can do gradient descent on these alphas, which takes, you"}, {"start": 1243.46, "end": 1248.66, "text": " know, a number of steps to converge, or you can actually do a single step."}, {"start": 1248.66, "end": 1254.44, "text": " So you just observe the gradient and by the gradient, you recognize which one has the"}, {"start": 1254.44, "end": 1257.38, "text": " lowest gradient, and that's the one you pick."}, {"start": 1257.38, "end": 1258.5800000000002, "text": " So where's the catch here?"}, {"start": 1258.5800000000002, "end": 1265.9, "text": " The catch is that if you do something like this, if you do something like this, there"}, {"start": 1265.9, "end": 1267.78, "text": " are two catches, actually."}, {"start": 1267.78, "end": 1273.46, "text": " First of all, this here is a a convex combination, right?"}, {"start": 1273.46, "end": 1275.6200000000001, "text": " This is convex combination."}, {"start": 1275.6200000000001, "end": 1278.06, "text": " And the problem isn't convex at all."}, {"start": 1278.06, "end": 1283.9, "text": " But if you simply take this convex combination, multiply it, and then look at the gradient,"}, {"start": 1283.9, "end": 1290.3400000000001, "text": " you sort of assume that the problem is a kind of a convex, nicely shaped problem."}, {"start": 1290.3400000000001, "end": 1296.02, "text": " And if you then observe these, the gradients with respect to the alphas, you make assumptions"}, {"start": 1296.02, "end": 1300.02, "text": " about the problem that might not be true."}, {"start": 1300.02, "end": 1305.74, "text": " So you lose, you kind of heuristically approximate the importance of these masks."}, {"start": 1305.74, "end": 1307.5400000000002, "text": " That's the first thing."}, {"start": 1307.54, "end": 1316.8, "text": " The second thing, of course, is that you still are implicitly saving, you still are implicitly"}, {"start": 1316.8, "end": 1321.44, "text": " trying all the models, but you're just not trying them explicitly."}, {"start": 1321.44, "end": 1328.22, "text": " You're implicitly trying all the models because when you do this combination right here, your"}, {"start": 1328.22, "end": 1335.78, "text": " auto differentiation library will actually keep track of what the individual models contribute."}, {"start": 1335.78, "end": 1337.58, "text": " It's just that per layer."}, {"start": 1337.58, "end": 1346.06, "text": " So of course, this here, this W is multi layer perceptron, which means that if you have multiple"}, {"start": 1346.06, "end": 1350.22, "text": " layers, you know, there's w one, and there's w two."}, {"start": 1350.22, "end": 1356.78, "text": " And you have your alphas, and your alphas are also, you know, you can distribute them"}, {"start": 1356.78, "end": 1364.42, "text": " into these, sorry, your masks are also mask for layer one mask for layer two, and so on."}, {"start": 1364.42, "end": 1370.18, "text": " So your auto differentiation package needs to keep track of okay, mask one goes here"}, {"start": 1370.18, "end": 1375.54, "text": " with this alpha mask to the layer two goes here with this alpha."}, {"start": 1375.54, "end": 1381.52, "text": " And there is there, so it needs to keep track of this graph."}, {"start": 1381.52, "end": 1383.74, "text": " It's just that this is highly optimized."}, {"start": 1383.74, "end": 1388.54, "text": " And you also need to you only need to do it layer by layer."}, {"start": 1388.54, "end": 1398.46, "text": " So the contribution of alpha of mask one, this is maybe alpha i of mask i one mask i"}, {"start": 1398.46, "end": 1406.1399999999999, "text": " two, the contribution of the alpha i will not be explicit in this layer, it will be"}, {"start": 1406.1399999999999, "end": 1411.3799999999999, "text": " implicit as an average across the layer, right."}, {"start": 1411.3799999999999, "end": 1416.08, "text": " So again, this is you assume in each layer, you assume a convex combination of all the"}, {"start": 1416.08, "end": 1419.3, "text": " alphas and propagate that forward."}, {"start": 1419.3, "end": 1425.6999999999998, "text": " And therefore, if you look at the next layer, you can only view what mask two does mask"}, {"start": 1425.6999999999998, "end": 1431.86, "text": " of layer two does as in terms of a convex combination of layer one."}, {"start": 1431.86, "end": 1436.8, "text": " So you make multiple approximations, and you rely on the optimization of your auto differentiation"}, {"start": 1436.8, "end": 1442.3, "text": " library to keep track of these different things and do operations in parallel."}, {"start": 1442.3, "end": 1450.22, "text": " And in the case where you do it linearly, I'm going to guess you simply do it as a sequential"}, {"start": 1450.22, "end": 1451.86, "text": " operation."}, {"start": 1451.86, "end": 1453.5, "text": " But it's going to be exact."}, {"start": 1453.5, "end": 1455.02, "text": " So that's the trade off."}, {"start": 1455.02, "end": 1462.78, "text": " Alright, so we now know how we can figure out where the task is from."}, {"start": 1462.78, "end": 1465.7, "text": " And let's see how that works."}, {"start": 1465.7, "end": 1472.18, "text": " So in this first task, we are looking at split image net, split image net, simply it"}, {"start": 1472.18, "end": 1478.3400000000001, "text": " takes the image net data set, which is a thousand class data set, and it distributes it into"}, {"start": 1478.3400000000001, "end": 1483.98, "text": " 100 different tasks, each is a 10 class classification task."}, {"start": 1483.98, "end": 1486.2, "text": " Now note two things."}, {"start": 1486.2, "end": 1492.7, "text": " First thing is that split image net, each task is approximately as hard as each other"}, {"start": 1492.7, "end": 1495.42, "text": " as as the other tasks, right?"}, {"start": 1495.42, "end": 1502.64, "text": " It's still image net classification, and it's the same number of the of it's the same number"}, {"start": 1502.64, "end": 1504.22, "text": " of labels."}, {"start": 1504.22, "end": 1509.66, "text": " And each task is about, you know, the same hardness, you can make that assumption."}, {"start": 1509.66, "end": 1514.46, "text": " And second of all, the tasks are actually pretty, pretty easy, right?"}, {"start": 1514.46, "end": 1518.8600000000001, "text": " It's hard to distinguish image net into 1000 classes."}, {"start": 1518.8600000000001, "end": 1524.48, "text": " But if you split that task, I'm going to bet that you have these high resolution images,"}, {"start": 1524.48, "end": 1529.4, "text": " and you have a 10 class classification, it's going to be relatively easy."}, {"start": 1529.4, "end": 1534.74, "text": " So all our conditions are met for at least for my hypothesis to hold."}, {"start": 1534.74, "end": 1540.94, "text": " And you can see on the right side, you can see split CIFAR 100, which does the same thing"}, {"start": 1540.94, "end": 1548.48, "text": " to CIFAR 100, it subdivides it into different, very small class classification tasks."}, {"start": 1548.48, "end": 1550.34, "text": " You can see the results."}, {"start": 1550.34, "end": 1554.78, "text": " The upper bound here is where you train a single model for each of the tasks that gets"}, {"start": 1554.78, "end": 1558.82, "text": " you to an average accuracy of 92%."}, {"start": 1558.82, "end": 1564.1, "text": " So on image net 92%, you know, it's pretty, it's pretty good."}, {"start": 1564.1, "end": 1570.3799999999999, "text": " Of course, this is again, this is 10 class, which makes the numbers a lot different."}, {"start": 1570.3799999999999, "end": 1578.82, "text": " With the sub sub sub sub sub, you get to this pretty good 88% accuracy."}, {"start": 1578.82, "end": 1582.1799999999998, "text": " This is this super masks in superposition."}, {"start": 1582.1799999999998, "end": 1587.7, "text": " This here is a baseline that also does lifelong learning."}, {"start": 1587.7, "end": 1595.34, "text": " Now they have these annotations right here, GG, which yes, GG, haha."}, {"start": 1595.34, "end": 1603.32, "text": " But so the first letter will always tell you whether the task ID is given during training."}, {"start": 1603.32, "end": 1608.3, "text": " And the second letter will tell you whether the task ID is given during testing."}, {"start": 1608.3, "end": 1614.12, "text": " So this here simply evaluates whether or not this masking is feasible, which you can see"}, {"start": 1614.12, "end": 1620.98, "text": " here it is so this will we know which mask to train during training, and we know which"}, {"start": 1620.98, "end": 1622.86, "text": " masks to retrieve during testing."}, {"start": 1622.86, "end": 1628.86, "text": " So there is nothing of this entropy gradients here, none of it, this simply evaluates the"}, {"start": 1628.86, "end": 1633.98, "text": " viability of the masking approach, which, as you can see, it's pretty viable, and it's"}, {"start": 1633.98, "end": 1638.82, "text": " more viable than these baselines."}, {"start": 1638.82, "end": 1643.32, "text": " This same thing on the CIFAR 100 right here."}, {"start": 1643.32, "end": 1647.3, "text": " So you can see they also evaluate since I guess it's an easier problem, they also evaluate"}, {"start": 1647.3, "end": 1650.74, "text": " the number of bytes, which they can control."}, {"start": 1650.74, "end": 1655.52, "text": " So they can control the number of bytes in their model by simply increasing or decreasing"}, {"start": 1655.52, "end": 1658.38, "text": " the required sparsity of their mask."}, {"start": 1658.38, "end": 1665.0600000000002, "text": " So you can change your mask by saying how sparse you want it."}, {"start": 1665.0600000000002, "end": 1670.1000000000001, "text": " And of course, if you want it more sparse, you get a worse model because you have less"}, {"start": 1670.1000000000001, "end": 1676.5600000000002, "text": " less ones in your budget to make your model perform well."}, {"start": 1676.5600000000002, "end": 1684.3000000000002, "text": " But you can see that if they do it with these baseline model is batch E, you severely underperform"}, {"start": 1684.3, "end": 1690.1, "text": " with regard to the upper bound right here, the upper bound again is where you train a"}, {"start": 1690.1, "end": 1692.54, "text": " model per task."}, {"start": 1692.54, "end": 1697.7, "text": " And separate heads here is another kind of dummy baseline, where you train a different"}, {"start": 1697.7, "end": 1704.8, "text": " head for each of the tasks with a common trunk that gets you pretty much nowhere."}, {"start": 1704.8, "end": 1710.82, "text": " With the sub sub algorithm, you do get almost to the performance of the upper bound."}, {"start": 1710.82, "end": 1715.82, "text": " And in fact, if you do this transfer approach right here, you do get there."}, {"start": 1715.82, "end": 1720.78, "text": " The transfer approach simply means that so you do these tasks in succession, right, you"}, {"start": 1720.78, "end": 1724.62, "text": " do task one, okay, done, you do task two, okay, done."}, {"start": 1724.62, "end": 1729.6599999999999, "text": " And for each one, you train a mask, okay, for each one you train, this is mask one,"}, {"start": 1729.6599999999999, "end": 1736.02, "text": " mask two, the transfer approach simply says, if I start task three, I'm going to start"}, {"start": 1736.02, "end": 1742.42, "text": " the mask three, my initial weights basically, are going to be a running average of the masks"}, {"start": 1742.42, "end": 1749.02, "text": " that I have already considered or an average, there is some amount of transfer going on,"}, {"start": 1749.02, "end": 1755.74, "text": " simply to initialize the weights, it's actually astounding that this helps you so much."}, {"start": 1755.74, "end": 1760.56, "text": " But with this, if you look at the actual numbers, I believe you can get like a tiny bit higher"}, {"start": 1760.56, "end": 1766.22, "text": " than the training a single model for each of the tasks."}, {"start": 1766.22, "end": 1774.8999999999999, "text": " Okay, so this sort of establishes the viability of training the different masks for the different"}, {"start": 1774.8999999999999, "end": 1780.86, "text": " tasks, which I, again, I think it is not surprising because essentially, you're training a different"}, {"start": 1780.86, "end": 1782.58, "text": " model per task."}, {"start": 1782.58, "end": 1791.26, "text": " And it's just the fact that you do a very crude model, and that you can store very efficiently,"}, {"start": 1791.26, "end": 1796.22, "text": " you might object and say, hey, don't I need to store the underlying randomly initialized"}, {"start": 1796.22, "end": 1797.22, "text": " network?"}, {"start": 1797.22, "end": 1801.34, "text": " And the answer is yes and no, actually, you only need to store the random seed to produce"}, {"start": 1801.34, "end": 1802.34, "text": " it."}, {"start": 1802.34, "end": 1803.8999999999999, "text": " So checkmate."}, {"start": 1803.8999999999999, "end": 1807.1399999999999, "text": " Yeah, they do."}, {"start": 1807.1399999999999, "end": 1812.1, "text": " So here they explain this one shot algorithm where they simply look at the gradient of"}, {"start": 1812.1, "end": 1819.82, "text": " the entropy, you can see with the maximum negative gradient of the entropy."}, {"start": 1819.82, "end": 1825.5, "text": " They also have this binary algorithm, if the task where they say with the task is harder"}, {"start": 1825.5, "end": 1831.3, "text": " to differentiate this kind of assumption of the convex combination thing does might not"}, {"start": 1831.3, "end": 1832.3, "text": " hold."}, {"start": 1832.3, "end": 1840.1, "text": " So what they do is they have this binary algorithm, where they do a binary search, where so they"}, {"start": 1840.1, "end": 1847.2199999999998, "text": " simply want to circumvent the necessity to evaluate each of the masks by itself, because"}, {"start": 1847.2199999999998, "end": 1848.48, "text": " that takes long."}, {"start": 1848.48, "end": 1854.0, "text": " So they do something in between where they do this binary algorithm."}, {"start": 1854.0, "end": 1861.86, "text": " This is right here, where they do this convex combination, they evaluate the gradient, but"}, {"start": 1861.86, "end": 1868.98, "text": " then they don't just take the highest of the negative gradients, they eliminate half of"}, {"start": 1868.98, "end": 1869.98, "text": " them."}, {"start": 1869.98, "end": 1875.5, "text": " So basically, whenever it's lower than the median, they eliminate it, and then they start"}, {"start": 1875.5, "end": 1878.3, "text": " off with this new set of reduced alphas."}, {"start": 1878.3, "end": 1882.3, "text": " So in each of these steps, they eliminate half of the masks, and then they recompute"}, {"start": 1882.3, "end": 1888.48, "text": " again, because because it is not a convex problem, the the order might actually be different"}, {"start": 1888.48, "end": 1892.32, "text": " in the second and third and fourth step."}, {"start": 1892.32, "end": 1898.06, "text": " Of course, this is simply this is like halfway towards between this one shot algorithm and"}, {"start": 1898.06, "end": 1900.3799999999999, "text": " trying each mask by itself."}, {"start": 1900.3799999999999, "end": 1904.1, "text": " It's kind of a compromise."}, {"start": 1904.1, "end": 1911.34, "text": " I mean, they make it, they really try to not not try each mask once because it's one of"}, {"start": 1911.34, "end": 1912.8999999999999, "text": " their contributions, right?"}, {"start": 1912.8999999999999, "end": 1917.4199999999998, "text": " But then they probably realized if we just do it one shot, sometimes it doesn't work."}, {"start": 1917.4199999999998, "end": 1921.06, "text": " So they're going between which is, you know, it's a pretty cool idea."}, {"start": 1921.06, "end": 1925.02, "text": " All right, next experiments."}, {"start": 1925.02, "end": 1928.82, "text": " We're now in this situation, and you see, you see a number of things."}, {"start": 1928.82, "end": 1933.46, "text": " So first of all, we have a new added a new baseline, this PSP."}, {"start": 1933.46, "end": 1936.9, "text": " And you can see that the baselines operate in this GG regime."}, {"start": 1936.9, "end": 1943.68, "text": " So the baselines are given the task during training, and given the task during evaluation."}, {"start": 1943.68, "end": 1949.1399999999999, "text": " You see the upper bound here in gray is where we train a model for each task."}, {"start": 1949.1399999999999, "end": 1953.82, "text": " And you assume that's an upper bound, because you assume the tasks are kind of unrelated"}, {"start": 1953.82, "end": 1956.8999999999999, "text": " to each other, which is not the case."}, {"start": 1956.8999999999999, "end": 1962.98, "text": " So there is actually potential to beat the to beat the upper bound baseline."}, {"start": 1962.98, "end": 1966.6599999999999, "text": " And subs up here you see operates in a different regime."}, {"start": 1966.6599999999999, "end": 1971.98, "text": " Namely, there's this regime of you're given the task during training, but then during"}, {"start": 1971.98, "end": 1974.46, "text": " testing, you're not given the task."}, {"start": 1974.46, "end": 1975.46, "text": " Okay."}, {"start": 1975.46, "end": 1980.5, "text": " And this you here, it basically means that the labels you assume that the labels of the"}, {"start": 1980.5, "end": 1981.98, "text": " tasks are not shared."}, {"start": 1981.98, "end": 1991.3, "text": " So in in this case, if you predict, if you predict, like if you split MNIST into always"}, {"start": 1991.3, "end": 2000.6200000000001, "text": " that two class, if you split MNIST into two tasks, you predict the first task is 01234."}, {"start": 2000.6200000000001, "end": 2002.9, "text": " The second task is 56789."}, {"start": 2002.9, "end": 2004.58, "text": " Okay."}, {"start": 2004.58, "end": 2006.18, "text": " And you have the same amount of labels."}, {"start": 2006.18, "end": 2008.26, "text": " So you always have five output neurons, right?"}, {"start": 2008.26, "end": 2012.14, "text": " So you have 12345 output neurons."}, {"start": 2012.14, "end": 2022.3799999999999, "text": " If you if the image here is like a five, that would be task, task one, label zero, right?"}, {"start": 2022.3799999999999, "end": 2030.86, "text": " If your network now predicts label zero correctly, but predicts the the image to come from task"}, {"start": 2030.86, "end": 2035.54, "text": " one, you count it as a mistake, you say, Well, you know, you've predicted the right output"}, {"start": 2035.54, "end": 2040.3799999999999, "text": " neuron, but you've told me it comes from task zero from from the zero to four."}, {"start": 2040.3799999999999, "end": 2042.6599999999999, "text": " So I'm going to count that as a mistake."}, {"start": 2042.6599999999999, "end": 2050.06, "text": " So it really there isn't there isn't a way for the network to kind of go get around."}, {"start": 2050.06, "end": 2052.62, "text": " Predicting the wrong tasks are kind of share information."}, {"start": 2052.62, "end": 2057.54, "text": " So you assume that the labels are not shared or on shared."}, {"start": 2057.54, "end": 2065.5, "text": " Yeah, so it's the sub sub here has a significantly harder task than the baseline."}, {"start": 2065.5, "end": 2067.5, "text": " Keep keep that in mind."}, {"start": 2067.5, "end": 2073.46, "text": " And now we're applying our because we we are not given the task at inference time."}, {"start": 2073.46, "end": 2079.76, "text": " Now we're applying our heuristic, where we go and look at which of the mask entropies"}, {"start": 2079.76, "end": 2085.5, "text": " is the lowest, respectively, we use this actually this one shot algorithm, where we look at"}, {"start": 2085.5, "end": 2086.86, "text": " the gradients."}, {"start": 2086.86, "end": 2093.34, "text": " And you can see this is on permuted MNIST in permuted MNIST, what you do is you take"}, {"start": 2093.34, "end": 2098.2200000000003, "text": " MNIST, and you simply permute the pixels."}, {"start": 2098.2200000000003, "end": 2102.42, "text": " And this, it sounds crazy, but you simply permute the pixels."}, {"start": 2102.42, "end": 2103.98, "text": " And that gives you a new task."}, {"start": 2103.98, "end": 2108.94, "text": " So you can come up with like almost an infinite number of tasks because there are what 28"}, {"start": 2108.94, "end": 2118.34, "text": " times 28 pixels, so you can commute them 784, you know, factorial times, which gives you"}, {"start": 2118.34, "end": 2120.34, "text": " like infinitely many tasks."}, {"start": 2120.34, "end": 2122.78, "text": " And so you can modulate."}, {"start": 2122.78, "end": 2126.1200000000003, "text": " So here you can see the number of tasks learned increases."}, {"start": 2126.1200000000003, "end": 2131.1000000000004, "text": " And at the beginning, this baselines, especially this baseline is doing fairly well actually"}, {"start": 2131.1000000000004, "end": 2137.5400000000004, "text": " on par with the upper bound when you only have 10 different tasks."}, {"start": 2137.5400000000004, "end": 2145.5400000000004, "text": " However, after that quickly degrades, however, this sub sub here, it, you know, keeps it"}, {"start": 2145.5400000000004, "end": 2152.6200000000003, "text": " keeps its performance, which it so this doesn't only mean that it correctly predicts the output"}, {"start": 2152.62, "end": 2160.42, "text": " neuron, it also correctly predicts which task which permutation was applied to the digit,"}, {"start": 2160.42, "end": 2164.7, "text": " simply by looking where the entropy is high, right."}, {"start": 2164.7, "end": 2167.3399999999997, "text": " So that's pretty cool."}, {"start": 2167.3399999999997, "end": 2172.98, "text": " And you know, it's it's actually kind of surprising to be to be honest."}, {"start": 2172.98, "end": 2177.88, "text": " So on the left, this is a lunette architecture on the on the right, it's a fully connected"}, {"start": 2177.88, "end": 2178.88, "text": " network."}, {"start": 2178.88, "end": 2183.6600000000003, "text": " So the fully connected network here performing better is sort of expected."}, {"start": 2183.6600000000003, "end": 2187.06, "text": " First of all, amnest is really easy and can actually be solved with a fully connected"}, {"start": 2187.06, "end": 2188.06, "text": " network."}, {"start": 2188.06, "end": 2195.38, "text": " And second of all, especially permuted amnest, I guess doesn't really conform to the to the"}, {"start": 2195.38, "end": 2199.34, "text": " assumptions of convolutional neural networks anymore."}, {"start": 2199.34, "end": 2202.7000000000003, "text": " Again, keep in mind, these tasks are very easy."}, {"start": 2202.7000000000003, "end": 2204.2200000000003, "text": " Yeah."}, {"start": 2204.22, "end": 2212.06, "text": " So so especially for the fully connected network, of course, each permutation kind of looks"}, {"start": 2212.06, "end": 2218.8599999999997, "text": " the same because it's it doesn't care at the beginning that pixels are next to each other"}, {"start": 2218.8599999999997, "end": 2221.2999999999997, "text": " simply each pixel is a different thing."}, {"start": 2221.2999999999997, "end": 2228.04, "text": " It's just the fact that it cannot it cannot learn from one tasks much about the other"}, {"start": 2228.04, "end": 2229.04, "text": " tasks."}, {"start": 2229.04, "end": 2232.5, "text": " That's why you that's the nature of permuted amnest."}, {"start": 2232.5, "end": 2240.38, "text": " All right, and then in this experiment right here, and this is the sort of crown experiment,"}, {"start": 2240.38, "end": 2249.66, "text": " they learn they do this permuted amnest, but they go up to 2500 tasks, right 2500 different"}, {"start": 2249.66, "end": 2250.66, "text": " permutations."}, {"start": 2250.66, "end": 2255.94, "text": " But so but now they have an additional thing right here."}, {"start": 2255.94, "end": 2261.98, "text": " So again, they have this sub sub where it needs to predict the correct permutation."}, {"start": 2261.98, "end": 2269.14, "text": " But also they compare it with a an algorithm that needs that is this n n right here."}, {"start": 2269.14, "end": 2276.1, "text": " So in this n n, not not only are you not given the task label at testing time, you are actually"}, {"start": 2276.1, "end": 2279.94, "text": " not even given the task label at training time."}, {"start": 2279.94, "end": 2282.54, "text": " But here the outputs are shared."}, {"start": 2282.54, "end": 2287.9, "text": " So you know, since since you have no way of knowing which task it is, you've never given"}, {"start": 2287.9, "end": 2293.1, "text": " it as long as you predict the correct class, you good."}, {"start": 2293.1, "end": 2295.96, "text": " So it's always it's always a 10 class classification problem."}, {"start": 2295.96, "end": 2298.98, "text": " It's just no permuted."}, {"start": 2298.98, "end": 2302.38, "text": " You're not given the task label here."}, {"start": 2302.38, "end": 2308.6600000000003, "text": " So first of all, I want to say that this here, the shared labels, it could actually contribute"}, {"start": 2308.6600000000003, "end": 2311.14, "text": " to the success of this algorithm right here."}, {"start": 2311.14, "end": 2317.8199999999997, "text": " Because even though you permute the pixels, you can still sort of do things like count"}, {"start": 2317.8199999999997, "end": 2322.5, "text": " the frequency of light pixels versus dark pixels in MNIST."}, {"start": 2322.5, "end": 2327.22, "text": " And that might already give you a very, very big hint, right?"}, {"start": 2327.22, "end": 2332.8599999999997, "text": " Or, you know, simple correlation of of two pixels, though that's that's a task specific"}, {"start": 2332.8599999999997, "end": 2333.8599999999997, "text": " thing."}, {"start": 2333.8599999999997, "end": 2340.22, "text": " But that the frequency of light pixels versus dark pixels will already give you a big boost"}, {"start": 2340.22, "end": 2341.5, "text": " in accuracy."}, {"start": 2341.5, "end": 2345.66, "text": " And now you can actually share that feature, that feature will always be the same for every"}, {"start": 2345.66, "end": 2346.66, "text": " permutation."}, {"start": 2346.66, "end": 2351.7799999999997, "text": " So this is something you can share between tasks."}, {"start": 2351.7799999999997, "end": 2356.4199999999996, "text": " And I would like so one way I guess you could eliminate that."}, {"start": 2356.4199999999996, "end": 2358.18, "text": " Well, I don't know."}, {"start": 2358.18, "end": 2363.18, "text": " I'm not sure is you kind of have to randomize the number of light pixels, but keep the classes"}, {"start": 2363.18, "end": 2364.18, "text": " the same."}, {"start": 2364.18, "end": 2367.3799999999997, "text": " Yeah, it's it's going to be complicated, right?"}, {"start": 2367.3799999999997, "end": 2369.14, "text": " But just keep that in mind."}, {"start": 2369.14, "end": 2373.54, "text": " So how, how does the algorithm even decide?"}, {"start": 2373.54, "end": 2377.46, "text": " So they have a heuristic right here as well."}, {"start": 2377.46, "end": 2390.42, "text": " Namely, they say, okay, if we don't have no task identity during training or inference,"}, {"start": 2390.42, "end": 2395.2999999999997, "text": " where task identity is entirely unknown, even during training, if sub sub is uncertain about"}, {"start": 2395.3, "end": 2400.0600000000004, "text": " the current task identity, it is likely that the data does not do not belong to any tasks"}, {"start": 2400.0600000000004, "end": 2401.54, "text": " seen so far."}, {"start": 2401.54, "end": 2406.38, "text": " When this occurs, a new super mask is allocated, and the number of tasks learned so far is"}, {"start": 2406.38, "end": 2407.38, "text": " incremented."}, {"start": 2407.38, "end": 2412.46, "text": " Okay, so the they go with the same principle right here, they say, if we get a new training"}, {"start": 2412.46, "end": 2419.1400000000003, "text": " sample, we just evaluated against all the masks that we had so far, or we do our, you"}, {"start": 2419.14, "end": 2426.2799999999997, "text": " know, one shot algorithm to to approximate which masks gets it gets us a low entropy."}, {"start": 2426.2799999999997, "end": 2432.02, "text": " If none of the mask gets us a low entropy, then we decide this must be some kind of unseen"}, {"start": 2432.02, "end": 2433.02, "text": " tasks."}, {"start": 2433.02, "end": 2438.42, "text": " So we're going to allocate a new mask for this unseen tasks."}, {"start": 2438.42, "end": 2445.74, "text": " And that heuristic, as you can see, it performs fairly, fairly well, where was our graph,"}, {"start": 2445.74, "end": 2448.42, "text": " our graph was down here."}, {"start": 2448.42, "end": 2455.82, "text": " In fact, it performs pretty much on par with where you know the task during training, and"}, {"start": 2455.82, "end": 2463.02, "text": " just not during during inference, up until like here, the very last bit, if you really"}, {"start": 2463.02, "end": 2469.82, "text": " get into the high task regime, where I guess it starts getting it starts getting confusing."}, {"start": 2469.82, "end": 2474.58, "text": " So this this heuristic might start to break down, but it might just be a fact how they"}, {"start": 2474.58, "end": 2478.3, "text": " tune their constants, like they have to define a threshold where they say, okay, if the end"}, {"start": 2478.3, "end": 2484.02, "text": " entropy is somehow higher than this threshold, then we allocate a new a new task."}, {"start": 2484.02, "end": 2487.3, "text": " And this might be optimized in order to solve this."}, {"start": 2487.3, "end": 2491.1800000000003, "text": " Again, these tasks are very, very, very, very easy."}, {"start": 2491.1800000000003, "end": 2494.9, "text": " So keep keep that in mind."}, {"start": 2494.9, "end": 2496.34, "text": " Yeah."}, {"start": 2496.34, "end": 2502.84, "text": " Okay, so this basically was the experimental part of that paper."}, {"start": 2502.84, "end": 2506.84, "text": " Now they consider different extensions to that."}, {"start": 2506.84, "end": 2512.76, "text": " And I'm not sure they also considered some ablations, which are pretty interesting."}, {"start": 2512.76, "end": 2519.54, "text": " So here, they say, we are going to up the kind of the hardness of the task with with"}, {"start": 2519.54, "end": 2527.58, "text": " rotated MNIST and also their model does pretty well on the rotated MNIST task where the differences"}, {"start": 2527.58, "end": 2533.42, "text": " of between the the differences between the tasks are simply some of them are rotated"}, {"start": 2533.42, "end": 2534.58, "text": " by 10 degrees."}, {"start": 2534.58, "end": 2541.34, "text": " So that's a tiny rotation in the right if you have a number three, you kind of rotate"}, {"start": 2541.34, "end": 2542.34, "text": " it by 10."}, {"start": 2542.34, "end": 2546.86, "text": " I can't even draw that subtle of a rotation by 10 degrees."}, {"start": 2546.86, "end": 2556.9, "text": " And you know, the sub sub must correctly predict which task the image is from, or it will not"}, {"start": 2556.9, "end": 2561.94, "text": " get the it will not get a correct reward."}, {"start": 2561.94, "end": 2564.78, "text": " And the fact that it performs pretty well."}, {"start": 2564.78, "end": 2570.0, "text": " And the fact that it has, you know, rotation degrees where it outperforms the baseline"}, {"start": 2570.0, "end": 2573.44, "text": " that is all actually given the rotation."}, {"start": 2573.44, "end": 2577.94, "text": " So it's given the task at inference time is pretty, pretty remarkable."}, {"start": 2577.94, "end": 2583.38, "text": " Again, I believe this is due to the fact that these tasks are so easy, and therefore, this"}, {"start": 2583.38, "end": 2591.6, "text": " entropy, it just spikes when you get the correct thing, because it it sort of, it sort of latches"}, {"start": 2591.6, "end": 2594.54, "text": " on to very easy features for each task."}, {"start": 2594.54, "end": 2600.7, "text": " So I'm going to guess that the tasks are, you know, generally solvable by maybe correlating"}, {"start": 2600.7, "end": 2601.9, "text": " two pixels, right?"}, {"start": 2601.9, "end": 2606.6, "text": " If like this pixel correlated with this pixel, if the correlation is high, it's a three,"}, {"start": 2606.6, "end": 2609.38, "text": " the correlations low, it's something else, okay."}, {"start": 2609.38, "end": 2614.3399999999997, "text": " And then if you rotate it, it's just not the case anymore that this pixel and this pixel,"}, {"start": 2614.3399999999997, "end": 2617.2999999999997, "text": " the correlation is very high."}, {"start": 2617.3, "end": 2624.34, "text": " So if you predict using this correlation, you'll get a pretty low confidence."}, {"start": 2624.34, "end": 2629.2200000000003, "text": " And I'm going to guess that yeah, if you have discrete tasks, and it's in this task, then"}, {"start": 2629.2200000000003, "end": 2632.6600000000003, "text": " your confidence will just spike because the task is so easy."}, {"start": 2632.6600000000003, "end": 2637.54, "text": " And because all the tasks are about equally hard, because if you can find this correlation"}, {"start": 2637.54, "end": 2642.78, "text": " here, you can find it over here, it's simply going to be two different two different pixels"}, {"start": 2642.78, "end": 2650.1400000000003, "text": " in this task, and then what as you try the masks, whenever you hit the one where you"}, {"start": 2650.1400000000003, "end": 2655.98, "text": " can predict pretty confidently with those two pixels, then your confidence is going"}, {"start": 2655.98, "end": 2661.6600000000003, "text": " to spike your entropy is going to get down and you know, it's that task, right?"}, {"start": 2661.6600000000003, "end": 2665.94, "text": " They also here they compare."}, {"start": 2665.94, "end": 2666.94, "text": " Where is it?"}, {"start": 2666.94, "end": 2668.0600000000004, "text": " The one shot algorithm."}, {"start": 2668.06, "end": 2676.42, "text": " So they, they, they use their one shot algorithm to and and they put it on a baseline."}, {"start": 2676.42, "end": 2683.7799999999997, "text": " So this baseline, where they always actually have to give it the the task, they augmented"}, {"start": 2683.7799999999997, "end": 2689.64, "text": " by by their, their one shot algorithm to select the task."}, {"start": 2689.64, "end": 2695.58, "text": " And it turns out they can, you know, make it perform fairly well, not on par with them,"}, {"start": 2695.58, "end": 2701.2599999999998, "text": " interestingly, but they can make it perform also fairly well actually better than it was"}, {"start": 2701.2599999999998, "end": 2703.58, "text": " performing before."}, {"start": 2703.58, "end": 2707.7799999999997, "text": " So they have different extensions right here."}, {"start": 2707.7799999999997, "end": 2710.48, "text": " And that's some of them are pretty important."}, {"start": 2710.48, "end": 2716.18, "text": " The one important thing they do is they have these superfluous neurons."}, {"start": 2716.18, "end": 2717.86, "text": " And that's sort of hidden."}, {"start": 2717.86, "end": 2720.98, "text": " And it's always a bit."}, {"start": 2720.98, "end": 2726.62, "text": " So here, for example, you see, in the output, they say, we have a lunette model using output"}, {"start": 2726.62, "end": 2728.62, "text": " size 500."}, {"start": 2728.62, "end": 2733.62, "text": " Now there there are only 10 different labels in the MNIST task, right, also in the permuted"}, {"start": 2733.62, "end": 2740.92, "text": " MNIST task, there are 10 different labels that I mean, there are a total of 25,000 labels"}, {"start": 2740.92, "end": 2746.06, "text": " if you have 2500 tasks, but the neural network has output size 10."}, {"start": 2746.06, "end": 2753.7, "text": " However, their neural network here has output size 500, which is surprising."}, {"start": 2753.7, "end": 2761.5, "text": " So they say right here, and we're going to get to the hopfield network at the very end."}, {"start": 2761.5, "end": 2766.14, "text": " For those who are still around, because that's, I think that should be its own paper, but"}, {"start": 2766.14, "end": 2773.2599999999998, "text": " you know, they say it could use an output of size L, where L is the actual number of"}, {"start": 2773.26, "end": 2780.7000000000003, "text": " labels per task, though we find in practice that it helps significantly to add extra neurons"}, {"start": 2780.7000000000003, "end": 2782.5800000000004, "text": " to the final layer."}, {"start": 2782.5800000000004, "end": 2790.98, "text": " Specifically, we consider outputs p in our s, so s is higher than L, and refer to the"}, {"start": 2790.98, "end": 2796.2200000000003, "text": " neurons that are past L as superfluous neurons."}, {"start": 2796.2200000000003, "end": 2800.6600000000003, "text": " So let's try to make sense of this."}, {"start": 2800.66, "end": 2803.54, "text": " So they have a neural network."}, {"start": 2803.54, "end": 2807.42, "text": " And let's say it's a three class classification task, right?"}, {"start": 2807.42, "end": 2812.54, "text": " So you have three classes, and that's what you would do, they simply add a bunch of neurons"}, {"start": 2812.54, "end": 2813.66, "text": " right here."}, {"start": 2813.66, "end": 2817.08, "text": " That means they also they, you know, they add all of the connections from the previous"}, {"start": 2817.08, "end": 2818.94, "text": " layer to those neurons."}, {"start": 2818.94, "end": 2825.62, "text": " But still, the classes can only be either 01 or two, these classes never appear during"}, {"start": 2825.62, "end": 2827.14, "text": " training."}, {"start": 2827.14, "end": 2833.7799999999997, "text": " So they claim this helps during during their procedure."}, {"start": 2833.7799999999997, "end": 2842.98, "text": " And I, I thought about it a bit, and we might be able to try to guess why it makes sense."}, {"start": 2842.98, "end": 2846.46, "text": " They say they simply say we observe that helps."}, {"start": 2846.46, "end": 2850.62, "text": " And I mean, you know, let's, let's try to make sense of it."}, {"start": 2850.62, "end": 2856.58, "text": " Okay, so if we train, if we train our model using these too many neurons, what happens?"}, {"start": 2856.58, "end": 2859.86, "text": " Well, our label is always going to be of the top three neurons."}, {"start": 2859.86, "end": 2865.1, "text": " So let's say our label is one, this is going to result in a one hot vector like this."}, {"start": 2865.1, "end": 2870.66, "text": " Now, what are we training in this layer here in this layer here, we're training logits."}, {"start": 2870.66, "end": 2875.66, "text": " Okay, so pre pre softmax outputs."}, {"start": 2875.66, "end": 2886.1, "text": " So our, our algorithm, our cross entropy loss is going to push all of these here down during"}, {"start": 2886.1, "end": 2890.7799999999997, "text": " every single training point is going to push this one up and all of these down."}, {"start": 2890.7799999999997, "end": 2895.94, "text": " Now these three here are going to be pushed up and down depending on the label."}, {"start": 2895.94, "end": 2902.64, "text": " However, all of these down here are going to be only pushed down during the entire training."}, {"start": 2902.64, "end": 2906.7, "text": " So they are going to be exceptionally low numbers."}, {"start": 2906.7, "end": 2907.98, "text": " Okay."}, {"start": 2907.98, "end": 2919.18, "text": " Now if we then come and we look at the at the entropy of this, the the entropy, I think"}, {"start": 2919.18, "end": 2925.02, "text": " honestly, this is simply you could achieve the same thing by using a different temperature"}, {"start": 2925.02, "end": 2932.02, "text": " parameter in the softmax or in the entropy that you consider, because why can this help"}, {"start": 2932.02, "end": 2936.1, "text": " and this helps with inferring which task it's coming from, right?"}, {"start": 2936.1, "end": 2941.7999999999997, "text": " So if you consider a task where you only have three outputs, so you don't have this bit"}, {"start": 2941.7999999999997, "end": 2948.58, "text": " down here, and you look at the entropy, it's going to be you know, it's going to be something"}, {"start": 2948.58, "end": 2949.58, "text": " something."}, {"start": 2949.58, "end": 2953.42, "text": " Sorry, I have to draw this right here."}, {"start": 2953.42, "end": 2956.74, "text": " It's going to be like this, you know, it's fairly confident."}, {"start": 2956.74, "end": 2964.4, "text": " But if and maybe for the other tasks, it's not going to be as confident, you know, it's"}, {"start": 2964.4, "end": 2967.3, "text": " maybe going to be like this a bit."}, {"start": 2967.3, "end": 2972.62, "text": " However, if you have those, and if it's of the correct tasks, I'm going to guess this"}, {"start": 2972.62, "end": 2975.14, "text": " kind of stays the same because they're really low."}, {"start": 2975.14, "end": 2979.46, "text": " But if it's of the incorrect tasks, then you're not sure."}, {"start": 2979.46, "end": 2985.58, "text": " And you not being sure about the output also means that you allocate a lot more to these"}, {"start": 2985.58, "end": 2987.42, "text": " things right here."}, {"start": 2987.42, "end": 2992.1, "text": " Because you've sort of never seen this particular kind of training examples."}, {"start": 2992.1, "end": 2993.1, "text": " So you're not sure."}, {"start": 2993.1, "end": 2999.22, "text": " You're just going to distribute your kind of your probability mass across these things"}, {"start": 2999.22, "end": 3000.8399999999997, "text": " right here."}, {"start": 3000.8399999999997, "end": 3004.7, "text": " Because you've not been trained on that kind of input, right?"}, {"start": 3004.7, "end": 3009.48, "text": " It's very important to see that this is task, this is the correct task, which they always"}, {"start": 3009.48, "end": 3016.2, "text": " label J. And for for any other incorrect task, you've never seen data like this."}, {"start": 3016.2, "end": 3023.02, "text": " So these things here sort of act like an outlier class without you explicitly training an outlier"}, {"start": 3023.02, "end": 3026.04, "text": " class, you simply train these things."}, {"start": 3026.04, "end": 3028.3, "text": " During training, you make them small."}, {"start": 3028.3, "end": 3034.7, "text": " But you it's important to notice you always make them small from a data point that comes"}, {"start": 3034.7, "end": 3037.1, "text": " from their particular task."}, {"start": 3037.1, "end": 3040.54, "text": " Okay, that's what you train them for."}, {"start": 3040.54, "end": 3048.7599999999998, "text": " And now if you input a data point from a different task, they have less reason to be small, because"}, {"start": 3048.7599999999998, "end": 3050.82, "text": " this is an outlier data point."}, {"start": 3050.82, "end": 3054.7400000000002, "text": " So you have much more fluctuations, so you have more fluctuations here, and therefore,"}, {"start": 3054.7400000000002, "end": 3057.1000000000004, "text": " the entropy is going to be even higher."}, {"start": 3057.1000000000004, "end": 3063.06, "text": " All right, this is sort of how I make sense of the fact that these additional superfluous"}, {"start": 3063.06, "end": 3069.86, "text": " neurons help here, they act as kind of an outlier detector for the training data set"}, {"start": 3069.86, "end": 3072.6200000000003, "text": " of that particular task."}, {"start": 3072.6200000000003, "end": 3079.54, "text": " Now, because you have different training data for each task, they go further and they say,"}, {"start": 3079.54, "end": 3083.22, "text": " it actually works even better, it works even better."}, {"start": 3083.22, "end": 3089.02, "text": " If we instead of this entropy heuristic, we consider another heuristic."}, {"start": 3089.02, "end": 3095.32, "text": " Accordingly, we consider an objective G, which encourages the S neurons to have large negative"}, {"start": 3095.32, "end": 3100.2599999999998, "text": " values and confused as an as an alternative to entropy in equation four."}, {"start": 3100.2599999999998, "end": 3107.1, "text": " So G they analyze down in the appendix, and we're just quickly going to look at what G"}, {"start": 3107.1, "end": 3109.5, "text": " is sorry, this is about to load."}, {"start": 3109.5, "end": 3111.94, "text": " Right here."}, {"start": 3111.94, "end": 3115.46, "text": " And it's very interesting to see what G is."}, {"start": 3115.46, "end": 3117.94, "text": " Or is it?"}, {"start": 3117.94, "end": 3118.94, "text": " Yes."}, {"start": 3118.94, "end": 3125.32, "text": " So G is going to be this right here."}, {"start": 3125.32, "end": 3131.0, "text": " So Y are the logits, and then G is this expression right here."}, {"start": 3131.0, "end": 3136.42, "text": " So and in fact, it's this expression with the with a bit of a modification."}, {"start": 3136.42, "end": 3144.62, "text": " So it's going to be G is going to be the log sum x of the logits, right?"}, {"start": 3144.62, "end": 3150.66, "text": " So it's, this is some, this is somewhat like the entropy."}, {"start": 3150.66, "end": 3155.54, "text": " And what we're going to consider is the gradient of G. So what we want is the gradient of G"}, {"start": 3155.54, "end": 3159.26, "text": " with respect to our alphas."}, {"start": 3159.26, "end": 3169.7000000000003, "text": " And the condition here with this detach operation is that"}, {"start": 3169.7000000000003, "end": 3178.0200000000004, "text": " the gradient of G should be, you know, the gradient of the loss function for all v that"}, {"start": 3178.0200000000004, "end": 3182.36, "text": " are superfluous neurons, and zero otherwise."}, {"start": 3182.36, "end": 3189.7400000000002, "text": " So we're going to detach the gradient of G for all the real neurons for all the actual"}, {"start": 3189.7400000000002, "end": 3191.96, "text": " logits of the output class."}, {"start": 3191.96, "end": 3196.6600000000003, "text": " And we're only going to consider the gradient flowing through the superfluous neurons."}, {"start": 3196.6600000000003, "end": 3203.78, "text": " So all of this here is if we take the gradient, it's only going to flow to in these in the"}, {"start": 3203.78, "end": 3210.46, "text": " last layer through the gradients of the superfluous neurons."}, {"start": 3210.46, "end": 3216.62, "text": " Okay, and that's why we don't need the entropy, because the entropy always considers, you"}, {"start": 3216.62, "end": 3221.94, "text": " know, the difference sort of the difference between the correct label and the other labels."}, {"start": 3221.94, "end": 3226.78, "text": " We are pretty sure that in our superfluous neurons, we don't have the correct label."}, {"start": 3226.78, "end": 3227.78, "text": " Okay."}, {"start": 3227.78, "end": 3235.7400000000002, "text": " So this log, the log sum x of our of these outputs here, what will they represent?"}, {"start": 3235.74, "end": 3242.3399999999997, "text": " Well, this is sort of a flatness measure, again, it's kind of like the entropy, except"}, {"start": 3242.3399999999997, "end": 3246.54, "text": " we don't have a correct label right here."}, {"start": 3246.54, "end": 3251.74, "text": " If one of them is very high, and the other ones are very lower, if they're generally"}, {"start": 3251.74, "end": 3258.06, "text": " very high up, then this will be high."}, {"start": 3258.06, "end": 3265.74, "text": " However, consider the difference between this and this, where they're all super small."}, {"start": 3265.74, "end": 3270.58, "text": " And also, they're all pretty equal, the log sum x will be very small."}, {"start": 3270.58, "end": 3278.08, "text": " So this is an alternative where we can basically only look at the superfluous neurons and say,"}, {"start": 3278.08, "end": 3282.66, "text": " is are the superfluous neurons all very small?"}, {"start": 3282.66, "end": 3288.22, "text": " And you know, none of them basically says I'm the correct label, then we can be pretty"}, {"start": 3288.22, "end": 3292.8599999999997, "text": " sure that over here, there is some confidence."}, {"start": 3292.8599999999997, "end": 3299.94, "text": " However, if they are sort of kind of larger, and you know, generally kind of generally"}, {"start": 3299.94, "end": 3306.22, "text": " large, maybe unequal, that means we're not very confident because these are our outlier"}, {"start": 3306.22, "end": 3310.3399999999997, "text": " classes, they shouldn't be, they shouldn't be large at all."}, {"start": 3310.34, "end": 3315.46, "text": " So an alternative to looking at the entropy of this distribution is to build such superfluous"}, {"start": 3315.46, "end": 3320.7000000000003, "text": " neurons, and then look at those and only those."}, {"start": 3320.7000000000003, "end": 3326.42, "text": " And so the gradient of only those, in order to decide which task it's from."}, {"start": 3326.42, "end": 3332.0, "text": " It's an interesting idea, I have to say, but I maybe one could achieve sort of the same"}, {"start": 3332.0, "end": 3340.74, "text": " thing with a with a temperature parameter here or by building an explicit outlier detection."}, {"start": 3340.74, "end": 3345.3, "text": " But it's generally an interesting idea for outlier detection, I have to say, I've never"}, {"start": 3345.3, "end": 3350.14, "text": " really seen anything like this, though I also haven't really considered it."}, {"start": 3350.14, "end": 3354.7, "text": " So here they show the importance and you've seen in the experiments before that there"}, {"start": 3354.7, "end": 3359.18, "text": " sometimes was this H objective and also this G objective."}, {"start": 3359.18, "end": 3363.66, "text": " So you can either look at the entropy, but also you can look at the G, in both cases"}, {"start": 3363.66, "end": 3365.18, "text": " you have superfluous neurons."}, {"start": 3365.18, "end": 3373.1, "text": " So before you actually saw you have 500 neurons for a task of for a task of 10 that needed"}, {"start": 3373.1, "end": 3375.18, "text": " 10 output classes, right."}, {"start": 3375.18, "end": 3381.02, "text": " So this tells me that the superfluous neurons are pretty important for them."}, {"start": 3381.02, "end": 3388.74, "text": " And it's, this is probably one of the things that makes this work, right, these superfluous"}, {"start": 3388.74, "end": 3389.74, "text": " neurons."}, {"start": 3389.74, "end": 3396.18, "text": " So you're kind of setting up a trap where for the wrong models, you let it run into"}, {"start": 3396.18, "end": 3402.06, "text": " this trap of assigning a lot of weight into these outlier classes and only the correct"}, {"start": 3402.06, "end": 3407.8999999999996, "text": " model is trained to not do that on the particular data that you're considering."}, {"start": 3407.8999999999996, "end": 3412.06, "text": " I don't think this comes through in the paper too much that this is one of I guess this"}, {"start": 3412.06, "end": 3414.06, "text": " is one of the main factors making this work."}, {"start": 3414.06, "end": 3417.5, "text": " And you can see right here, they actually do an experiment, so I don't want to be too"}, {"start": 3417.5, "end": 3425.28, "text": " mean, where they say, look, if we train with just 25 classes, and this is permuted MNIST,"}, {"start": 3425.28, "end": 3428.36, "text": " so the necessary amount will be 10."}, {"start": 3428.36, "end": 3433.62, "text": " So if we train with only 25, you can see how quickly we degrade right here."}, {"start": 3433.62, "end": 3440.0, "text": " However, as we go up and train with 100 and 200, we get better and better."}, {"start": 3440.0, "end": 3447.9, "text": " In fact, if we train with this G objective, it always sort of outperforms the H objective."}, {"start": 3447.9, "end": 3453.72, "text": " Interestingly, the more output neurons you have, the less this difference seems to be,"}, {"start": 3453.72, "end": 3457.7, "text": " but maybe the percent difference is the same."}, {"start": 3457.7, "end": 3460.34, "text": " The percent error difference is the same."}, {"start": 3460.34, "end": 3462.62, "text": " I don't know, I can't tell from here."}, {"start": 3462.62, "end": 3463.62, "text": " Yeah."}, {"start": 3463.62, "end": 3466.22, "text": " So this isn't all."}, {"start": 3466.22, "end": 3472.74, "text": " There is also this Hopfield network going on where they say, okay, okay."}, {"start": 3472.74, "end": 3476.22, "text": " So essentially, we're actually training different models, right?"}, {"start": 3476.22, "end": 3479.9399999999996, "text": " We're not really superimposing all of these models, we're training a different mask for"}, {"start": 3479.9399999999996, "end": 3484.4599999999996, "text": " each of the tasks and kind of remembering the masks and so on."}, {"start": 3484.4599999999996, "end": 3490.52, "text": " Can we also build a model where we actually only have one model?"}, {"start": 3490.52, "end": 3494.58, "text": " And that's what they do right here, where they build a Hopfield network, which is basically"}, {"start": 3494.58, "end": 3496.42, "text": " just a big matrix."}, {"start": 3496.42, "end": 3498.2599999999998, "text": " This is the Hopfield network."}, {"start": 3498.2599999999998, "end": 3501.8199999999997, "text": " And then they encode the masks in this Hopfield network."}, {"start": 3501.8199999999997, "end": 3509.38, "text": " So specifically, the Hopfield network is of size d squared, where it is able to encode"}, {"start": 3509.38, "end": 3513.52, "text": " two to the d different binary strings."}, {"start": 3513.52, "end": 3515.18, "text": " And it does so in a fuzzy way."}, {"start": 3515.18, "end": 3520.5, "text": " But you know, you can prove that if you construct the Hopfield network like this, where z is"}, {"start": 3520.5, "end": 3527.1, "text": " a binary string, you can recover the binary strings by gradient descent in the Hopfield"}, {"start": 3527.1, "end": 3528.42, "text": " network."}, {"start": 3528.42, "end": 3534.4, "text": " And as obviously, the more binary strings you encode, the less you get out like it's"}, {"start": 3534.4, "end": 3539.78, "text": " not magic, you can't store that many bits into the thing that doesn't have that many"}, {"start": 3539.78, "end": 3540.78, "text": " bits."}, {"start": 3540.78, "end": 3547.86, "text": " But I believe, you know, again, this is using gradient descent, and it can do so with surprising"}, {"start": 3547.86, "end": 3550.8, "text": " accuracy."}, {"start": 3550.8, "end": 3555.7000000000003, "text": " So remember that these here are bits, while these here are floating point numbers."}, {"start": 3555.7000000000003, "end": 3560.6400000000003, "text": " So the comparison that I just made isn't entirely fair."}, {"start": 3560.6400000000003, "end": 3565.2400000000002, "text": " But I don't want to go into the Hopfield networks, because I really feel this should be its own"}, {"start": 3565.2400000000002, "end": 3566.2400000000002, "text": " paper."}, {"start": 3566.2400000000002, "end": 3574.58, "text": " I guess they just want to show that it's also possible to compress these masks into one"}, {"start": 3574.58, "end": 3579.38, "text": " thing such that I can't make the argument anymore that hey, all you're doing is training"}, {"start": 3579.38, "end": 3581.34, "text": " different models for different tasks."}, {"start": 3581.34, "end": 3586.58, "text": " All right, all in all pretty cool paper, as I said, pretty dense paper, I invite you to"}, {"start": 3586.58, "end": 3592.14, "text": " read it, they have a big appendix where they have more experiments and so on, and explain"}, {"start": 3592.14, "end": 3593.7799999999997, "text": " everything in detail."}, {"start": 3593.7799999999997, "end": 3600.62, "text": " All in all, I from this, I don't really take the method, but the ideas are very interesting."}, {"start": 3600.62, "end": 3604.22, "text": " And I am excited to see where this goes in the future."}, {"start": 3604.22, "end": 3605.22, "text": " All right, I'll see you next time."}, {"start": 3605.22, "end": 3634.22, "text": " Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=z_3Qv4In2ac
[Live Machine Learning Research] Plain Self-Ensembles (I actually DISCOVER SOMETHING) - Part 1
I share my progress of implementing a research idea from scratch. I attempt to build an ensemble model out of students of label-free self-distillation without any additional data or augmentation. Turns out, it actually works, and interestingly, the more students I employ, the better the accuracy. This leads to the hypothesis that the ensemble effect is not a process of extracting more information from labels. OUTLINE: 0:00 - Introduction 2:10 - Research Idea 4:15 - Adjusting the Codebase 25:00 - Teacher and Student Models 52:30 - Shipping to the Server 1:03:40 - Results 1:14:50 - Conclusion Code: https://github.com/yk/PyTorch_CIFAR10 References: My Video on SimCLRv2: https://youtu.be/2lkUNDZld-4 Born-Again Neural Networks: https://arxiv.org/abs/1805.04770 Deep Ensembles: A Loss Landscape Perspective: https://arxiv.org/abs/1912.02757 Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher Parler: https://parler.com/profile/YannicKilcher
Hey, what's up? So I've had this relatively dumb research idea and people have been asking me for more coding videos and so on, so I thought why not do a video where I take a research idea and implement it from scratch just to show how one would go or how I would go about implementing something like this. Now this was simply meant as sort of a demonstration but then at the end it actually worked and so yeah that was unexpected and my initial reaction was just to be like oh crap just hold everything you know stop video making develop the idea write a paper about it okay and I was about doing that when I realized that you know I'm always the one complaining that research is not transparent enough and people aren't open enough and so on so I sort of thought I might do a different thing right here in that I will actually share the process of this non finished research project so currently I am in the middle of this I have no idea whether it's going to work out or not and that's it and I think we can do open source software development you know completely in the open whereas with research we're all like super scared that people are gonna scoop us and we people just keep it keep their work hidden until they're done and then boom they put it on archive and all I want to go to a world where we collaborate much more in research and it's much more like open source software development so here is my way here's my process of implementing this idea and it's fairly long so if you just want to get to the results you can just skip at the end I'll put timestamps in there's this new YouTube chapter video so that'll be very helpful I guess yeah and with that being said I hope you enjoy this let me know what you think of videos like this and I'll see you next time hey what's going on today we're going to take a research idea and implement it as fast as we can so this is not really to show you the best research idea because it's not and it's probably been done before so I have no high hopes here but this is just to show that if you had like some research idea and you've actually done the literature research and figured no one has done that yet which I haven't because probably someone has done that how you could take this and like get started up initially pretty quickly and this is just the process that I would go through and I'm going to go through with you today and we're going to try to get this up and running as quickly as possible so I had this idea that looking at SimClear v2 there's a lot of things to be done still in the space of let's say self teaching self distillation and so on you know there's mean teacher and then there's what not and this is all usually done in the semi supervised very few label regime and so on but we know that these self supervised techniques can help you and supervised learning and then in SimClear v2 you do semi supervised in that you do self supervised and then fully supervised and then distillation like self distillation there's there's all these kinds of interleaving stuff and I thought okay what if I just take a pre-trained network that performs really well on something and I self distill it into a bunch of student models like a number like ten or so and then I like that's my ensemble model will that perform better than the original model like this is a terrible idea and it's probably not going to work like there's 99% chance it's not going to work but let's try to test this today so I got my drink I got my carbs since it's weekend and we're going to give this a shot all right so first thing we need some sort of base to go from in research it's good to build your own stuff but a lot of times if you want to be as fast as possible you want to go as quickly as you can so here I found this repo thankfully with an MIT license so shout out to who even fun I guess for training for putting up a repo training these c410 models or training these Pytorch vision models on c410 c410 is a small enough data set so that we can kind of work with it and these models are already pre trained so I've cloned this repo and we're going to adjust that so there is a first of all there is a download as you can see here which in this report says it downloads these I have not done this before I have no clue how this is gonna work out in this download script here downloads the weights from box and I hope you can see this and then I guess you can load the the pre trained weights with pre trained equals true and yeah we'll get into all that later so the first thing we got to do is get this to run let's say so let's look at this downloads thing first so the download thing is going to have a URL it's going to use requests to get that URL and then save this into this state dicts thing now what I usually want to do is I don't I want my folder of code to only have code and not to be intermixed with data and code because this is the thing that I'm gonna ship around to various servers and so on so I'd rather have the code in one folder and then the data and like a central folder so I'm not really fine with this sort of downloading the this right here into into the folder that we have so what I'm going to do is I'm going to change that such that it downloads it into a central folder so first we already have OS so what we're going to do is we're going to get some like data path going which is going to be our home folder OS path and I guess I also I already have a c410 folder right here so we'll use this and then so half dot join will join that and that's going to download it's not really data is it it's more like models okay let's do this cool so data path is this is the models that is going to download all right and then it unzips the file again so here it unzips the file to the current working directory I don't want this so I'm going to change that again to the models path all right nope directory to path to zip file directory to extract to I think we're fine right now so this download script is going to download the path the all the weights there now I want this to happen sort of automatically while this is in a server or while this is on a server so what I'm going to do is probably just to so if this script runs you can see it runs the main but in the other script I might just want to do this automatically so let's go to the test script right here or let's say we go to the train script this is probably the main script right here the train script so we have to somehow call this other script here probably in the main function all right so let's import this other so import c410 what was it called c410 download okay and here we're going to call that and does this does this not download it if it already exists we have to check that so a lot of this is just going to be you know beating the stuff into beating stuff into into existence so if this zip file already exists we're not going to we're not going to do anything right which leaves us open if like if the unzipping fails then we're going to be in a kind of dumb path but you know we'll risk it zip path would be that so let's if OS path exists zip path then return okay so we're good in the download script what else do we need the data set I probably already have the data set from torch vision so that's not going to be an issue okay so here we're gonna call c410 download dot main all right and that should do we can't really call that yet let's actually just run this download script no no such file a directory probably need to make that probably need to make that directory right okay if OS make there's models path exist okay true yeah that should be something all right and we're downloading so this is 2.4 gigabytes which can you know be put by itself let's put that over there and while that's downloading let's check out the test script actually let's check out the test script so this simply takes in this c410 module and instantiates a trainer and as you can see it calls test on it so this should not be too hard I'm going to guess this c410 module is a lightning module as you can see right here it is we know how tensor sorry pi torch lightning works if you don't know how patrick's lightning works pretty easy you configure this module right here you configure a bunch of stuff like the data sets the training step and so on and you're good to go so I guess what we're going to do is we're going to change this train script and change it to our needs okay so let's copy that let's go with train ensemble bang so this is what we're going to change all right so first if the GPUs is a string then yada yada yada if it's to then wow that's that's that's kind of a weird engineering quirk right here okay what I want to do is make the GPU use transparent so we'll only ever use one GPU so let's call that CUDA and put that to true and then we'll say da da da da oh come on there is like a lot of stuff going on here let's so and then torch is called torch I'd hate that can I do this can I import it like twice with different names probably it's probably not very good but I'll do it um okay so if CUDA is not available we'll just set the CUDA to false if th dot CUDA dot is available cannot if it's not available then age params dot CUDA equals false and then we'll set the GPUs to zero comma I guess that's what it expects if else none and that should do it for the GPUs okay so second thing that we need we're going to need we're going fit here and there is this logs directory where the checkpoints are going to be saved I'm fine with that I just want to kind of remove the logs directory at the beginning so I'll do that and whenever we start this I'm going to remove the logs directory this is a controversial move but you know um remove tree recursively delete delete the directory yes logs good okay our download is done so what do we do next we might want to do just try to test test something and here in the test thing we might want to set the GPUs I don't have a GPU right here so none and the data directory is going to be yeah I'll put it so nope nope nope okay it doesn't find the it doesn't find the the state dicts and so on now we're going to have to fix this we're going to have to fix the fact that it doesn't load okay okay and that's probably going to be here in these models so if I look in the dense net for example which we can learn and there's this pre trained argument and what's that going to be it's oh that's bad okay it like has a hard code at the fact as hard coded the fact that there are there is this state dicts directory okay um yeah that's terrible terrible terrible terrible so I guess this is going to be in every single one of these models and that's not good so what we're going to do is probably always late loaded without the pre trained and then kind of loaded ourselves from the from the correct directory so what's the correct directory again we're going to set the model deer we probably can just take that from the download script like that state dicts okay and then we want the architecture I guess that's a thing we can actually put the classifier here right here that's something we can so it's going to be the classifier if you look in the state dicts directory I'm going to guess you can models c4 10 state dicts we haven't unpacked it where have we not where have we unpacked it to help help oh no have we unpacked it to here we have not we have not so what is in here ah it's a c4 10 models something and then state dicts okay so it's always going to be the architecture plus PT so we can you know we can deal with that so it's going to be c4 10 models state dicts that's fine and then it's always going to be the architecture plus a PT so let's look at one of these models to see how this is loaded we've saw we've seen this here so we simply want to load this state dict in and here it constructs the thing this is let's do proper string interpolation shall we oh device where this device come from we should check that out device is given device device device CPU where is device given okay dense net device CPU oh I guess device is always CPU and then then we map it to wherever I'm not entirely sure so here we say set device I guess we can just get the device from somewhere let's try it out okay so we're going to need this right here so we're going to OS path join models path and something that's dot PT so and here we're going to get the architecture which is the classifier cool so that's how we load something and then the device maybe we can just go torch CUDA dot get device is that possible let's try nope okay nope no get device device maybe nope map location was given okay so we have to figure out where this device comes from honestly here no module there's this get classifier right here but that's just says pre trained this device always CPU I just can't believe that I guess I'll believe it will always load to the CPU okay cool we can do that I guess pytorch lightning will then put it on the GPU for us cool so this is about how far I got when I try to do this by myself and now the problem starts missing keys in state dick a lot of missing stuff we can't we can't possibly load that yeah no not going to so we can't load stuff what does it do load file name equals and then let's paste this and let's put some kind of breakpoint here so we can check it out okay that exists no she feels like that should exist yeah that exists what's the what's the deal what's the matter here so we got model which is I guess a resonant 18 and we got this thing that we might want to load so why doesn't it work torch load load file name see that works so that's the state dict is that let's look at its keys we got a you know a bunch of stuff okay so why can't we load that model load state dict state dict and now unexpected keys in state dick missing keys so this is always prepended with model dot and here it's not okay what do we do about that I guess this is because we loaded ourselves okay cool so our model is not yes so our model has the sub path model so we need model dot model dot load state dict right look at us we made it so this is testing I guess this is this resonant 18 or whatnot so we can leave that to run for itself so we figured out how to load this stuff took us a while now let's go ahead and we know how to load the models we know how to load the weights so this is our teacher model right our teacher model is supposed to load up the weights and then and then teach the student models so here what does this training thing do we download the thing we make our GPUs to be really good okay and then we instantiate this module right here as you can see so now we're going to check out this module by the way the testing is done and as you can see there's an accuracy of 93.33 which I'm pretty happy with this is congruent with what we saw right here the resonant 18 do okay and we can I guess we can take a resonant 18 or a resonant 50 they're both fairly small right here so a lot of them are going to fit on our GPUs once we use the GPUs so let's change this module around right here to actually do the to actually do the let's say the the proper thing that we wanted to do so here we have self dot model as you can see and it's get classifier and the question is does it load it pre-trained so what we want to do is this is going to be our teacher model and this in this get classifier we want pre-trained to be false always right here we don't want any sort of we don't want to load the pre-trained instead what we want to do is we actually want to have the we want to load it ourselves right so here pre-trained false and now we're going from our test script we're going to take over the path they think the code that we used to load this okay all right so but a beam but a boom OS we don't have OS that coming along just fine yep yep yep so now here we're going to have our self teacher model to load that state dict all right so this is it for initialization now we also need our student models of course so our student models are going to be a bunch of models models are going to be a bunch of models where what do we say so this is going to be a torch or like a module list there's this module list and under under under torch dot nn dot module list right so I initialize that with a list and the list is going to be get me the classifier and we're just gonna go for the same kind of classifiers right now to really boil it down to have the same architecture for the student and for the teachers for bar in range in range and here we probably need a flag so H params dot num students okay so these are going to be our student model so let's quickly create this num students thing right here I'll probably have to have an integer and we'll go with five students for now okay so we're creating five students all of them are not pre-trained so we're going to are we going to train them from scratch or do we want actually to take over the weights we probably don't want to take over the weights let's just train them from scratch in a distillation mode I have no clue about this stuff by the way okay I guess this concludes this already concludes what we what we wanted to do so I guess this module list what can we do with it does anyone know I don't know by the way I'm sorry for the switching between the dark and the bright background I don't know how to fix that so pi torch and an module list it would be nice if we could give them some names right so I guess that's just an iterable right here so probably there's nothing that we can do to give them proper names or we'd have to hack around and I don't want to do that so I guess we can just check if that actually computes until here so let's check it out let's try the ensemble it doesn't data set not found or corrupted okay so what we'll have to do is we'll have to implement have to change this data directory right here so the data deer is going to be OS this whatever my c410 directory is no such file directory logs okay so logs doesn't exist so let's actually make it still no such file a directory logs why why doesn't it make it no such file a directory logs ah okay we need to ignore errors here and we're good okay so it computes until the point you probably you probably can't see that right I guess now you can see it let's check yeah now you can see it all right so where are we we are at the point right here in our module after we've created the teacher and the students so if we look at self technically we should be able to see right here a whole bunch of resnet 18s whole bunch so here you can see the teacher model right and I'm going to guess you can see layer 4 and here you can see the student models so the student models are going to be in a whole list of models and now we're going to train them so since they're initialized differently our hope is going to be that they're sort of going to end up at different places we're going to train them with the same like we're going to be really really stupid about this okay all right so let's be really stupid about it so what what are we gonna have to change here is our training step and our training step is actually fine we'll simply forward we'll get a loss from that and then we are going to return that and that's going to be back propped so in our optimizer wherever we initialize our optimizer we should probably give it the parameters that are not only the student model parameters right not the teacher model parameters so it should only train the student models okay and even even like that we should probably always set the teacher model in Eve in eval mode but we'll do that in the forward step right here so in the forward step we get images and labels and here it runs it just forward through the model we want to change that we actually want to have teacher predictions which we're going to have the teacher model we're going to forward this through the teacher models now the criterion I'm gonna guess is a cross entropy so the predictions here are actually going to be logits right and this is this is good except that what we want to do is have a distribution of over labels so after the teacher here runs through and let's put a break point right here and actually look at it I find it's always easy if you go and just run until the point where you're are at the code and then you can just look at stuff so here there's oh there's a validation sanity check okay probably don't want that and now we have the break right here and now we can look at teacher predictions dot shape so that's a batch size times ten and if we look at it I'm going to guess there's some negative numbers in there so that's not going to be that those are going to be logits now we want them that to be a soft max over the last dimension and that's going to be of the same shape but of course now we're going to have a proper distribution so if we sum over the last dimension you should see a bunch of ones all right so the teacher predictions are going to be soft max over the last dimension and since we since we don't want to back prop through the teacher we can do this in an environment of no grad right here so we have that with not being stupid and we also set the teacher model into eval mode so I guess that does it set train no that should do it I have no idea yeah let's let's run it again we could have done that there okay so so far so good so we have the teacher predictions now what we need to do is run them through the student and use them as labels so we'll go for student in student models we'll go student forward or we simply run the images through that and that give us the logits and then we use our loss function on the logits and that not the labels but the teacher predictions right so we never actually use the labels here as you can see and that's going to be the student loss and now we have a bunch of losses and we're going to append that nope like this and our loss is simply going to be the sum of all the student losses not even the average I guess we could losses I guess we could make it the average just so if we change the number of students will will get some kind of some sort of a better sense of the actual numbers what what what okay I think over here we're good yeah so our teacher model is not in training mode but our student models hopefully are in training mode no is this the eval pass I guess this is the eval pass this is the validation sanity check pass okay so this is going to be our loss and our accuracy now right so okay what's going to be our accuracy our accuracy is going to be we have these student losses all of them and what we are going to do is we're simply going to take the maximum prediction across the students pretty easy pretty easy but we need to collect the logits so come on so we'll also have the logits append the student logits okay so we have a whole bunch of logits right here and we'll get some predictions out of that now the question is do we want to simply take the mode or do we actually want to run a softmax over each and then take the average prediction I'm not super super sure but we can try to do it in different different ways so right now we might just want to take the maybe the average logit and then run a softmax on top of that because I'm gonna guess the logits are outputs of a linear layer so they might behave more in a linear fashion than if we were to average the actual probabilities that come out right maybe let's let's do this okay so we'll go we'll take these logits they're all and we need to somehow concatenate those or stack them so how we're gonna stack them so they're 256 their batch size by number of classes so we'll just stack them at dimension zero I guess that's fine and then we are going to mean also across dimension zero so those are going to be our logits or final logits and then our predictions are going to be the argmax of the logits in the last dimension yep that should be pretty straightforward I guess that's it easy as that yes the rest here should just do by itself and I'm going to go ahead and run give this another run and see where we run into problems can't really see how this could ever go wrong we'll just take everything over okay we actually got a problem 1d target tensor expected multi-target not supported so the cross entropy loss in pytorch does not support that let's let's give it a shot make this a little bigger for you and let's go for the cross P loss I can't type today so here we have the cross entropy loss and the cross entropy loss is useful when training classification problem with the classes yada yada yada wait should be one okay criterion expects a class index as the target okay so what we need is like a soft loss right we don't need this cross entropy loss we actually want we want to have soft targets so what do we do we want to do I think the cross entropy loss is a combination of the here of the log softmax and the NLL loss can we take the NLL loss maybe so the NLL loss right here is going to be the target that this loss expect should be a class index no okay that's not good so next let's go do we have we somehow need a soft cross entropy loss let's search for that pytorch soft cross entropy soft classes I guess people do that kind of stuff so the problem with these kind of losses is that what you do what you have to do is kind of protect yourself against against numerical instabilities right so what we want to do is find a function that does this for us I guess if we do the lot the the log softmax that should take care of it for us okay this is tensor flow okay following thread cross entropy loss I guess people just do really the log softmax and then do that and we should be fine with this okay thanks K Frank yeah maybe maybe this has advanced since then so we can give like a last look at this and this is a bit too big I'm sorry your eyes are gonna have to suffer and we're going to look at loss functions and we're going to just look through them multi-label soft margin loss mmm multi-label we don't really want multi-label right we want this but not with the targets okay I guess we're just gonna have to write this ourselves so ultimately what is the cross entropy that cross entropy is simply the probability of the true label times the log probability of the wrong or of the predicted label if you as you see right here so we are going to simply multiply target times the log probability of the predicted label and then some some don't take that mean across the batch I guess yeah that should do we can implement this let's do it so this criterion right here is going to be our loss function and that's only used once so what we can do is going to be a function so we're going to take student logits and we're going to take teacher probabilities okay so how's that gonna work out we're going to do the log soft max from the student logits so and then dot does that exist log softmax functional okay we need functional and student logits of that dimension so now we have properly normalized student log it so that's going to be student log probes and then what we want to do is simply multiply the teacher probes times the student log probes and the negative of that is going to be our loss the question is do we want to sum that I guess across this dimension or mean it I guess the sum sum should do all right this is it easy as that why have we searched for so long so the criterion we can simply replace that now by our loss function cool so let's run it again yada yada yada okay sanity check maybe we should have taken like a smaller model it sometimes pays off to you know start with a really small model small model just so you can you can do these kind of things fast so here we have dimension out of range today okay which is where is that in forward in line 78 let's go there line 78 okay here the max is not going to be as much fun let's like let's go there I think this is some of these things change over time in Pytorch so this code might be written when you know so what we have is we have a max over the predictions and predictions oh it's already an arg max so I guess we can remove this all whether or not that agrees with labels dot data we don't need any of that dot float and we also don't need that we so the accuracy is simply going to be the mean of this no I guess so we're here can't we just do predictions equals labels yes and we want the sum of that actually we want the float first and then we want the mean yeah that seems reasonable so let's do it like this yeah that it doesn't float mean perfect how could this be any more easy but this right here is all of it so validation step accuracy corrects we'll just look at it once we done it and what I do is usually just run it until it doesn't give me any mistakes anymore and then I know I sort of have succeeded okay we're pretty close I feel so it says grad can implicitly created only for scalar outputs which probably means our loss function is not a scalar so when we return the loss right here here we have the sum of the losses divided by the length of the losses let's go here and check out what's up with that so what we'll do I see this loss function here will output basically one loss for each data point so what we need to do I guess is call mean on this or sum when they created the criterion in the original one now we've thrown it away look at the git diff right here so I guess this reduces how does this reduce the cross entropy loss when we don't do anything cross entropy loss reduces reduction mean okay so let's reduce with the mean so if we call loss then after that we should call mean and then here I'm not so sure anymore we should divide here because the learning rate is kind of tuned to the original loss size so I guess we'll be content for now with summing up these things and over here I guess we've we've solved that right no losses yeah see our losses is going to be an entire tensor and now we just fix that right now okay so let's try it again in the meantime what can we do we can so we already take care of our GPU we take care of the logs one thing to do when with respect to this download stuff right here is you know if you have a server or something and you let a lot of things run in parallel what you want to do is make sure they don't all download the same stuff at the same time that's pretty bad so what you want to do is ideally have some sort of lock such that they coordinate and I usually use a file lock for this so I'm gonna create that right here from import the file lock and then I simply create the lock let's go file lock and here you have to input a file so sometimes like yeah data lock I don't know you just pick some file and that's the file that these these processes are going to sync on and then once you do this you simply wrap all of it in a with lock so only one at a time can go in in this function all right so that's that that should make us safe and right here we're now training this is excellent we are training the students now we need to do that on an actual GPU so I have multiple tools to ship this to a GPU so first of all I can try to ship this to and try to ship this to a let's say to to one GPU so the way you do that is first of all I want some sort of unbuffered version of Python and then I have this do I even have this tool I do have the tool okay so I'm gonna call one of our servers and we don't know what's going on okay so cannot import name seed everything from PyTorch lightning seed everything is that some kind of new thing in PyTorch lightning I guess I have it apparently so here seed everything with zero why I don't need that we are running without any seed here we are being really cool okay next mistake cannot okay still same mistake of course since we don't yep next mistake we'll just go through the mistake learning rate late learning rate loggers so I guess we need to update PyTorch lightning on the servers and I'll do that quickly okay I've updated PyTorch lightning let's check out whether or not we can actually run something yeah we can run something so this again is now downloading this on the server while this is happening there's another thing we can do namely I have sort of sort of made a system to run stuff on servers which I like a lot honestly so I guess we can try this out how do I hidden with I okay so I want to first of all delete this delete this yes I guess delete this cool and this git folder is a bit annoying let's restructure because otherwise it will always ship the git folder with everything up here does it do that yeah I don't like to have the code in the top level so quickly make a sources directory move everything in there so move the c410 models into the source directory move all the Python files into the source directory no clear the logs and we're much better much better okay much better so what we what what we will do is my system requires like a file and I'm just gonna copy one from another project quickly okay so we're back and I copied that over as you can see you basically give hyperparameters and it blasts ever the hyperparameters through in a kind of a random search fashion it's not too sophisticated but we can work with it so 10 that's the file right for 10 train ensemble yes that's the file cool and here we're just going to put all of our hyperparameters and that will remove the logs file I'm okay with that but on this bang cool so what do we want we want basically we just want to try it like a bunch of times and then see like average across it right that's all maybe we want the the architecture to change so let's say the classifier is a resnet 18 or a resnet 34 or a resnet 50 just so we have a bunch of stuff to to do okay and this downloaded and is training on GPU hopefully if this works then we can ship this off and we'll make this other hyperparameter that I like to use called rep which is just basically a dummy parameter and so I can just repeat the experiment a bunch of times and let's put that in here so this is really that this has this has no effect except for randomizing it a bit I guess we can try to seed stuff so whenever it says seed everything we'll just seed it with this we'll call it seed no is it here this seed everything yeah so h params dot rep sorry seed cool with this this is doing something nice you can see it so this is unbuffered Python output thanks yeah so what other classifiers do we have we can again we can try a bunch of them we can try all of them why don't we try all of them like this then let's go into this rat file I don't know why I called it rat I just want it like some three letter thing so yep like this and then we can just take all of that crap and delete it and delete this and those are going to be all our models so our classifier is going to consist of all of this stuff let's I know I know I know I suck at them don't tell me actually tell me I want VIM tips trying to learn something new like each week in VIM but it is hard and tend to make myself actually do it so let's go let's go with just one repetition so far if we if we are not sure we can still up the number of repetitions we don't even have the rep right now this is called seed all right so we have different classifiers and what we're going to need we also have this num students right let's go with one with five and with twenty so here we got one epoch done and we get a validation loss do we get a validation accuracy validating validating I have no idea we'll cancel this right now and we'll go ahead and just blast this on to our servers and hopefully that that's gonna work I have no idea is everything fine everything's fine go no what what cool and let me get back to you once this is finished all right we're back so I've just written some code here to extract the results of that run and something you know it's pretty interesting what came out so in these plots you'll see on the x-axis have the number of students in the ensemble remember these students are all trained from the same teacher the teacher you can see an orange that's just a single teacher for reference you can see that if you have one student model it sometimes underperforms or in sometimes outperforms the single teacher model but then if you have more student models you can see that there is a pretty monotonic relationship so here it's the reason this fit doesn't finish here is because there is not enough space on the GPU for that many student models but you can see that the relationship here is fairly monotonic here it's a bit of a kink so the first idea like this this is really astounding because these students have all been trained from that single teacher and they have been trained for as long as the teacher has been trained so they don't have more compute than a teacher they've been trained from scratch not from some checkpoint or from the teacher weights it's simple distillation from the teacher no labels and the students are all in parallel as well so they don't see different data or even different data augmentations it's the exact same order of the exact same data points going through all of the students the exact same learning rate schedule there's no noise and so on so the first thought that came to my mind like something fishy is going on here right like this this is this seems like to like come on there's no new information here so I thought hey I the teacher the teacher model I've just grabbed them from this from this repo from this pre-trained checkpoints and these pre-trained checkpoints they are you know the checkpoints that have performed best on the validation set so this is sort of a sneaky way of how we could train on the validation set right because we annotate each data point in the training data set with this checkpoint and the checkpoint has been selected for performing especially well on the validation data set it could explain why we get a gain on the validation data set so what I did is I retrained all of the teacher models such that I just retrained them for these 100 epochs and I just took the last checkpoint the all everything's the same the hyper parameters learning rate schedule and so on this is not tuned for any particular model and it's pretty like it's pretty standard it's like it's not like 0.12589 it's like 0.01 and 100 epochs or so fairly standard parameters and I took just took the last checkpoint to make it didn't even look at its performance to make sure that I didn't you know select something that was especially good on the validation data set and the results here you'll see are actually already the results of that run which the previous run it was almost the same like I was astounded how well it works and then I thought hey maybe I'm kind of you know cheating here so I redid it with the teachers that are not specifically selected and this is already the results so that's pretty cool right so then I wondered what happens if I now if I increase my training amount so I just let this run for more like what if I let the students run for more than the teacher has run again there's no new information here so you can see that the now the okay the green is now the teacher the blue is a hundred epochs and the orange is 250 epochs and you can see with that even one student will outperform the teacher but many students will outperform even more so if you give more compute there's lots of lots of headroom here to improve you'll see this here I think this last one with the blue line is just a bit of a weird a weird configuration I guess if you were to rerun that that would you know fall in line so this is pretty pretty weird right so I have a bunch of questions so first of all I've searched the literature a bit more and I came up with a number of papers that do things like this now usually when you do distillation you people stress the importance of like how to introduce noise like in the noisy student paper or that you really need these data augmentations or you know sim clear v2 uses the self distillation in order to do in in order to label more data so they say it's important that we bring more unlabeled data into the process and so on so all of this really doesn't match right here and especially this focus on we need noise during the distillation process to build these ensembles this is also you know if you know mean teacher things like this I also found a paper called born again neural networks that does something quite similar but not very simple not like the same where they distill a teacher to the student with the same architecture and then they distill the student again into another student and then that into another student and so on and then at the end they say oh we can also build an ensemble but sometimes their ensembles outperform their you know chain of distillation sometimes they don't they don't really focus on that part a lot and it's way more complicated like you distill one student after another and I also think they they have some introduction of variability in the students like like noise or different augmentations and so on so this here seems you know really really really simple now I want to know this ensemble effect it seems pretty pretty weird right so what gives so the first thing we could do is we could say what what does how does this compare to an ensemble of teacher models like if you actually were to build an ensemble like train five teacher models on you know five five different teacher models it's still the same data but reasonably they might be able to learn something more from the data if we have five teacher models they might learn different things from the data and therefore if we combine them they might kind of overlap their knowledge and sort of catch where if one doesn't generalize in one data point the other four can overrule it whereas with these student with these cell phone samples there's not really a way where we can learn more from data because we can only learn from the teacher and the teacher is fixed and has seen that much data right so how does this compare so wrote some rewrote some code is it's just plumbing and I release the code it's linked but it's just plumbing don't worry don't worry there is no great thoughts in there it's just plumbing such that my students don't are not all in parallel so the ensembles are not trained in parallel anymore I train each model individually which means that at maximum I have to have two models on the same GPU one teacher and one student so I make sure that the teachers they are trained from scratch and the students they're always trained from the same teacher right so the student ensembles will be exactly the same as we have them here that means one teacher is responsible for all the students but yeah so okay I'll just show you the results right here so if we look at those results you can see that and I've done it for a bunch of models right here the blue line is the ensemble of teachers and here on the x-axis you see the number of models and now since I'm not training everything on the same GPU but I recombine later that that basically means that I have doubt the ability to train up to ten models are actually however many I want and the only real trick in the code is that when I evaluate one of these ensembles what I do is I load a mini batch and then I basically load the first checkpoint run the forward pass load the second checkpoint run the forward pass load the third checkpoint run a forward pass I do this for all the checkpoints until I go to the next mini batch but that's just for evaluating right it just seemed easiest with the code that I had so you can see right here that the there is a significant like this is almost overlapping right here for most models there sometimes the student wins sometimes the teacher wins so the teacher ensemble wins now remember the teachers are trained on you know ten times as much data right here but it's always the same data but still they have the opportunity to learn ten times as much information from the data whereas the students they're all distilled from that same teacher without any noise any augmentate any augmentations except for the augmentations that you use during training anyway and I've done this for a hundred epochs and I've done this for two hundred and fifty is this already 250 I think that was a hundred I just put that there nope okay yeah that was a hundred epochs but you'll see the 250 epoch plots they look very much the same okay they're just a bit better if you train for 250 epochs now interestingly okay here's the interesting part about the 250 epochs the student is still distilled from a teacher model that has been trained for a hundred epochs so all of this all of this makes no sense to me right the student is still distilled from the hundred epoch teacher model yet if you train the student for 250 epochs in self distillation and then build an ensemble of these students from that same teacher model and you compare that to an ensemble of teachers that have all been trained for longer for 250 epochs which you know should out it the 250 epochs generally outperforms the hundred epochs models still they are the same this is this is pretty crazy results I I think and sort of my conclusion from this is that the ensemble effect right here is not a function of learning of extracting more information from the data the ensemble effect might actually be have something to do with the function landscape itself and kind of exploring different minima of the of the same function not of the same function but exploring different functions to describe the same phenomena and I've also found a paper that explains the lost landscape of deep ensembles and I will make a video on that maybe it's out already maybe it will be out after you see this one I I haven't decided yet which which order I'm going to release things but this here I it's it's pretty interesting and we need like a name so self self ensembles are already a thing but they are always with noise and stuff like this so let's call them something like plain self ensembles like that that that sounds like a good name plain self ensembles the act of self distillation a single model into multiple models without any noise any augmentations anything just you run as if you were to train the model itself and then you build an ensemble of these models by simply averaging the logits plain self ensembles alright so the plan from here is to check on like at least one other data set you know these these models I appreciate that I could get them pre-trained but they're just the image net models and then kind of let run on c410 so there's no kind of guarantee that these have been you know tuned or anything that the learning rates or whatnot so I want to take like an image net model still make sure that I don't use any like hidden information where I could cheat on the validation set but try this on at least one thing and see if that works as well if we can sort of push image net performance simply by doing this trick so that's the plan for now and I have some other ideas but I just wanted to let you know and this is sort of how research works I guess you have a dumb idea and it turns out to work and then you go on and still probably probably there is not maybe too much interesting things here maybe it doesn't work on image net because these models are just under trained and this somehow made them better somehow or regularize them somehow that usually doesn't work there's so much that can go wrong still so but yeah that was it and I invite you to like check out other papers in this space if you want it's a pretty interesting space and with that I don't have much more to say yeah I hope you enjoyed this let me know what you think of like research implementation or research process videos like this I'm not sure what people expect like I can't make this into five-minute video of like whoo I discovered something because then you know there's no clue of what's what's happening but maybe like an hour or so is also too long I'm not sure yeah let me know what you think and I'll see you next time bye
[{"start": 0.0, "end": 5.88, "text": " Hey, what's up? So I've had this relatively dumb research idea and people"}, {"start": 5.88, "end": 10.68, "text": " have been asking me for more coding videos and so on, so I thought why not do"}, {"start": 10.68, "end": 15.56, "text": " a video where I take a research idea and implement it from scratch just to show"}, {"start": 15.56, "end": 21.6, "text": " how one would go or how I would go about implementing something like this. Now"}, {"start": 21.6, "end": 26.12, "text": " this was simply meant as sort of a demonstration but then at the end it"}, {"start": 26.12, "end": 33.2, "text": " actually worked and so yeah that was unexpected and my initial reaction was"}, {"start": 33.2, "end": 38.160000000000004, "text": " just to be like oh crap just hold everything you know stop video making"}, {"start": 38.160000000000004, "end": 44.92, "text": " develop the idea write a paper about it okay and I was about doing that when I"}, {"start": 44.92, "end": 49.56, "text": " realized that you know I'm always the one complaining that research is not"}, {"start": 49.56, "end": 55.0, "text": " transparent enough and people aren't open enough and so on so I sort of"}, {"start": 55.0, "end": 60.12, "text": " thought I might do a different thing right here in that I will actually share"}, {"start": 60.12, "end": 65.36, "text": " the process of this non finished research project so currently I am in"}, {"start": 65.36, "end": 68.76, "text": " the middle of this I have no idea whether it's going to work out or not"}, {"start": 68.76, "end": 75.28, "text": " and that's it and I think we can do open source software development you know"}, {"start": 75.28, "end": 80.36, "text": " completely in the open whereas with research we're all like super scared"}, {"start": 80.36, "end": 85.24, "text": " that people are gonna scoop us and we people just keep it keep their work"}, {"start": 85.24, "end": 91.96, "text": " hidden until they're done and then boom they put it on archive and all I want to"}, {"start": 91.96, "end": 97.64, "text": " go to a world where we collaborate much more in research and it's much more like"}, {"start": 97.64, "end": 106.24, "text": " open source software development so here is my way here's my process of"}, {"start": 106.24, "end": 111.19999999999999, "text": " implementing this idea and it's fairly long so if you just want to get to the"}, {"start": 111.19999999999999, "end": 114.96, "text": " results you can just skip at the end I'll put timestamps in there's this new"}, {"start": 114.96, "end": 121.91999999999999, "text": " YouTube chapter video so that'll be very helpful I guess yeah and with that being"}, {"start": 121.91999999999999, "end": 126.19999999999999, "text": " said I hope you enjoy this let me know what you think of videos like this and"}, {"start": 126.19999999999999, "end": 133.04, "text": " I'll see you next time hey what's going on today we're going to take a research"}, {"start": 133.04, "end": 140.0, "text": " idea and implement it as fast as we can so this is not really to show you the"}, {"start": 140.0, "end": 144.51999999999998, "text": " best research idea because it's not and it's probably been done before so I have"}, {"start": 144.51999999999998, "end": 148.72, "text": " no high hopes here but this is just to show that if you had like some research"}, {"start": 148.72, "end": 152.42, "text": " idea and you've actually done the literature research and figured no one"}, {"start": 152.42, "end": 156.12, "text": " has done that yet which I haven't because probably someone has done that"}, {"start": 156.12, "end": 163.0, "text": " how you could take this and like get started up initially pretty quickly and"}, {"start": 163.0, "end": 168.08, "text": " this is just the process that I would go through and I'm going to go through with"}, {"start": 168.08, "end": 172.72, "text": " you today and we're going to try to get this up and running as quickly as"}, {"start": 172.72, "end": 181.0, "text": " possible so I had this idea that looking at SimClear v2 there's a lot of things"}, {"start": 181.0, "end": 187.64, "text": " to be done still in the space of let's say self teaching self distillation and"}, {"start": 187.64, "end": 192.96, "text": " so on you know there's mean teacher and then there's what not and this is all"}, {"start": 192.96, "end": 198.16, "text": " usually done in the semi supervised very few label regime and so on but we know"}, {"start": 198.16, "end": 201.84, "text": " that these self supervised techniques can help you and supervised learning"}, {"start": 201.84, "end": 206.4, "text": " and then in SimClear v2 you do semi supervised in that you do self"}, {"start": 206.4, "end": 211.64000000000001, "text": " supervised and then fully supervised and then distillation like self"}, {"start": 211.64000000000001, "end": 215.68, "text": " distillation there's there's all these kinds of interleaving stuff and I"}, {"start": 215.68, "end": 220.56, "text": " thought okay what if I just take a pre-trained network that performs really"}, {"start": 220.56, "end": 227.16, "text": " well on something and I self distill it into a bunch of student models like a"}, {"start": 227.16, "end": 233.52, "text": " number like ten or so and then I like that's my ensemble model will that"}, {"start": 233.52, "end": 239.24, "text": " perform better than the original model like this is a terrible idea and it's"}, {"start": 239.24, "end": 243.52, "text": " probably not going to work like there's 99% chance it's not going to work but"}, {"start": 243.52, "end": 250.4, "text": " let's try to test this today so I got my drink I got my carbs since it's"}, {"start": 250.4, "end": 256.12, "text": " weekend and we're going to give this a shot all right so first thing we need"}, {"start": 256.12, "end": 261.68, "text": " some sort of base to go from in research it's good to build your own stuff but a"}, {"start": 261.68, "end": 266.4, "text": " lot of times if you want to be as fast as possible you want to go as quickly as"}, {"start": 266.4, "end": 272.96, "text": " you can so here I found this repo thankfully with an MIT license so shout"}, {"start": 272.96, "end": 282.15999999999997, "text": " out to who even fun I guess for training for putting up a repo training"}, {"start": 282.15999999999997, "end": 289.52, "text": " these c410 models or training these Pytorch vision models on c410 c410 is a"}, {"start": 289.52, "end": 293.64, "text": " small enough data set so that we can kind of work with it and these models"}, {"start": 293.64, "end": 300.15999999999997, "text": " are already pre trained so I've cloned this repo and we're going to adjust that"}, {"start": 300.16, "end": 305.48, "text": " so there is a first of all there is a download as you can see here which in"}, {"start": 305.48, "end": 309.64000000000004, "text": " this report says it downloads these I have not done this before I have no clue"}, {"start": 309.64000000000004, "end": 315.0, "text": " how this is gonna work out in this download script here downloads the"}, {"start": 315.0, "end": 322.24, "text": " weights from box and I hope you can see this and then I guess you can load the"}, {"start": 322.24, "end": 327.88, "text": " the pre trained weights with pre trained equals true and yeah we'll get into all"}, {"start": 327.88, "end": 332.88, "text": " that later so the first thing we got to do is get this to run let's say so let's"}, {"start": 332.88, "end": 339.32, "text": " look at this downloads thing first so the download thing is going to have a"}, {"start": 339.32, "end": 343.76, "text": " URL it's going to use requests to get that URL and then save this into this"}, {"start": 343.76, "end": 349.56, "text": " state dicts thing now what I usually want to do is I don't I want my folder"}, {"start": 349.56, "end": 354.15999999999997, "text": " of code to only have code and not to be intermixed with data and code because"}, {"start": 354.15999999999997, "end": 357.82, "text": " this is the thing that I'm gonna ship around to various servers and so on so"}, {"start": 357.82, "end": 361.96, "text": " I'd rather have the code in one folder and then the data and like a central"}, {"start": 361.96, "end": 369.36, "text": " folder so I'm not really fine with this sort of downloading the this right here"}, {"start": 369.36, "end": 375.28, "text": " into into the folder that we have so what I'm going to do is I'm going to"}, {"start": 375.28, "end": 379.0, "text": " change that such that it downloads it into a central folder so first we"}, {"start": 379.0, "end": 384.92, "text": " already have OS so what we're going to do is we're going to get some like data"}, {"start": 384.92, "end": 397.92, "text": " path going which is going to be our home folder OS path and I guess I also I"}, {"start": 397.92, "end": 409.84000000000003, "text": " already have a c410 folder right here so we'll use this and then so half dot join"}, {"start": 409.84, "end": 418.96, "text": " will join that and that's going to download it's not really data is it it's"}, {"start": 418.96, "end": 427.88, "text": " more like models okay let's do this cool so data path is this is the models that"}, {"start": 427.88, "end": 433.47999999999996, "text": " is going to download all right and then it unzips the file again so here it"}, {"start": 433.47999999999996, "end": 437.76, "text": " unzips the file to the current working directory I don't want this so I'm going"}, {"start": 437.76, "end": 443.2, "text": " to change that again to the models path all right"}, {"start": 443.2, "end": 449.64, "text": " nope directory to path to zip file directory to extract to I think we're"}, {"start": 449.64, "end": 455.84, "text": " fine right now so this download script is going to download the path the all"}, {"start": 455.84, "end": 460.32, "text": " the weights there now I want this to happen sort of automatically while this"}, {"start": 460.32, "end": 465.84, "text": " is in a server or while this is on a server so what I'm going to do is"}, {"start": 465.84, "end": 470.91999999999996, "text": " probably just to so if this script runs you can see it runs the main but in the"}, {"start": 470.91999999999996, "end": 475.11999999999995, "text": " other script I might just want to do this automatically so let's go to the"}, {"start": 475.11999999999995, "end": 481.47999999999996, "text": " test script right here or let's say we go to the train script this is probably"}, {"start": 481.47999999999996, "end": 491.35999999999996, "text": " the main script right here the train script so we have to somehow call this"}, {"start": 491.36, "end": 498.64, "text": " other script here probably in the main function all right so let's import this"}, {"start": 498.64, "end": 512.72, "text": " other so import c410 what was it called c410 download okay and here we're going"}, {"start": 512.72, "end": 519.16, "text": " to call that and does this does this not download it if it already exists we have"}, {"start": 519.16, "end": 523.6, "text": " to check that so a lot of this is just going to be you know beating the stuff"}, {"start": 523.6, "end": 531.24, "text": " into beating stuff into into existence so if this zip file already exists we're"}, {"start": 531.24, "end": 539.68, "text": " not going to we're not going to do anything right which leaves us open if"}, {"start": 539.68, "end": 544.88, "text": " like if the unzipping fails then we're going to be in a kind of dumb path but"}, {"start": 544.88, "end": 559.56, "text": " you know we'll risk it zip path would be that so let's if OS path exists zip path"}, {"start": 559.56, "end": 571.08, "text": " then return okay so we're good in the download script what else do we need the"}, {"start": 571.08, "end": 575.24, "text": " data set I probably already have the data set from torch vision so that's not"}, {"start": 575.24, "end": 586.2, "text": " going to be an issue okay so here we're gonna call c410 download dot main all"}, {"start": 586.2, "end": 593.1600000000001, "text": " right and that should do we can't really call that yet let's actually just run"}, {"start": 593.16, "end": 605.92, "text": " this download script no no such file a directory probably need to make that"}, {"start": 605.92, "end": 617.6, "text": " probably need to make that directory right okay if OS make there's models"}, {"start": 617.6, "end": 632.44, "text": " path exist okay true yeah that should be something all right and we're downloading"}, {"start": 632.44, "end": 638.88, "text": " so this is 2.4 gigabytes which can you know be put by itself let's put that"}, {"start": 638.88, "end": 646.5600000000001, "text": " over there and while that's downloading let's check out the test script actually"}, {"start": 646.56, "end": 654.16, "text": " let's check out the test script so this simply takes in this c410 module and"}, {"start": 654.16, "end": 662.8399999999999, "text": " instantiates a trainer and as you can see it calls test on it so this should"}, {"start": 662.8399999999999, "end": 667.64, "text": " not be too hard I'm going to guess this c410 module is a lightning module as you"}, {"start": 667.64, "end": 674.28, "text": " can see right here it is we know how tensor sorry pi torch lightning works if"}, {"start": 674.28, "end": 677.52, "text": " you don't know how patrick's lightning works pretty easy you configure this"}, {"start": 677.52, "end": 681.36, "text": " module right here you configure a bunch of stuff like the data sets the training"}, {"start": 681.36, "end": 687.64, "text": " step and so on and you're good to go so I guess what we're going to do is we're"}, {"start": 687.64, "end": 696.64, "text": " going to change this train script and change it to our needs okay so let's"}, {"start": 696.64, "end": 704.4, "text": " copy that let's go with train ensemble bang so this is what we're going to"}, {"start": 704.4, "end": 713.56, "text": " change all right so first if the GPUs is a string then yada yada yada if it's to"}, {"start": 713.56, "end": 723.76, "text": " then wow that's that's that's kind of a weird engineering quirk right here okay"}, {"start": 723.76, "end": 729.52, "text": " what I want to do is make the GPU use transparent so we'll only ever use one"}, {"start": 729.52, "end": 743.56, "text": " GPU so let's call that CUDA and put that to true and then we'll say da da da da"}, {"start": 743.56, "end": 759.76, "text": " oh come on there is like a lot of stuff going on here let's so and then torch is"}, {"start": 759.76, "end": 765.4399999999999, "text": " called torch I'd hate that can I do this can I import it like twice with"}, {"start": 765.4399999999999, "end": 773.0799999999999, "text": " different names probably it's probably not very good but I'll do it um okay so"}, {"start": 773.08, "end": 780.8000000000001, "text": " if CUDA is not available we'll just set the CUDA to false if th dot CUDA dot is"}, {"start": 780.8000000000001, "end": 790.48, "text": " available cannot if it's not available then age params dot CUDA equals false"}, {"start": 790.48, "end": 802.72, "text": " and then we'll set the GPUs to zero comma I guess that's what it expects if"}, {"start": 802.72, "end": 813.72, "text": " else none and that should do it for the GPUs okay so second thing that we need"}, {"start": 813.72, "end": 823.1600000000001, "text": " we're going to need we're going fit here and there is this logs directory where"}, {"start": 823.1600000000001, "end": 827.24, "text": " the checkpoints are going to be saved I'm fine with that I just want to kind"}, {"start": 827.24, "end": 836.88, "text": " of remove the logs directory at the beginning so I'll do that and whenever"}, {"start": 836.88, "end": 840.76, "text": " we start this I'm going to remove the logs directory this is a controversial"}, {"start": 840.76, "end": 851.04, "text": " move but you know um remove tree recursively delete delete the directory"}, {"start": 851.04, "end": 862.12, "text": " yes logs good okay our download is done so what do we do next we might want to"}, {"start": 862.12, "end": 871.28, "text": " do just try to test test something and here in the test thing we might want to"}, {"start": 871.28, "end": 882.3199999999999, "text": " set the GPUs I don't have a GPU right here so none and the data directory is"}, {"start": 882.3199999999999, "end": 887.76, "text": " going to be yeah I'll put it so"}, {"start": 887.76, "end": 904.72, "text": " nope nope nope okay it doesn't find the it doesn't find the the state dicts and"}, {"start": 904.72, "end": 908.88, "text": " so on now we're going to have to fix this we're going to have to fix the fact"}, {"start": 908.88, "end": 918.12, "text": " that it doesn't load okay okay and that's probably going to be here in"}, {"start": 918.12, "end": 924.68, "text": " these models so if I look in the dense net for example which we can learn and"}, {"start": 924.68, "end": 931.0, "text": " there's this pre trained argument and what's that going to be it's oh that's"}, {"start": 931.0, "end": 938.16, "text": " bad okay it like has a hard code at the fact as hard coded the fact that there"}, {"start": 938.16, "end": 949.8, "text": " are there is this state dicts directory okay um yeah that's terrible terrible"}, {"start": 949.8, "end": 955.88, "text": " terrible terrible so I guess this is going to be in every single one of these"}, {"start": 955.88, "end": 961.68, "text": " models and that's not good so what we're going to do is probably always late"}, {"start": 961.68, "end": 968.7199999999999, "text": " loaded without the pre trained and then kind of loaded ourselves from the from"}, {"start": 968.7199999999999, "end": 974.68, "text": " the correct directory so what's the correct directory again we're going to"}, {"start": 974.68, "end": 983.8399999999999, "text": " set the model deer we probably can just take that from the download script like"}, {"start": 983.84, "end": 997.88, "text": " that state dicts okay and then we want the architecture I guess that's a thing"}, {"start": 997.88, "end": 1005.2, "text": " we can actually put the classifier here right here that's something we can so"}, {"start": 1005.2, "end": 1008.64, "text": " it's going to be the classifier if you look in the state dicts directory I'm"}, {"start": 1008.64, "end": 1019.68, "text": " going to guess you can models c4 10 state dicts we haven't unpacked it where"}, {"start": 1019.68, "end": 1026.98, "text": " have we not where have we unpacked it to help help oh no have we unpacked it to"}, {"start": 1026.98, "end": 1040.6, "text": " here we have not we have not so what is in here ah it's a c4 10 models something"}, {"start": 1040.6, "end": 1045.6, "text": " and then state dicts okay so it's always going to be the architecture plus PT so"}, {"start": 1045.6, "end": 1053.2, "text": " we can you know we can deal with that so it's going to be c4 10 models state"}, {"start": 1053.2, "end": 1062.1200000000001, "text": " dicts that's fine and then it's always going to be the architecture plus a PT"}, {"start": 1062.68, "end": 1068.88, "text": " so let's look at one of these models to see how this is loaded we've saw we've"}, {"start": 1068.88, "end": 1079.6000000000001, "text": " seen this here so we simply want to load this state dict in and here it"}, {"start": 1079.6, "end": 1085.36, "text": " constructs the thing this is let's do proper string interpolation shall we oh"}, {"start": 1085.36, "end": 1098.1999999999998, "text": " device where this device come from we should check that out device is given"}, {"start": 1098.2, "end": 1115.8, "text": " device device device CPU where is device given okay dense net device CPU oh I"}, {"start": 1115.8, "end": 1123.8, "text": " guess device is always CPU and then then we map it to wherever I'm not entirely"}, {"start": 1123.8, "end": 1131.08, "text": " sure so here we say set device I guess we can just get the device from"}, {"start": 1131.08, "end": 1148.12, "text": " somewhere let's try it out okay so we're going to need this right here so we're"}, {"start": 1148.12, "end": 1161.56, "text": " going to OS path join models path and something that's dot PT so and here we're"}, {"start": 1161.56, "end": 1172.9199999999998, "text": " going to get the architecture which is the classifier cool so that's how we"}, {"start": 1172.92, "end": 1183.8000000000002, "text": " load something and then the device maybe we can just go torch CUDA dot get device"}, {"start": 1183.8000000000002, "end": 1189.28, "text": " is that possible let's try"}, {"start": 1189.28, "end": 1217.04, "text": " nope okay nope no get device device maybe nope"}, {"start": 1219.6, "end": 1226.56, "text": " map location was given okay so we have to figure out where this device comes"}, {"start": 1226.56, "end": 1238.8, "text": " from honestly here no module there's this get classifier right here but"}, {"start": 1238.8, "end": 1254.9199999999998, "text": " that's just says pre trained this device always CPU I just can't believe that I"}, {"start": 1254.92, "end": 1270.92, "text": " guess I'll believe it will always load to the CPU okay cool we can do that I"}, {"start": 1270.92, "end": 1279.88, "text": " guess pytorch lightning will then put it on the GPU for us cool so this is about"}, {"start": 1279.88, "end": 1293.6000000000001, "text": " how far I got when I try to do this by myself and now the problem starts missing"}, {"start": 1293.6000000000001, "end": 1301.6000000000001, "text": " keys in state dick a lot of missing stuff we can't we can't possibly load"}, {"start": 1301.6, "end": 1319.3999999999999, "text": " that yeah no not going to so we can't load stuff what does it do"}, {"start": 1319.4, "end": 1332.3200000000002, "text": " load file name equals and then let's paste this and let's put some kind of"}, {"start": 1332.32, "end": 1361.3999999999999, "text": " breakpoint here so we can check it out okay that exists no she feels like that"}, {"start": 1361.4, "end": 1373.64, "text": " should exist yeah that exists what's the what's the deal what's the matter here"}, {"start": 1373.64, "end": 1390.0, "text": " so we got model which is I guess a resonant 18 and we got this thing that"}, {"start": 1390.0, "end": 1399.04, "text": " we might want to load so why doesn't it work torch load load file name see that"}, {"start": 1399.04, "end": 1410.96, "text": " works so that's the state dict is that let's look at its keys we got a you know"}, {"start": 1410.96, "end": 1419.48, "text": " a bunch of stuff okay so why can't we load that model load state dict state"}, {"start": 1419.48, "end": 1436.52, "text": " dict and now unexpected keys in state dick missing keys so this is always"}, {"start": 1436.52, "end": 1453.8, "text": " prepended with model dot and here it's not okay what do we do about that I"}, {"start": 1453.8, "end": 1459.2, "text": " guess this is because we loaded ourselves okay"}, {"start": 1459.2, "end": 1471.24, "text": " cool so our model is not yes so our model has the sub path model so we need"}, {"start": 1471.24, "end": 1481.4, "text": " model dot model dot load state dict right look at us we made it so this is"}, {"start": 1481.4, "end": 1488.04, "text": " testing I guess this is this resonant 18 or whatnot so we can leave that to run"}, {"start": 1488.04, "end": 1498.24, "text": " for itself so we figured out how to load this stuff took us a while now let's go"}, {"start": 1498.24, "end": 1505.08, "text": " ahead and we know how to load the models we know how to load the weights so this"}, {"start": 1505.08, "end": 1508.8799999999999, "text": " is our teacher model right our teacher model is supposed to load up the weights"}, {"start": 1508.8799999999999, "end": 1516.76, "text": " and then and then teach the student models so here what does this training"}, {"start": 1516.76, "end": 1524.84, "text": " thing do we download the thing we make our GPUs to be really good okay and then"}, {"start": 1524.84, "end": 1530.2, "text": " we instantiate this module right here as you can see so now we're going to check"}, {"start": 1530.2, "end": 1533.68, "text": " out this module by the way the testing is done and as you can see there's an"}, {"start": 1533.68, "end": 1539.8, "text": " accuracy of 93.33 which I'm pretty happy with this is congruent with what we saw"}, {"start": 1539.8, "end": 1545.68, "text": " right here the resonant 18 do okay and we can I guess we can take a resonant 18"}, {"start": 1545.68, "end": 1549.88, "text": " or a resonant 50 they're both fairly small right here so a lot of them are"}, {"start": 1549.88, "end": 1555.44, "text": " going to fit on our GPUs once we use the GPUs so let's change this module around"}, {"start": 1555.44, "end": 1562.64, "text": " right here to actually do the to actually do the let's say the the proper"}, {"start": 1562.64, "end": 1568.3200000000002, "text": " thing that we wanted to do so here we have self dot model as you can see and"}, {"start": 1568.32, "end": 1575.98, "text": " it's get classifier and the question is does it load it pre-trained so what we"}, {"start": 1575.98, "end": 1581.58, "text": " want to do is this is going to be our teacher model and this in this get"}, {"start": 1581.58, "end": 1586.84, "text": " classifier we want pre-trained to be false always right here we don't want"}, {"start": 1586.84, "end": 1593.0, "text": " any sort of we don't want to load the pre-trained instead what we want to do"}, {"start": 1593.0, "end": 1601.8, "text": " is we actually want to have the we want to load it ourselves right so here"}, {"start": 1601.8, "end": 1604.96, "text": " pre-trained false and now we're going from our test script we're going to take"}, {"start": 1604.96, "end": 1614.4, "text": " over the path they think the code that we used to load this okay all right so"}, {"start": 1614.4, "end": 1628.2, "text": " but a beam but a boom OS we don't have OS that coming along just fine yep yep"}, {"start": 1628.2, "end": 1635.8000000000002, "text": " yep so now here we're going to have our self teacher model to load that state"}, {"start": 1635.8000000000002, "end": 1642.3200000000002, "text": " dict all right so this is it for initialization now we also need our"}, {"start": 1642.32, "end": 1649.2, "text": " student models of course so our student models are going to be a bunch of models"}, {"start": 1649.8, "end": 1659.72, "text": " models are going to be a bunch of models where what do we say so this is going to"}, {"start": 1659.72, "end": 1676.16, "text": " be a torch or like a module list there's this module list and under under under"}, {"start": 1678.84, "end": 1688.72, "text": " torch dot nn dot module list right so I initialize that with a list and the list"}, {"start": 1688.72, "end": 1693.3600000000001, "text": " is going to be get me the classifier and we're just gonna go for the same kind of"}, {"start": 1693.3600000000001, "end": 1697.72, "text": " classifiers right now to really boil it down to have the same architecture for"}, {"start": 1697.72, "end": 1711.4, "text": " the student and for the teachers for bar in range in range and here we probably"}, {"start": 1711.4, "end": 1718.76, "text": " need a flag so H params dot num students okay so these are going to be our"}, {"start": 1718.76, "end": 1723.76, "text": " student model so let's quickly create this num students thing right here I'll"}, {"start": 1723.76, "end": 1732.8400000000001, "text": " probably have to have an integer and we'll go with five students for now okay"}, {"start": 1732.8400000000001, "end": 1739.72, "text": " so we're creating five students all of them are not pre-trained so we're going"}, {"start": 1739.72, "end": 1744.68, "text": " to are we going to train them from scratch or do we want actually to take"}, {"start": 1744.68, "end": 1749.44, "text": " over the weights we probably don't want to take over the weights let's just"}, {"start": 1749.44, "end": 1755.68, "text": " train them from scratch in a distillation mode I have no clue about"}, {"start": 1755.68, "end": 1764.0, "text": " this stuff by the way okay I guess this concludes this already concludes what we"}, {"start": 1764.0, "end": 1770.08, "text": " what we wanted to do so I guess this module list what can we do with it does"}, {"start": 1770.08, "end": 1776.36, "text": " anyone know I don't know by the way I'm sorry for the switching between the dark"}, {"start": 1776.36, "end": 1784.2, "text": " and the bright background I don't know how to fix that so pi torch and an"}, {"start": 1784.2, "end": 1791.48, "text": " module list it would be nice if we could give them some names right so I guess"}, {"start": 1791.48, "end": 1797.76, "text": " that's just an iterable right here so probably there's nothing that we can do"}, {"start": 1797.76, "end": 1802.1200000000001, "text": " to give them proper names or we'd have to hack around and I don't want to do"}, {"start": 1802.1200000000001, "end": 1808.92, "text": " that so I guess we can just check if that actually computes until here so"}, {"start": 1808.92, "end": 1818.88, "text": " let's check it out let's try the ensemble it doesn't data set not found"}, {"start": 1818.88, "end": 1825.24, "text": " or corrupted okay so what we'll have to do is we'll have to implement have to"}, {"start": 1825.24, "end": 1836.5200000000002, "text": " change this data directory right here so the data deer is going to be OS this"}, {"start": 1836.52, "end": 1849.96, "text": " whatever my c410 directory is no such file directory logs okay so logs doesn't"}, {"start": 1849.96, "end": 1864.24, "text": " exist so let's actually make it still no such file a directory logs why why"}, {"start": 1864.24, "end": 1872.64, "text": " doesn't it make it no such file a directory logs ah okay we need to ignore"}, {"start": 1872.64, "end": 1881.8, "text": " errors here and we're good okay so it computes until the point you probably"}, {"start": 1881.8, "end": 1887.24, "text": " you probably can't see that right I guess now you can see it let's check"}, {"start": 1887.24, "end": 1894.88, "text": " yeah now you can see it all right so where are we we are at the point right"}, {"start": 1894.88, "end": 1900.58, "text": " here in our module after we've created the teacher and the students so if we"}, {"start": 1900.58, "end": 1907.68, "text": " look at self technically we should be able to see right here a whole bunch of"}, {"start": 1907.68, "end": 1915.28, "text": " resnet 18s whole bunch so here you can see the teacher model right and I'm"}, {"start": 1915.28, "end": 1921.16, "text": " going to guess you can see layer 4 and here you can see the student models so"}, {"start": 1921.16, "end": 1926.36, "text": " the student models are going to be in a whole list of models and now we're going"}, {"start": 1926.36, "end": 1929.3799999999999, "text": " to train them so since they're initialized differently our hope is"}, {"start": 1929.3799999999999, "end": 1933.52, "text": " going to be that they're sort of going to end up at different places we're"}, {"start": 1933.52, "end": 1936.6, "text": " going to train them with the same like we're going to be really really stupid"}, {"start": 1936.6, "end": 1946.8, "text": " about this okay all right so let's be really stupid about it so what what are"}, {"start": 1946.8, "end": 1950.1599999999999, "text": " we gonna have to change here is our training step and our training step is"}, {"start": 1950.1599999999999, "end": 1957.1999999999998, "text": " actually fine we'll simply forward we'll get a loss from that and then we are"}, {"start": 1957.1999999999998, "end": 1962.36, "text": " going to return that and that's going to be back propped so in our optimizer"}, {"start": 1962.36, "end": 1967.36, "text": " wherever we initialize our optimizer we should probably give it the parameters"}, {"start": 1967.36, "end": 1972.3999999999999, "text": " that are not only the student model parameters right not the teacher model"}, {"start": 1972.3999999999999, "end": 1985.3999999999999, "text": " parameters so it should only train the student models okay and even even like"}, {"start": 1985.3999999999999, "end": 1991.9599999999998, "text": " that we should probably always set the teacher model in Eve in eval mode but"}, {"start": 1991.96, "end": 1997.16, "text": " we'll do that in the forward step right here so in the forward step we get"}, {"start": 1997.16, "end": 2002.32, "text": " images and labels and here it runs it just forward through the model we want"}, {"start": 2002.32, "end": 2009.3600000000001, "text": " to change that we actually want to have teacher predictions which we're going to"}, {"start": 2009.3600000000001, "end": 2013.52, "text": " have the teacher model we're going to forward this through the teacher models"}, {"start": 2013.52, "end": 2018.6000000000001, "text": " now the criterion I'm gonna guess is a cross entropy so the predictions here"}, {"start": 2018.6, "end": 2026.28, "text": " are actually going to be logits right and this is this is good except that"}, {"start": 2026.28, "end": 2033.3999999999999, "text": " what we want to do is have a distribution of over labels so after the"}, {"start": 2033.3999999999999, "end": 2038.24, "text": " teacher here runs through and let's put a break point right here and actually"}, {"start": 2038.24, "end": 2045.56, "text": " look at it I find it's always easy if you go and just run until the point"}, {"start": 2045.56, "end": 2051.2799999999997, "text": " where you're are at the code and then you can just look at stuff so here"}, {"start": 2051.2799999999997, "end": 2057.2, "text": " there's oh there's a validation sanity check okay probably don't want that and"}, {"start": 2057.2, "end": 2064.96, "text": " now we have the break right here and now we can look at teacher predictions dot"}, {"start": 2064.96, "end": 2069.7999999999997, "text": " shape so that's a batch size times ten and if we look at it I'm going to guess"}, {"start": 2069.7999999999997, "end": 2072.84, "text": " there's some negative numbers in there so that's not going to be that those are"}, {"start": 2072.84, "end": 2079.32, "text": " going to be logits now we want them that to be a soft max over the last dimension"}, {"start": 2079.32, "end": 2083.96, "text": " and that's going to be of the same shape but of course now we're going to have a"}, {"start": 2083.96, "end": 2087.78, "text": " proper distribution so if we sum over the last dimension you should see a"}, {"start": 2087.78, "end": 2094.44, "text": " bunch of ones all right so the teacher predictions are going to be soft max"}, {"start": 2094.44, "end": 2103.2000000000003, "text": " over the last dimension and since we since we don't want to back prop through"}, {"start": 2103.2000000000003, "end": 2110.04, "text": " the teacher we can do this in an environment of no grad right here so we"}, {"start": 2110.04, "end": 2117.56, "text": " have that with not being stupid and we also set the teacher model into eval"}, {"start": 2117.56, "end": 2128.2799999999997, "text": " mode so I guess that does it set train no"}, {"start": 2130.32, "end": 2140.4, "text": " that should do it I have no idea yeah let's let's run it again we could have"}, {"start": 2140.4, "end": 2148.96, "text": " done that there okay so so far so good so we have the teacher predictions now"}, {"start": 2148.96, "end": 2154.4, "text": " what we need to do is run them through the student and use them as labels so"}, {"start": 2154.4, "end": 2166.4, "text": " we'll go for student in student models we'll go student forward or we simply"}, {"start": 2166.4, "end": 2176.84, "text": " run the images through that and that give us the logits and then we use our"}, {"start": 2176.84, "end": 2187.48, "text": " loss function on the logits and that not the labels but the teacher predictions"}, {"start": 2187.48, "end": 2194.0, "text": " right so we never actually use the labels here as you can see and that's"}, {"start": 2194.0, "end": 2203.76, "text": " going to be the student loss and now we have a bunch of losses and we're going"}, {"start": 2203.76, "end": 2206.64, "text": " to append that"}, {"start": 2208.96, "end": 2222.36, "text": " nope like this and our loss is simply going to be the sum of all the student"}, {"start": 2222.36, "end": 2234.48, "text": " losses not even the average I guess we could losses I guess we could make it"}, {"start": 2234.48, "end": 2239.4, "text": " the average just so if we change the number of students will will get some"}, {"start": 2239.4, "end": 2248.2000000000003, "text": " kind of some sort of a better sense of the actual numbers what what what okay I"}, {"start": 2248.2, "end": 2257.64, "text": " think over here we're good yeah so our teacher model is not in training mode"}, {"start": 2257.64, "end": 2265.68, "text": " but our student models hopefully are in training mode no is this the eval pass I"}, {"start": 2265.68, "end": 2270.4399999999996, "text": " guess this is the eval pass this is the validation sanity check pass okay so"}, {"start": 2270.4399999999996, "end": 2278.16, "text": " this is going to be our loss and our accuracy now right so okay what's going"}, {"start": 2278.16, "end": 2283.3599999999997, "text": " to be our accuracy our accuracy is going to be we have these student losses all"}, {"start": 2283.3599999999997, "end": 2289.44, "text": " of them and what we are going to do is we're simply going to take the maximum"}, {"start": 2289.44, "end": 2297.08, "text": " prediction across the students pretty easy pretty easy but we need to collect"}, {"start": 2297.08, "end": 2316.56, "text": " the logits so come on so we'll also have the logits append the student logits"}, {"start": 2316.56, "end": 2321.7999999999997, "text": " okay so we have a whole bunch of logits right here and we'll get some"}, {"start": 2321.8, "end": 2327.92, "text": " predictions out of that now the question is do we want to simply take the mode or"}, {"start": 2327.92, "end": 2332.48, "text": " do we actually want to run a softmax over each and then take the average"}, {"start": 2332.48, "end": 2341.2400000000002, "text": " prediction I'm not super super sure but we can try to do it in different"}, {"start": 2341.2400000000002, "end": 2347.04, "text": " different ways so right now we might just want to take the maybe the average"}, {"start": 2347.04, "end": 2353.08, "text": " logit and then run a softmax on top of that because I'm gonna guess the logits"}, {"start": 2353.08, "end": 2359.56, "text": " are outputs of a linear layer so they might behave more in a linear fashion"}, {"start": 2359.56, "end": 2369.92, "text": " than if we were to average the actual probabilities that come out right maybe"}, {"start": 2369.92, "end": 2376.44, "text": " let's let's do this okay so we'll go we'll take these logits they're all and"}, {"start": 2376.44, "end": 2387.7200000000003, "text": " we need to somehow concatenate those or stack them so how we're gonna stack them"}, {"start": 2387.7200000000003, "end": 2393.88, "text": " so they're 256 their batch size by number of classes so we'll just stack"}, {"start": 2393.88, "end": 2400.96, "text": " them at dimension zero I guess that's fine and then we are going to mean also"}, {"start": 2400.96, "end": 2408.12, "text": " across dimension zero so those are going to be our logits or final logits and"}, {"start": 2408.12, "end": 2418.08, "text": " then our predictions are going to be the argmax of the logits in the last"}, {"start": 2418.08, "end": 2430.56, "text": " dimension yep that should be pretty straightforward I guess that's it"}, {"start": 2430.56, "end": 2441.52, "text": " easy as that yes the rest here should just do by itself and I'm going to go"}, {"start": 2441.52, "end": 2449.84, "text": " ahead and run give this another run and see where we run into problems can't"}, {"start": 2449.84, "end": 2453.04, "text": " really see how this could ever go wrong"}, {"start": 2453.04, "end": 2461.24, "text": " we'll just take everything over okay we actually got a problem 1d target tensor"}, {"start": 2461.24, "end": 2466.48, "text": " expected multi-target not supported so the cross entropy loss in pytorch does"}, {"start": 2466.48, "end": 2473.04, "text": " not support that let's let's give it a shot make this a little bigger for you"}, {"start": 2473.04, "end": 2485.8, "text": " and let's go for the cross P loss I can't type today so here we have the"}, {"start": 2485.8, "end": 2490.64, "text": " cross entropy loss and the cross entropy loss is useful when training"}, {"start": 2490.64, "end": 2496.48, "text": " classification problem with the classes yada yada yada wait should be one okay"}, {"start": 2496.48, "end": 2506.64, "text": " criterion expects a class index as the target okay so what we need is like a"}, {"start": 2506.64, "end": 2513.2, "text": " soft loss right we don't need this cross entropy loss we actually want we want to"}, {"start": 2513.2, "end": 2520.52, "text": " have soft targets so what do we do we want to do I think the cross entropy"}, {"start": 2520.52, "end": 2527.6, "text": " loss is a combination of the here of the log softmax and the NLL loss can we take"}, {"start": 2527.6, "end": 2540.52, "text": " the NLL loss maybe so the NLL loss right here is going to be the target that this"}, {"start": 2540.52, "end": 2552.44, "text": " loss expect should be a class index no okay that's not good so next let's go do"}, {"start": 2552.44, "end": 2561.64, "text": " we have we somehow need a soft cross entropy loss let's search for that"}, {"start": 2561.64, "end": 2577.24, "text": " pytorch soft cross entropy soft classes I guess people do that kind of stuff so"}, {"start": 2578.8399999999997, "end": 2584.7999999999997, "text": " the problem with these kind of losses is that what you do what you have to do is"}, {"start": 2584.8, "end": 2594.0800000000004, "text": " kind of protect yourself against against numerical instabilities right so what we"}, {"start": 2594.0800000000004, "end": 2601.2400000000002, "text": " want to do is find a function that does this for us I guess if we do the lot the"}, {"start": 2601.24, "end": 2613.9599999999996, "text": " the log softmax that should take care of it for us okay this is tensor flow okay"}, {"start": 2614.72, "end": 2622.68, "text": " following thread cross entropy loss I guess people just do really the log"}, {"start": 2622.68, "end": 2635.04, "text": " softmax and then do that and we should be fine with this okay thanks"}, {"start": 2635.04, "end": 2646.04, "text": " K Frank yeah maybe maybe this has advanced since then so we can give like"}, {"start": 2646.04, "end": 2651.2799999999997, "text": " a last look at this and this is a bit too big I'm sorry your eyes are gonna"}, {"start": 2651.28, "end": 2662.4, "text": " have to suffer and we're going to look at loss functions and we're going to"}, {"start": 2662.4, "end": 2673.36, "text": " just look through them multi-label soft margin loss mmm multi-label we don't"}, {"start": 2673.36, "end": 2684.36, "text": " really want multi-label right we want this but not with the targets okay I"}, {"start": 2684.36, "end": 2689.8, "text": " guess we're just gonna have to write this ourselves so ultimately what is the"}, {"start": 2689.8, "end": 2695.36, "text": " cross entropy that cross entropy is simply the probability of the true label"}, {"start": 2695.36, "end": 2703.06, "text": " times the log probability of the wrong or of the predicted label if you as you"}, {"start": 2703.06, "end": 2707.7599999999998, "text": " see right here so we are going to simply multiply target times the log"}, {"start": 2707.7599999999998, "end": 2715.72, "text": " probability of the predicted label and then some some don't take that mean"}, {"start": 2715.72, "end": 2725.2599999999998, "text": " across the batch I guess yeah that should do we can implement this let's do"}, {"start": 2725.2599999999998, "end": 2732.64, "text": " it so this criterion right here is going to be our loss function and that's only"}, {"start": 2732.64, "end": 2746.4, "text": " used once so what we can do is going to be a function so we're going to take"}, {"start": 2746.4, "end": 2756.3599999999997, "text": " student logits and we're going to take teacher probabilities okay so how's that"}, {"start": 2756.3599999999997, "end": 2762.62, "text": " gonna work out we're going to do the log soft max from the student logits so"}, {"start": 2762.62, "end": 2776.16, "text": " and then dot does that exist log softmax functional okay we need functional and"}, {"start": 2776.16, "end": 2784.4, "text": " student logits of that dimension so now we have properly normalized student log"}, {"start": 2784.4, "end": 2790.8399999999997, "text": " it so that's going to be student log probes and then what we want to do is"}, {"start": 2790.84, "end": 2798.6400000000003, "text": " simply multiply the teacher probes times the student log probes and the negative"}, {"start": 2798.6400000000003, "end": 2806.88, "text": " of that is going to be our loss the question is do we want to sum that I"}, {"start": 2806.88, "end": 2820.0, "text": " guess across this dimension or mean it I guess the sum sum should do all right"}, {"start": 2820.0, "end": 2829.18, "text": " this is it easy as that why have we searched for so long so the criterion we"}, {"start": 2829.18, "end": 2839.12, "text": " can simply replace that now by our loss function cool so let's run it again"}, {"start": 2839.12, "end": 2850.56, "text": " yada yada yada okay sanity check maybe we should have taken like a smaller"}, {"start": 2850.56, "end": 2854.92, "text": " model it sometimes pays off to you know start with a really small model small"}, {"start": 2854.92, "end": 2863.56, "text": " model just so you can you can do these kind of things fast so here we have"}, {"start": 2863.56, "end": 2872.4, "text": " dimension out of range today okay which is where is that in forward in line 78"}, {"start": 2872.4, "end": 2884.2, "text": " let's go there line 78 okay here the max is not going to be as much fun let's"}, {"start": 2884.2, "end": 2888.16, "text": " like let's go there I think this is some of these things change over time in"}, {"start": 2888.16, "end": 2894.7599999999998, "text": " Pytorch so this code might be written when you know so what we have is we have"}, {"start": 2894.7599999999998, "end": 2902.16, "text": " a max over the predictions and predictions oh it's already an arg max"}, {"start": 2902.16, "end": 2909.42, "text": " so I guess we can remove this all whether or not that agrees with labels"}, {"start": 2909.42, "end": 2919.8, "text": " dot data we don't need any of that dot float and we also don't need that we so"}, {"start": 2919.8, "end": 2928.48, "text": " the accuracy is simply going to be the mean of this no I guess so we're here"}, {"start": 2928.48, "end": 2942.72, "text": " can't we just do predictions equals labels yes and we want the sum of that"}, {"start": 2945.28, "end": 2952.2400000000002, "text": " actually we want the float first and then we want the mean yeah that seems"}, {"start": 2952.24, "end": 2961.64, "text": " reasonable so let's do it like this yeah that it doesn't float mean perfect how"}, {"start": 2961.64, "end": 2970.7999999999997, "text": " could this be any more easy but this right here is all of it so validation"}, {"start": 2970.7999999999997, "end": 2980.3399999999997, "text": " step accuracy corrects we'll just look at it once we done it and what I do is"}, {"start": 2980.34, "end": 2984.76, "text": " usually just run it until it doesn't give me any mistakes anymore and then I"}, {"start": 2984.76, "end": 3012.5200000000004, "text": " know I sort of have succeeded"}, {"start": 3014.76, "end": 3031.5600000000004, "text": " okay we're pretty close I feel so it says grad can implicitly created only"}, {"start": 3031.5600000000004, "end": 3037.2000000000003, "text": " for scalar outputs which probably means our loss function is not a scalar so"}, {"start": 3037.2000000000003, "end": 3042.6800000000003, "text": " when we return the loss right here here we have the sum of the losses divided by"}, {"start": 3042.68, "end": 3055.44, "text": " the length of the losses let's go here and check out what's up with that so"}, {"start": 3055.44, "end": 3061.7999999999997, "text": " what we'll do I see this loss function here will output basically one loss for"}, {"start": 3061.7999999999997, "end": 3071.3199999999997, "text": " each data point so what we need to do I guess is call mean on this or sum when"}, {"start": 3071.32, "end": 3077.04, "text": " they created the criterion in the original one now we've thrown it away"}, {"start": 3077.52, "end": 3087.52, "text": " look at the git diff right here so I guess this reduces how does this reduce"}, {"start": 3087.52, "end": 3097.32, "text": " the cross entropy loss when we don't do anything cross entropy loss reduces"}, {"start": 3097.32, "end": 3106.48, "text": " reduction mean okay so let's reduce with the mean so if we call loss then after"}, {"start": 3106.48, "end": 3112.4, "text": " that we should call mean and then here I'm not so sure anymore we should divide"}, {"start": 3112.4, "end": 3117.2000000000003, "text": " here because the learning rate is kind of tuned to the original loss size so I"}, {"start": 3117.2000000000003, "end": 3124.1200000000003, "text": " guess we'll be content for now with summing up these things and over here I"}, {"start": 3124.12, "end": 3132.52, "text": " guess we've we've solved that right no losses yeah see our losses is going to"}, {"start": 3132.52, "end": 3141.04, "text": " be an entire tensor and now we just fix that right now okay so let's try it"}, {"start": 3141.04, "end": 3149.52, "text": " again in the meantime what can we do we can so we already take care of our GPU"}, {"start": 3149.52, "end": 3156.0, "text": " we take care of the logs one thing to do when with respect to this download stuff"}, {"start": 3156.0, "end": 3163.56, "text": " right here is you know if you have a server or something and you let a lot of"}, {"start": 3163.56, "end": 3167.88, "text": " things run in parallel what you want to do is make sure they don't all download"}, {"start": 3167.88, "end": 3173.04, "text": " the same stuff at the same time that's pretty bad so what you want to do is"}, {"start": 3173.04, "end": 3177.84, "text": " ideally have some sort of lock such that they coordinate and I usually use a file"}, {"start": 3177.84, "end": 3189.1600000000003, "text": " lock for this so I'm gonna create that right here from import the file lock and"}, {"start": 3189.1600000000003, "end": 3198.7400000000002, "text": " then I simply create the lock let's go file lock and here you have to input a"}, {"start": 3198.74, "end": 3212.8399999999997, "text": " file so sometimes like yeah data lock I don't know you just pick some file and"}, {"start": 3212.8399999999997, "end": 3219.0, "text": " that's the file that these these processes are going to sync on and then"}, {"start": 3219.0, "end": 3231.68, "text": " once you do this you simply wrap all of it in a with lock so only one at a time"}, {"start": 3231.68, "end": 3243.9, "text": " can go in in this function all right so that's that that should make us safe and"}, {"start": 3243.9, "end": 3250.84, "text": " right here we're now training this is excellent we are training the students"}, {"start": 3250.84, "end": 3258.64, "text": " now we need to do that on an actual GPU so I have multiple tools to ship this to"}, {"start": 3258.64, "end": 3268.32, "text": " a GPU so first of all I can try to ship this to and try to ship this to a let's"}, {"start": 3268.32, "end": 3274.6000000000004, "text": " say to to one GPU so the way you do that is first of all I want some sort of"}, {"start": 3274.6000000000004, "end": 3282.1600000000003, "text": " unbuffered version of Python and then I have this do I even have this tool I do"}, {"start": 3282.1600000000003, "end": 3289.76, "text": " have the tool okay so I'm gonna call one of our servers"}, {"start": 3289.76, "end": 3302.84, "text": " and we don't know what's going on okay so cannot import name seed everything"}, {"start": 3302.84, "end": 3310.0400000000004, "text": " from PyTorch lightning seed everything is that some kind of new thing in PyTorch"}, {"start": 3310.04, "end": 3329.48, "text": " lightning I guess I have it apparently so here seed everything with zero why I"}, {"start": 3329.48, "end": 3337.12, "text": " don't need that we are running without any seed here we are being really cool"}, {"start": 3337.12, "end": 3348.6, "text": " okay next mistake cannot okay still same mistake of course since we don't yep"}, {"start": 3352.44, "end": 3358.2, "text": " next mistake we'll just go through the mistake learning rate late learning"}, {"start": 3358.2, "end": 3364.9, "text": " rate loggers so I guess we need to update PyTorch lightning on the servers"}, {"start": 3364.9, "end": 3371.36, "text": " and I'll do that quickly okay I've updated PyTorch lightning let's check"}, {"start": 3371.36, "end": 3376.42, "text": " out whether or not we can actually run something yeah we can run something so"}, {"start": 3376.42, "end": 3380.84, "text": " this again is now downloading this on the server while this is happening"}, {"start": 3380.84, "end": 3387.1800000000003, "text": " there's another thing we can do namely I have sort of sort of made a system to"}, {"start": 3387.18, "end": 3395.8799999999997, "text": " run stuff on servers which I like a lot honestly so I guess we can try this out"}, {"start": 3395.8799999999997, "end": 3407.08, "text": " how do I hidden with I okay so I want to first of all delete this delete this"}, {"start": 3407.08, "end": 3418.24, "text": " yes I guess delete this cool and this git folder is a bit annoying let's"}, {"start": 3418.24, "end": 3423.3199999999997, "text": " restructure because otherwise it will always ship the git folder with"}, {"start": 3423.3199999999997, "end": 3430.48, "text": " everything up here does it do that yeah I don't like to have the code in the top"}, {"start": 3430.48, "end": 3441.88, "text": " level so quickly make a sources directory move everything in there so"}, {"start": 3441.88, "end": 3451.36, "text": " move the c410 models into the source directory move all the Python files into"}, {"start": 3451.36, "end": 3465.54, "text": " the source directory no clear the logs and we're much better much better okay"}, {"start": 3465.54, "end": 3474.32, "text": " much better so what we what what we will do is my system requires like a file and"}, {"start": 3474.32, "end": 3497.2400000000002, "text": " I'm just gonna copy one from another project quickly okay so we're back and I"}, {"start": 3497.2400000000002, "end": 3503.1200000000003, "text": " copied that over as you can see you basically give hyperparameters and it"}, {"start": 3503.12, "end": 3508.04, "text": " blasts ever the hyperparameters through in a kind of a random search fashion it's"}, {"start": 3508.04, "end": 3520.48, "text": " not too sophisticated but we can work with it so 10 that's the file right for"}, {"start": 3520.48, "end": 3528.24, "text": " 10 train ensemble yes that's the file cool and here we're just going to put"}, {"start": 3528.24, "end": 3536.9199999999996, "text": " all of our hyperparameters and that will remove the logs file I'm okay with that"}, {"start": 3536.9199999999996, "end": 3540.7599999999998, "text": " but on this"}, {"start": 3546.56, "end": 3555.0, "text": " bang cool so what do we want we want basically we just want to try it like a"}, {"start": 3555.0, "end": 3562.48, "text": " bunch of times and then see like average across it right that's all maybe we want"}, {"start": 3562.48, "end": 3575.32, "text": " the the architecture to change so let's say the classifier is a resnet 18 or a"}, {"start": 3575.32, "end": 3587.2000000000003, "text": " resnet 34 or a resnet 50 just so we have a bunch of stuff to to do okay and this"}, {"start": 3587.2000000000003, "end": 3596.04, "text": " downloaded and is training on GPU hopefully if this works then we can"}, {"start": 3596.04, "end": 3601.32, "text": " ship this off and we'll make this other hyperparameter that I like to use called"}, {"start": 3601.32, "end": 3606.7200000000003, "text": " rep which is just basically a dummy parameter and so I can just repeat the"}, {"start": 3606.7200000000003, "end": 3615.0800000000004, "text": " experiment a bunch of times and let's put that in here so this is really that"}, {"start": 3615.0800000000004, "end": 3624.0800000000004, "text": " this has this has no effect except for randomizing it a bit I guess we can try"}, {"start": 3624.0800000000004, "end": 3630.2400000000002, "text": " to seed stuff so whenever it says seed everything we'll just seed it with this"}, {"start": 3630.24, "end": 3646.04, "text": " we'll call it seed no is it here this seed everything yeah so h params dot rep"}, {"start": 3646.04, "end": 3658.2, "text": " sorry seed cool with this this is doing something nice you can see it so this is"}, {"start": 3658.2, "end": 3668.68, "text": " unbuffered Python output thanks yeah so what other classifiers do we have we can"}, {"start": 3668.68, "end": 3676.2, "text": " again we can try a bunch of them we can try all of them why don't we try all of"}, {"start": 3676.2, "end": 3684.7599999999998, "text": " them like this then let's go into this rat file I don't know why I called it"}, {"start": 3684.76, "end": 3697.2000000000003, "text": " rat I just want it like some three letter thing so yep like this and then"}, {"start": 3697.2000000000003, "end": 3704.5600000000004, "text": " we can just take all of that crap and delete it and delete this and those are"}, {"start": 3704.5600000000004, "end": 3709.88, "text": " going to be all our models so our classifier is going to consist of all of"}, {"start": 3709.88, "end": 3721.6400000000003, "text": " this stuff let's I know I know I know I suck at them don't tell me actually tell"}, {"start": 3721.6400000000003, "end": 3727.2400000000002, "text": " me I want VIM tips trying to learn something new like each week in VIM but"}, {"start": 3727.2400000000002, "end": 3735.04, "text": " it is hard and tend to make myself actually do it so let's go let's go with"}, {"start": 3735.04, "end": 3739.7400000000002, "text": " just one repetition so far if we if we are not sure we can still up the number"}, {"start": 3739.74, "end": 3746.8799999999997, "text": " of repetitions we don't even have the rep right now this is called seed all"}, {"start": 3746.8799999999997, "end": 3752.64, "text": " right so we have different classifiers and what we're going to need we also have"}, {"start": 3752.64, "end": 3768.0, "text": " this num students right let's go with one with five and with twenty so here we"}, {"start": 3768.0, "end": 3774.0, "text": " got one epoch done and we get a validation loss do we get a validation"}, {"start": 3774.0, "end": 3784.16, "text": " accuracy validating validating I have no idea we'll cancel this right now and"}, {"start": 3784.16, "end": 3790.76, "text": " we'll go ahead and just blast this on to our servers and hopefully that that's"}, {"start": 3790.76, "end": 3808.0, "text": " gonna work I have no idea is everything fine everything's fine go no what what"}, {"start": 3808.0, "end": 3826.84, "text": " cool and let me get back to you once this is finished all right we're back so"}, {"start": 3826.84, "end": 3832.64, "text": " I've just written some code here to extract the results of that run and"}, {"start": 3832.64, "end": 3836.52, "text": " something you know it's pretty interesting what came out so in these"}, {"start": 3836.52, "end": 3841.64, "text": " plots you'll see on the x-axis have the number of students in the ensemble"}, {"start": 3841.64, "end": 3845.3, "text": " remember these students are all trained from the same teacher the teacher you"}, {"start": 3845.3, "end": 3850.36, "text": " can see an orange that's just a single teacher for reference you can see that"}, {"start": 3850.36, "end": 3855.8, "text": " if you have one student model it sometimes underperforms or in sometimes"}, {"start": 3855.8, "end": 3862.88, "text": " outperforms the single teacher model but then if you have more student models you"}, {"start": 3862.88, "end": 3868.6, "text": " can see that there is a pretty monotonic relationship so here it's the reason"}, {"start": 3868.6, "end": 3873.48, "text": " this fit doesn't finish here is because there is not enough space on the GPU for"}, {"start": 3873.48, "end": 3879.48, "text": " that many student models but you can see that the relationship here is fairly"}, {"start": 3879.48, "end": 3885.6, "text": " monotonic here it's a bit of a kink so the first idea like this this is really"}, {"start": 3885.6, "end": 3889.52, "text": " astounding because these students have all been trained from that single"}, {"start": 3889.52, "end": 3893.64, "text": " teacher and they have been trained for as long as the teacher has been trained"}, {"start": 3893.64, "end": 3896.52, "text": " so they don't have more compute than a teacher they've been trained from"}, {"start": 3896.52, "end": 3902.08, "text": " scratch not from some checkpoint or from the teacher weights it's simple"}, {"start": 3902.08, "end": 3906.68, "text": " distillation from the teacher no labels and the students are all in parallel as"}, {"start": 3906.68, "end": 3910.44, "text": " well so they don't see different data or even different data augmentations it's"}, {"start": 3910.44, "end": 3915.0, "text": " the exact same order of the exact same data points going through all of the"}, {"start": 3915.0, "end": 3921.52, "text": " students the exact same learning rate schedule there's no noise and so on so"}, {"start": 3921.52, "end": 3925.96, "text": " the first thought that came to my mind like something fishy is going on here"}, {"start": 3925.96, "end": 3932.6, "text": " right like this this is this seems like to like come on there's no new"}, {"start": 3932.6, "end": 3938.84, "text": " information here so I thought hey I the teacher the teacher model I've just"}, {"start": 3938.84, "end": 3942.64, "text": " grabbed them from this from this repo from this pre-trained checkpoints and"}, {"start": 3942.64, "end": 3946.52, "text": " these pre-trained checkpoints they are you know the checkpoints that have"}, {"start": 3946.52, "end": 3952.2, "text": " performed best on the validation set so this is sort of a sneaky way of how we"}, {"start": 3952.2, "end": 3957.16, "text": " could train on the validation set right because we annotate each data point in"}, {"start": 3957.16, "end": 3960.72, "text": " the training data set with this checkpoint and the checkpoint has been"}, {"start": 3960.72, "end": 3965.92, "text": " selected for performing especially well on the validation data set it could"}, {"start": 3965.92, "end": 3971.52, "text": " explain why we get a gain on the validation data set so what I did is I"}, {"start": 3971.52, "end": 3977.56, "text": " retrained all of the teacher models such that I just retrained them for these"}, {"start": 3977.56, "end": 3983.36, "text": " 100 epochs and I just took the last checkpoint the all everything's the same"}, {"start": 3983.36, "end": 3987.84, "text": " the hyper parameters learning rate schedule and so on this is not tuned for"}, {"start": 3987.84, "end": 3991.92, "text": " any particular model and it's pretty like it's pretty standard it's like it's"}, {"start": 3991.92, "end": 4000.72, "text": " not like 0.12589 it's like 0.01 and 100 epochs or so fairly standard parameters"}, {"start": 4000.72, "end": 4005.12, "text": " and I took just took the last checkpoint to make it didn't even look at its"}, {"start": 4005.12, "end": 4009.68, "text": " performance to make sure that I didn't you know select something that was"}, {"start": 4009.68, "end": 4014.8799999999997, "text": " especially good on the validation data set and the results here you'll see are"}, {"start": 4014.8799999999997, "end": 4021.12, "text": " actually already the results of that run which the previous run it was almost the"}, {"start": 4021.12, "end": 4025.16, "text": " same like I was astounded how well it works and then I thought hey maybe I'm"}, {"start": 4025.16, "end": 4031.52, "text": " kind of you know cheating here so I redid it with the teachers that are not"}, {"start": 4031.52, "end": 4038.56, "text": " specifically selected and this is already the results so that's pretty"}, {"start": 4038.56, "end": 4045.6, "text": " cool right so then I wondered what happens if I now if I increase my"}, {"start": 4045.6, "end": 4049.7999999999997, "text": " training amount so I just let this run for more like what if I let the students"}, {"start": 4049.8, "end": 4056.36, "text": " run for more than the teacher has run again there's no new information here so"}, {"start": 4056.36, "end": 4061.1200000000003, "text": " you can see that the now the okay the green is now the teacher the blue is a"}, {"start": 4061.1200000000003, "end": 4068.0800000000004, "text": " hundred epochs and the orange is 250 epochs and you can see with that even"}, {"start": 4068.0800000000004, "end": 4075.28, "text": " one student will outperform the teacher but many students will outperform even"}, {"start": 4075.28, "end": 4079.6800000000003, "text": " more so if you give more compute there's lots of lots of headroom here to"}, {"start": 4079.68, "end": 4084.16, "text": " improve you'll see this here I think this last one with the blue line is just"}, {"start": 4084.16, "end": 4089.56, "text": " a bit of a weird a weird configuration I guess if you were to rerun that that"}, {"start": 4089.56, "end": 4096.72, "text": " would you know fall in line so this is pretty pretty weird right so I have a"}, {"start": 4096.72, "end": 4102.12, "text": " bunch of questions so first of all I've searched the literature a bit more and I"}, {"start": 4102.12, "end": 4106.32, "text": " came up with a number of papers that do things like this now usually when you do"}, {"start": 4106.32, "end": 4111.24, "text": " distillation you people stress the importance of like how to introduce"}, {"start": 4111.24, "end": 4117.759999999999, "text": " noise like in the noisy student paper or that you really need these data"}, {"start": 4117.759999999999, "end": 4124.44, "text": " augmentations or you know sim clear v2 uses the self distillation in order to"}, {"start": 4124.44, "end": 4129.639999999999, "text": " do in in order to label more data so they say it's important that we bring"}, {"start": 4129.639999999999, "end": 4135.96, "text": " more unlabeled data into the process and so on so all of this really doesn't"}, {"start": 4135.96, "end": 4140.44, "text": " match right here and especially this focus on we need noise during the"}, {"start": 4140.44, "end": 4144.88, "text": " distillation process to build these ensembles this is also you know if you"}, {"start": 4144.88, "end": 4149.68, "text": " know mean teacher things like this I also found a paper called born again"}, {"start": 4149.68, "end": 4154.72, "text": " neural networks that does something quite similar but not very simple not"}, {"start": 4154.72, "end": 4159.12, "text": " like the same where they distill a teacher to the student with the same"}, {"start": 4159.12, "end": 4165.44, "text": " architecture and then they distill the student again into another student and"}, {"start": 4165.44, "end": 4169.759999999999, "text": " then that into another student and so on and then at the end they say oh we can"}, {"start": 4169.759999999999, "end": 4174.5599999999995, "text": " also build an ensemble but sometimes their ensembles outperform their you"}, {"start": 4174.5599999999995, "end": 4179.36, "text": " know chain of distillation sometimes they don't they don't really focus on"}, {"start": 4179.36, "end": 4183.719999999999, "text": " that part a lot and it's way more complicated like you distill one student"}, {"start": 4183.719999999999, "end": 4189.04, "text": " after another and I also think they they have some introduction of variability in"}, {"start": 4189.04, "end": 4194.799999999999, "text": " the students like like noise or different augmentations and so on so"}, {"start": 4194.8, "end": 4202.52, "text": " this here seems you know really really really simple now I want to know this"}, {"start": 4202.52, "end": 4208.0, "text": " ensemble effect it seems pretty pretty weird right so what gives so the first"}, {"start": 4208.0, "end": 4214.56, "text": " thing we could do is we could say what what does how does this compare to an"}, {"start": 4214.56, "end": 4218.88, "text": " ensemble of teacher models like if you actually were to build an ensemble like"}, {"start": 4218.88, "end": 4224.6, "text": " train five teacher models on you know five five different teacher models"}, {"start": 4224.6, "end": 4230.64, "text": " it's still the same data but reasonably they might be able to learn something"}, {"start": 4230.64, "end": 4234.56, "text": " more from the data if we have five teacher models they might learn"}, {"start": 4234.56, "end": 4239.400000000001, "text": " different things from the data and therefore if we combine them they might"}, {"start": 4239.400000000001, "end": 4245.08, "text": " kind of overlap their knowledge and sort of catch where if one doesn't"}, {"start": 4245.08, "end": 4249.68, "text": " generalize in one data point the other four can overrule it whereas with these"}, {"start": 4249.68, "end": 4254.120000000001, "text": " student with these cell phone samples there's not really a way where we can"}, {"start": 4254.12, "end": 4258.64, "text": " learn more from data because we can only learn from the teacher and the teacher"}, {"start": 4258.64, "end": 4263.32, "text": " is fixed and has seen that much data right so how does this compare so wrote"}, {"start": 4263.32, "end": 4267.8, "text": " some rewrote some code is it's just plumbing and I release the code it's"}, {"start": 4267.8, "end": 4273.08, "text": " linked but it's just plumbing don't worry don't worry there is no great"}, {"start": 4273.08, "end": 4278.04, "text": " thoughts in there it's just plumbing such that my students don't are not all"}, {"start": 4278.04, "end": 4283.0, "text": " in parallel so the ensembles are not trained in parallel anymore I train each"}, {"start": 4283.0, "end": 4287.52, "text": " model individually which means that at maximum I have to have two models on the"}, {"start": 4287.52, "end": 4295.16, "text": " same GPU one teacher and one student so I make sure that the teachers they are"}, {"start": 4295.16, "end": 4299.8, "text": " trained from scratch and the students they're always trained from the same"}, {"start": 4299.8, "end": 4304.52, "text": " teacher right so the student ensembles will be exactly the same as we have them"}, {"start": 4304.52, "end": 4308.8, "text": " here that means one teacher is responsible for all the students but"}, {"start": 4308.8, "end": 4315.2, "text": " yeah so okay I'll just show you the results right here so if we look at"}, {"start": 4315.2, "end": 4321.84, "text": " those results you can see that and I've done it for a bunch of models right here"}, {"start": 4321.84, "end": 4326.2, "text": " the blue line is the ensemble of teachers and here on the x-axis you see"}, {"start": 4326.2, "end": 4330.9800000000005, "text": " the number of models and now since I'm not training everything on the same GPU"}, {"start": 4330.9800000000005, "end": 4337.56, "text": " but I recombine later that that basically means that I have doubt the"}, {"start": 4337.56, "end": 4342.4800000000005, "text": " ability to train up to ten models are actually however many I want and the"}, {"start": 4342.4800000000005, "end": 4348.780000000001, "text": " only real trick in the code is that when I evaluate one of these ensembles what I"}, {"start": 4348.780000000001, "end": 4354.4400000000005, "text": " do is I load a mini batch and then I basically load the first checkpoint run"}, {"start": 4354.4400000000005, "end": 4358.4400000000005, "text": " the forward pass load the second checkpoint run the forward pass load the"}, {"start": 4358.4400000000005, "end": 4361.56, "text": " third checkpoint run a forward pass I do this for all the checkpoints until I go"}, {"start": 4361.56, "end": 4365.400000000001, "text": " to the next mini batch but that's just for evaluating right it just seemed"}, {"start": 4365.4, "end": 4372.96, "text": " easiest with the code that I had so you can see right here that the there is a"}, {"start": 4372.96, "end": 4378.839999999999, "text": " significant like this is almost overlapping right here for most models"}, {"start": 4378.839999999999, "end": 4383.4, "text": " there sometimes the student wins sometimes the teacher wins so the"}, {"start": 4383.4, "end": 4389.28, "text": " teacher ensemble wins now remember the teachers are trained on you know ten"}, {"start": 4389.28, "end": 4393.839999999999, "text": " times as much data right here but it's always the same data but still they have"}, {"start": 4393.84, "end": 4397.76, "text": " the opportunity to learn ten times as much information from the data whereas"}, {"start": 4397.76, "end": 4402.360000000001, "text": " the students they're all distilled from that same teacher without any noise any"}, {"start": 4402.360000000001, "end": 4407.76, "text": " augmentate any augmentations except for the augmentations that you use during"}, {"start": 4407.76, "end": 4413.8, "text": " training anyway and I've done this for a hundred epochs and I've done this for"}, {"start": 4413.8, "end": 4418.56, "text": " two hundred and fifty is this already 250 I think that was a hundred I just"}, {"start": 4418.56, "end": 4425.88, "text": " put that there nope okay yeah that was a hundred epochs but you'll see the 250"}, {"start": 4425.88, "end": 4432.52, "text": " epoch plots they look very much the same okay they're just a bit better if you"}, {"start": 4432.52, "end": 4438.280000000001, "text": " train for 250 epochs now interestingly okay here's the interesting part about"}, {"start": 4438.280000000001, "end": 4447.240000000001, "text": " the 250 epochs the student is still distilled from a teacher model that has"}, {"start": 4447.24, "end": 4454.76, "text": " been trained for a hundred epochs so all of this all of this makes no sense to me"}, {"start": 4454.76, "end": 4459.88, "text": " right the student is still distilled from the hundred epoch teacher model yet"}, {"start": 4459.88, "end": 4466.48, "text": " if you train the student for 250 epochs in self distillation and then build an"}, {"start": 4466.48, "end": 4471.639999999999, "text": " ensemble of these students from that same teacher model and you compare that"}, {"start": 4471.64, "end": 4477.68, "text": " to an ensemble of teachers that have all been trained for longer for 250 epochs"}, {"start": 4477.68, "end": 4484.360000000001, "text": " which you know should out it the 250 epochs generally outperforms the"}, {"start": 4484.360000000001, "end": 4490.4800000000005, "text": " hundred epochs models still they are the same this is this is pretty crazy"}, {"start": 4490.4800000000005, "end": 4496.400000000001, "text": " results I I think and sort of my conclusion from this is that the"}, {"start": 4496.4, "end": 4503.16, "text": " ensemble effect right here is not a function of learning of extracting more"}, {"start": 4503.16, "end": 4508.799999999999, "text": " information from the data the ensemble effect might actually be have something"}, {"start": 4508.799999999999, "end": 4514.36, "text": " to do with the function landscape itself and kind of exploring different minima"}, {"start": 4514.36, "end": 4519.799999999999, "text": " of the of the same function not of the same function but exploring different"}, {"start": 4519.799999999999, "end": 4524.92, "text": " functions to describe the same phenomena and I've also found a paper that"}, {"start": 4524.92, "end": 4529.24, "text": " explains the lost landscape of deep ensembles and I will make a video on"}, {"start": 4529.24, "end": 4534.16, "text": " that maybe it's out already maybe it will be out after you see this one I I"}, {"start": 4534.16, "end": 4540.52, "text": " haven't decided yet which which order I'm going to release things but this"}, {"start": 4540.52, "end": 4545.56, "text": " here I it's it's pretty interesting and we need like a name so self self"}, {"start": 4545.56, "end": 4551.56, "text": " ensembles are already a thing but they are always with noise and stuff like"}, {"start": 4551.56, "end": 4556.56, "text": " this so let's call them something like plain self ensembles like that that"}, {"start": 4556.56, "end": 4562.68, "text": " that sounds like a good name plain self ensembles the act of self distillation a"}, {"start": 4562.68, "end": 4567.52, "text": " single model into multiple models without any noise any augmentations"}, {"start": 4567.52, "end": 4573.240000000001, "text": " anything just you run as if you were to train the model itself and then you"}, {"start": 4573.240000000001, "end": 4579.56, "text": " build an ensemble of these models by simply averaging the logits plain self"}, {"start": 4579.56, "end": 4585.88, "text": " ensembles alright so the plan from here is to check on like at least one other"}, {"start": 4585.88, "end": 4591.56, "text": " data set you know these these models I appreciate that I could get them"}, {"start": 4591.56, "end": 4597.56, "text": " pre-trained but they're just the image net models and then kind of let run on"}, {"start": 4597.56, "end": 4604.160000000001, "text": " c410 so there's no kind of guarantee that these have been you know tuned or"}, {"start": 4604.16, "end": 4609.76, "text": " anything that the learning rates or whatnot so I want to take like an image"}, {"start": 4609.76, "end": 4615.68, "text": " net model still make sure that I don't use any like hidden information where I"}, {"start": 4615.68, "end": 4621.5, "text": " could cheat on the validation set but try this on at least one thing and see"}, {"start": 4621.5, "end": 4627.24, "text": " if that works as well if we can sort of push image net performance simply by"}, {"start": 4627.24, "end": 4634.08, "text": " doing this trick so that's the plan for now and I have some other ideas but"}, {"start": 4634.08, "end": 4640.28, "text": " I just wanted to let you know and this is sort of how research works I guess"}, {"start": 4640.28, "end": 4647.4, "text": " you have a dumb idea and it turns out to work and then you go on and still"}, {"start": 4647.4, "end": 4652.04, "text": " probably probably there is not maybe too much interesting things here maybe it"}, {"start": 4652.04, "end": 4656.28, "text": " doesn't work on image net because these models are just under trained and this"}, {"start": 4656.28, "end": 4662.48, "text": " somehow made them better somehow or regularize them somehow that usually"}, {"start": 4662.48, "end": 4669.839999999999, "text": " doesn't work there's so much that can go wrong still so but yeah that was it and"}, {"start": 4669.839999999999, "end": 4675.719999999999, "text": " I invite you to like check out other papers in this space if you want it's a"}, {"start": 4675.719999999999, "end": 4684.32, "text": " pretty interesting space and with that I don't have much more to say yeah I hope"}, {"start": 4684.32, "end": 4689.4, "text": " you enjoyed this let me know what you think of like research implementation or"}, {"start": 4689.4, "end": 4694.759999999999, "text": " research process videos like this I'm not sure what people expect like I can't"}, {"start": 4694.759999999999, "end": 4700.04, "text": " make this into five-minute video of like whoo I discovered something because then"}, {"start": 4700.04, "end": 4706.12, "text": " you know there's no clue of what's what's happening but maybe like an hour"}, {"start": 4706.12, "end": 4711.48, "text": " or so is also too long I'm not sure yeah let me know what you think and I'll see"}, {"start": 4711.48, "end": 4724.919999999999, "text": " you next time bye"}]
Yannic Kilchner
https://www.youtube.com/watch?v=qFRfnIRMNlk
SpineNet: Learning Scale-Permuted Backbone for Recognition and Localization (Paper Explained)
#machinelearning #ai #google The high-level architecture of CNNs has not really changed over the years. We tend to build high-resolution low-dimensional layers first, followed by ever more coarse, but deep layers. This paper challenges this decades-old heuristic and uses neural architecture search to find an alternative, called SpineNet that employs multiple rounds of re-scaling and long-range skip connections. OUTLINE: 0:00 - Intro & Overview 1:00 - Problem Statement 2:30 - The Problem with Current Architectures 8:20 - Scale-Permuted Networks 11:40 - Neural Architecture Search 14:00 - Up- and Downsampling 19:10 - From ResNet to SpineNet 24:20 - Ablations 27:00 - My Idea: Attention Routing for CNNs 29:55 - More Experiments 34:45 - Conclusion & Comments Papers: https://arxiv.org/abs/1912.05027 Code: https://github.com/tensorflow/tpu/tree/master/models/official/detection Abstract: Convolutional neural networks typically encode an input image into a series of intermediate features with decreasing resolutions. While this structure is suited to classification tasks, it does not perform well for tasks requiring simultaneous recognition and localization (e.g., object detection). The encoder-decoder architectures are proposed to resolve this by applying a decoder network onto a backbone model designed for classification tasks. In this paper, we argue encoder-decoder architecture is ineffective in generating strong multi-scale features because of the scale-decreased backbone. We propose SpineNet, a backbone with scale-permuted intermediate features and cross-scale connections that is learned on an object detection task by Neural Architecture Search. Using similar building blocks, SpineNet models outperform ResNet-FPN models by ~3% AP at various scales while using 10-20% fewer FLOPs. In particular, SpineNet-190 achieves 52.5% AP with a MaskR-CNN detector and achieves 52.1% AP with a RetinaNet detector on COCO for a single model without test-time augmentation, significantly outperforms prior art of detectors. SpineNet can transfer to classification tasks, achieving 5% top-1 accuracy improvement on a challenging iNaturalist fine-grained dataset. Code is at: this https URL. Authors: Xianzhi Du, Tsung-Yi Lin, Pengchong Jin, Golnaz Ghiasi, Mingxing Tan, Yin Cui, Quoc V. Le, Xiaodan Song Thumbnail art by Lucas Ferreira Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we'll look at SpineNet learning scale permuted backbone for recognition and localization by Xianze Du et al of Google Research. On a high level, this paper proposes to take current recognition and localization networks which have a CNN backbone, usually something like a ResNet, and switch up the order of the blocks in the ResNet and cross connect them in a different way, such that they reach a higher accuracy with the new network that has the same amount of parameters or almost the same amount of parameters. They then further modify this network such that it reaches that higher accuracy with less compute than the original network. So if you want to know how it's done, you know, stick around. You can help me by sharing out this video if you liked it. If you didn't like it, leave a comment and tell me what you didn't like. Otherwise, I have no chance of improving. So that's the deal. Okay, cool. So the task here is a recognition and localization, as you can see here, which basically means that you have an image and there's stuff on the image. Maybe there's a cat right here. And maybe there is some kind of a house right here. And the task, these tasks come in various forms. But some of the tasks are to say what's on the image. So in this case, cat and house. And also, where is it? Now, this could be a point, this could be a bounding box, or this could actually be a pixel segmentation. All of this sort of tasks exists in various forms. What usually is done in these tasks is you want to go in some way through a neural network, and the neural network will output the same image again, or the same shape. So it will output a image that is of the same shape that if this is your input image, I'm going to, I'm just going to quickly redraw without the labels. If this is your input image, then the output image, let's say we're doing bounding boxes, the output would say something like, here are bounding boxes. And also the output would be cat and house. So these are the two outputs that the neural network would generate. This is some sort of a convolutional neural network because they deal with images fairly well. Now, usually, when we do image processing, and we know this from, for example, image classification. So if we just have image classification, just to classify here, if we just want the outputs cat or house, or even just one single thing, like an image net, our convolutional neural networks have a particular architecture, namely, what we do is we have the first convolutional neural net, the first layers will take the image and run these convolutional filters across them, which gives you the same shape image back. But then, with time, we scale it down, we have a max pooling or a convolution with stride two, so that the image is only this big anymore. And then we have a bunch of further layers, and then we scale it down again, and so on. Now, as we scale it down, the number of channels goes up, of course, at the beginning, you have three channels for the three colors. But then after the first convolution, you might have whatever 32 channels right here, this is no longer the original image, this now is, of course, for each pixel, you have a stack of features, right, you have a stack of features right here, because that's what your convolutional layer does. And then when you scale it down, you have even more feature maps. So we tend to scale down the resolution of our feature maps. But we tend to increase the number of feature maps right here. The reasoning behind this is, if you look at these bounding boxes, they, they don't really so not enough, sorry, if you look at the labels right here, the fact that there's a cat on the image shouldn't depend on the exact pixel location of the cat, right. So even if I scale this down a bit, I'll still recognize that there's a cat somewhere, it can still aggregate that information. In fact, I could deal with a single, right, I could deal with scaling this down successively, up to a single pixel. And that's ultimately what an image classifier does. You simply have a single vector at the end with the features in it. And from that you classify. So the reasoning is that as you go through the network, you pick up the low level features first, like here, you pick up the edges and the kind of low level shapes. As you go higher through the network, your features become more abstract, but less localized, which means that it's less important where they are. And that's why you look at this image through a coarser and coarser segmentation. And at the end, your segmentation might be something like this. Okay, so we we have had a lot of success building image classifiers with this reasoning. And this is sort of a human heuristic that just hasn't worked well. Now, when we do something like this, bounding box classification, or even per pixel classification, all of a sudden, it is very important where the things are, right, it is very important that it's this pixel and this pixel and this pixel and this pixel forming the bounding box. Because the more accurate you are, the better your bounding box classifier, you still have this right here, this recognition, but the localization part, we can't just scale down anymore, because we need to output something that's of the same size. So what people have done is they've gone from this kind of from architecture that scales down, because we know that works well, we know the downscaling works well. So we take that, and then we scale up again. And there is some reasoning behind this, right? So that's what we can do. Because we know this part works very well for extracting high level features that are not that localized. So our reasoning is going to be something like, okay, we'll force the network through this kind of bottleneck right here, we'll force it to learn some high level features. Because otherwise, you can just, you know, kind of remember the individual pixels, and that won't work as well, we'll force it to remember the high level, we'll force it to remember what a cat is. And then it will help in the pixel segmentation to know what a cat is. This is very valid assumption, but it doesn't need to be the case. And so there's one additional thing that these networks usually do is that they have like some skip connections here from the layers that are of the same size to the layers that are of the same size right here to here, in order to kind of recover these high level features. Because if you only look at an image through the lens of this right here, and you're you have to segment the ear of the cat, you know, you can only either color an entire pixel or not. So you want to gain back some of that some of those high level features. And that's what you do with skip connections. And that's why these networks usually look like this. Now, in this work, the authors sort of criticize this, they say, why, why are we doing it like this? Isn't there a better way to do it? Specifically, we want to look at this part right here, which is called the backbone. So we assume that we have these these output layers that give you at different scales, different features. And what we have to do is we have to construct a backbone that somehow feeds features either, you know, through this direct way or through these connections right here, and feeds features to this, these ultimate classifiers. So these classifiers will then be used to classify the bounding boxes and classify the output classes for recognition and localization. This is an illustration of this. On the left, you see a typical backbone. And they call this a scale decreased network. So an example of scale decreased network on the left versus a scale permuted network on the right, the width of the block indicates feature resolution, and the height indicates feature dimension, dotted arrows represent connections from two blocks not plotted. Okay, so on the left, you have the typical architecture, you see that the the width, so this is the resolution is very high. And as you go through the layers, that resolution gets smaller and smaller and smaller. But the number of features indicated by the height gets higher and higher and higher as you go through. This is your typical architecture, we are looking into, let's say that this is not the only one, what we can do is we can build any sort of backbone. And here they restrict themselves, they say, okay, in order to make it comparable, in order to be, you know, scientifically a bit more rigorous than just building anything, what we restrict ourselves are simply permutations of this. So we only allow us to permute these things. So all the, you know, this goes here, and this goes here, as you see, and that ensures that you still have roughly the same amount of parameters. Now, there is a sort of a parameter difference, because these connections here, you need to up and down sample the images. And sometimes that introduces parameters. But in essence, you have the rough same amount of parameters. And then you can really research what can we improve a network simply by rearranging its blocks, because that would give evidence that this scaling down architecture isn't really the best one. Okay, so here, you can see an example of this. This is what they call a scale permuted network. Sorry, this scale permuted network right here. So in a scale permuted network, what you're allowed to do is you're allowed you have these blocks on the left, and you're allowed to put them anywhere you want in in any in any sort of I don't want to say order, but yes, in any sort of order. Yes, it's an order actually. So it goes from here down it this is 12345. Any block for any block you first place you first place this block, you're allowed to connect it to any other block before it. Now here we don't see but you can see there's two incoming connections right here. So we make use of more than one connection on the left, you see there's always one connection between the blocks. And on the right, you see, we allow up to two blocks to connect to a given block. Okay, then you're done with this block, you place the next block this one here. Also, you're allowed to have two incoming connections, this one here, and this one here. And you place the next block and so on. Now how you make this you also see that there doesn't need to be like a straight linear path, because there is no connection right here, if you can see that. So you might be wondering, how do I decide which block goes where? And how do I decide on which connections connect where? And that is going to be the idea here to use neural architecture search. So neural architecture search, right now is still a fancy way of saying, let's try stuff out. And so what you'll do is you will initialize a reinforcement learning controller that decides on the ordering and on the connections. And it has some action space, and you basically let it run. So it, it, you know, proposes a couple of architectures. And, and then you measure all of them, you train all of these architectures and you see how well they fare. And then you go back to the controller, that's the reward signal. And so we can draw so you have an agent, which builds the building plan. So the agent in the agent will emit as an action, a building plan, like big, small, big, small, big with connections like this, and like this, and like this. And then that will go to the environment, the environment here simply takes the architecture and trains, train the architecture. And then the, let's say the eval loss or the validation loss, the validation accuracy is equal is going to be your reward signal. So you simply train a reinforcement learning agent to solve this particular problem, which is training this in recognition and localization on the particular data set, as well as possible to basically come up with the best architecture, which, you know, it's, it's fancy, and it's a bit better than trying everything out. But it's not much better right now. And it takes a lot of compute to run these experiments, because it takes a lot of iterations of this. And every iteration consists of training one of these networks fully once, and you can do something with like early stopping and stuff. But so you get the idea. This is what they what they propose. And this is, you know, how they get better. So there are a number of challenges in this. Namely, we've, we said, okay, when you input a signal, for example, when you input a signal from this layer to this layer, you can see that you have to shrink the resolution, and you have to up the number of features. And this was already sort of solved in the resonant original resonant paper, but they reiterate how they do this here. Basically, you have, you have this layer, and it is connected to these two layers, we said every layer can receive inputs from two layers, you see, at the very end, these are just added together. Okay, so we have two things. First of all, the number of features is different, you can see right over here, the number of features, the number of channels is different than the number of channels in the output image, let's say, right here. So those are different. And in fact, they're different in both inputs. And we have this method of one by one convolutions that was introduced in the original resonant paper. If we do one by one convolutions, it's basically a learned transformation from a number of input channels to a number of output channels without chain without doing any actual convolution operation. This is simply linear operation, upscaling or up, up, upping the number of feature maps, you can see these one by one convolutions are employed here in various ways. So because this is fairly compute intensive, or so they claim, what they do first is they always first, go to less features. So here we have a number of features, which is maybe, let's say this is f or sorry, this is c zero. You can see very small here, maybe that there is this first we go to alpha times c zero and alpha is I think in the default setting, it's one half. So first, we always go to one half the number of features. Before we do this switch here, and then we have two options, either. So you go to one half the features and at the end, you go to the number of target features. So it could be if the target features are more than you currently have, it could be that you first go to less features. And then you go to even more features, right? As if you the current one has more features than the end, it's probably not as bad because you first go to less features and to even less features. This is probably one of the things they did to save computation. But which you can imagine that it hurts because here you simply have to you have to basically throw away half the features or you have to like linearly combine them in every step where you connect two layers to each other. Okay, so there's two situations. First situation, your current resolution here is higher than the target resolution. In that case, we can simply do a convolution with a bigger stride than one, right? If you have an image and you do a convolution, usually you have this overlapping convolution, such that the result is the same size as you started with. But you can also do a bigger stride. And I'm a bit overdrawing this here. But you can do a bigger stride such that the final resolution is smaller. And you can also do this max pooling right here. So the max pooling is also a way to reduce the number of of the resolution of the image. So if we're bigger, we can do that. If we are currently smaller than the target, what we can do is we can up sample and up sample you can do by doing nearest neighbor or things like this. We can also do a learned up sample. There are various ways I believe here they do a nearest neighbor. But I'm not sure anymore. Actually. Let's check it out. That's here somewhere. resampling and cross scale connections, yada yada yada yada yada yada yada. It's important to keep the computational resampling low, we introduce a scaling factor alpha, we had that, then we use a nearest neighbor interpolation for up sampling, or a stripe to three by three convolution. Okay, so it's nearest neighbor by up sampling. All right. So that's, that's how they up and down sample the feature maps to the correct shapes, either using nearest neighbor up sampling, or using multi stride convolution followed by max pooling. So what does that give them? Now, they do several different steps in this. So the first architecture, this resnet 50 is the original architecture. And remember, we're only talking about the backbone right here. Now in the original resnet 50 architecture, we have this resnet 50, FPN. And this FPN is these are called the output layers. This is what then goes and classifies the bounding boxes and the labels and so on. Now, here you can see the resnet 50 is continuously getting smaller and more features. They do an intermediate step. So this, this right here is their final thing where they let this let this algorithm go wild. And you can see that it's pretty, pretty fuzzy. So this RL controller finds this architecture to be the best architecture. And you can see it's continuously down and up and down and sorry, and up and down. And there's considerable cross connections between all of these things. And then here you have the you have the different output layers built into the network rather than next to the network, right. So these are the ones that are now the red border ones are now the features that are used for going in classifying. As an intermediate step, they also consider this architecture, where they basically built a smaller resnet right here, and then let the algorithm decide on the rest right here. So it still has the same amount of parameters roughly, but they can investigate what happens if we go to these to this lower if we have this structure at the beginning, but then part of it we can do with our algorithm. And lastly, they also consider this architecture. Now this architecture, again, their algorithm has control over the whole network. But there is an additional thing that the algorithm can do the algorithm can also decide to change the number of features and to change the type of block. So here you can see these are all residual blocks. And these are these called bottleneck blocks, they're simply a different way of of doing a residual block, it wasn't introduced in the original resnet paper. But the controller can simply switch to that. And that can save some computation if you go through these bottleneck blocks. So what does that give you, you can see below that the resnet 50 is at 37.8% average precision. If you liberate the top part to leave it to the algorithm, it's at 39. If you liberate the entire network, it's at 40.7. And remember, these are like roughly the same amount of parameters. And then if you if you also let the network control a bit of the feature size and the type of block, you get a 40.8, which is the same as before. But now this one, I believe has about Oh, yeah, here we go with 10% fewer flops. Okay, so that's, that's pretty cool. Though, remember that the left thing this is this is made by humans, this is just our heuristic. And the right things they are made by RL. And they are no for these particular data sets, though they do find that generally this also transfers to ImageNet classification. But still, this is sort of a, it works well for the type of data we work with, and so on. So I don't know how much I would trust it how far we should go of building SpineNet 49 as our new backbone for every image task that we have. It remains to be seen, I believe. Before actually, we go to the experiments before we go to the experiments, I want to state my idea right here. So you get the general gist here. And so another kind of coral I have with this is that, you know, in here, you always have these single connections. And here you always have these these double connections. And I've looked through the experiment, it seems like nowhere do they ablate or anything what what it means to only have single connections, or if they so if they let the ResNet run with double connections, so if their controller could not switch the order, but only introduce the connections, they might have done this, they have a lot of experiments where they do the different ablations. So I would be interested what happens when you let it run on the ResNet, but let it have two connections per per layer. Is it then better or not? So here the importance, I'll get to my idea later. The importance of scale permutation, that's where they investigate how important is it that you permute the layers and that turns out to be fairly important. Then the importance of cross scale connections. That's how they investigate here. So these are these connections, they say, the cross scale connections play a crucial role in fusing features at different resolutions throughout the scale permuted network. So that's the reasoning behind it. We we take features from different kinds of resolutions, and we can also scale up again and then scale down again, to gain some additional features from the from the higher resolutions. We study it's important by graph damage. So either they remove the short term connections, or they remove the long range connections, or they remove both and then connect one block to the previous block via a sequential connection. So this is only this is only in the things that they learned, right. So this model is where they fully give their model control over the ordering and connections, you can see that as this 40.7%. Now, if they delete the short range connections, they drop to 35. If they delete the only the long range, they drop to even more. So here, you can see that these long range connections, which I guess are connections that are going across multiple blocks, skipping multiple blocks, these tend to be very important. So you can make the case that it might be very important to fuse these things from different layers to fuse the features from different resolutions, because these long range connections tend to be important, though, it's one thing to say that if we just leave them away with our model, if we just damage it and then let it run, it it it drops in accuracy. It's not entirely the same thing as to say that these are important because you don't really know what happens like if you train without them, maybe you could if you train without them, you could reach as good an accuracy. So this graph damage investigation, it has something but not I wouldn't trust it too much. And yeah, I think they haven't investigated what happens if they keep the ResNet order but let the connections be twice. But you get the general the general idea of the paper right here of what they do. Now, they do this with architecture search right here. But here's an idea. Okay, I propose the following, you have an image right here. And we are wondering here, should we let it go through a layer that's wide and with less features? Should we let it go through a layer that's, you know, very many features, but not as wide. But we have to downscale the image? Or should we let it go first through something intermediate? Let's see it like this. Okay, so we're wondering, how should we order these blocks? Why can't we do all of at the same time? Why can't we do this, this and this? Okay. And then in the next layer, again, do all of them at the same time. And you, you can already see where this is going, I hope, I hope you can see where this is going. So you have a routing right here. And how do we do routing in modern times in deep learning with attention? So I propose you have layers with different attention. Let's say these are these are now your sequences or you can also make them as attention heads. Okay, these are your these and the lower level features are routed to the higher level features with an attention mechanism. And you do this layer by layer by layer. So you let because what's the problem here? The problem here is that the same data point has to go, you know, you find these good connections, but the all the data points have to go through the same connections. And it might actually be that you need different routing depending on the data point, it might be that what this is, this is good for the average data point, but it will be much better if whenever there's a cat, you take one path, and whenever there's a dog, you take a different path. So this will allow for that, you basically have the routing parameterized by an attention mechanism. This I have no clue how much compute this would take. It doesn't seem that outrageous. Because what's your sequence length here, your sequence length is going to be the number of layers maybe and maybe times the number of feature maps, maybe have different attention heads. So you maybe want to replicate some of those here. But ultimately, I would guess the attention mechanism itself isn't that much of an overhead. Maybe it's an overhead that you have so many in parallel. Yeah, but you know, it remains to be seen. That's, that's the idea. Yeah, you heard it here first. Okay, so they have more experiments. So they also build here is where they say, Okay, we have the spine net 49. Now and we found this to work. We found this to work really well. This is our spine net 49 architecture. Cool. And you want to make it bigger. But I guess they didn't have the computational resources to run the neural architecture search for bigger networks. This is now as about as big as a resonant 50. Right. But what if you want to go to resonant 100 or resonant 150? There you you don't have the computational resources do neural architectures. Imagine this Google hasn't doesn't have the computational resources to do neural architecture search on this thing. So this must be expensive, or I'm just, I have no idea. But what they do is they kind of do a trick. So here they take the the spine net 49. And they say we build a spine net 6096 by simply repeating each block twice. So all the incoming connections would go to the first block, and all the outgoing connections would come from the second block right here, you had two in and maybe there's actually no limit to how many outgoing connections you can have. And also, you can also do this three times, which I think is a bit of a cheap way. And it kind of defeats the entire purpose, right? Couldn't you make the exact same argument again here that maybe it's helpful to route from this block right here? Or maybe it's helpful that these don't have the same scale, right after one another. It just seems, but okay, so they say we found this good structure and we simply duplicate each block. I'm not that big of a fan, in any case. So they train this and it of course outperforms everything else. If you compare with kind of models of the same size. So here you compare this spine net 49 to the resnet 50. And you can see there's about the same number of parameters, how about it outperforms the resnet 50, pretty much. And as you go up the number of parameters here, the performance goes up yet again. And I believe these dagger ones here are simply trained with a special schedule with here with applying stochastic depth and swish activation for a longer training schedule. So you can see that not only do are the spine nets, sorry, the number of parameters is here. Not only are the spine nets slightly smaller than the resnets, they do require less flops. And they reach better accuracy. So you know, every everything is a win here. Yeah, so they apply this to these data sets, I don't want to go too much into into that. But in the last part, they also apply this to image net. So there's image classification, where they basically say, Okay, we can just go to our architecture and we can just add up all the output blocks, we scale them appropriately, and add up all the output blocks right here, because these are good features for localization and so on. And we can train it to do image classification. So all of these go into a big combination classifier that does the 1000 classes of image net image classification. And that also works pretty well with this network. So they basically argue what they found is sort of a better image image processing network than the resnet 50. And I guess they would argue that from now on, you should take this as your backbone for image classification and recognition and so on, which is entirely possible that this works better. There's no particular reason why the resnet 50 should work at all, right? It's just a heuristic. But I guess it remains to be to be seen, whether that's generally true or just in the things they considered. So you can see right here, the spine net generally improving over the image net, which is not stated right here, but it does generally improve. And you can see, as you go higher and higher spine net, the numbers tend to improve as well. And this is already pretty respectable, respectable number for image net, right? All right. So this was it for this paper for this particular paper. They do have, you know, two different of these object detection recognition data sets. And I invite you to check out the experiments more closely. If you're interested in that sort of thing, I was mainly interested in the method of doing and arranging these layers and so on. It seems like it's a cool engineering project, cool investigative project, the experiments are done well. And in the end, they reach a better, you know, they achieve, they get a better model out of that. And if it turns out that this model is a good model, the entire community will be better off. Unfortunately, there's no broader impact statement to tell us that also the terrorists will be able to use this for purposes. But you can imagine that yourself. All right, that was it for me. Again, leave a comment if you want me to change anything or have suggestions. Leave a like if you liked the video, share it out. Bye bye.
[{"start": 0.0, "end": 6.140000000000001, "text": " Hi there, today we'll look at SpineNet learning scale permuted backbone for recognition and"}, {"start": 6.140000000000001, "end": 12.76, "text": " localization by Xianze Du et al of Google Research. On a high level, this paper proposes"}, {"start": 12.76, "end": 19.18, "text": " to take current recognition and localization networks which have a CNN backbone, usually"}, {"start": 19.18, "end": 25.400000000000002, "text": " something like a ResNet, and switch up the order of the blocks in the ResNet and cross"}, {"start": 25.4, "end": 31.04, "text": " connect them in a different way, such that they reach a higher accuracy with the new"}, {"start": 31.04, "end": 35.9, "text": " network that has the same amount of parameters or almost the same amount of parameters. They"}, {"start": 35.9, "end": 41.04, "text": " then further modify this network such that it reaches that higher accuracy with less"}, {"start": 41.04, "end": 46.72, "text": " compute than the original network. So if you want to know how it's done, you know, stick"}, {"start": 46.72, "end": 53.04, "text": " around. You can help me by sharing out this video if you liked it. If you didn't like"}, {"start": 53.04, "end": 58.86, "text": " it, leave a comment and tell me what you didn't like. Otherwise, I have no chance of improving."}, {"start": 58.86, "end": 66.52, "text": " So that's the deal. Okay, cool. So the task here is a recognition and localization, as"}, {"start": 66.52, "end": 71.52, "text": " you can see here, which basically means that you have an image and there's stuff on the"}, {"start": 71.52, "end": 77.36, "text": " image. Maybe there's a cat right here. And maybe there is some kind of a house right"}, {"start": 77.36, "end": 85.4, "text": " here. And the task, these tasks come in various forms. But some of the tasks are to say what's"}, {"start": 85.4, "end": 92.78, "text": " on the image. So in this case, cat and house. And also, where is it? Now, this could be"}, {"start": 92.78, "end": 98.52, "text": " a point, this could be a bounding box, or this could actually be a pixel segmentation."}, {"start": 98.52, "end": 106.16, "text": " All of this sort of tasks exists in various forms. What usually is done in these tasks"}, {"start": 106.16, "end": 113.72, "text": " is you want to go in some way through a neural network, and the neural network will output"}, {"start": 113.72, "end": 119.6, "text": " the same image again, or the same shape. So it will output a image that is of the same"}, {"start": 119.6, "end": 125.72, "text": " shape that if this is your input image, I'm going to, I'm just going to quickly redraw"}, {"start": 125.72, "end": 130.84, "text": " without the labels. If this is your input image, then the output image, let's say we're"}, {"start": 130.84, "end": 136.96, "text": " doing bounding boxes, the output would say something like, here are bounding boxes. And"}, {"start": 136.96, "end": 145.24, "text": " also the output would be cat and house. So these are the two outputs that the neural"}, {"start": 145.24, "end": 149.6, "text": " network would generate. This is some sort of a convolutional neural network because"}, {"start": 149.6, "end": 156.76, "text": " they deal with images fairly well. Now, usually, when we do image processing, and we know this"}, {"start": 156.76, "end": 162.04, "text": " from, for example, image classification. So if we just have image classification, just"}, {"start": 162.04, "end": 169.12, "text": " to classify here, if we just want the outputs cat or house, or even just one single thing,"}, {"start": 169.12, "end": 175.23999999999998, "text": " like an image net, our convolutional neural networks have a particular architecture, namely,"}, {"start": 175.23999999999998, "end": 181.04, "text": " what we do is we have the first convolutional neural net, the first layers will take the"}, {"start": 181.04, "end": 189.32, "text": " image and run these convolutional filters across them, which gives you the same shape"}, {"start": 189.32, "end": 195.23999999999998, "text": " image back. But then, with time, we scale it down, we have a max pooling or a convolution"}, {"start": 195.23999999999998, "end": 201.68, "text": " with stride two, so that the image is only this big anymore. And then we have a bunch"}, {"start": 201.68, "end": 207.88, "text": " of further layers, and then we scale it down again, and so on. Now, as we scale it down,"}, {"start": 207.88, "end": 211.2, "text": " the number of channels goes up, of course, at the beginning, you have three channels"}, {"start": 211.2, "end": 216.18, "text": " for the three colors. But then after the first convolution, you might have whatever 32 channels"}, {"start": 216.18, "end": 222.0, "text": " right here, this is no longer the original image, this now is, of course, for each pixel,"}, {"start": 222.0, "end": 229.56, "text": " you have a stack of features, right, you have a stack of features right here, because that's"}, {"start": 229.56, "end": 234.92, "text": " what your convolutional layer does. And then when you scale it down, you have even more"}, {"start": 234.92, "end": 241.44, "text": " feature maps. So we tend to scale down the resolution of our feature maps. But we tend"}, {"start": 241.44, "end": 247.6, "text": " to increase the number of feature maps right here. The reasoning behind this is, if you"}, {"start": 247.6, "end": 253.35999999999999, "text": " look at these bounding boxes, they, they don't really so not enough, sorry, if you look at"}, {"start": 253.35999999999999, "end": 258.8, "text": " the labels right here, the fact that there's a cat on the image shouldn't depend on the"}, {"start": 258.8, "end": 264.4, "text": " exact pixel location of the cat, right. So even if I scale this down a bit, I'll still"}, {"start": 264.4, "end": 269.44, "text": " recognize that there's a cat somewhere, it can still aggregate that information. In fact,"}, {"start": 269.44, "end": 274.64, "text": " I could deal with a single, right, I could deal with scaling this down successively,"}, {"start": 274.64, "end": 279.76, "text": " up to a single pixel. And that's ultimately what an image classifier does. You simply"}, {"start": 279.76, "end": 285.88, "text": " have a single vector at the end with the features in it. And from that you classify. So the"}, {"start": 285.88, "end": 291.96, "text": " reasoning is that as you go through the network, you pick up the low level features first,"}, {"start": 291.96, "end": 298.91999999999996, "text": " like here, you pick up the edges and the kind of low level shapes. As you go higher through"}, {"start": 298.91999999999996, "end": 304.91999999999996, "text": " the network, your features become more abstract, but less localized, which means that it's"}, {"start": 304.91999999999996, "end": 310.38, "text": " less important where they are. And that's why you look at this image through a coarser"}, {"start": 310.38, "end": 315.02, "text": " and coarser segmentation. And at the end, your segmentation might be something like"}, {"start": 315.02, "end": 323.28, "text": " this. Okay, so we we have had a lot of success building image classifiers with this reasoning."}, {"start": 323.28, "end": 330.32, "text": " And this is sort of a human heuristic that just hasn't worked well. Now, when we do something"}, {"start": 330.32, "end": 336.59999999999997, "text": " like this, bounding box classification, or even per pixel classification, all of a sudden,"}, {"start": 336.59999999999997, "end": 341.71999999999997, "text": " it is very important where the things are, right, it is very important that it's this"}, {"start": 341.72, "end": 345.84000000000003, "text": " pixel and this pixel and this pixel and this pixel forming the bounding box. Because the"}, {"start": 345.84000000000003, "end": 350.6, "text": " more accurate you are, the better your bounding box classifier, you still have this right"}, {"start": 350.6, "end": 356.6, "text": " here, this recognition, but the localization part, we can't just scale down anymore, because"}, {"start": 356.6, "end": 361.72, "text": " we need to output something that's of the same size. So what people have done is they've"}, {"start": 361.72, "end": 368.26000000000005, "text": " gone from this kind of from architecture that scales down, because we know that works well,"}, {"start": 368.26, "end": 375.76, "text": " we know the downscaling works well. So we take that, and then we scale up again. And"}, {"start": 375.76, "end": 380.71999999999997, "text": " there is some reasoning behind this, right? So that's what we can do. Because we know"}, {"start": 380.71999999999997, "end": 386.58, "text": " this part works very well for extracting high level features that are not that localized."}, {"start": 386.58, "end": 390.9, "text": " So our reasoning is going to be something like, okay, we'll force the network through"}, {"start": 390.9, "end": 396.84, "text": " this kind of bottleneck right here, we'll force it to learn some high level features."}, {"start": 396.84, "end": 400.59999999999997, "text": " Because otherwise, you can just, you know, kind of remember the individual pixels, and"}, {"start": 400.59999999999997, "end": 404.59999999999997, "text": " that won't work as well, we'll force it to remember the high level, we'll force it to"}, {"start": 404.59999999999997, "end": 411.91999999999996, "text": " remember what a cat is. And then it will help in the pixel segmentation to know what a cat"}, {"start": 411.91999999999996, "end": 419.76, "text": " is. This is very valid assumption, but it doesn't need to be the case. And so there's"}, {"start": 419.76, "end": 424.44, "text": " one additional thing that these networks usually do is that they have like some skip connections"}, {"start": 424.44, "end": 428.94, "text": " here from the layers that are of the same size to the layers that are of the same size"}, {"start": 428.94, "end": 434.04, "text": " right here to here, in order to kind of recover these high level features. Because if you"}, {"start": 434.04, "end": 439.92, "text": " only look at an image through the lens of this right here, and you're you have to segment"}, {"start": 439.92, "end": 446.0, "text": " the ear of the cat, you know, you can only either color an entire pixel or not. So you"}, {"start": 446.0, "end": 450.08, "text": " want to gain back some of that some of those high level features. And that's what you do"}, {"start": 450.08, "end": 456.15999999999997, "text": " with skip connections. And that's why these networks usually look like this. Now, in this"}, {"start": 456.15999999999997, "end": 462.0, "text": " work, the authors sort of criticize this, they say, why, why are we doing it like this?"}, {"start": 462.0, "end": 467.88, "text": " Isn't there a better way to do it? Specifically, we want to look at this part right here, which"}, {"start": 467.88, "end": 473.65999999999997, "text": " is called the backbone. So we assume that we have these these output layers that give"}, {"start": 473.65999999999997, "end": 479.71999999999997, "text": " you at different scales, different features. And what we have to do is we have to construct"}, {"start": 479.72, "end": 485.56, "text": " a backbone that somehow feeds features either, you know, through this direct way or through"}, {"start": 485.56, "end": 492.46000000000004, "text": " these connections right here, and feeds features to this, these ultimate classifiers. So these"}, {"start": 492.46000000000004, "end": 498.98, "text": " classifiers will then be used to classify the bounding boxes and classify the output"}, {"start": 498.98, "end": 506.56, "text": " classes for recognition and localization. This is an illustration of this. On the left,"}, {"start": 506.56, "end": 513.74, "text": " you see a typical backbone. And they call this a scale decreased network. So an example"}, {"start": 513.74, "end": 519.68, "text": " of scale decreased network on the left versus a scale permuted network on the right, the"}, {"start": 519.68, "end": 525.04, "text": " width of the block indicates feature resolution, and the height indicates feature dimension,"}, {"start": 525.04, "end": 529.6, "text": " dotted arrows represent connections from two blocks not plotted. Okay, so on the left,"}, {"start": 529.6, "end": 536.6800000000001, "text": " you have the typical architecture, you see that the the width, so this is the resolution"}, {"start": 536.6800000000001, "end": 542.0400000000001, "text": " is very high. And as you go through the layers, that resolution gets smaller and smaller and"}, {"start": 542.0400000000001, "end": 548.28, "text": " smaller. But the number of features indicated by the height gets higher and higher and higher"}, {"start": 548.28, "end": 554.36, "text": " as you go through. This is your typical architecture, we are looking into, let's say that this is"}, {"start": 554.36, "end": 559.52, "text": " not the only one, what we can do is we can build any sort of backbone. And here they"}, {"start": 559.52, "end": 565.48, "text": " restrict themselves, they say, okay, in order to make it comparable, in order to be, you"}, {"start": 565.48, "end": 571.36, "text": " know, scientifically a bit more rigorous than just building anything, what we restrict ourselves"}, {"start": 571.36, "end": 579.24, "text": " are simply permutations of this. So we only allow us to permute these things. So all the,"}, {"start": 579.24, "end": 585.3, "text": " you know, this goes here, and this goes here, as you see, and that ensures that you still"}, {"start": 585.3, "end": 590.04, "text": " have roughly the same amount of parameters. Now, there is a sort of a parameter difference,"}, {"start": 590.04, "end": 595.04, "text": " because these connections here, you need to up and down sample the images. And sometimes"}, {"start": 595.04, "end": 602.6800000000001, "text": " that introduces parameters. But in essence, you have the rough same amount of parameters."}, {"start": 602.6800000000001, "end": 608.76, "text": " And then you can really research what can we improve a network simply by rearranging"}, {"start": 608.76, "end": 614.24, "text": " its blocks, because that would give evidence that this scaling down architecture isn't"}, {"start": 614.24, "end": 620.04, "text": " really the best one. Okay, so here, you can see an example of this. This is what they"}, {"start": 620.04, "end": 627.7, "text": " call a scale permuted network. Sorry, this scale permuted network right here. So in a"}, {"start": 627.7, "end": 633.2, "text": " scale permuted network, what you're allowed to do is you're allowed you have these blocks"}, {"start": 633.2, "end": 639.1600000000001, "text": " on the left, and you're allowed to put them anywhere you want in in any in any sort of"}, {"start": 639.1600000000001, "end": 644.6, "text": " I don't want to say order, but yes, in any sort of order. Yes, it's an order actually."}, {"start": 644.6, "end": 653.6400000000001, "text": " So it goes from here down it this is 12345. Any block for any block you first place you"}, {"start": 653.6400000000001, "end": 660.4000000000001, "text": " first place this block, you're allowed to connect it to any other block before it. Now"}, {"start": 660.4, "end": 665.1999999999999, "text": " here we don't see but you can see there's two incoming connections right here. So we"}, {"start": 665.1999999999999, "end": 669.3, "text": " make use of more than one connection on the left, you see there's always one connection"}, {"start": 669.3, "end": 675.92, "text": " between the blocks. And on the right, you see, we allow up to two blocks to connect"}, {"start": 675.92, "end": 683.76, "text": " to a given block. Okay, then you're done with this block, you place the next block this"}, {"start": 683.76, "end": 689.0799999999999, "text": " one here. Also, you're allowed to have two incoming connections, this one here, and this"}, {"start": 689.08, "end": 695.1600000000001, "text": " one here. And you place the next block and so on. Now how you make this you also see"}, {"start": 695.1600000000001, "end": 700.72, "text": " that there doesn't need to be like a straight linear path, because there is no connection"}, {"start": 700.72, "end": 707.6, "text": " right here, if you can see that. So you might be wondering, how do I decide which block"}, {"start": 707.6, "end": 716.5600000000001, "text": " goes where? And how do I decide on which connections connect where? And that is going to be the"}, {"start": 716.56, "end": 722.4, "text": " idea here to use neural architecture search. So neural architecture search, right now is"}, {"start": 722.4, "end": 730.16, "text": " still a fancy way of saying, let's try stuff out. And so what you'll do is you will initialize"}, {"start": 730.16, "end": 737.0799999999999, "text": " a reinforcement learning controller that decides on the ordering and on the connections. And"}, {"start": 737.0799999999999, "end": 741.5799999999999, "text": " it has some action space, and you basically let it run. So it, it, you know, proposes"}, {"start": 741.58, "end": 748.0, "text": " a couple of architectures. And, and then you measure all of them, you train all of these"}, {"start": 748.0, "end": 751.76, "text": " architectures and you see how well they fare. And then you go back to the controller, that's"}, {"start": 751.76, "end": 759.7, "text": " the reward signal. And so we can draw so you have an agent, which builds the building plan."}, {"start": 759.7, "end": 766.44, "text": " So the agent in the agent will emit as an action, a building plan, like big, small,"}, {"start": 766.44, "end": 773.24, "text": " big, small, big with connections like this, and like this, and like this. And then that"}, {"start": 773.24, "end": 781.08, "text": " will go to the environment, the environment here simply takes the architecture and trains,"}, {"start": 781.08, "end": 789.08, "text": " train the architecture. And then the, let's say the eval loss or the validation loss,"}, {"start": 789.08, "end": 795.82, "text": " the validation accuracy is equal is going to be your reward signal. So you simply train"}, {"start": 795.82, "end": 801.58, "text": " a reinforcement learning agent to solve this particular problem, which is training this"}, {"start": 801.58, "end": 806.46, "text": " in recognition and localization on the particular data set, as well as possible to basically"}, {"start": 806.46, "end": 811.6400000000001, "text": " come up with the best architecture, which, you know, it's, it's fancy, and it's a bit"}, {"start": 811.6400000000001, "end": 815.6400000000001, "text": " better than trying everything out. But it's not much better right now. And it takes a"}, {"start": 815.6400000000001, "end": 820.4000000000001, "text": " lot of compute to run these experiments, because it takes a lot of iterations of this. And"}, {"start": 820.4, "end": 825.88, "text": " every iteration consists of training one of these networks fully once, and you can do"}, {"start": 825.88, "end": 833.12, "text": " something with like early stopping and stuff. But so you get the idea. This is what they"}, {"start": 833.12, "end": 840.78, "text": " what they propose. And this is, you know, how they get better. So there are a number"}, {"start": 840.78, "end": 849.48, "text": " of challenges in this. Namely, we've, we said, okay, when you input a signal, for example,"}, {"start": 849.48, "end": 857.6, "text": " when you input a signal from this layer to this layer, you can see that you have to shrink"}, {"start": 857.6, "end": 864.6, "text": " the resolution, and you have to up the number of features. And this was already sort of"}, {"start": 864.6, "end": 871.5600000000001, "text": " solved in the resonant original resonant paper, but they reiterate how they do this here."}, {"start": 871.5600000000001, "end": 877.6, "text": " Basically, you have, you have this layer, and it is connected to these two layers, we"}, {"start": 877.6, "end": 883.2, "text": " said every layer can receive inputs from two layers, you see, at the very end, these are"}, {"start": 883.2, "end": 892.08, "text": " just added together. Okay, so we have two things. First of all, the number of features"}, {"start": 892.08, "end": 898.66, "text": " is different, you can see right over here, the number of features, the number of channels"}, {"start": 898.66, "end": 905.8000000000001, "text": " is different than the number of channels in the output image, let's say, right here. So"}, {"start": 905.8, "end": 910.56, "text": " those are different. And in fact, they're different in both inputs. And we have this"}, {"start": 910.56, "end": 915.54, "text": " method of one by one convolutions that was introduced in the original resonant paper."}, {"start": 915.54, "end": 922.4, "text": " If we do one by one convolutions, it's basically a learned transformation from a number of"}, {"start": 922.4, "end": 928.06, "text": " input channels to a number of output channels without chain without doing any actual convolution"}, {"start": 928.06, "end": 934.3599999999999, "text": " operation. This is simply linear operation, upscaling or up, up, upping the number of"}, {"start": 934.36, "end": 940.6, "text": " feature maps, you can see these one by one convolutions are employed here in various"}, {"start": 940.6, "end": 948.28, "text": " ways. So because this is fairly compute intensive, or so they claim, what they do first is they"}, {"start": 948.28, "end": 955.96, "text": " always first, go to less features. So here we have a number of features, which is maybe,"}, {"start": 955.96, "end": 963.76, "text": " let's say this is f or sorry, this is c zero. You can see very small here, maybe that there"}, {"start": 963.76, "end": 970.56, "text": " is this first we go to alpha times c zero and alpha is I think in the default setting,"}, {"start": 970.56, "end": 979.76, "text": " it's one half. So first, we always go to one half the number of features. Before we do"}, {"start": 979.76, "end": 986.7, "text": " this switch here, and then we have two options, either. So you go to one half the features"}, {"start": 986.7, "end": 992.0, "text": " and at the end, you go to the number of target features. So it could be if the target features"}, {"start": 992.0, "end": 998.08, "text": " are more than you currently have, it could be that you first go to less features. And"}, {"start": 998.08, "end": 1005.0, "text": " then you go to even more features, right? As if you the current one has more features"}, {"start": 1005.0, "end": 1009.24, "text": " than the end, it's probably not as bad because you first go to less features and to even"}, {"start": 1009.24, "end": 1015.4, "text": " less features. This is probably one of the things they did to save computation. But which"}, {"start": 1015.4, "end": 1020.0, "text": " you can imagine that it hurts because here you simply have to you have to basically throw"}, {"start": 1020.0, "end": 1025.16, "text": " away half the features or you have to like linearly combine them in every step where"}, {"start": 1025.16, "end": 1033.34, "text": " you connect two layers to each other. Okay, so there's two situations. First situation,"}, {"start": 1033.34, "end": 1039.84, "text": " your current resolution here is higher than the target resolution. In that case, we can"}, {"start": 1039.84, "end": 1046.72, "text": " simply do a convolution with a bigger stride than one, right? If you have an image and"}, {"start": 1046.72, "end": 1051.76, "text": " you do a convolution, usually you have this overlapping convolution, such that the result"}, {"start": 1051.76, "end": 1057.96, "text": " is the same size as you started with. But you can also do a bigger stride. And I'm a"}, {"start": 1057.96, "end": 1064.24, "text": " bit overdrawing this here. But you can do a bigger stride such that the final resolution"}, {"start": 1064.24, "end": 1070.26, "text": " is smaller. And you can also do this max pooling right here. So the max pooling is also a way"}, {"start": 1070.26, "end": 1077.32, "text": " to reduce the number of of the resolution of the image. So if we're bigger, we can do"}, {"start": 1077.32, "end": 1085.0, "text": " that. If we are currently smaller than the target, what we can do is we can up sample"}, {"start": 1085.0, "end": 1092.44, "text": " and up sample you can do by doing nearest neighbor or things like this. We can also"}, {"start": 1092.44, "end": 1099.94, "text": " do a learned up sample. There are various ways I believe here they do a nearest neighbor."}, {"start": 1099.94, "end": 1111.6000000000001, "text": " But I'm not sure anymore. Actually. Let's check it out. That's here somewhere. resampling"}, {"start": 1111.6000000000001, "end": 1118.38, "text": " and cross scale connections, yada yada yada yada yada yada yada. It's important to keep"}, {"start": 1118.38, "end": 1123.56, "text": " the computational resampling low, we introduce a scaling factor alpha, we had that, then"}, {"start": 1123.56, "end": 1130.08, "text": " we use a nearest neighbor interpolation for up sampling, or a stripe to three by three"}, {"start": 1130.08, "end": 1138.3999999999999, "text": " convolution. Okay, so it's nearest neighbor by up sampling. All right. So that's, that's"}, {"start": 1138.3999999999999, "end": 1144.96, "text": " how they up and down sample the feature maps to the correct shapes, either using nearest"}, {"start": 1144.96, "end": 1151.96, "text": " neighbor up sampling, or using multi stride convolution followed by max pooling. So what"}, {"start": 1151.96, "end": 1159.28, "text": " does that give them? Now, they do several different steps in this. So the first architecture,"}, {"start": 1159.28, "end": 1164.46, "text": " this resnet 50 is the original architecture. And remember, we're only talking about the"}, {"start": 1164.46, "end": 1171.64, "text": " backbone right here. Now in the original resnet 50 architecture, we have this resnet 50, FPN."}, {"start": 1171.64, "end": 1177.92, "text": " And this FPN is these are called the output layers. This is what then goes and classifies"}, {"start": 1177.92, "end": 1186.8400000000001, "text": " the bounding boxes and the labels and so on. Now, here you can see the resnet 50 is continuously"}, {"start": 1186.8400000000001, "end": 1196.64, "text": " getting smaller and more features. They do an intermediate step. So this, this right"}, {"start": 1196.64, "end": 1202.8200000000002, "text": " here is their final thing where they let this let this algorithm go wild. And you can see"}, {"start": 1202.82, "end": 1209.0, "text": " that it's pretty, pretty fuzzy. So this RL controller finds this architecture to be the"}, {"start": 1209.0, "end": 1216.6399999999999, "text": " best architecture. And you can see it's continuously down and up and down and sorry, and up and"}, {"start": 1216.6399999999999, "end": 1222.56, "text": " down. And there's considerable cross connections between all of these things. And then here"}, {"start": 1222.56, "end": 1227.72, "text": " you have the you have the different output layers built into the network rather than"}, {"start": 1227.72, "end": 1232.92, "text": " next to the network, right. So these are the ones that are now the red border ones are"}, {"start": 1232.92, "end": 1239.6000000000001, "text": " now the features that are used for going in classifying. As an intermediate step, they"}, {"start": 1239.6000000000001, "end": 1245.52, "text": " also consider this architecture, where they basically built a smaller resnet right here,"}, {"start": 1245.52, "end": 1251.78, "text": " and then let the algorithm decide on the rest right here. So it still has the same amount"}, {"start": 1251.78, "end": 1259.8, "text": " of parameters roughly, but they can investigate what happens if we go to these to this lower"}, {"start": 1259.8, "end": 1266.08, "text": " if we have this structure at the beginning, but then part of it we can do with our algorithm."}, {"start": 1266.08, "end": 1273.6, "text": " And lastly, they also consider this architecture. Now this architecture, again, their algorithm"}, {"start": 1273.6, "end": 1278.08, "text": " has control over the whole network. But there is an additional thing that the algorithm"}, {"start": 1278.08, "end": 1284.56, "text": " can do the algorithm can also decide to change the number of features and to change the type"}, {"start": 1284.56, "end": 1290.5, "text": " of block. So here you can see these are all residual blocks. And these are these called"}, {"start": 1290.5, "end": 1297.3, "text": " bottleneck blocks, they're simply a different way of of doing a residual block, it wasn't"}, {"start": 1297.3, "end": 1305.04, "text": " introduced in the original resnet paper. But the controller can simply switch to that."}, {"start": 1305.04, "end": 1311.28, "text": " And that can save some computation if you go through these bottleneck blocks. So what"}, {"start": 1311.28, "end": 1319.48, "text": " does that give you, you can see below that the resnet 50 is at 37.8% average precision."}, {"start": 1319.48, "end": 1325.46, "text": " If you liberate the top part to leave it to the algorithm, it's at 39. If you liberate"}, {"start": 1325.46, "end": 1330.32, "text": " the entire network, it's at 40.7. And remember, these are like roughly the same amount of"}, {"start": 1330.32, "end": 1337.96, "text": " parameters. And then if you if you also let the network control a bit of the feature size"}, {"start": 1337.96, "end": 1344.48, "text": " and the type of block, you get a 40.8, which is the same as before. But now this one, I"}, {"start": 1344.48, "end": 1352.96, "text": " believe has about Oh, yeah, here we go with 10% fewer flops. Okay, so that's, that's pretty"}, {"start": 1352.96, "end": 1360.4, "text": " cool. Though, remember that the left thing this is this is made by humans, this is just"}, {"start": 1360.4, "end": 1367.44, "text": " our heuristic. And the right things they are made by RL. And they are no for these particular"}, {"start": 1367.44, "end": 1374.96, "text": " data sets, though they do find that generally this also transfers to ImageNet classification."}, {"start": 1374.96, "end": 1381.26, "text": " But still, this is sort of a, it works well for the type of data we work with, and so"}, {"start": 1381.26, "end": 1387.48, "text": " on. So I don't know how much I would trust it how far we should go of building SpineNet"}, {"start": 1387.48, "end": 1398.68, "text": " 49 as our new backbone for every image task that we have. It remains to be seen, I believe."}, {"start": 1398.68, "end": 1403.34, "text": " Before actually, we go to the experiments before we go to the experiments, I want to"}, {"start": 1403.34, "end": 1409.8799999999999, "text": " state my idea right here. So you get the general gist here. And so another kind of coral I"}, {"start": 1409.88, "end": 1414.7600000000002, "text": " have with this is that, you know, in here, you always have these single connections."}, {"start": 1414.7600000000002, "end": 1419.88, "text": " And here you always have these these double connections. And I've looked through the experiment,"}, {"start": 1419.88, "end": 1428.6200000000001, "text": " it seems like nowhere do they ablate or anything what what it means to only have single connections,"}, {"start": 1428.6200000000001, "end": 1436.24, "text": " or if they so if they let the ResNet run with double connections, so if their controller"}, {"start": 1436.24, "end": 1442.44, "text": " could not switch the order, but only introduce the connections, they might have done this,"}, {"start": 1442.44, "end": 1447.76, "text": " they have a lot of experiments where they do the different ablations. So I would be"}, {"start": 1447.76, "end": 1456.04, "text": " interested what happens when you let it run on the ResNet, but let it have two connections"}, {"start": 1456.04, "end": 1465.36, "text": " per per layer. Is it then better or not? So here the importance, I'll get to my idea later."}, {"start": 1465.36, "end": 1471.4599999999998, "text": " The importance of scale permutation, that's where they investigate how important is it"}, {"start": 1471.4599999999998, "end": 1480.3999999999999, "text": " that you permute the layers and that turns out to be fairly important. Then the importance"}, {"start": 1480.3999999999999, "end": 1486.28, "text": " of cross scale connections. That's how they investigate here. So these are these connections,"}, {"start": 1486.28, "end": 1490.8, "text": " they say, the cross scale connections play a crucial role in fusing features at different"}, {"start": 1490.8, "end": 1495.52, "text": " resolutions throughout the scale permuted network. So that's the reasoning behind it."}, {"start": 1495.52, "end": 1501.52, "text": " We we take features from different kinds of resolutions, and we can also scale up again"}, {"start": 1501.52, "end": 1508.48, "text": " and then scale down again, to gain some additional features from the from the higher resolutions."}, {"start": 1508.48, "end": 1514.8799999999999, "text": " We study it's important by graph damage. So either they remove the short term connections,"}, {"start": 1514.8799999999999, "end": 1519.36, "text": " or they remove the long range connections, or they remove both and then connect one block"}, {"start": 1519.36, "end": 1525.24, "text": " to the previous block via a sequential connection. So this is only this is only in the things"}, {"start": 1525.24, "end": 1530.4799999999998, "text": " that they learned, right. So this model is where they fully give their model control"}, {"start": 1530.4799999999998, "end": 1536.12, "text": " over the ordering and connections, you can see that as this 40.7%. Now, if they delete"}, {"start": 1536.12, "end": 1542.9199999999998, "text": " the short range connections, they drop to 35. If they delete the only the long range,"}, {"start": 1542.9199999999998, "end": 1547.4799999999998, "text": " they drop to even more. So here, you can see that these long range connections, which I"}, {"start": 1547.48, "end": 1554.72, "text": " guess are connections that are going across multiple blocks, skipping multiple blocks,"}, {"start": 1554.72, "end": 1562.52, "text": " these tend to be very important. So you can make the case that it might be very important"}, {"start": 1562.52, "end": 1569.76, "text": " to fuse these things from different layers to fuse the features from different resolutions,"}, {"start": 1569.76, "end": 1574.56, "text": " because these long range connections tend to be important, though, it's one thing to"}, {"start": 1574.56, "end": 1581.52, "text": " say that if we just leave them away with our model, if we just damage it and then let it"}, {"start": 1581.52, "end": 1587.3799999999999, "text": " run, it it it drops in accuracy. It's not entirely the same thing as to say that these"}, {"start": 1587.3799999999999, "end": 1593.5, "text": " are important because you don't really know what happens like if you train without them,"}, {"start": 1593.5, "end": 1598.9199999999998, "text": " maybe you could if you train without them, you could reach as good an accuracy. So this"}, {"start": 1598.92, "end": 1604.88, "text": " graph damage investigation, it has something but not I wouldn't trust it too much. And"}, {"start": 1604.88, "end": 1611.16, "text": " yeah, I think they haven't investigated what happens if they keep the ResNet order but"}, {"start": 1611.16, "end": 1617.6000000000001, "text": " let the connections be twice. But you get the general the general idea of the paper"}, {"start": 1617.6000000000001, "end": 1624.98, "text": " right here of what they do. Now, they do this with architecture search right here. But here's"}, {"start": 1624.98, "end": 1632.7, "text": " an idea. Okay, I propose the following, you have an image right here. And we are wondering"}, {"start": 1632.7, "end": 1638.0, "text": " here, should we let it go through a layer that's wide and with less features? Should"}, {"start": 1638.0, "end": 1645.44, "text": " we let it go through a layer that's, you know, very many features, but not as wide. But we"}, {"start": 1645.44, "end": 1651.8, "text": " have to downscale the image? Or should we let it go first through something intermediate?"}, {"start": 1651.8, "end": 1658.0, "text": " Let's see it like this. Okay, so we're wondering, how should we order these blocks? Why can't"}, {"start": 1658.0, "end": 1666.68, "text": " we do all of at the same time? Why can't we do this, this and this? Okay. And then in"}, {"start": 1666.68, "end": 1677.04, "text": " the next layer, again, do all of them at the same time. And you, you can already see where"}, {"start": 1677.04, "end": 1683.7, "text": " this is going, I hope, I hope you can see where this is going. So you have a routing"}, {"start": 1683.7, "end": 1689.3999999999999, "text": " right here. And how do we do routing in modern times in deep learning with attention? So"}, {"start": 1689.3999999999999, "end": 1697.76, "text": " I propose you have layers with different attention. Let's say these are these are now your sequences"}, {"start": 1697.76, "end": 1707.72, "text": " or you can also make them as attention heads. Okay, these are your these and the lower level"}, {"start": 1707.72, "end": 1715.8, "text": " features are routed to the higher level features with an attention mechanism. And you do this"}, {"start": 1715.8, "end": 1720.8799999999999, "text": " layer by layer by layer. So you let because what's the problem here? The problem here"}, {"start": 1720.8799999999999, "end": 1726.36, "text": " is that the same data point has to go, you know, you find these good connections, but"}, {"start": 1726.36, "end": 1731.6, "text": " the all the data points have to go through the same connections. And it might actually"}, {"start": 1731.6, "end": 1737.84, "text": " be that you need different routing depending on the data point, it might be that what this"}, {"start": 1737.84, "end": 1742.0, "text": " is, this is good for the average data point, but it will be much better if whenever there's"}, {"start": 1742.0, "end": 1747.56, "text": " a cat, you take one path, and whenever there's a dog, you take a different path. So this"}, {"start": 1747.56, "end": 1755.8, "text": " will allow for that, you basically have the routing parameterized by an attention mechanism."}, {"start": 1755.8, "end": 1760.9199999999998, "text": " This I have no clue how much compute this would take. It doesn't seem that outrageous."}, {"start": 1760.9199999999998, "end": 1765.3, "text": " Because what's your sequence length here, your sequence length is going to be the number"}, {"start": 1765.3, "end": 1769.8, "text": " of layers maybe and maybe times the number of feature maps, maybe have different attention"}, {"start": 1769.8, "end": 1776.52, "text": " heads. So you maybe want to replicate some of those here. But ultimately, I would guess"}, {"start": 1776.52, "end": 1780.56, "text": " the attention mechanism itself isn't that much of an overhead. Maybe it's an overhead"}, {"start": 1780.56, "end": 1788.3999999999999, "text": " that you have so many in parallel. Yeah, but you know, it remains to be seen. That's, that's"}, {"start": 1788.3999999999999, "end": 1797.6399999999999, "text": " the idea. Yeah, you heard it here first. Okay, so they have more experiments. So they also"}, {"start": 1797.6399999999999, "end": 1802.8, "text": " build here is where they say, Okay, we have the spine net 49. Now and we found this to"}, {"start": 1802.8, "end": 1809.24, "text": " work. We found this to work really well. This is our spine net 49 architecture. Cool. And"}, {"start": 1809.24, "end": 1814.0, "text": " you want to make it bigger. But I guess they didn't have the computational resources to"}, {"start": 1814.0, "end": 1819.72, "text": " run the neural architecture search for bigger networks. This is now as about as big as a"}, {"start": 1819.72, "end": 1827.6, "text": " resonant 50. Right. But what if you want to go to resonant 100 or resonant 150? There"}, {"start": 1827.6, "end": 1832.52, "text": " you you don't have the computational resources do neural architectures. Imagine this Google"}, {"start": 1832.52, "end": 1838.44, "text": " hasn't doesn't have the computational resources to do neural architecture search on this thing."}, {"start": 1838.44, "end": 1844.04, "text": " So this must be expensive, or I'm just, I have no idea. But what they do is they kind"}, {"start": 1844.04, "end": 1851.2, "text": " of do a trick. So here they take the the spine net 49. And they say we build a spine net"}, {"start": 1851.2, "end": 1858.3200000000002, "text": " 6096 by simply repeating each block twice. So all the incoming connections would go to"}, {"start": 1858.3200000000002, "end": 1863.06, "text": " the first block, and all the outgoing connections would come from the second block right here,"}, {"start": 1863.06, "end": 1867.52, "text": " you had two in and maybe there's actually no limit to how many outgoing connections"}, {"start": 1867.52, "end": 1874.56, "text": " you can have. And also, you can also do this three times, which I think is a bit of a cheap"}, {"start": 1874.56, "end": 1880.2, "text": " way. And it kind of defeats the entire purpose, right? Couldn't you make the exact same argument"}, {"start": 1880.2, "end": 1885.24, "text": " again here that maybe it's helpful to route from this block right here? Or maybe it's"}, {"start": 1885.24, "end": 1892.72, "text": " helpful that these don't have the same scale, right after one another. It just seems, but"}, {"start": 1892.72, "end": 1898.92, "text": " okay, so they say we found this good structure and we simply duplicate each block. I'm not"}, {"start": 1898.92, "end": 1906.16, "text": " that big of a fan, in any case. So they train this and it of course outperforms everything"}, {"start": 1906.16, "end": 1910.88, "text": " else. If you compare with kind of models of the same size. So here you compare this spine"}, {"start": 1910.88, "end": 1919.76, "text": " net 49 to the resnet 50. And you can see there's about the same number of parameters, how about"}, {"start": 1919.76, "end": 1927.36, "text": " it outperforms the resnet 50, pretty much. And as you go up the number of parameters"}, {"start": 1927.36, "end": 1933.48, "text": " here, the performance goes up yet again. And I believe these dagger ones here are simply"}, {"start": 1933.48, "end": 1940.76, "text": " trained with a special schedule with here with applying stochastic depth and swish activation"}, {"start": 1940.76, "end": 1949.24, "text": " for a longer training schedule. So you can see that not only do are the spine nets, sorry,"}, {"start": 1949.24, "end": 1954.48, "text": " the number of parameters is here. Not only are the spine nets slightly smaller than the"}, {"start": 1954.48, "end": 1963.64, "text": " resnets, they do require less flops. And they reach better accuracy. So you know, every"}, {"start": 1963.64, "end": 1973.68, "text": " everything is a win here. Yeah, so they apply this to these data sets, I don't want to go"}, {"start": 1973.68, "end": 1985.6000000000001, "text": " too much into into that. But in the last part, they also apply this to image net. So there's"}, {"start": 1985.6000000000001, "end": 1990.72, "text": " image classification, where they basically say, Okay, we can just go to our architecture"}, {"start": 1990.72, "end": 1997.5600000000002, "text": " and we can just add up all the output blocks, we scale them appropriately, and add up all"}, {"start": 1997.5600000000002, "end": 2001.92, "text": " the output blocks right here, because these are good features for localization and so"}, {"start": 2001.92, "end": 2009.16, "text": " on. And we can train it to do image classification. So all of these go into a big combination"}, {"start": 2009.16, "end": 2017.72, "text": " classifier that does the 1000 classes of image net image classification. And that also works"}, {"start": 2017.72, "end": 2023.16, "text": " pretty well with this network. So they basically argue what they found is sort of a better"}, {"start": 2023.16, "end": 2030.3200000000002, "text": " image image processing network than the resnet 50. And I guess they would argue that from"}, {"start": 2030.32, "end": 2037.28, "text": " now on, you should take this as your backbone for image classification and recognition and"}, {"start": 2037.28, "end": 2044.08, "text": " so on, which is entirely possible that this works better. There's no particular reason"}, {"start": 2044.08, "end": 2050.0, "text": " why the resnet 50 should work at all, right? It's just a heuristic. But I guess it remains"}, {"start": 2050.0, "end": 2056.56, "text": " to be to be seen, whether that's generally true or just in the things they considered."}, {"start": 2056.56, "end": 2064.84, "text": " So you can see right here, the spine net generally improving over the image net, which is not"}, {"start": 2064.84, "end": 2071.08, "text": " stated right here, but it does generally improve. And you can see, as you go higher and higher"}, {"start": 2071.08, "end": 2080.92, "text": " spine net, the numbers tend to improve as well. And this is already pretty respectable,"}, {"start": 2080.92, "end": 2088.32, "text": " respectable number for image net, right? All right. So this was it for this paper for this"}, {"start": 2088.32, "end": 2094.6, "text": " particular paper. They do have, you know, two different of these object detection recognition"}, {"start": 2094.6, "end": 2100.0, "text": " data sets. And I invite you to check out the experiments more closely. If you're interested"}, {"start": 2100.0, "end": 2105.54, "text": " in that sort of thing, I was mainly interested in the method of doing and arranging these"}, {"start": 2105.54, "end": 2111.44, "text": " layers and so on. It seems like it's a cool engineering project, cool investigative project,"}, {"start": 2111.44, "end": 2117.16, "text": " the experiments are done well. And in the end, they reach a better, you know, they achieve,"}, {"start": 2117.16, "end": 2122.92, "text": " they get a better model out of that. And if it turns out that this model is a good model,"}, {"start": 2122.92, "end": 2129.96, "text": " the entire community will be better off. Unfortunately, there's no broader impact statement to tell"}, {"start": 2129.96, "end": 2139.56, "text": " us that also the terrorists will be able to use this for purposes. But you can imagine"}, {"start": 2139.56, "end": 2145.0, "text": " that yourself. All right, that was it for me. Again, leave a comment if you want me"}, {"start": 2145.0, "end": 2150.44, "text": " to change anything or have suggestions. Leave a like if you liked the video, share it out."}, {"start": 2150.44, "end": 2160.44, "text": " Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=hAooAOFRsYc
Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention (Paper Explained)
#ai #attention #transformer #deeplearning Transformers are famous for two things: Their superior performance and their insane requirements of compute and memory. This paper reformulates the attention mechanism in terms of kernel functions and obtains a linear formulation, which reduces these requirements. Surprisingly, this formulation also surfaces an interesting connection between autoregressive transformers and RNNs. OUTLINE: 0:00 - Intro & Overview 1:35 - Softmax Attention & Transformers 8:40 - Quadratic Complexity of Softmax Attention 9:40 - Generalized Attention Mechanism 13:45 - Kernels 20:40 - Linear Attention 25:20 - Experiments 28:30 - Intuition on Linear Attention 33:55 - Connecting Autoregressive Transformers and RNNs 41:30 - Caveats with the RNN connection 46:00 - More Results & Conclusion Paper: https://arxiv.org/abs/2006.16236 Website: https://linear-transformers.com/ Code: https://github.com/idiap/fast-transformers My Video on Attention: https://youtu.be/iDulhoQ2pro My Video on BERT: https://youtu.be/-9evrZnBorM Abstract: Transformers achieve remarkable performance in several tasks but due to their quadratic complexity, with respect to the input's length, they are prohibitively slow for very long sequences. To address this limitation, we express the self-attention as a linear dot-product of kernel feature maps and make use of the associativity property of matrix products to reduce the complexity from (N2) to (N), where N is the sequence length. We show that this formulation permits an iterative implementation that dramatically accelerates autoregressive transformers and reveals their relationship to recurrent neural networks. Our linear transformers achieve similar performance to vanilla transformers and they are up to 4000x faster on autoregressive prediction of very long sequences. Authors: Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, François Fleuret Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we're looking at transformers or RNNs, fast autoregressive transformers with linear attention by Angelos Kateropoulos, Apor Vias, Nikolaos Papas and Francois Fleuret. So this paper on a high level proposes to interpret the attention mechanism in transformers with a in terms of a kernel function, and therefore the resulting higher dimensional linear operation can be used to formulate the linear transformer, which is orders of magnitude faster than a classic transformer. They also show that in the case of autoregressive transformers, this makes the transformer essentially equivalent to a special kind of RNN. So yeah, that's what this paper is about. And I think I have some comments to make that I haven't really seen made by others, though I have to admit, I also haven't really looked at many comments. So I might just be telling old boring things. As always, if you like content like this, consider sharing it out, leave a like if you liked it, leave a comment to you know, let me know what you think I do read the comments and they're generally comment section is very, very helpful to me and also people, you know, respond to each other. It's fairly cool to see that the community is usually very helpful to people asking questions. And yeah, just let me know what you think. Alright, so what's the problem with transformers and I've done many videos on transformers and I keep referring back to them for people who don't know what it is. But there's this original paper called attention is all you need that where I made a video about that. So if you don't know what transformers are, you can go look at that that should basically cover everything you need to know. But there's many more transformers. In the meantime, there's BERT, GPT, 2GPT, whatever the number is after that. Many sequence processing models are now transformers, many set processing models are now transformers. So this has reached a very, very made a very big splash in the community. So essentially, transformers come with this attention mechanism where you have an input set, actually, but let's consider it a sequence. So a sequence of text, maybe like I have an ice cream cone, something like this. And you want to classify the text or you want to perform language modeling. So in language modeling, the problem is as follows, I give you this piece of text and I ask you to predict the next piece of text. This is this was kind of the first task that these transformers were used on. And this is what is called an autoregressive transformer, because you always have a piece, you predict the next piece, and then I give you that next, it gives you that entire piece, and then you predict the next piece yet again, and so on. And this autoregressive property is going to, you know, come in play in this paper later. But ultimately, what you have in a transformer is called an attention mechanism. So an attention mechanism is the following each layer in the transformer, you can imagine as having the same number of nodes, kind of the same number of neurons as the seek your sequence is long. Now, from these input sequence, you're going to generate for each of these tokens, you're going to generate three different things, you're going to generate a key query and the value. So in in these you do from so usually, this doesn't come in form of a letter, right, this comes in form of some kind of embedding vector. And from that, you're going to generate three different things, I should probably use different colors for for. So this is a function, you're going to produce three different things from that, you're going to produce a key, you're going to produce a query, and you're going to produce a value. Now, the key is, you can imagine it being attached to this lower layer right here. So that's the key for this, this token right here. That's the key, the key here for that token right here, it's a word piece, right. So the keys, again, are also just you know, vectors, vector, vector, the query, you figuratively attach to the top layer right here. So the queries, they go here for each token, and they are also vectors. And the values will keep out of it for now. So the queries and the keys define basically how you route the information, and you route the information by going over each. So each, you have to imagine each token right here, this this half or half, it needs to aggregate information from all the other tokens, right. So we're going through multiple layers of this. And in each layer, each of these tokens is aggregating information from the other tokens. If we do this in multiple rounds is eventually, you know, the each token is aggregating information, eventually, each token knows about all the other tokens. But how this information aggregation is done is very important. For example, if the token is a pronoun, it would be very interested in information coming from any sort of named entity in the sentence, because it very much wants to know what it is referring to, right. If you are a if you are the the pronoun in the sentence, it is very vital that you understand which of these things you refer to. So you'll start aggregating information for that. And then once you know, who or what you refer to, then the other parts of the sentence can make use of that information. So they will start requesting information from you. And so layer after layer, each token aggregates information from each other token. So this works by let's say we're at this token right here. What we're going to do is we're going to form the inner product between that vector and each of these vectors. And then we're going to transfer that into a softmax, which makes this into a first of all, there's so we do the query together with all the keys, key, and then we run it through the exponential function. And after that, we're going to normalize it by the sum of all the exponential functions that will give us a properly normalized distribution. So a histogram basically, of where we are going to get our information from, this is going to be the highest where the inner product right here is the highest. So from this token right here, and you know, this is fairly, fairly standard. What I drew by accident is fairly standard that a token probably wants to know a lot about itself. So you want to carry forward the information that you already have in this particular token. That's why your inner product is going to maybe align a lot with your own key. So the keys and queries are learned. So each token decides what kind of information it wants to advertise to the others. And then also each token decides what kind of information it wants to gather from the others. And the the routing then is put through a softmax function. And that gives you this right here, you do this for every single token. So the problem with this is that every single token needs to do the inner product of its query with all the different keys, and each of that has to go through the softmax. And then the value that's actually aggregated are these values right here. Now, the values are simply a transformation of the incoming values. Values are what's really propagated. You can think of it as just like a one layer neural network. Ultimately, you could also leave away the values, people don't do this. Some people do the same queries and keys, but the values are just a transformation of your input. So the important thing is this right here, this decides how you're going to aggregate the values. Alright, so this is has a quadratic complexity. So if you if you have n input tokens, then this entire process will require n squared operations because you need to form the inner products between each pair of queries and keys, right. And it also is going to require that much memory. And this we're going to see this is in large part due to this softmax operation because because we have a softmax, it makes the whole thing nonlinear. And it being nonlinear basically means we'll have to, you know, store everything, keep everything around and we have to recompute for each query. We're going to see in this paper formulation where if we make the whole process linear, then we will not have to do that. So let's dive into it. So here they go linear transformers. They start off with saying each transformer layer is essentially this right here. So this is a this is kind of a higher level of view. What we viewed so far is just this part right here. This is the attention routing mechanism. Each layer is actually wrapped in a residual connection and also a simple element wise or row wise feed forward layer. But these things are usually not that much into consideration. What's really hurting in the transformer if you go into very long sequences is this attention routing mechanism. So the attention routing mechanism is as follows. You can see right here this is the formal expression of what I described right here. Here you have the and notice this is an outer product. So if I have if I have n sequence elements, the q right here are the queries. So this transforms each of the n into a into a d dimensional space, right? And also the keys will transform each of these into a d dimensional space. So this here is going this here is going to be a n by n matrix, right? This is this q k t is going to be an n by n matrix. This is x w q w k x and this transposed right here. Nope. Yeah, like this. Okay. So this is sort of an outer product. And then we're going to take the row wise softmax. And that will give us for each row in this matrix. So for each row in this matrix, we're going to have these this distribution of how to aggregate information each row will give us basically for each of the upper level tokens for each of the outputs, how we need to aggregate information from the inputs and the information that we're aggregating are these values right here. Now, they generalize this first of all, they say, we can also we can write it in this form right here. Instead of having a softmax, we can actually think of any kind of similarity function it between the queries and the keys. So here you see what we want to do if we want to calculate output I here, the important thing is there is no longer this is an entire matrix. And we considered a row wise softmax. And now we write this out into the individual elements of the output. And we can we can do so we can say, okay, how do we obtain one element of the output, we're going to calculate some sort of similarity of that particular query see I here, I here, we're going to calculate some sort of similarity between the query of that particular output with all of the keys. So here you can see all of the keys of the input. And we're going to add and we're going to normalize, right, this is the normalization that happens also in the softmax. And that will give us like a histogram of how we aggregate the values right here. So all of this all of this red stuff will give us again, some sort of a histogram of how we're going to aggregate information. If you look a bit like this, and you know how the softmax is defined, you'll see that if we plug in the exponential function for as the similarity function, then you'll get back to the softmax. Okay, these they say, equation three is equivalent to equation two, if we substitute the similarity function with the exponential function. Now, they go, they go ahead, and they go into kernels. So for that, you sort of need to understand what a kernel is. A kernel is a special kind. For the purposes that we are, you know, looking at here, a kernel is a special kind of a similarity function, it needs to have some properties right here. But essentially, they say, well, this this kind of looks like a kernel. And we will simply say, okay, here, this similarity. What if we use a kernel here. So a kernel simply is a similarity function of two vectors, if you interpret it like it has some more conditions, I know, I know, don't freak on me. But the interesting properties about kernels is that if a similarity function is a kernel, it means that there exists a mapping. And where do we do so, if k between a and b is a kernel, if k is a kernel, that means that there exists a similar a function phi, such that phi, such that the kernel between a and b can be expressed as a linear product between phi of a and phi of b transpose. Okay, this is like, this is an inner product. So what it means is that this can be like a super nonlinear function, a kernel. For example, it can be and the example often given in like machine learning classes is maybe something like this, you have one dimensional data, right, and here is the error zero. And you have two kinds of data points, you have the x's right here, and you have the circles right here. Now, I cannot classify this data linearly. However, however, I can transform this into a higher dimensional space. So my function phi is of my function phi of x is going to map to the vector x x squared. And that will transform the data into a two dimensional space, right. And the data will look something like this. So it's going to the y axis is going to be the square of the x axis, okay. And like this, and now I can find a linear classifier. Okay, so in this case, right here, you can see that in this higher space, things become linear, things become linearly classifiable. And very similarly, like this is you can define the similarity between things right here. So the similarity function would be the square function right here. And this would be a quadratic an example of a quadratic kernel. So this function right here can be very non linear. I mean, it can be a linear function, but it can be very nonlinear. But it is equivalent, it is equivalent, this means it is equivalent to a linear function in a high dimensional space. Now to figure out linear to figure out what this function phi is, is the big, the big question, of course, for a couple of kernels, we know the function phi, right for the quadratic kernel, for example, we know we just saw that phi maps this to the vector of the coordinate and it's quadratic to its square, we know for a couple of other kernels what their associated functions are. But in general, if it's a kernel, then we can just replace it with a linear function. With with with this thing, and in reverse, we can just say, well, what we could do is we could just simply define a function phi, and basically map this into map these a and b into a higher dimensional space, where this super duper nonlinear function would just become a linear function, wouldn't that be much easier, linear functions are much easier to work with than long nonlinear functions. And if we know that, as long as we get the correct phi, we do exactly the same thing as the nonlinear function, you know, that would be helpful. So there is an entire literature in the entire like decade of kernelization and kernelize everything kernelized SVMs to start, but then you can go way further in this. And this is just the beginning. And this is just a very sloppy explanation by me right here. But ultimately, they're saying, hey, instead of doing complicated nonlinear similarity function like the softmax, can't we just project a and b into the higher dimensional space, and then just do the linear inner product? And do the same thing as the softmax? And the answer is yes. And no, we know that for the softmax, the particular five function that we would need would map to an infinite dimensional space. Usually, usually this is applied in reverse. It's like, oh, here, instead, usually in machine learning, they say, you know, we want to do this, we want to map it into a high dimensional space, there's just linear, but we we can't because these spaces are too high dimensional. And therefore, we find an equivalent kernel function. And it's usually said, well, we use an RBF kernel that corresponds to an infinite dimensional space and so on. That's pretty cool. Here, it's the reverse here, it's, we want to do, we want the linear function, we end the equivalent of the softmax function is an infinite dimensional function, which we can't do, right, we can't feasibly compute an infinite dimensional space explicitly. So it's not possible to just do the equivalent thing than in a transformer. However, you can still do something else, you can still use polynomial kernels, you can still use any kind of kernels that have corresponding functions that map to a finite dimensional space. And that's what this paper does. So here, they say, if we have such a function that maps these things into a higher dimensional space, such that their inner product, such that the similarity function in this higher dimensional space is an inner product, then we can write it as just this inner product right here explicitly. And then because of the associativity, you can see that here is an I and here there's no I so we can just sort of pull this out of this sum and as well, right here, it doesn't don't don't cross this away. These are vectors, right? But you can see, especially here, you can see pretty clear, why is there a cursor stop, you can see that this here, you have to pay attention to the matrix dimension. So if we use like bracket notation, this is like this, like this, like this and like this. Okay, so here on the bottom, you see that there is an inner product. So each output will be normalized by this inner product right here. However, the top is going to be a vector, we know that, you know, each output is a vector. So the top will aggregate these vectors right here, according to this routing. Okay, but if we write it like this, you can see that what we could technically do is we could technically compute this part here once because it doesn't contain any I. So there's no I in that part. So we could just compute it once because we have these two, these two layers of the attention mechanism. And these K and V, they just refer to this lower layer right here. We could just compute that thing on the right ones, that's going to give us a matrix, as you can see right here from the dimensions. And then we can simply take the product of that vector right here of the vector on the left with the matrix on the right. And we'd be done. It's one operation, right? Instead of for each thing, you know, going and attending to each other, and then do the softmax. Without the softmax, we can all do this in a linear fashion. So that makes it a lot easier. In fact, it makes the computation linear in. So this is now O of n. Okay, plus, of course, the the work that you have to do for mapping this into the higher dimensional space. But this is also not quadratic, this is done to each of these elements individually. Okay, so this, this is now, as we said, it's pretty easy. You can calculate the matrix on the top, you can actually also calculate this part right here, this vector, you can aggregate over the bottom. And then if you go through the top, it's simply a inner product with the vector of the queries, and you're done. And this is it, in fact, in matrix form, you can simply write it down as one matrix multiplication. Seems pretty easy. So the computational cost goes way down. And they use the following function right here. Okay, this is their map to the higher dimensional space. So they say for our experiments that deal with smaller sequences, we employ a feature map that results in a positive similarity function as defined below. So right here, you have to pay attention, you can't just pick any function. But you can you can pick a lot of different functions, where LU denotes the exponential linear unit activation function. Okay, like this seems, this seems fine. They also say in our experimental section, we show that the feature map of equation seven performs on par with the full transformer, while significantly reducing the computational memory requirements. This, you know, it seems, it seems like the the original transformer, this choice of the softmax function, even though it's, you know, powerful and can't be approximated with this trick right here, it was also somewhat arbitrary, I mean, there is a reasoning behind it, but it's also somewhat like, and it's entirely possible right that that this here is way faster. So I want to jump this causal masking thing for now and look at the results where you can see a verify the fact that in terms of time in terms of GPU memory, if they apply their transformer and here on the x axis, you see sequence length, you can see that the this is log plot, right? These are log plots, you can see that the original transformer right here has a way steeper slope than their transformer, which is the black line right here. The blue lines are the reformers, which we've also I've also done a video on reformer. If you want to check that out, that is also a trick that uses locality sensitive hashing to get rid of the quadratic attention mechanism. Now the locality sensitive hashing also means that you kind of lose some accuracy. So that's the trade off right here. But you can see that is also linear, actually, it's n log n depending on the sequence length, but the log n is negligible. So you see GPU memory and time way down. And in terms of experiments, it does perform on par, it seems like it has different optimization trajectory, but they show that, you know, there is this trade off for the reformer where you lose in accuracy, they do not experience that trade off in the linear transformer compared to the original transformer in their particular experiments. Now they do their experiments sort of show that they are not on par with the original transfer like they are on par in some of the tasks, but also in some of the tasks, they are not on par. For example, this speech data set right here, where they do fairly well, they actually beat the BI-LSTM baseline and the reformer, but they do not beat the softmax transformer. So there's, it is still the case that the softmax transformer is more powerful than the thing here and we'll give some intuition very shortly on that. But the linear transformer is way faster. Here it's three times faster. And up here, it is 300 times faster. And on MNIST, and if you go on C410, it is 4000 times faster. Simply by property of the longer either sequences are that you input, the much more matters the fact that the softmax transformer has a quadratic runtime, whereas the linear transformer has a linear runtime. And I was also surprised here to see that the reformer wasn't that much faster. That's probably due to the fact that it already has like a big overhead in these hashing rounds and so on, that probably is hurting it at sort of a constant level. I guess if you were to up the sequence length even more than the reformer would also improve a lot more over the softmax transformer. Okay, so what's happening here? What's happening with this attention? And why is it different? What does it makes it different from the old attention? Now I want to, I want to sort of connect this to the kind of old and old, the old and literature of topic modeling. So if you think of the of this transformer, again, of this attention mechanism, what you'll have is a dynamic routing of information, right? So for each, from each output token, you get to look at all the input tokens. If we, for example, select this one, you get to look and you get to decide for each one, how do I want to aggregate my information? Okay, and this is what makes this quadratic from each of the output tokens, you get to look at all of the input tokens and decide how you want to do that. And that is can be very long nonlinear in terms of when we use the softmax and so on. So that's what makes it very expensive. What this thing is doing is the following. It takes all the keys right here. So here we have all the keys. And it's going to map them through this five function, right? Each key is going to map through the five function. And each query is also going to be mapped through the five function into these higher dimensional spaces. And then an inner product is performed between the two and that decides the routing. This is very similar to like topic models, where if you interpret this, this right here can be a mapping of my dimension of these keys and queries to the topics. So essentially, what's happening right here is for each of the input tokens, sorry, input tokens here, output tokens here, the dimension of this map defines is how many topics there are. So in you know, in these topics modeling, you would have things like I want to I have news articles or words, and then I define like a set of topics. And I'm going to assign each word to a topic. And then I'm going to assign each news article to a topic and so on. And then you kind of do this dimension reduction. But this can be done in many ways. So let's say this is a mapping to three dimensions. What this does is essentially this five function decides how you're going to map each of these inputs into these three topics. So you can say, oh, this token goes here and here, this one goes here, and a bit here, this one goes here, and so on. So again, this is a, this is a mapping into a well, in this case, a lower dimensional space. And then this function decides how you're going to aggregate these topics are over across here. And since this is, you know, this is now a linear multiplication between the two things. So these two are going to be your matrices, this here is going to be your phi of k, and this here is going to be your phi of q. So you can see the difference here between the old attention mechanism and the new attention mechanism, right, the old attention mechanism, each token was directly able to look at all the input tokens and decide how to aggregate the information. And here, it's sort of, we have this in between, in between representation in this higher dimensional space. And we can aggregate in only a we can distribute in a linear fashion. And we can aggregate in a linear fashion in and from this higher dimensional space. That's sort of how how I sort of how I imagine that, okay, so you get to distribute each token right here into these topics, and then the the outputs they, they don't see the inputs anymore, right, you see that in the formulation, there is a sum over j. So right here, there is this sum over j. And that means that the outputs here, they don't see the different inputs as different inputs, they only see the inputs through the map of the phi function. So they can only see the individual dimensions of that phi function, they cannot see the outputs anymore. And therefore, yeah, therefore, you don't have the dependence on the big quadratic dependence on this on this n. Okay, however, you do have a code, of course, now a dependence on this dimension of the intermediate representation. And they also they say this, right, this is, you know, reasonable. Yeah, they do derive the gradients here to save even more memory. So you don't have to search that you don't have to, let's say store of all of these activations. That's pretty cool as well. And they implemented in CUDA, there is code available for the linear transformer, all of this pretty, pretty cool. Okay. So the last thing they say they make the connections to RNNs. Now, this is a bit detached from the linear transformer. But because they formulated how they do, they can make this connection. So this now, this now is valid for all transformers, what they say right here. But keep in mind, it is valid for the original transformers in practice, if you can make this mapping phi to map to infinite dimensions, which you can't. But the analysis is equivalent. So they say, look, if we write the attention mechanism like this, and therefore, like this, what we can do is we can define these two quantities, right, s and z. This is what we said before, we can actually pre compute these quantities right here. Okay, so that reduces to this right here. If now we are looking at a autoregressive transformer, and we said before, what an autoregressive transformer was an autoregressive transformers, you have a piece of sequence and you are tasked to predict this next thing right here. Now, usually, if you want to train this using an RNN, you have to, you know, run your RNN input this hidden state and input that map forward the hidden state. So you have to do all of this forward propagation in order to derive at this hidden at this output right here, make the output and then you need to back prop through time right here. There is no way to what you would like to do is you would like to say here, I have a sentence, I can actually make like five different training examples from that sentence. So the first one is the one you just saw, I just block off the last word. But I can also make that training example right here, right to when I just cut a second to last word, and so on, I can actually make all of these different training examples for language modeling from a single sentence. And what I would like to do is I would like to train them all in parallel, right? I load my data point once I already have it, why can't I just train everything at the same time, like predict this from this word now predict also this from these two words, and the transformers are, you know, very well conditioned, they are very good at this basically. So what a transformer can do is if you input a sequence, like sorry, like the thing at the bottom, you can calculate the training signal for all of these different things at the same time. And okay, this was maybe a mistake, you can calculate the training signal for all of this at the same time, by using what's called causal masking in attention. So if I have my attention mechanism, right here, let's consider it again, let's consider these two layers. If I have my attention mechanism, what I want to do is I want to constrain each token to only attend to tokens that came before it in the sequence. So for example, this token right here, I'm going to constrain it to only attend to itself and the past, because it will, it will predict the next token in the sequence. And it wouldn't be, it would be really easy if we could attend to the input of that token, right? It could simply remember what that token is, and then aggregate that here and then predict that. So if for each token, we restrict the attention to the tokens that came before it, like also for this right here, we restrict the attention only to go backwards, then we can train all of this in parallel. This is called causal masking, it's usually implemented with like a mask that is like an upper diagonal. And it's a bit unclear if you can attend to yourself, because then I guess this will become the output and you can only attend to this. I don't know exactly how it is implemented. But there it is usually realized with an upper triangular matrix as a mask. And you apply this mask to each layer. Now, they say that this is actually like an RNN. And with their formulation, you can make this pretty explicit. Namely, you have these two states s and z. And in each sequence element, it's actually like an RNN, where you update the s and z with these quantities right here. And so it's like an RNN where these are the hidden states that you pass forward, right? And then you can formulate any transformer as an RNN that simply updates these two states. But you see, you need the explicit mapping of these of this kernel function, you need this explicit mapping in order to be able to do this, because otherwise, this is here, this is not going to be a linear addition, it is going to be complicated, you can't do it by simply remembering the past state. So you need that formulation in order to be able to express it as an RNN. But their analysis shows that this a transformer autoregressive is essentially an RNN. And you can you can so you can make a connection in that and you can actually formulate this as an RNN, which means that you can train in the transformer fashion, everything at the same time. But what is cool about an RNN, an RNN at inference time, an RNN, once it has produced, you know, this word, it can then because if you produce autoregressively, you simply say, Hey, I have this beginning of my news article, please finish it. So the model must output the next word and then from that sequence, it must output the next part, the next word and then from that the next word and so on. And RNN because of the nature of simply passing forward hidden states at inference time can simply you know, remember what the hidden states were input those again input the output here and go on. So it's pretty fast at inference time, which a transformer isn't with their formulation. Now, if they have the explicit function phi, they can use this at inference time to be so much faster. In fact, on their website, which I'll link, of course, in the in the description, you can play with image generation using one of these transformers in your browser. So you can simply start a transformer run in your browser. That's how easy this becomes. So you can see the linear transformer with causal masking, you'll simply update these states right here, and then pass those forward. So easy. And the backward pass, as we said, I don't want to go into the gradient calculation, but they derive the gradient such that you don't have to remember these hidden states and it becomes or it is linear in or it saves a lot of more memory than before. Okay. Note, so this is the last comment from my side. Note that this this causal masking transformers, they are, they are a bit of a hack in transformers. And because so ultimately, let's say, let's say, I have this sequence right here, this is given. And I want to predict this word right here. What? And okay, let's make it up here. So I need multiple layers for this. So I want to predict that next word. And I have multiple layers, right? So I want to predict this from from the outputs right here, let's say there is an output node right here, I want to predict that particular word. It's true that I should only be able to aggregate information from whatever was, you know, on the back right here. But technically, in a transformer, it would be completely valid to say that this node right here, which is let's say that's an article, and it followed by a noun, right, would be able to attend to that one. And then that one would be able to attend to that one. And or sorry, the output right here would be able to attend to that one. This would not violate the autoregressive property, right? You can, but you can see that in the intermediate layer, this node right here is attending to a forward node. Now, if you do things like this, you can't do this trick anymore, where you train everything at once. Because if if this connection exists, that also means that if in this other training sample where this is the word to be predicted, then this node could aggregate information from that node and basically cheat. But the the technical autoregressive property is not violated by this connection right here. And you only get this RNN formulation if you do not have these connections, right. So the this this hack to make the autoregressive transformers train in parallel is actually making the transformer formulation much weaker. And therefore, that's then equivalent to an RNN. Okay, I it's not that transformers in general are equivalent to an RNN, or at least this paper doesn't show that. It's just that these hacked transformers are. And I think that's an important distinction to make here, rather than saying transformers are RNNs. If we could only approximate the softmax in these infinite dimensions. I don't think that's entirely true. But it is true for the transformers, the autoregressive transformers that we currently train. Now, why is this connection so powerful? It allows a token to attend to, you know, tokens forward of it. And what does it mean to be able to tend like, let's say, it's really important that this token right here, attends to that token right here. What would you need to do if you couldn't do that? If you let's let's, let's say this is a program, right? So this token is the function f and it needs the input, this argument a of whatever token comes in front of it, and needs to do something conditioned on a so if a if a is one, it does something if a is two, it does something else, right? If you if you don't have if you can't input a, then you can simply pass on the output value, what you'll have to do is conceptually is basically you'll have to store the entire code of the function into hidden state. If this is an RNN, right, it can't look forward, it needs to store the entire code of this function f. So all it needs to basically build this map, if a is one, then this if a is two, then this if a is three, then this store that in the hidden state. And then once a comes around in the next time step, this can be resolved, you can see that this is infinitely more complicated than simply looking forward and outputting the value yourself. So that's sort of the difference in power that these two formulations are talking about. Okay, so yeah, two parts to this paper, first part, linear transformer through kernels, second part, if you formulate it like this, it is equivalent. So a autoregressive transformer in this way becomes equivalent to an RNN. And here are some of the output samples, you know, they're, they're pretty, pretty good, though, if you look at the more output samples they have here, it. So here, this, this is the linear one. And you can see, for example, as already in this very bottom one, this one right here, it's the kind of all the other transformers get the slant to the right, and that the the original has, whereas this one is simply straight. I mean, I don't want to, I don't want to dunk on this, like these others make a lot of mistake, mistakes right here. But here, I also saw, you know, all of them get that this is going to be the number three, while this one is somehow making this circle in here. So it is not perfect. And even though it's on par, where in the tasks they see, you can see right here that especially in this speech recognition, the original transformer right here is significantly outperforming the linear transformer, which is the one in black right here, in fact, in all of the tasks, but ultimately, it might not matter because they reach, you know, the same, they reach the same, they reach the same accuracy or whatnot, and the linear transformer is way, way faster. So I can see that this is going to be a thing that people apply, I guess time will tell. Right, I invite you to read the paper, tell me what you think I might be totally wrong here with any of my formulations or my intuition about what this new attention mechanism does. Yeah, please let me know. And I'll see you next time. Bye bye.
[{"start": 0.0, "end": 6.44, "text": " Hi there, today we're looking at transformers or RNNs, fast autoregressive transformers"}, {"start": 6.44, "end": 14.620000000000001, "text": " with linear attention by Angelos Kateropoulos, Apor Vias, Nikolaos Papas and Francois Fleuret."}, {"start": 14.620000000000001, "end": 19.88, "text": " So this paper on a high level proposes to interpret the attention mechanism in transformers"}, {"start": 19.88, "end": 25.6, "text": " with a in terms of a kernel function, and therefore the resulting higher dimensional"}, {"start": 25.6, "end": 32.44, "text": " linear operation can be used to formulate the linear transformer, which is orders of"}, {"start": 32.44, "end": 38.56, "text": " magnitude faster than a classic transformer. They also show that in the case of autoregressive"}, {"start": 38.56, "end": 48.6, "text": " transformers, this makes the transformer essentially equivalent to a special kind of RNN. So yeah,"}, {"start": 48.6, "end": 53.480000000000004, "text": " that's what this paper is about. And I think I have some comments to make that I haven't"}, {"start": 53.48, "end": 59.72, "text": " really seen made by others, though I have to admit, I also haven't really looked at"}, {"start": 59.72, "end": 65.39999999999999, "text": " many comments. So I might just be telling old boring things. As always, if you like"}, {"start": 65.39999999999999, "end": 70.56, "text": " content like this, consider sharing it out, leave a like if you liked it, leave a comment"}, {"start": 70.56, "end": 75.82, "text": " to you know, let me know what you think I do read the comments and they're generally"}, {"start": 75.82, "end": 81.67999999999999, "text": " comment section is very, very helpful to me and also people, you know, respond to each"}, {"start": 81.68, "end": 90.48, "text": " other. It's fairly cool to see that the community is usually very helpful to people asking questions."}, {"start": 90.48, "end": 97.18, "text": " And yeah, just let me know what you think. Alright, so what's the problem with transformers"}, {"start": 97.18, "end": 103.12, "text": " and I've done many videos on transformers and I keep referring back to them for people"}, {"start": 103.12, "end": 107.64000000000001, "text": " who don't know what it is. But there's this original paper called attention is all you"}, {"start": 107.64, "end": 113.8, "text": " need that where I made a video about that. So if you don't know what transformers are,"}, {"start": 113.8, "end": 117.68, "text": " you can go look at that that should basically cover everything you need to know. But there's"}, {"start": 117.68, "end": 125.44, "text": " many more transformers. In the meantime, there's BERT, GPT, 2GPT, whatever the number is after"}, {"start": 125.44, "end": 132.46, "text": " that. Many sequence processing models are now transformers, many set processing models"}, {"start": 132.46, "end": 138.84, "text": " are now transformers. So this has reached a very, very made a very big splash in the"}, {"start": 138.84, "end": 144.04000000000002, "text": " community. So essentially, transformers come with this attention mechanism where you have"}, {"start": 144.04000000000002, "end": 150.84, "text": " an input set, actually, but let's consider it a sequence. So a sequence of text, maybe"}, {"start": 150.84, "end": 160.48000000000002, "text": " like I have an ice cream cone, something like this. And you want to classify the text or"}, {"start": 160.48, "end": 166.76, "text": " you want to perform language modeling. So in language modeling, the problem is as follows,"}, {"start": 166.76, "end": 173.92, "text": " I give you this piece of text and I ask you to predict the next piece of text. This is"}, {"start": 173.92, "end": 179.51999999999998, "text": " this was kind of the first task that these transformers were used on. And this is what"}, {"start": 179.51999999999998, "end": 184.64, "text": " is called an autoregressive transformer, because you always have a piece, you predict the next"}, {"start": 184.64, "end": 188.88, "text": " piece, and then I give you that next, it gives you that entire piece, and then you predict"}, {"start": 188.88, "end": 194.28, "text": " the next piece yet again, and so on. And this autoregressive property is going to, you know,"}, {"start": 194.28, "end": 199.07999999999998, "text": " come in play in this paper later. But ultimately, what you have in a transformer is called an"}, {"start": 199.07999999999998, "end": 204.56, "text": " attention mechanism. So an attention mechanism is the following each layer in the transformer,"}, {"start": 204.56, "end": 209.66, "text": " you can imagine as having the same number of nodes, kind of the same number of neurons"}, {"start": 209.66, "end": 216.72, "text": " as the seek your sequence is long. Now, from these input sequence, you're going to generate"}, {"start": 216.72, "end": 221.04, "text": " for each of these tokens, you're going to generate three different things, you're going"}, {"start": 221.04, "end": 228.2, "text": " to generate a key query and the value. So in in these you do from so usually, this doesn't"}, {"start": 228.2, "end": 232.52, "text": " come in form of a letter, right, this comes in form of some kind of embedding vector."}, {"start": 232.52, "end": 236.22, "text": " And from that, you're going to generate three different things, I should probably use different"}, {"start": 236.22, "end": 242.4, "text": " colors for for. So this is a function, you're going to produce three different things from"}, {"start": 242.4, "end": 247.04, "text": " that, you're going to produce a key, you're going to produce a query, and you're going"}, {"start": 247.04, "end": 255.28, "text": " to produce a value. Now, the key is, you can imagine it being attached to this lower layer"}, {"start": 255.28, "end": 261.48, "text": " right here. So that's the key for this, this token right here. That's the key, the key"}, {"start": 261.48, "end": 267.0, "text": " here for that token right here, it's a word piece, right. So the keys, again, are also"}, {"start": 267.0, "end": 273.04, "text": " just you know, vectors, vector, vector, the query, you figuratively attach to the top"}, {"start": 273.04, "end": 280.88, "text": " layer right here. So the queries, they go here for each token, and they are also vectors."}, {"start": 280.88, "end": 286.12, "text": " And the values will keep out of it for now. So the queries and the keys define basically"}, {"start": 286.12, "end": 293.72, "text": " how you route the information, and you route the information by going over each. So each,"}, {"start": 293.72, "end": 304.0, "text": " you have to imagine each token right here, this this half or half, it needs to aggregate"}, {"start": 304.0, "end": 309.64000000000004, "text": " information from all the other tokens, right. So we're going through multiple layers of"}, {"start": 309.64000000000004, "end": 315.96000000000004, "text": " this. And in each layer, each of these tokens is aggregating information from the other"}, {"start": 315.96000000000004, "end": 321.76000000000005, "text": " tokens. If we do this in multiple rounds is eventually, you know, the each token is aggregating"}, {"start": 321.76, "end": 328.4, "text": " information, eventually, each token knows about all the other tokens. But how this information"}, {"start": 328.4, "end": 334.4, "text": " aggregation is done is very important. For example, if the token is a pronoun, it would"}, {"start": 334.4, "end": 339.8, "text": " be very interested in information coming from any sort of named entity in the sentence,"}, {"start": 339.8, "end": 345.76, "text": " because it very much wants to know what it is referring to, right. If you are a if you"}, {"start": 345.76, "end": 352.12, "text": " are the the pronoun in the sentence, it is very vital that you understand which of these"}, {"start": 352.12, "end": 358.92, "text": " things you refer to. So you'll start aggregating information for that. And then once you know,"}, {"start": 358.92, "end": 364.71999999999997, "text": " who or what you refer to, then the other parts of the sentence can make use of that information."}, {"start": 364.71999999999997, "end": 372.15999999999997, "text": " So they will start requesting information from you. And so layer after layer, each token"}, {"start": 372.16, "end": 378.36, "text": " aggregates information from each other token. So this works by let's say we're at this token"}, {"start": 378.36, "end": 383.40000000000003, "text": " right here. What we're going to do is we're going to form the inner product between that"}, {"start": 383.40000000000003, "end": 390.76000000000005, "text": " vector and each of these vectors. And then we're going to transfer that into a softmax,"}, {"start": 390.76000000000005, "end": 400.8, "text": " which makes this into a first of all, there's so we do the query together with all the keys,"}, {"start": 400.8, "end": 406.92, "text": " key, and then we run it through the exponential function. And after that, we're going to normalize"}, {"start": 406.92, "end": 414.6, "text": " it by the sum of all the exponential functions that will give us a properly normalized distribution."}, {"start": 414.6, "end": 420.52, "text": " So a histogram basically, of where we are going to get our information from, this is"}, {"start": 420.52, "end": 426.44, "text": " going to be the highest where the inner product right here is the highest. So from this token"}, {"start": 426.44, "end": 433.36, "text": " right here, and you know, this is fairly, fairly standard. What I drew by accident is"}, {"start": 433.36, "end": 440.4, "text": " fairly standard that a token probably wants to know a lot about itself. So you want to"}, {"start": 440.4, "end": 444.76, "text": " carry forward the information that you already have in this particular token. That's why"}, {"start": 444.76, "end": 449.56, "text": " your inner product is going to maybe align a lot with your own key. So the keys and queries"}, {"start": 449.56, "end": 456.0, "text": " are learned. So each token decides what kind of information it wants to advertise to the"}, {"start": 456.0, "end": 462.72, "text": " others. And then also each token decides what kind of information it wants to gather from"}, {"start": 462.72, "end": 470.48, "text": " the others. And the the routing then is put through a softmax function. And that gives"}, {"start": 470.48, "end": 475.24, "text": " you this right here, you do this for every single token. So the problem with this is"}, {"start": 475.24, "end": 482.04, "text": " that every single token needs to do the inner product of its query with all the different"}, {"start": 482.04, "end": 488.48, "text": " keys, and each of that has to go through the softmax. And then the value that's actually"}, {"start": 488.48, "end": 493.64000000000004, "text": " aggregated are these values right here. Now, the values are simply a transformation of"}, {"start": 493.64000000000004, "end": 501.68, "text": " the incoming values. Values are what's really propagated. You can think of it as just like"}, {"start": 501.68, "end": 507.6, "text": " a one layer neural network. Ultimately, you could also leave away the values, people don't"}, {"start": 507.6, "end": 513.72, "text": " do this. Some people do the same queries and keys, but the values are just a transformation"}, {"start": 513.72, "end": 519.36, "text": " of your input. So the important thing is this right here, this decides how you're going"}, {"start": 519.36, "end": 528.4, "text": " to aggregate the values. Alright, so this is has a quadratic complexity. So if you if"}, {"start": 528.4, "end": 536.24, "text": " you have n input tokens, then this entire process will require n squared operations"}, {"start": 536.24, "end": 542.04, "text": " because you need to form the inner products between each pair of queries and keys, right."}, {"start": 542.04, "end": 547.2, "text": " And it also is going to require that much memory. And this we're going to see this is"}, {"start": 547.2, "end": 553.32, "text": " in large part due to this softmax operation because because we have a softmax, it makes"}, {"start": 553.32, "end": 559.8, "text": " the whole thing nonlinear. And it being nonlinear basically means we'll have to, you know, store"}, {"start": 559.8, "end": 564.8, "text": " everything, keep everything around and we have to recompute for each query. We're going"}, {"start": 564.8, "end": 572.28, "text": " to see in this paper formulation where if we make the whole process linear, then we"}, {"start": 572.28, "end": 583.76, "text": " will not have to do that. So let's dive into it. So here they go linear transformers. They"}, {"start": 583.76, "end": 589.04, "text": " start off with saying each transformer layer is essentially this right here. So this is"}, {"start": 589.04, "end": 593.24, "text": " a this is kind of a higher level of view. What we viewed so far is just this part right"}, {"start": 593.24, "end": 598.92, "text": " here. This is the attention routing mechanism. Each layer is actually wrapped in a residual"}, {"start": 598.92, "end": 606.46, "text": " connection and also a simple element wise or row wise feed forward layer. But these"}, {"start": 606.46, "end": 613.52, "text": " things are usually not that much into consideration. What's really hurting in the transformer if"}, {"start": 613.52, "end": 620.9, "text": " you go into very long sequences is this attention routing mechanism. So the attention routing"}, {"start": 620.9, "end": 626.48, "text": " mechanism is as follows. You can see right here this is the formal expression of what"}, {"start": 626.48, "end": 635.0799999999999, "text": " I described right here. Here you have the and notice this is an outer product. So if"}, {"start": 635.0799999999999, "end": 644.0, "text": " I have if I have n sequence elements, the q right here are the queries. So this transforms"}, {"start": 644.0, "end": 652.8, "text": " each of the n into a into a d dimensional space, right? And also the keys will transform"}, {"start": 652.8, "end": 657.88, "text": " each of these into a d dimensional space. So this here is going this here is going to"}, {"start": 657.88, "end": 667.4, "text": " be a n by n matrix, right? This is this q k t is going to be an n by n matrix. This"}, {"start": 667.4, "end": 680.48, "text": " is x w q w k x and this transposed right here. Nope. Yeah, like this. Okay. So this is sort"}, {"start": 680.48, "end": 686.12, "text": " of an outer product. And then we're going to take the row wise softmax. And that will"}, {"start": 686.12, "end": 692.84, "text": " give us for each row in this matrix. So for each row in this matrix, we're going to have"}, {"start": 692.84, "end": 699.64, "text": " these this distribution of how to aggregate information each row will give us basically"}, {"start": 699.64, "end": 706.4, "text": " for each of the upper level tokens for each of the outputs, how we need to aggregate information"}, {"start": 706.4, "end": 715.1, "text": " from the inputs and the information that we're aggregating are these values right here. Now,"}, {"start": 715.1, "end": 721.5400000000001, "text": " they generalize this first of all, they say, we can also we can write it in this form right"}, {"start": 721.54, "end": 729.4, "text": " here. Instead of having a softmax, we can actually think of any kind of similarity function"}, {"start": 729.4, "end": 736.48, "text": " it between the queries and the keys. So here you see what we want to do if we want to calculate"}, {"start": 736.48, "end": 742.4399999999999, "text": " output I here, the important thing is there is no longer this is an entire matrix. And"}, {"start": 742.4399999999999, "end": 749.48, "text": " we considered a row wise softmax. And now we write this out into the individual elements"}, {"start": 749.48, "end": 757.44, "text": " of the output. And we can we can do so we can say, okay, how do we obtain one element"}, {"start": 757.44, "end": 765.36, "text": " of the output, we're going to calculate some sort of similarity of that particular query"}, {"start": 765.36, "end": 771.66, "text": " see I here, I here, we're going to calculate some sort of similarity between the query"}, {"start": 771.66, "end": 778.5600000000001, "text": " of that particular output with all of the keys. So here you can see all of the keys"}, {"start": 778.56, "end": 784.4399999999999, "text": " of the input. And we're going to add and we're going to normalize, right, this is the normalization"}, {"start": 784.4399999999999, "end": 790.68, "text": " that happens also in the softmax. And that will give us like a histogram of how we aggregate"}, {"start": 790.68, "end": 796.4399999999999, "text": " the values right here. So all of this all of this red stuff will give us again, some"}, {"start": 796.4399999999999, "end": 805.0, "text": " sort of a histogram of how we're going to aggregate information. If you look a bit like"}, {"start": 805.0, "end": 811.0, "text": " this, and you know how the softmax is defined, you'll see that if we plug in the exponential"}, {"start": 811.0, "end": 816.52, "text": " function for as the similarity function, then you'll get back to the softmax. Okay, these"}, {"start": 816.52, "end": 821.72, "text": " they say, equation three is equivalent to equation two, if we substitute the similarity"}, {"start": 821.72, "end": 831.56, "text": " function with the exponential function. Now, they go, they go ahead, and they go into kernels."}, {"start": 831.56, "end": 839.52, "text": " So for that, you sort of need to understand what a kernel is. A kernel is a special kind."}, {"start": 839.52, "end": 846.0, "text": " For the purposes that we are, you know, looking at here, a kernel is a special kind of a similarity"}, {"start": 846.0, "end": 851.9599999999999, "text": " function, it needs to have some properties right here. But essentially, they say, well,"}, {"start": 851.9599999999999, "end": 859.04, "text": " this this kind of looks like a kernel. And we will simply say, okay, here, this similarity."}, {"start": 859.04, "end": 867.76, "text": " What if we use a kernel here. So a kernel simply is a similarity function of two vectors,"}, {"start": 867.76, "end": 871.48, "text": " if you interpret it like it has some more conditions, I know, I know, don't freak on"}, {"start": 871.48, "end": 880.5799999999999, "text": " me. But the interesting properties about kernels is that if a similarity function is a kernel,"}, {"start": 880.58, "end": 890.84, "text": " it means that there exists a mapping. And where do we do so, if k between a and b is"}, {"start": 890.84, "end": 902.12, "text": " a kernel, if k is a kernel, that means that there exists a similar a function phi, such"}, {"start": 902.12, "end": 912.44, "text": " that phi, such that the kernel between a and b can be expressed as a linear product between"}, {"start": 912.44, "end": 923.32, "text": " phi of a and phi of b transpose. Okay, this is like, this is an inner product. So what"}, {"start": 923.32, "end": 931.6800000000001, "text": " it means is that this can be like a super nonlinear function, a kernel. For example,"}, {"start": 931.68, "end": 938.0799999999999, "text": " it can be and the example often given in like machine learning classes is maybe something"}, {"start": 938.0799999999999, "end": 943.68, "text": " like this, you have one dimensional data, right, and here is the error zero. And you"}, {"start": 943.68, "end": 950.3599999999999, "text": " have two kinds of data points, you have the x's right here, and you have the circles right"}, {"start": 950.3599999999999, "end": 959.5, "text": " here. Now, I cannot classify this data linearly. However, however, I can transform this into"}, {"start": 959.5, "end": 967.76, "text": " a higher dimensional space. So my function phi is of my function phi of x is going to"}, {"start": 967.76, "end": 975.84, "text": " map to the vector x x squared. And that will transform the data into a two dimensional"}, {"start": 975.84, "end": 983.98, "text": " space, right. And the data will look something like this. So it's going to the y axis is"}, {"start": 983.98, "end": 991.36, "text": " going to be the square of the x axis, okay. And like this, and now I can find a linear"}, {"start": 991.36, "end": 1002.96, "text": " classifier. Okay, so in this case, right here, you can see that in this higher space, things"}, {"start": 1002.96, "end": 1012.9200000000001, "text": " become linear, things become linearly classifiable. And very similarly, like this is you can define"}, {"start": 1012.92, "end": 1018.28, "text": " the similarity between things right here. So the similarity function would be the square"}, {"start": 1018.28, "end": 1026.72, "text": " function right here. And this would be a quadratic an example of a quadratic kernel. So this"}, {"start": 1026.72, "end": 1033.24, "text": " function right here can be very non linear. I mean, it can be a linear function, but it"}, {"start": 1033.24, "end": 1039.32, "text": " can be very nonlinear. But it is equivalent, it is equivalent, this means it is equivalent"}, {"start": 1039.32, "end": 1049.8799999999999, "text": " to a linear function in a high dimensional space. Now to figure out linear to figure"}, {"start": 1049.8799999999999, "end": 1056.9199999999998, "text": " out what this function phi is, is the big, the big question, of course, for a couple"}, {"start": 1056.9199999999998, "end": 1062.6, "text": " of kernels, we know the function phi, right for the quadratic kernel, for example, we"}, {"start": 1062.6, "end": 1070.3999999999999, "text": " know we just saw that phi maps this to the vector of the coordinate and it's quadratic"}, {"start": 1070.3999999999999, "end": 1076.12, "text": " to its square, we know for a couple of other kernels what their associated functions are."}, {"start": 1076.12, "end": 1081.76, "text": " But in general, if it's a kernel, then we can just replace it with a linear function."}, {"start": 1081.76, "end": 1090.52, "text": " With with with this thing, and in reverse, we can just say, well, what we could do is"}, {"start": 1090.52, "end": 1099.4, "text": " we could just simply define a function phi, and basically map this into map these a and"}, {"start": 1099.4, "end": 1105.08, "text": " b into a higher dimensional space, where this super duper nonlinear function would just"}, {"start": 1105.08, "end": 1109.04, "text": " become a linear function, wouldn't that be much easier, linear functions are much easier"}, {"start": 1109.04, "end": 1115.98, "text": " to work with than long nonlinear functions. And if we know that, as long as we get the"}, {"start": 1115.98, "end": 1121.04, "text": " correct phi, we do exactly the same thing as the nonlinear function, you know, that"}, {"start": 1121.04, "end": 1126.76, "text": " would be helpful. So there is an entire literature in the entire like decade of kernelization"}, {"start": 1126.76, "end": 1132.32, "text": " and kernelize everything kernelized SVMs to start, but then you can go way further in"}, {"start": 1132.32, "end": 1137.98, "text": " this. And this is just the beginning. And this is just a very sloppy explanation by"}, {"start": 1137.98, "end": 1144.6, "text": " me right here. But ultimately, they're saying, hey, instead of doing complicated nonlinear"}, {"start": 1144.6, "end": 1152.3999999999999, "text": " similarity function like the softmax, can't we just project a and b into the higher dimensional"}, {"start": 1152.3999999999999, "end": 1160.08, "text": " space, and then just do the linear inner product? And do the same thing as the softmax? And"}, {"start": 1160.08, "end": 1167.8, "text": " the answer is yes. And no, we know that for the softmax, the particular five function"}, {"start": 1167.8, "end": 1172.6, "text": " that we would need would map to an infinite dimensional space. Usually, usually this is"}, {"start": 1172.6, "end": 1180.0, "text": " applied in reverse. It's like, oh, here, instead, usually in machine learning, they say, you"}, {"start": 1180.0, "end": 1183.76, "text": " know, we want to do this, we want to map it into a high dimensional space, there's just"}, {"start": 1183.76, "end": 1187.1999999999998, "text": " linear, but we we can't because these spaces are too high dimensional. And therefore, we"}, {"start": 1187.1999999999998, "end": 1193.6799999999998, "text": " find an equivalent kernel function. And it's usually said, well, we use an RBF kernel that"}, {"start": 1193.6799999999998, "end": 1198.12, "text": " corresponds to an infinite dimensional space and so on. That's pretty cool. Here, it's"}, {"start": 1198.12, "end": 1205.12, "text": " the reverse here, it's, we want to do, we want the linear function, we end the equivalent"}, {"start": 1205.12, "end": 1212.9599999999998, "text": " of the softmax function is an infinite dimensional function, which we can't do, right, we can't"}, {"start": 1212.9599999999998, "end": 1222.32, "text": " feasibly compute an infinite dimensional space explicitly. So it's not possible to just do"}, {"start": 1222.32, "end": 1227.9199999999998, "text": " the equivalent thing than in a transformer. However, you can still do something else,"}, {"start": 1227.92, "end": 1232.88, "text": " you can still use polynomial kernels, you can still use any kind of kernels that have"}, {"start": 1232.88, "end": 1237.92, "text": " corresponding functions that map to a finite dimensional space. And that's what this paper"}, {"start": 1237.92, "end": 1246.0, "text": " does. So here, they say, if we have such a function that maps these things into a higher"}, {"start": 1246.0, "end": 1253.0800000000002, "text": " dimensional space, such that their inner product, such that the similarity function in this"}, {"start": 1253.08, "end": 1258.8799999999999, "text": " higher dimensional space is an inner product, then we can write it as just this inner product"}, {"start": 1258.8799999999999, "end": 1263.56, "text": " right here explicitly. And then because of the associativity, you can see that here is"}, {"start": 1263.56, "end": 1270.56, "text": " an I and here there's no I so we can just sort of pull this out of this sum and as well,"}, {"start": 1270.56, "end": 1276.8799999999999, "text": " right here, it doesn't don't don't cross this away. These are vectors, right? But you can"}, {"start": 1276.88, "end": 1284.48, "text": " see, especially here, you can see pretty clear, why is there a cursor stop, you can see that"}, {"start": 1284.48, "end": 1291.0, "text": " this here, you have to pay attention to the matrix dimension. So if we use like bracket"}, {"start": 1291.0, "end": 1303.44, "text": " notation, this is like this, like this, like this and like this. Okay, so here on the bottom,"}, {"start": 1303.44, "end": 1310.3200000000002, "text": " you see that there is an inner product. So each output will be normalized by this inner"}, {"start": 1310.3200000000002, "end": 1316.06, "text": " product right here. However, the top is going to be a vector, we know that, you know, each"}, {"start": 1316.06, "end": 1323.6200000000001, "text": " output is a vector. So the top will aggregate these vectors right here, according to this"}, {"start": 1323.6200000000001, "end": 1330.06, "text": " routing. Okay, but if we write it like this, you can see that what we could technically"}, {"start": 1330.06, "end": 1334.8799999999999, "text": " do is we could technically compute this part here once because it doesn't contain any I."}, {"start": 1334.8799999999999, "end": 1341.12, "text": " So there's no I in that part. So we could just compute it once because we have these"}, {"start": 1341.12, "end": 1350.78, "text": " two, these two layers of the attention mechanism. And these K and V, they just refer to this"}, {"start": 1350.78, "end": 1356.24, "text": " lower layer right here. We could just compute that thing on the right ones, that's going"}, {"start": 1356.24, "end": 1360.76, "text": " to give us a matrix, as you can see right here from the dimensions. And then we can"}, {"start": 1360.76, "end": 1366.52, "text": " simply take the product of that vector right here of the vector on the left with the matrix"}, {"start": 1366.52, "end": 1373.2, "text": " on the right. And we'd be done. It's one operation, right? Instead of for each thing, you know,"}, {"start": 1373.2, "end": 1379.28, "text": " going and attending to each other, and then do the softmax. Without the softmax, we can"}, {"start": 1379.28, "end": 1387.48, "text": " all do this in a linear fashion. So that makes it a lot easier. In fact, it makes the computation"}, {"start": 1387.48, "end": 1397.44, "text": " linear in. So this is now O of n. Okay, plus, of course, the the work that you have to do"}, {"start": 1397.44, "end": 1402.04, "text": " for mapping this into the higher dimensional space. But this is also not quadratic, this"}, {"start": 1402.04, "end": 1412.76, "text": " is done to each of these elements individually. Okay, so this, this is now, as we said, it's"}, {"start": 1412.76, "end": 1416.92, "text": " pretty easy. You can calculate the matrix on the top, you can actually also calculate"}, {"start": 1416.92, "end": 1421.48, "text": " this part right here, this vector, you can aggregate over the bottom. And then if you"}, {"start": 1421.48, "end": 1428.2, "text": " go through the top, it's simply a inner product with the vector of the queries, and you're"}, {"start": 1428.2, "end": 1435.72, "text": " done. And this is it, in fact, in matrix form, you can simply write it down as one matrix"}, {"start": 1435.72, "end": 1445.78, "text": " multiplication. Seems pretty easy. So the computational cost goes way down. And they"}, {"start": 1445.78, "end": 1453.56, "text": " use the following function right here. Okay, this is their map to the higher dimensional"}, {"start": 1453.56, "end": 1459.12, "text": " space. So they say for our experiments that deal with smaller sequences, we employ a feature"}, {"start": 1459.12, "end": 1465.12, "text": " map that results in a positive similarity function as defined below. So right here,"}, {"start": 1465.12, "end": 1470.8, "text": " you have to pay attention, you can't just pick any function. But you can you can pick"}, {"start": 1470.8, "end": 1477.8799999999999, "text": " a lot of different functions, where LU denotes the exponential linear unit activation function."}, {"start": 1477.88, "end": 1485.72, "text": " Okay, like this seems, this seems fine. They also say in our experimental section, we show"}, {"start": 1485.72, "end": 1491.0800000000002, "text": " that the feature map of equation seven performs on par with the full transformer, while significantly"}, {"start": 1491.0800000000002, "end": 1497.0400000000002, "text": " reducing the computational memory requirements. This, you know, it seems, it seems like the"}, {"start": 1497.0400000000002, "end": 1502.2800000000002, "text": " the original transformer, this choice of the softmax function, even though it's, you know,"}, {"start": 1502.2800000000002, "end": 1507.8400000000001, "text": " powerful and can't be approximated with this trick right here, it was also somewhat arbitrary,"}, {"start": 1507.84, "end": 1513.6799999999998, "text": " I mean, there is a reasoning behind it, but it's also somewhat like, and it's entirely"}, {"start": 1513.6799999999998, "end": 1522.52, "text": " possible right that that this here is way faster. So I want to jump this causal masking"}, {"start": 1522.52, "end": 1529.6, "text": " thing for now and look at the results where you can see a verify the fact that in terms"}, {"start": 1529.6, "end": 1536.28, "text": " of time in terms of GPU memory, if they apply their transformer and here on the x axis,"}, {"start": 1536.28, "end": 1542.96, "text": " you see sequence length, you can see that the this is log plot, right? These are log"}, {"start": 1542.96, "end": 1550.48, "text": " plots, you can see that the original transformer right here has a way steeper slope than their"}, {"start": 1550.48, "end": 1557.72, "text": " transformer, which is the black line right here. The blue lines are the reformers, which"}, {"start": 1557.72, "end": 1562.76, "text": " we've also I've also done a video on reformer. If you want to check that out, that is also"}, {"start": 1562.76, "end": 1571.16, "text": " a trick that uses locality sensitive hashing to get rid of the quadratic attention mechanism."}, {"start": 1571.16, "end": 1578.4, "text": " Now the locality sensitive hashing also means that you kind of lose some accuracy. So that's"}, {"start": 1578.4, "end": 1583.52, "text": " the trade off right here. But you can see that is also linear, actually, it's n log"}, {"start": 1583.52, "end": 1589.72, "text": " n depending on the sequence length, but the log n is negligible. So you see GPU memory"}, {"start": 1589.72, "end": 1596.16, "text": " and time way down. And in terms of experiments, it does perform on par, it seems like it has"}, {"start": 1596.16, "end": 1600.98, "text": " different optimization trajectory, but they show that, you know, there is this trade off"}, {"start": 1600.98, "end": 1606.96, "text": " for the reformer where you lose in accuracy, they do not experience that trade off in the"}, {"start": 1606.96, "end": 1615.22, "text": " linear transformer compared to the original transformer in their particular experiments."}, {"start": 1615.22, "end": 1622.1200000000001, "text": " Now they do their experiments sort of show that they are not on par with the original"}, {"start": 1622.1200000000001, "end": 1626.6000000000001, "text": " transfer like they are on par in some of the tasks, but also in some of the tasks, they"}, {"start": 1626.6000000000001, "end": 1634.84, "text": " are not on par. For example, this speech data set right here, where they do fairly well,"}, {"start": 1634.84, "end": 1640.84, "text": " they actually beat the BI-LSTM baseline and the reformer, but they do not beat the softmax"}, {"start": 1640.84, "end": 1648.24, "text": " transformer. So there's, it is still the case that the softmax transformer is more powerful"}, {"start": 1648.24, "end": 1655.9199999999998, "text": " than the thing here and we'll give some intuition very shortly on that. But the linear transformer"}, {"start": 1655.9199999999998, "end": 1664.52, "text": " is way faster. Here it's three times faster. And up here, it is 300 times faster. And on"}, {"start": 1664.52, "end": 1671.16, "text": " MNIST, and if you go on C410, it is 4000 times faster. Simply by property of the longer either"}, {"start": 1671.16, "end": 1677.72, "text": " sequences are that you input, the much more matters the fact that the softmax transformer"}, {"start": 1677.72, "end": 1684.44, "text": " has a quadratic runtime, whereas the linear transformer has a linear runtime. And I was"}, {"start": 1684.44, "end": 1690.96, "text": " also surprised here to see that the reformer wasn't that much faster. That's probably due"}, {"start": 1690.96, "end": 1696.76, "text": " to the fact that it already has like a big overhead in these hashing rounds and so on,"}, {"start": 1696.76, "end": 1702.52, "text": " that probably is hurting it at sort of a constant level. I guess if you were to up the sequence"}, {"start": 1702.52, "end": 1710.04, "text": " length even more than the reformer would also improve a lot more over the softmax transformer."}, {"start": 1710.04, "end": 1719.08, "text": " Okay, so what's happening here? What's happening with this attention? And why is it different?"}, {"start": 1719.08, "end": 1724.48, "text": " What does it makes it different from the old attention? Now I want to, I want to sort of"}, {"start": 1724.48, "end": 1733.12, "text": " connect this to the kind of old and old, the old and literature of topic modeling. So if"}, {"start": 1733.12, "end": 1737.98, "text": " you think of the of this transformer, again, of this attention mechanism, what you'll have"}, {"start": 1737.98, "end": 1745.08, "text": " is a dynamic routing of information, right? So for each, from each output token, you get"}, {"start": 1745.08, "end": 1750.9199999999998, "text": " to look at all the input tokens. If we, for example, select this one, you get to look"}, {"start": 1750.9199999999998, "end": 1757.02, "text": " and you get to decide for each one, how do I want to aggregate my information? Okay,"}, {"start": 1757.02, "end": 1760.32, "text": " and this is what makes this quadratic from each of the output tokens, you get to look"}, {"start": 1760.32, "end": 1767.1, "text": " at all of the input tokens and decide how you want to do that. And that is can be very"}, {"start": 1767.1, "end": 1773.8, "text": " long nonlinear in terms of when we use the softmax and so on. So that's what makes it"}, {"start": 1773.8, "end": 1778.76, "text": " very expensive. What this thing is doing is the following. It takes all the keys right"}, {"start": 1778.76, "end": 1785.0, "text": " here. So here we have all the keys. And it's going to map them through this five function,"}, {"start": 1785.0, "end": 1790.44, "text": " right? Each key is going to map through the five function. And each query is also going"}, {"start": 1790.44, "end": 1796.22, "text": " to be mapped through the five function into these higher dimensional spaces. And then"}, {"start": 1796.22, "end": 1800.8999999999999, "text": " an inner product is performed between the two and that decides the routing. This is"}, {"start": 1800.9, "end": 1808.0400000000002, "text": " very similar to like topic models, where if you interpret this, this right here can be"}, {"start": 1808.0400000000002, "end": 1816.2800000000002, "text": " a mapping of my dimension of these keys and queries to the topics. So essentially, what's"}, {"start": 1816.2800000000002, "end": 1823.2, "text": " happening right here is for each of the input tokens, sorry, input tokens here, output tokens"}, {"start": 1823.2, "end": 1830.4, "text": " here, the dimension of this map defines is how many topics there are. So in you know,"}, {"start": 1830.4, "end": 1837.76, "text": " in these topics modeling, you would have things like I want to I have news articles or words,"}, {"start": 1837.76, "end": 1844.3200000000002, "text": " and then I define like a set of topics. And I'm going to assign each word to a topic."}, {"start": 1844.3200000000002, "end": 1852.88, "text": " And then I'm going to assign each news article to a topic and so on. And then you kind of"}, {"start": 1852.88, "end": 1856.92, "text": " do this dimension reduction. But this can be done in many ways. So let's say this is"}, {"start": 1856.92, "end": 1862.48, "text": " a mapping to three dimensions. What this does is essentially this five function decides"}, {"start": 1862.48, "end": 1870.48, "text": " how you're going to map each of these inputs into these three topics. So you can say, oh,"}, {"start": 1870.48, "end": 1877.1200000000001, "text": " this token goes here and here, this one goes here, and a bit here, this one goes here,"}, {"start": 1877.1200000000001, "end": 1885.16, "text": " and so on. So again, this is a, this is a mapping into a well, in this case, a lower"}, {"start": 1885.16, "end": 1890.92, "text": " dimensional space. And then this function decides how you're going to aggregate these"}, {"start": 1890.92, "end": 1898.8400000000001, "text": " topics are over across here. And since this is, you know, this is now a linear multiplication"}, {"start": 1898.8400000000001, "end": 1903.1200000000001, "text": " between the two things. So these two are going to be your matrices, this here is going to"}, {"start": 1903.1200000000001, "end": 1910.8400000000001, "text": " be your phi of k, and this here is going to be your phi of q. So you can see the difference"}, {"start": 1910.84, "end": 1916.1599999999999, "text": " here between the old attention mechanism and the new attention mechanism, right, the old"}, {"start": 1916.1599999999999, "end": 1922.52, "text": " attention mechanism, each token was directly able to look at all the input tokens and decide"}, {"start": 1922.52, "end": 1928.72, "text": " how to aggregate the information. And here, it's sort of, we have this in between, in"}, {"start": 1928.72, "end": 1934.9199999999998, "text": " between representation in this higher dimensional space. And we can aggregate in only a we can"}, {"start": 1934.9199999999998, "end": 1940.52, "text": " distribute in a linear fashion. And we can aggregate in a linear fashion in and from"}, {"start": 1940.52, "end": 1950.58, "text": " this higher dimensional space. That's sort of how how I sort of how I imagine that, okay,"}, {"start": 1950.58, "end": 1956.8, "text": " so you get to distribute each token right here into these topics, and then the the outputs"}, {"start": 1956.8, "end": 1961.24, "text": " they, they don't see the inputs anymore, right, you see that in the formulation, there is"}, {"start": 1961.24, "end": 1970.76, "text": " a sum over j. So right here, there is this sum over j. And that means that the outputs"}, {"start": 1970.76, "end": 1976.76, "text": " here, they don't see the different inputs as different inputs, they only see the inputs"}, {"start": 1976.76, "end": 1982.4, "text": " through the map of the phi function. So they can only see the individual dimensions of"}, {"start": 1982.4, "end": 1989.68, "text": " that phi function, they cannot see the outputs anymore. And therefore, yeah, therefore, you"}, {"start": 1989.68, "end": 1998.28, "text": " don't have the dependence on the big quadratic dependence on this on this n. Okay, however,"}, {"start": 1998.28, "end": 2005.1200000000001, "text": " you do have a code, of course, now a dependence on this dimension of the intermediate representation."}, {"start": 2005.1200000000001, "end": 2013.48, "text": " And they also they say this, right, this is, you know, reasonable. Yeah, they do derive"}, {"start": 2013.48, "end": 2020.04, "text": " the gradients here to save even more memory. So you don't have to search that you don't"}, {"start": 2020.04, "end": 2026.0, "text": " have to, let's say store of all of these activations. That's pretty cool as well. And they implemented"}, {"start": 2026.0, "end": 2032.72, "text": " in CUDA, there is code available for the linear transformer, all of this pretty, pretty cool."}, {"start": 2032.72, "end": 2040.8, "text": " Okay. So the last thing they say they make the connections to RNNs. Now, this is a bit"}, {"start": 2040.8, "end": 2047.44, "text": " detached from the linear transformer. But because they formulated how they do, they"}, {"start": 2047.44, "end": 2053.6, "text": " can make this connection. So this now, this now is valid for all transformers, what they"}, {"start": 2053.6, "end": 2060.36, "text": " say right here. But keep in mind, it is valid for the original transformers in practice,"}, {"start": 2060.36, "end": 2067.56, "text": " if you can make this mapping phi to map to infinite dimensions, which you can't. But"}, {"start": 2067.56, "end": 2073.2, "text": " the analysis is equivalent. So they say, look, if we write the attention mechanism like this,"}, {"start": 2073.2, "end": 2080.2999999999997, "text": " and therefore, like this, what we can do is we can define these two quantities, right,"}, {"start": 2080.2999999999997, "end": 2085.44, "text": " s and z. This is what we said before, we can actually pre compute these quantities right"}, {"start": 2085.44, "end": 2095.24, "text": " here. Okay, so that reduces to this right here. If now we are looking at a autoregressive"}, {"start": 2095.24, "end": 2100.3199999999997, "text": " transformer, and we said before, what an autoregressive transformer was an autoregressive transformers,"}, {"start": 2100.3199999999997, "end": 2107.3199999999997, "text": " you have a piece of sequence and you are tasked to predict this next thing right here. Now,"}, {"start": 2107.3199999999997, "end": 2114.9599999999996, "text": " usually, if you want to train this using an RNN, you have to, you know, run your RNN input"}, {"start": 2114.9599999999996, "end": 2119.9199999999996, "text": " this hidden state and input that map forward the hidden state. So you have to do all of"}, {"start": 2119.92, "end": 2126.04, "text": " this forward propagation in order to derive at this hidden at this output right here,"}, {"start": 2126.04, "end": 2131.32, "text": " make the output and then you need to back prop through time right here. There is no"}, {"start": 2131.32, "end": 2137.16, "text": " way to what you would like to do is you would like to say here, I have a sentence, I can"}, {"start": 2137.16, "end": 2142.44, "text": " actually make like five different training examples from that sentence. So the first"}, {"start": 2142.44, "end": 2148.36, "text": " one is the one you just saw, I just block off the last word. But I can also make that"}, {"start": 2148.36, "end": 2155.08, "text": " training example right here, right to when I just cut a second to last word, and so on,"}, {"start": 2155.08, "end": 2159.7200000000003, "text": " I can actually make all of these different training examples for language modeling from"}, {"start": 2159.7200000000003, "end": 2164.6400000000003, "text": " a single sentence. And what I would like to do is I would like to train them all in parallel,"}, {"start": 2164.6400000000003, "end": 2170.38, "text": " right? I load my data point once I already have it, why can't I just train everything"}, {"start": 2170.38, "end": 2176.1200000000003, "text": " at the same time, like predict this from this word now predict also this from these two"}, {"start": 2176.12, "end": 2184.72, "text": " words, and the transformers are, you know, very well conditioned, they are very good"}, {"start": 2184.72, "end": 2193.16, "text": " at this basically. So what a transformer can do is if you input a sequence, like sorry,"}, {"start": 2193.16, "end": 2199.96, "text": " like the thing at the bottom, you can calculate the training signal for all of these different"}, {"start": 2199.96, "end": 2206.6, "text": " things at the same time. And okay, this was maybe a mistake, you can calculate the training"}, {"start": 2206.6, "end": 2213.1, "text": " signal for all of this at the same time, by using what's called causal masking in attention."}, {"start": 2213.1, "end": 2220.12, "text": " So if I have my attention mechanism, right here, let's consider it again, let's consider"}, {"start": 2220.12, "end": 2225.78, "text": " these two layers. If I have my attention mechanism, what I want to do is I want to constrain each"}, {"start": 2225.78, "end": 2231.8, "text": " token to only attend to tokens that came before it in the sequence. So for example, this token"}, {"start": 2231.8, "end": 2239.1200000000003, "text": " right here, I'm going to constrain it to only attend to itself and the past, because it"}, {"start": 2239.1200000000003, "end": 2246.0800000000004, "text": " will, it will predict the next token in the sequence. And it wouldn't be, it would be"}, {"start": 2246.0800000000004, "end": 2252.4, "text": " really easy if we could attend to the input of that token, right? It could simply remember"}, {"start": 2252.4, "end": 2258.7200000000003, "text": " what that token is, and then aggregate that here and then predict that. So if for each"}, {"start": 2258.7200000000003, "end": 2265.38, "text": " token, we restrict the attention to the tokens that came before it, like also for this right"}, {"start": 2265.38, "end": 2271.44, "text": " here, we restrict the attention only to go backwards, then we can train all of this in"}, {"start": 2271.44, "end": 2276.12, "text": " parallel. This is called causal masking, it's usually implemented with like a mask that"}, {"start": 2276.12, "end": 2283.12, "text": " is like an upper diagonal. And it's a bit unclear if you can attend to yourself, because"}, {"start": 2283.12, "end": 2287.2, "text": " then I guess this will become the output and you can only attend to this. I don't know"}, {"start": 2287.2, "end": 2294.44, "text": " exactly how it is implemented. But there it is usually realized with an upper triangular"}, {"start": 2294.44, "end": 2304.7799999999997, "text": " matrix as a mask. And you apply this mask to each layer. Now, they say that this is"}, {"start": 2304.78, "end": 2310.84, "text": " actually like an RNN. And with their formulation, you can make this pretty explicit. Namely,"}, {"start": 2310.84, "end": 2318.52, "text": " you have these two states s and z. And in each sequence element, it's actually like"}, {"start": 2318.52, "end": 2327.88, "text": " an RNN, where you update the s and z with these quantities right here. And so it's like"}, {"start": 2327.88, "end": 2333.7200000000003, "text": " an RNN where these are the hidden states that you pass forward, right? And then you can"}, {"start": 2333.72, "end": 2340.72, "text": " formulate any transformer as an RNN that simply updates these two states. But you see, you"}, {"start": 2340.72, "end": 2348.58, "text": " need the explicit mapping of these of this kernel function, you need this explicit mapping"}, {"start": 2348.58, "end": 2354.3599999999997, "text": " in order to be able to do this, because otherwise, this is here, this is not going to be a linear"}, {"start": 2354.3599999999997, "end": 2360.52, "text": " addition, it is going to be complicated, you can't do it by simply remembering the past"}, {"start": 2360.52, "end": 2366.52, "text": " state. So you need that formulation in order to be able to express it as an RNN. But their"}, {"start": 2366.52, "end": 2374.36, "text": " analysis shows that this a transformer autoregressive is essentially an RNN. And you can you can"}, {"start": 2374.36, "end": 2381.44, "text": " so you can make a connection in that and you can actually formulate this as an RNN, which"}, {"start": 2381.44, "end": 2387.46, "text": " means that you can train in the transformer fashion, everything at the same time. But"}, {"start": 2387.46, "end": 2394.44, "text": " what is cool about an RNN, an RNN at inference time, an RNN, once it has produced, you know,"}, {"start": 2394.44, "end": 2401.84, "text": " this word, it can then because if you produce autoregressively, you simply say, Hey, I have"}, {"start": 2401.84, "end": 2407.08, "text": " this beginning of my news article, please finish it. So the model must output the next"}, {"start": 2407.08, "end": 2411.84, "text": " word and then from that sequence, it must output the next part, the next word and then"}, {"start": 2411.84, "end": 2417.28, "text": " from that the next word and so on. And RNN because of the nature of simply passing forward"}, {"start": 2417.28, "end": 2422.0400000000004, "text": " hidden states at inference time can simply you know, remember what the hidden states"}, {"start": 2422.0400000000004, "end": 2428.48, "text": " were input those again input the output here and go on. So it's pretty fast at inference"}, {"start": 2428.48, "end": 2435.0, "text": " time, which a transformer isn't with their formulation. Now, if they have the explicit"}, {"start": 2435.0, "end": 2441.1800000000003, "text": " function phi, they can use this at inference time to be so much faster. In fact, on their"}, {"start": 2441.18, "end": 2447.6, "text": " website, which I'll link, of course, in the in the description, you can play with image"}, {"start": 2447.6, "end": 2454.2, "text": " generation using one of these transformers in your browser. So you can simply start a"}, {"start": 2454.2, "end": 2461.22, "text": " transformer run in your browser. That's how easy this becomes. So you can see the linear"}, {"start": 2461.22, "end": 2468.08, "text": " transformer with causal masking, you'll simply update these states right here, and then pass"}, {"start": 2468.08, "end": 2475.6, "text": " those forward. So easy. And the backward pass, as we said, I don't want to go into the gradient"}, {"start": 2475.6, "end": 2480.14, "text": " calculation, but they derive the gradient such that you don't have to remember these"}, {"start": 2480.14, "end": 2489.04, "text": " hidden states and it becomes or it is linear in or it saves a lot of more memory than before."}, {"start": 2489.04, "end": 2497.2799999999997, "text": " Okay. Note, so this is the last comment from my side. Note that this this causal masking"}, {"start": 2497.28, "end": 2507.6400000000003, "text": " transformers, they are, they are a bit of a hack in transformers. And because so ultimately,"}, {"start": 2507.6400000000003, "end": 2515.78, "text": " let's say, let's say, I have this sequence right here, this is given. And I want to predict"}, {"start": 2515.78, "end": 2523.28, "text": " this word right here. What? And okay, let's make it up here. So I need multiple layers"}, {"start": 2523.28, "end": 2530.4, "text": " for this. So I want to predict that next word. And I have multiple layers, right? So I want"}, {"start": 2530.4, "end": 2535.7000000000003, "text": " to predict this from from the outputs right here, let's say there is an output node right"}, {"start": 2535.7000000000003, "end": 2543.6400000000003, "text": " here, I want to predict that particular word. It's true that I should only be able to aggregate"}, {"start": 2543.6400000000003, "end": 2550.6200000000003, "text": " information from whatever was, you know, on the back right here. But technically, in a"}, {"start": 2550.62, "end": 2556.68, "text": " transformer, it would be completely valid to say that this node right here, which is"}, {"start": 2556.68, "end": 2562.12, "text": " let's say that's an article, and it followed by a noun, right, would be able to attend"}, {"start": 2562.12, "end": 2569.22, "text": " to that one. And then that one would be able to attend to that one. And or sorry, the output"}, {"start": 2569.22, "end": 2574.14, "text": " right here would be able to attend to that one. This would not violate the autoregressive"}, {"start": 2574.14, "end": 2580.44, "text": " property, right? You can, but you can see that in the intermediate layer, this node right"}, {"start": 2580.44, "end": 2586.8399999999997, "text": " here is attending to a forward node. Now, if you do things like this, you can't do this"}, {"start": 2586.8399999999997, "end": 2594.92, "text": " trick anymore, where you train everything at once. Because if if this connection exists,"}, {"start": 2594.92, "end": 2601.64, "text": " that also means that if in this other training sample where this is the word to be predicted,"}, {"start": 2601.64, "end": 2608.2799999999997, "text": " then this node could aggregate information from that node and basically cheat. But the"}, {"start": 2608.2799999999997, "end": 2615.0, "text": " the technical autoregressive property is not violated by this connection right here. And"}, {"start": 2615.0, "end": 2620.7999999999997, "text": " you only get this RNN formulation if you do not have these connections, right. So the"}, {"start": 2620.7999999999997, "end": 2626.08, "text": " this this hack to make the autoregressive transformers train in parallel is actually"}, {"start": 2626.08, "end": 2632.6, "text": " making the transformer formulation much weaker. And therefore, that's then equivalent to an"}, {"start": 2632.6, "end": 2638.96, "text": " RNN. Okay, I it's not that transformers in general are equivalent to an RNN, or at least"}, {"start": 2638.96, "end": 2645.64, "text": " this paper doesn't show that. It's just that these hacked transformers are. And I think"}, {"start": 2645.64, "end": 2652.18, "text": " that's an important distinction to make here, rather than saying transformers are RNNs."}, {"start": 2652.18, "end": 2657.24, "text": " If we could only approximate the softmax in these infinite dimensions. I don't think that's"}, {"start": 2657.24, "end": 2662.8999999999996, "text": " entirely true. But it is true for the transformers, the autoregressive transformers that we currently"}, {"start": 2662.8999999999996, "end": 2672.98, "text": " train. Now, why is this connection so powerful? It allows a token to attend to, you know,"}, {"start": 2672.98, "end": 2679.3999999999996, "text": " tokens forward of it. And what does it mean to be able to tend like, let's say, it's really"}, {"start": 2679.4, "end": 2686.6800000000003, "text": " important that this token right here, attends to that token right here. What would you need"}, {"start": 2686.6800000000003, "end": 2693.12, "text": " to do if you couldn't do that? If you let's let's, let's say this is a program, right?"}, {"start": 2693.12, "end": 2699.38, "text": " So this token is the function f and it needs the input, this argument a of whatever token"}, {"start": 2699.38, "end": 2709.1600000000003, "text": " comes in front of it, and needs to do something conditioned on a so if a if a is one, it does"}, {"start": 2709.16, "end": 2715.7, "text": " something if a is two, it does something else, right? If you if you don't have if you can't"}, {"start": 2715.7, "end": 2722.8399999999997, "text": " input a, then you can simply pass on the output value, what you'll have to do is conceptually"}, {"start": 2722.8399999999997, "end": 2728.12, "text": " is basically you'll have to store the entire code of the function into hidden state. If"}, {"start": 2728.12, "end": 2733.8799999999997, "text": " this is an RNN, right, it can't look forward, it needs to store the entire code of this"}, {"start": 2733.88, "end": 2740.1600000000003, "text": " function f. So all it needs to basically build this map, if a is one, then this if a is two,"}, {"start": 2740.1600000000003, "end": 2744.88, "text": " then this if a is three, then this store that in the hidden state. And then once a comes"}, {"start": 2744.88, "end": 2749.0, "text": " around in the next time step, this can be resolved, you can see that this is infinitely"}, {"start": 2749.0, "end": 2756.32, "text": " more complicated than simply looking forward and outputting the value yourself. So that's"}, {"start": 2756.32, "end": 2763.6, "text": " sort of the difference in power that these two formulations are talking about. Okay,"}, {"start": 2763.6, "end": 2770.08, "text": " so yeah, two parts to this paper, first part, linear transformer through kernels, second"}, {"start": 2770.08, "end": 2775.92, "text": " part, if you formulate it like this, it is equivalent. So a autoregressive transformer"}, {"start": 2775.92, "end": 2781.6, "text": " in this way becomes equivalent to an RNN. And here are some of the output samples, you"}, {"start": 2781.6, "end": 2786.56, "text": " know, they're, they're pretty, pretty good, though, if you look at the more output samples"}, {"start": 2786.56, "end": 2793.64, "text": " they have here, it. So here, this, this is the linear one. And you can see, for example,"}, {"start": 2793.64, "end": 2799.04, "text": " as already in this very bottom one, this one right here, it's the kind of all the other"}, {"start": 2799.04, "end": 2806.22, "text": " transformers get the slant to the right, and that the the original has, whereas this one"}, {"start": 2806.22, "end": 2810.44, "text": " is simply straight. I mean, I don't want to, I don't want to dunk on this, like these others"}, {"start": 2810.44, "end": 2815.4, "text": " make a lot of mistake, mistakes right here. But here, I also saw, you know, all of them"}, {"start": 2815.4, "end": 2821.6800000000003, "text": " get that this is going to be the number three, while this one is somehow making this circle"}, {"start": 2821.6800000000003, "end": 2830.2400000000002, "text": " in here. So it is not perfect. And even though it's on par, where in the tasks they see,"}, {"start": 2830.2400000000002, "end": 2835.8, "text": " you can see right here that especially in this speech recognition, the original transformer"}, {"start": 2835.8, "end": 2844.0, "text": " right here is significantly outperforming the linear transformer, which is the one in"}, {"start": 2844.0, "end": 2849.84, "text": " black right here, in fact, in all of the tasks, but ultimately, it might not matter because"}, {"start": 2849.84, "end": 2856.56, "text": " they reach, you know, the same, they reach the same, they reach the same accuracy or"}, {"start": 2856.56, "end": 2862.6, "text": " whatnot, and the linear transformer is way, way faster. So I can see that this is going"}, {"start": 2862.6, "end": 2868.92, "text": " to be a thing that people apply, I guess time will tell. Right, I invite you to read the"}, {"start": 2868.92, "end": 2875.16, "text": " paper, tell me what you think I might be totally wrong here with any of my formulations or"}, {"start": 2875.16, "end": 2882.32, "text": " my intuition about what this new attention mechanism does. Yeah, please let me know."}, {"start": 2882.32, "end": 2899.6000000000004, "text": " And I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=O9kFX33nUcU
On the Measure of Intelligence by François Chollet - Part 4: The ARC Challenge (Paper Explained)
In this part, we look at the ARC challenge as a proposed test of machine intelligence. The dataset features 1000 tasks that test rapid generalization based on human core knowledge priors, such as object-ness, symmetry, and navigation. OUTLINE: 0:00 - Intro 0:55 - What is ARC? 6:30 - The Goals of ARC 10:40 - Assumed Priors & Examples 21:50 - An Imagined Solution 28:15 - Consequences of a Solution 31:00 - Weaknesses 31:25 - My Comments & Ideas Paper: https://arxiv.org/abs/1911.01547 ARC: https://github.com/fchollet/ARC Abstract: To make deliberate progress towards more intelligent and more human-like artificial systems, we need to be following an appropriate feedback signal: we need to be able to define and evaluate intelligence in a way that enables comparisons between two systems, as well as comparisons with humans. Over the past hundred years, there has been an abundance of attempts to define and measure intelligence, across both the fields of psychology and AI. We summarize and critically assess these definitions and evaluation approaches, while making apparent the two historical conceptions of intelligence that have implicitly guided them. We note that in practice, the contemporary AI community still gravitates towards benchmarking intelligence by comparing the skill exhibited by AIs and humans at specific tasks such as board games and video games. We argue that solely measuring skill at any given task falls short of measuring intelligence, because skill is heavily modulated by prior knowledge and experience: unlimited priors or unlimited training data allow experimenters to "buy" arbitrary levels of skills for a system, in a way that masks the system's own generalization power. We then articulate a new formal definition of intelligence based on Algorithmic Information Theory, describing intelligence as skill-acquisition efficiency and highlighting the concepts of scope, generalization difficulty, priors, and experience. Using this definition, we propose a set of guidelines for what a general AI benchmark should look like. Finally, we present a benchmark closely following these guidelines, the Abstraction and Reasoning Corpus (ARC), built upon an explicit set of priors designed to be as close as possible to innate human priors. We argue that ARC can be used to measure a human-like form of general fluid intelligence and that it enables fair general intelligence comparisons between AI systems and humans. Authors: François Chollet Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there and welcome to the last part of On the Measure of Intelligence by Francois Chollet. This last part concerns the ARC challenge that Chollet has proposed, or the ARC dataset, which stands for the Abstraction and Reasoning Corpus. And we're just quickly going over the dataset, look how it's built and discuss what kind of solutions might be relevant right here. So if you haven't seen the last videos in this series, this is the last one of a series, you might not exactly know what's going on. But I think you can you can keep up pretty well because this part is fairly independent of the other parts. And it's just cool to think about even if you haven't seen the other ones, I encourage you to go see the other ones, but it's not necessary. Okay, let's jump in. So the ARC is a challenge currently running a Kaggle challenge. But in essence, it is a dataset. And let me just jump into one of the tasks of the dataset. So in this dataset, you always have the task in the following form. So you always have multiple input examples, like this, or say, these are called the training examples. And then you have a test example. In this case, you have three training example, one test example. So an entire, if you think of this in a machine learning way, this entire thing here is your x. And this thing here is your y. Okay, so the label is going to be the output of the last example that you you don't know that. Now in the in the course in the training dataset, you do, but in the test, you don't. So each one of these, as I said, is, is, is demonstrated, these are the demonstration examples, and then you're supposed to sort of learn the regularity out of the demonstration examples. And then on this test example, you are supposed to apply this regularity that you learned. So in here, a human can fairly accurately see that there are these black squares in each image, and that in the training samples, the output will always sort of exactly match into the place of these black squares. As you can see, this is like a high rectangle, it goes here, it has the same amount of tiles and so on. And you can also see that whatever colors are in here sort of are the continuation of a symmetric pattern. So here, this is exactly the same as up here, but you know, flipped or turned by 180 degrees. So there is a notion of symmetry right here. So technically, one could compute this one would say, Oh, that's probably going to be the three rows and this bunch of things. And it's probably going to be the same as this one down here, but just flipped on its head. So as a human, you get this, even without a description, you realize like, Oh, this is like a regular pattern, it's symmetric, there's a hole in it. And apparently the thing here always fills the hole, I can see that, you know, three examples are enough for me to confirm that that's what's going on. And I see the hole here. So I'm going to do the same thing. So you can already see how these things are constructed in every, this is not the only task by the way, this is just one task, okay, there are 1000 tasks in this data set of this sort of nature. Now, there are not always three demonstration examples, I believe there can be more or less. But what's always the case is they always, each of these training examples consists of these demonstration examples. And this test example, each of the demonstration examples consists of an input grid and an output grid. And the input grid and output grid, they can be anywhere from one by one to 30 by 30. Okay, anywhere in between that. And the colors here, I believe there are nine different colors that can go, they're just encoded by nine different numbers. But there are nine different colors that these things can have, you can see black, blue, orange, red, dark blue, and so on. And the output grid exactly the same. Now in this test example, you can only see the input grid, you cannot see the output grid. And that means you don't even know how large it should be, you can see right here, they're not all the same size, the output grids. In fact, not even the input grids have to be always the same size. But you have to now come up with an output grid, you have to first decide how big it is. And we've here we've determined since the whole has three rows, we're probably going to make three rows and it has like seven columns, we're probably going to make seven columns. And that's the sort of thing you have to do. And then not only do you have to decide how big it is, you now have to decide in each cell what color you put in. And only if this thing exactly matches the train or the test label, you get a you get a point. Otherwise, you get no point. Okay, so in the training task, there are I believe 400 of these tasks. And then there are 400 more as test split, but these are still public. And then there are 200 that are secret. That are I guess, part of this Kaggle challenge. Yes, the training set features 400 tasks, while the evaluation set features 600 tasks. The evaluation set is further split into a public evaluation set of 400 tasks and a private evaluation set of 200 tasks. All tasks are unique. And the set of tasks and the set of training tasks are disjoint, sorry, of test tasks and training tasks. The task data is available at this, as you can see right here. So I really hope that Sholay will keep these 200 tasks as a secret, even after the Kaggle challenge, because it's going to be fun for people that might want to get into this later. So here are the goals of this data set. They want to stay close to these psychometric intelligence tests. They say in particular, it should be solvable by humans without any specific practice or training and probably also without any language instructions. So you should be able to set a human in front of it and the human should be able to solve it or a large portion of humans should be able to solve it, right? Ideally, this test would also differentiate humans from each other. But at this point, we want to simply assess machines. So they say focus on measuring developer aware generalization rather than task specific skill by only featuring novel tasks in the evaluation set. And the novel tasks are unknown to the developer of a test taker. So if I develop a system, I don't know what are these 200 tasks that Sholay keeps hidden, I simply submit my code, and I'll figure out if my code does well on them. So they say they want to feature highly abstract tasks must be understood by a test taker using very few examples. That's what you saw, you don't have a big training example to learn that this task is about symmetry and whole filling. You only have three. And from three, you need to recognize what's going on and produce the output of the test sample, right? Quality of control for experience by only providing a fixed amount of training data for each task. That's what we saw, and only featuring tasks that do not lend themselves well to artificially generating new data. So it's not like ImageNet, where you can go on the internet and find a whole bunch of images or you know, some NLP tasks where people pre train on all of Wikipedia and all of the books in the world, because they want to understand language better. These tasks are supposed to be such that it's, it's makes no sense for you to go out and try to find more data or find similar data or pre train your model on something. And then lastly, and this refers to the last few chapters we looked at explicitly described the complete set of priors that it assumes, and enable a fair general intelligence comparison between human and machines by only requiring priors to those innate human, close to innate human prior knowledge. So that means that whatever human have, whatever humans have as a prior built into them by let's say evolution, or that most humans have picked up through life. Those are the things that you have to explicitly point out. So and you require that. And you have to point them out. Sorry, explicitly describe them such that I as a developer of a system can build them into my system such that it's a fair comparison. In the last chapters, we looked at the fact that a fair intelligence comparison is only fair if two systems that are compared to each other have the same amount of experience. And here we control that by only providing a fixed amount of training data, and also have the same prior knowledge. And here, we simply do that by listing the human priors that are required for the tasks that we think that humans have. And then we enable the developers to explicitly build those into machines. So I would maybe build a little calculator module into my AI that solves this tasks. Okay. So they say each task consists of a small number of demonstration examples, 3.3 on average, and a small number of test examples, generally one, although it might be two or three in rare cases. Each example consists of an input grid and an output grid. Each grid is a literal grid of symbols. Each symbol is visualized by color. There are 10 unique symbols, a grid can be any height or width between one by one and 30 by 30. So it doesn't even need to be square, right. And as I said, you need to provide your own output grid as an AI taking this test. So here are the priors that this test assumes. And we're going to look at some examples that make it explicit, like some tasks in the training set that where you can see these priors in action. So there's an objectness prior, where the task assumes that the AI or the task tests, that the AI understands something about objects. So these are tasks that you can only reasonably solve if you know something about objects, like you would, a human would recognize or would, you know, would recognize that these things might represent different objects, right. Now that's mainly, I think also due to the black background helps, but you would even recognize this with another background. Or here, the different colors indicate that those are two different things, even though those two pixels here touch and are different from black, you would recognize that those are two different things because they have different color. But you would generally recognize one of these things as an individual object. If you're not given anything, here you see, for example, a denoising task. As a human, you can pretty quickly see what the task is about, right? There appear to be these green things. They're all rectangles, and there appear to be these blue things. And on the right side, there are no more blue things. But the now it's not always that when there was a blue thing, there is now a green thing. Only here where it was sort of inside a green thing is now a green pixel. Whenever there was a blue pixel outside in this black area, then there is now black. So this is sort of like the blue things were noise and you're able to remove it. This already tests a lot of assumptions. A lot of these priors, a lot of understanding of the world. So there are objects, right? Objects, human understands that objects are square in this case, or rectangles. The human understands that we need to remove the blue things going over. And the human understands that somehow this inside relation, right, if something is inside or outside of one of these rectangles, and that determines whether we have to turn the pixel green or black. You can, I mean, think about how you would train a machine to do something like this. It's not easy, especially if you don't know that this task is coming. Imagine for all of these things, you don't know that the task is coming. This is just one of 400 tasks that you know of, there are 600 tasks that you don't know of that are similar, but also, in a way completely different. Here's another tasks that object influence via contact. So this is your first demonstration example. A human pretty quickly recognizes there appears to be red thing and a blue thing. And then they appear to be together. And then in the next thing, you see, oh, there appears to be a blue thing and the red thing in the next thing, they appear to be together. And if you look here, it always appears to be the red thing going to the blue thing in the most direct way. So in the, in the along the grid, that's all that the human needs to see two examples and the human, most humans will already make that inference and can now solve if there is like, if there now is a test example, where the blue thing is like, the blue thing is down here. And the red thing is here like this. And it asks you what comes next, you know, you know that the red thing is going down to the blue thing. But it's very hard to train a machine to do this. So I like this test, because it's sort of a different test. And I believe the test, these tests weren't procedurally generated. These tests were actually generated by show lay or, you know, by by actual humans. That's pretty cool. And 1000 tasks like this, it's going to be very hard to solve. There are even more abstract priors like goal directedness. So now you here you can already see this a little bit in that you can say, well, the red thing wants to go to the blue thing. So there is a notion of time involved, maybe. There's also counting and numbers and numbers prior. So here you see like a time process. So in this demonstration example, you see blue things here, red big thing. And then the next the output grid is this green thing. And as a human immediately recognize, okay, so it shoots out from the blue thing, the green thing shoots from the blue thing hits the red wall and goes here. Try to make a machine understand this. This is insane, right? So if you look at the more examples, it all it appears that the blue thing always comes from somewhere like the side of the image. And the green thing comes out obviously, from whatever is not at the at the border of the image and then bounces off the red thing if it hits the red thing. Now here you can, you can already see what's going to happen. Remember your AI would need to first determine aha, okay, all of these output grids, they seem to be the same as the input grid. So it would need to explicitly construct the output grid in the same manner as the input grid because it understands this right, this is not the same in every task, then it needs to recognize the red thing that stays in every one. So it needs to put the red thing here right from from here. And then it needs to recognize the blue thing stays as well. And then most, most shockingly needs to recognize, okay, I will draw a line in pixels and lines in pixels are hard here. And then as soon as it would hit the red thing, it bounces off into the other direction. So from just these three examples, the machine has to understand that and correctly output the exact solution, not an approximate solution, the exact solution. Okay, so yeah, there are these basic geometry and topology priors like lines, rectangular shapes, symmetries, rotations, translations, shape upscaling, containing, being contained, drawing lines, connecting points, and so on. Now, let's look at some more examples. These are fun, right? Check out this one here. So you see green, red, and then somehow the green connected to the red. So this is an example of that has many of these priors in many of these concepts in there is goal directedness, you can already sort of form the hypothesis that the green wants to go to the red. But also you see that somehow it sort of appears to the blue things seem to be maybe obstacles and it appears to change direction when it encounters an obstacle like here. So here, you see the example, and you probably confirm so your hypothesis could be it always goes until it hits and then it changes direction towards the red thing, right always towards red thing because it's not always towards the right because you return towards the left. So it goes somehow towards the red thing. And so it's pretty ambiguous in this situation. But you can also make the assumption that it if it's ambiguous, it goes towards the middle maybe maybe. So here, again, now we're actually confirming probably so we go towards the red thing, which would be towards this direction, then we hit an object, then we go towards the red thing until we hit an object. And then we go here. All also see that these grids here are not the same size. So it's not always the case that the grids of in within the same tasks are even the same size. So now here, you're again here AI would need to recognize what size of grid it needs to draw and what the result is. So it would need to copy this entire grid and also change these pixels right here to be green pixels. That's hard. I mean, that's I find I find this to be pretty hard. This is the line extrapolation and turning on obstacle and efficiently reaching a goal prior. That's crazy. And is there more? Yes, there is two more, I believe. Yeah, those are the last examples. So in this one, you can see right here, there appear to be objects, which there's this blue objects appear to be the same and there are these red and then the output grid is one of these blue objects. Okay, so here we again see different objects, the output grid is one of them. So as a human, you can already recognize the output grid is probably always going to be one of these objects. And now we need to decide on which one so we can formulate the hypothesis that it's probably going to be the one that's the most like here, there's three of the blue ones here, there's four of the yellow ones, that's more than any other. And this here confirms our hypothesis that the it's the object that appears most often. Now again, see that there is this notion of objectness. You need to upscale somehow. No, this is not upscaling because the grid is the same size. It's simply the image that's upscaled. But you need to somehow focus be able to focus in on one of these objects, I need to count them you need to compare the counts via each other. And now here you can pretty easily see that the output grid is going to contain one of those blue things as a human. And here it's it's sort of a symmetry filling task. Now as a human, you need one demonstration to get this. Maybe you need more, but many tasks involve some sort of symmetry, okay, drawing the symmetrized version around the version of a shape around a marker, that's going to be fairly hard for a machine to learn without without the developer knowing that this task is coming. Okay. They highlight some differentiations to standard psychometric tests. But what I find interesting here is that this thing, what a solution to arc may look like and what it would imply for AI applications. They say we have found arc to be fully solvable by humans. So they've set a human in front of every, every one of these tasks and it's solvable. While many arc tasks are intellectually challenging human test takes us appear to be able to solve the majority of tasks on their first try without any practice or verbal explanations. In effect, in this task, you get three tries at each at each of the at each of the problems you get three, three tries and the humans can already solve it in one. So that just show you it shows you how cool humans are. So here is a show they suggest a solution approach says by start by developing a domain specific language capable of expressing all possible situations, all possible solution programs for any arc task. Since the exact set of arc tasks is purposely not formally definable, this may be challenging. The space of tasks is defined as anything expressible in terms of arc pairs that would only involve core knowledge. So core knowledge is this set of human priors that we discussed last time like objectness and symmetries and geometric shapes and navigation and so on. So he asks you to basically develop a DSL that can capture all the different tasks. So so kept basically define a formalism of these tasks. But it's hard because you don't know what the tasks are going to be. So your best bet is probably to make a formalism that completely over represents what the tasks can be right. It would require hard coding the core knowledge priors from 3.1.2 in a sufficiently abstract and combinable program form to serve as a basis functions for a kind of human like reasoning DSL. We believe that solving this specific sub problem is critical to a to general AI progress. So he says whenever we can describe this is like saying that this AI progress will make a big step once we can formally describe human priors. And while true, this I feel the hardness of this problem is as hard as actually building general artificial intelligence or very close to it. So it is a bit of a like how to how to how to go how to build a GI step one build a GI that's sort of and not exactly but it's kind of what this says, right? If I could actually have this DSL to describe every single task and I could do it, you know, such that it is not not super over capturing all the tasks, then I would be able then I would have described human core knowledge in a sufficiently accurate degree that I could just you know, build a GI. But he goes on says given a task use the DSL to generate a set of candidate programs that turn the input grids into the corresponding output grids. This step would reuse and recombine sub programs that previously proved useful in other arc tasks. So it says, whenever you have captured the core knowledge or whenever you have captured the problem space in a formal language, you can simply use that formal language to express whatever your input is. So the that turn the input grids into the corresponding output grids. So you would put in these demonstration examples and describe this with your formal language that you have and you can somehow reuse and recombine sub programs that previously proved useful. So basically asking you to write to come up with source code that would generate these demonstration examples in the language of your DSL. And then he says select top candidates among these programs. So you would generate multiple versions of source code that generates these these things based on a criterion such as a program simplicity or program likelihood. Note that we do not expect that merely selecting the simplest possible program that works on training pairs will generalize well to test pairs. And then use the top three candidates to generate output grids for the test examples. So I hope the the approach here, I feel it makes sense, but it is sort of over hopeful in in my mind. And that's mainly because of of step one. So step one asks you to come up with like a programming language that can capture all the tasks in this all the tasks in the data set, even though you don't know what the tasks are, and that has this human core knowledge in inside of it in a in a formally describable way. And then once you have that programming language, you would, if you're given this task where you have, you know, a bunch of these demonstration, you have a bunch of these demonstration things, and then you have the test thing, you would generate all the programs that would produce these demonstration examples, or that would given the demo given the input grade would produce the output grid, right, you would generate all the programs. And then you would select somehow among all these programs, the one that you think generalizes the most and you would use that program to put this in and get out the solution. They say it's probably it's not always the simplest program, not always the shortest program, maybe who knows, like, I feel step one is the kind of the crucial issue here. Okay, so they say they make some claims here and about what this what this would bring the community, we posit that the existence of human level arc solver would represent the ability to program an AI from demonstrations alone, only requiring a handful of demonstrations to specify complex tasks to do a wide range of human relatable tasks of a kind that would normally require human level human like fluid intelligence. As supporting evidence, we note that human performance on psychometric intelligent tests, which are similar to our is predictive of success across all human cognitive tasks. Further, we posit that since an arc solver and human intelligence would be both founded on the same knowledge priors, the scope of application of an arc solver would be closer to that of human cognition, making it such a solver both practically valuable and easy to interact with, and would produce behavior that is in line with human expectations. Okay, so they're making the same argument that anyone before has made, but they condition it on some things. And this is, I think, the conclusion of the entire article here of on the measure of intelligence, because people had this hope and they say that here claims are highly speculative and may prove incorrect, much like Newell's 1973 hopes that progress on chess playing would translate into meaningful progress and achieving a broad range of cognitive abilities, especially if arc turns out to feature unforeseen vulnerabilities to unintelligent shortcuts. This is the AI effect, and basically means that whenever you think a task, the solving of a task represents AI, and then you actually see the solution, then the solution turns out to be not AI in the eyes of the human. So the human at first, they would say, Oh, this task really requires intelligence, and then someone solves the task, and they'll see all that's not intelligence, you can hack your way to that. And the expectation is that in this arc challenge, there might be a hacky way to that. But I mean, the good question is, when at what is there even a task like this arc challenge here? Could that is there even a possibility of a task where you wouldn't say that? And I'm not so sure about this. They seem to be more hopeful than I am. But at least they say, the arc challenge is founded on the same priors as a human has, it gives you the same amount of experience as a human has, right. And therefore, it is much more comparable to human intelligence. All right, they go over some weaknesses right here, of criticizing their own thing. Generalization is not quantified. So they have a measure of generalization in the previous chapter, but they don't use it right here. Test validity is not established, data set size and diversity may be limited, and so on. But I, in my mind, this, I would not consider this as like an AGI task or anything like this. I'm pretty sure the solution to this will come in a form again, where people don't really think it's, it exhibits intelligence. But I do like the task as such. And as a machine learner, I am very excited to think about how machine learning can go about solving this task. And especially with what we've seen from something like GPT-3, that has exactly this kind of structure where you train on a giant data set, blah, blah, blah, you pre train your language model, but then at inference time, you input a bunch of these demonstration examples, and you ask it for the next output. So I feel that might be a good start for for doing it. The question of course, is what, what then do you pre train this model on this GPT-3 for ARC? What's the pre training data set for it? And I guess that's going to be the challenge and probably going to require people to specifically program all of these priors into a data set generator for pre training. So that would be my approach. My approach would be write a data set generator for pre training and GPT-3 model to do these kind of tasks. And in order to write the data set generator, you'd have to basically program in all of these priors and that's not going to be easy because your best bet is to sort of put yourself into the shoes of shoal and be like, oh, if I were to design a task, what kind of things would I do and then try to capture that? That's going to be your best bet. Your most honest bet with respect to the challenge is to try to as faithfully as possible implement something like an objectness prior where cohesion and persistence are captured. That would be the most scientifically sound approach to my approach. All right, so that was my take on the ARC data set. If you have any comments, I'm very excited to hear comments on this. If you have already tried the ARC challenge, have some insight. I also welcome comments on that. And with that, I'll see you next time. Bye bye.
[{"start": 0.0, "end": 9.120000000000001, "text": " Hi there and welcome to the last part of On the Measure of Intelligence by Francois Chollet."}, {"start": 9.120000000000001, "end": 16.080000000000002, "text": " This last part concerns the ARC challenge that Chollet has proposed, or the ARC dataset,"}, {"start": 16.080000000000002, "end": 20.68, "text": " which stands for the Abstraction and Reasoning Corpus."}, {"start": 20.68, "end": 26.900000000000002, "text": " And we're just quickly going over the dataset, look how it's built and discuss what kind"}, {"start": 26.9, "end": 30.2, "text": " of solutions might be relevant right here."}, {"start": 30.2, "end": 36.14, "text": " So if you haven't seen the last videos in this series, this is the last one of a series,"}, {"start": 36.14, "end": 38.6, "text": " you might not exactly know what's going on."}, {"start": 38.6, "end": 43.84, "text": " But I think you can you can keep up pretty well because this part is fairly independent"}, {"start": 43.84, "end": 45.58, "text": " of the other parts."}, {"start": 45.58, "end": 49.5, "text": " And it's just cool to think about even if you haven't seen the other ones, I encourage"}, {"start": 49.5, "end": 53.28, "text": " you to go see the other ones, but it's not necessary."}, {"start": 53.28, "end": 55.980000000000004, "text": " Okay, let's jump in."}, {"start": 55.98, "end": 61.48, "text": " So the ARC is a challenge currently running a Kaggle challenge."}, {"start": 61.48, "end": 64.42, "text": " But in essence, it is a dataset."}, {"start": 64.42, "end": 68.89999999999999, "text": " And let me just jump into one of the tasks of the dataset."}, {"start": 68.89999999999999, "end": 74.28, "text": " So in this dataset, you always have the task in the following form."}, {"start": 74.28, "end": 82.88, "text": " So you always have multiple input examples, like this, or say, these are called the training"}, {"start": 82.88, "end": 83.88, "text": " examples."}, {"start": 83.88, "end": 85.36, "text": " And then you have a test example."}, {"start": 85.36, "end": 87.92, "text": " In this case, you have three training example, one test example."}, {"start": 87.92, "end": 95.34, "text": " So an entire, if you think of this in a machine learning way, this entire thing here is your"}, {"start": 95.34, "end": 96.56, "text": " x."}, {"start": 96.56, "end": 98.8, "text": " And this thing here is your y."}, {"start": 98.8, "end": 105.6, "text": " Okay, so the label is going to be the output of the last example that you you don't know"}, {"start": 105.6, "end": 106.6, "text": " that."}, {"start": 106.6, "end": 113.84, "text": " Now in the in the course in the training dataset, you do, but in the test, you don't."}, {"start": 113.84, "end": 119.64, "text": " So each one of these, as I said, is, is, is demonstrated, these are the demonstration"}, {"start": 119.64, "end": 124.24000000000001, "text": " examples, and then you're supposed to sort of learn the regularity out of the demonstration"}, {"start": 124.24000000000001, "end": 125.24000000000001, "text": " examples."}, {"start": 125.24000000000001, "end": 130.6, "text": " And then on this test example, you are supposed to apply this regularity that you learned."}, {"start": 130.6, "end": 137.04, "text": " So in here, a human can fairly accurately see that there are these black squares in"}, {"start": 137.04, "end": 144.23999999999998, "text": " each image, and that in the training samples, the output will always sort of exactly match"}, {"start": 144.23999999999998, "end": 146.28, "text": " into the place of these black squares."}, {"start": 146.28, "end": 150.51999999999998, "text": " As you can see, this is like a high rectangle, it goes here, it has the same amount of tiles"}, {"start": 150.51999999999998, "end": 151.72, "text": " and so on."}, {"start": 151.72, "end": 159.68, "text": " And you can also see that whatever colors are in here sort of are the continuation of"}, {"start": 159.68, "end": 161.0, "text": " a symmetric pattern."}, {"start": 161.0, "end": 170.56, "text": " So here, this is exactly the same as up here, but you know, flipped or turned by 180 degrees."}, {"start": 170.56, "end": 173.44, "text": " So there is a notion of symmetry right here."}, {"start": 173.44, "end": 179.8, "text": " So technically, one could compute this one would say, Oh, that's probably going to be"}, {"start": 179.8, "end": 183.8, "text": " the three rows and this bunch of things."}, {"start": 183.8, "end": 187.92000000000002, "text": " And it's probably going to be the same as this one down here, but just flipped on its"}, {"start": 187.92000000000002, "end": 189.24, "text": " head."}, {"start": 189.24, "end": 194.56, "text": " So as a human, you get this, even without a description, you realize like, Oh, this"}, {"start": 194.56, "end": 198.72, "text": " is like a regular pattern, it's symmetric, there's a hole in it."}, {"start": 198.72, "end": 203.24, "text": " And apparently the thing here always fills the hole, I can see that, you know, three"}, {"start": 203.24, "end": 206.62, "text": " examples are enough for me to confirm that that's what's going on."}, {"start": 206.62, "end": 207.84, "text": " And I see the hole here."}, {"start": 207.84, "end": 211.24, "text": " So I'm going to do the same thing."}, {"start": 211.24, "end": 215.60000000000002, "text": " So you can already see how these things are constructed in every, this is not the only"}, {"start": 215.6, "end": 223.57999999999998, "text": " task by the way, this is just one task, okay, there are 1000 tasks in this data set of this"}, {"start": 223.57999999999998, "end": 224.57999999999998, "text": " sort of nature."}, {"start": 224.57999999999998, "end": 230.72, "text": " Now, there are not always three demonstration examples, I believe there can be more or less."}, {"start": 230.72, "end": 235.24, "text": " But what's always the case is they always, each of these training examples consists of"}, {"start": 235.24, "end": 237.07999999999998, "text": " these demonstration examples."}, {"start": 237.07999999999998, "end": 242.92, "text": " And this test example, each of the demonstration examples consists of an input grid and an"}, {"start": 242.92, "end": 244.45999999999998, "text": " output grid."}, {"start": 244.46, "end": 251.52, "text": " And the input grid and output grid, they can be anywhere from one by one to 30 by 30."}, {"start": 251.52, "end": 255.56, "text": " Okay, anywhere in between that."}, {"start": 255.56, "end": 260.96000000000004, "text": " And the colors here, I believe there are nine different colors that can go, they're just"}, {"start": 260.96000000000004, "end": 263.14, "text": " encoded by nine different numbers."}, {"start": 263.14, "end": 267.6, "text": " But there are nine different colors that these things can have, you can see black, blue,"}, {"start": 267.6, "end": 271.96000000000004, "text": " orange, red, dark blue, and so on."}, {"start": 271.96, "end": 275.35999999999996, "text": " And the output grid exactly the same."}, {"start": 275.35999999999996, "end": 282.0, "text": " Now in this test example, you can only see the input grid, you cannot see the output"}, {"start": 282.0, "end": 283.0, "text": " grid."}, {"start": 283.0, "end": 286.52, "text": " And that means you don't even know how large it should be, you can see right here, they're"}, {"start": 286.52, "end": 288.88, "text": " not all the same size, the output grids."}, {"start": 288.88, "end": 292.4, "text": " In fact, not even the input grids have to be always the same size."}, {"start": 292.4, "end": 297.41999999999996, "text": " But you have to now come up with an output grid, you have to first decide how big it"}, {"start": 297.41999999999996, "end": 298.41999999999996, "text": " is."}, {"start": 298.41999999999996, "end": 301.47999999999996, "text": " And we've here we've determined since the whole has three rows, we're probably going"}, {"start": 301.48, "end": 307.44, "text": " to make three rows and it has like seven columns, we're probably going to make seven columns."}, {"start": 307.44, "end": 309.64000000000004, "text": " And that's the sort of thing you have to do."}, {"start": 309.64000000000004, "end": 314.20000000000005, "text": " And then not only do you have to decide how big it is, you now have to decide in each"}, {"start": 314.20000000000005, "end": 317.24, "text": " cell what color you put in."}, {"start": 317.24, "end": 327.0, "text": " And only if this thing exactly matches the train or the test label, you get a you get"}, {"start": 327.0, "end": 328.0, "text": " a point."}, {"start": 328.0, "end": 330.16, "text": " Otherwise, you get no point."}, {"start": 330.16, "end": 336.96000000000004, "text": " Okay, so in the training task, there are I believe 400 of these tasks."}, {"start": 336.96000000000004, "end": 341.72, "text": " And then there are 400 more as test split, but these are still public."}, {"start": 341.72, "end": 345.56, "text": " And then there are 200 that are secret."}, {"start": 345.56, "end": 349.6, "text": " That are I guess, part of this Kaggle challenge."}, {"start": 349.6, "end": 357.64000000000004, "text": " Yes, the training set features 400 tasks, while the evaluation set features 600 tasks."}, {"start": 357.64, "end": 362.36, "text": " The evaluation set is further split into a public evaluation set of 400 tasks and a private"}, {"start": 362.36, "end": 364.71999999999997, "text": " evaluation set of 200 tasks."}, {"start": 364.71999999999997, "end": 366.46, "text": " All tasks are unique."}, {"start": 366.46, "end": 372.06, "text": " And the set of tasks and the set of training tasks are disjoint, sorry, of test tasks and"}, {"start": 372.06, "end": 373.41999999999996, "text": " training tasks."}, {"start": 373.41999999999996, "end": 379.3, "text": " The task data is available at this, as you can see right here."}, {"start": 379.3, "end": 386.47999999999996, "text": " So I really hope that Sholay will keep these 200 tasks as a secret, even after the Kaggle"}, {"start": 386.48, "end": 393.28000000000003, "text": " challenge, because it's going to be fun for people that might want to get into this later."}, {"start": 393.28000000000003, "end": 395.82, "text": " So here are the goals of this data set."}, {"start": 395.82, "end": 400.76, "text": " They want to stay close to these psychometric intelligence tests."}, {"start": 400.76, "end": 405.52000000000004, "text": " They say in particular, it should be solvable by humans without any specific practice or"}, {"start": 405.52000000000004, "end": 409.24, "text": " training and probably also without any language instructions."}, {"start": 409.24, "end": 413.6, "text": " So you should be able to set a human in front of it and the human should be able to solve"}, {"start": 413.6, "end": 418.72, "text": " it or a large portion of humans should be able to solve it, right?"}, {"start": 418.72, "end": 422.20000000000005, "text": " Ideally, this test would also differentiate humans from each other."}, {"start": 422.20000000000005, "end": 426.92, "text": " But at this point, we want to simply assess machines."}, {"start": 426.92, "end": 433.08000000000004, "text": " So they say focus on measuring developer aware generalization rather than task specific skill"}, {"start": 433.08000000000004, "end": 437.36, "text": " by only featuring novel tasks in the evaluation set."}, {"start": 437.36, "end": 440.96000000000004, "text": " And the novel tasks are unknown to the developer of a test taker."}, {"start": 440.96, "end": 447.03999999999996, "text": " So if I develop a system, I don't know what are these 200 tasks that Sholay keeps hidden,"}, {"start": 447.03999999999996, "end": 455.08, "text": " I simply submit my code, and I'll figure out if my code does well on them."}, {"start": 455.08, "end": 462.5, "text": " So they say they want to feature highly abstract tasks must be understood by a test taker using"}, {"start": 462.5, "end": 464.76, "text": " very few examples."}, {"start": 464.76, "end": 468.0, "text": " That's what you saw, you don't have a big training example to learn that this task is"}, {"start": 468.0, "end": 470.47999999999996, "text": " about symmetry and whole filling."}, {"start": 470.48, "end": 472.32, "text": " You only have three."}, {"start": 472.32, "end": 477.12, "text": " And from three, you need to recognize what's going on and produce the output of the test"}, {"start": 477.12, "end": 481.24, "text": " sample, right?"}, {"start": 481.24, "end": 484.32, "text": " Quality of control for experience by only providing a fixed amount of training data"}, {"start": 484.32, "end": 485.32, "text": " for each task."}, {"start": 485.32, "end": 489.54, "text": " That's what we saw, and only featuring tasks that do not lend themselves well to artificially"}, {"start": 489.54, "end": 491.58000000000004, "text": " generating new data."}, {"start": 491.58000000000004, "end": 496.28000000000003, "text": " So it's not like ImageNet, where you can go on the internet and find a whole bunch of"}, {"start": 496.28, "end": 501.76, "text": " images or you know, some NLP tasks where people pre train on all of Wikipedia and all of the"}, {"start": 501.76, "end": 505.67999999999995, "text": " books in the world, because they want to understand language better."}, {"start": 505.67999999999995, "end": 511.52, "text": " These tasks are supposed to be such that it's, it's makes no sense for you to go out and"}, {"start": 511.52, "end": 517.56, "text": " try to find more data or find similar data or pre train your model on something."}, {"start": 517.56, "end": 523.12, "text": " And then lastly, and this refers to the last few chapters we looked at explicitly described"}, {"start": 523.12, "end": 530.24, "text": " the complete set of priors that it assumes, and enable a fair general intelligence comparison"}, {"start": 530.24, "end": 536.36, "text": " between human and machines by only requiring priors to those innate human, close to innate"}, {"start": 536.36, "end": 538.36, "text": " human prior knowledge."}, {"start": 538.36, "end": 545.44, "text": " So that means that whatever human have, whatever humans have as a prior built into them by"}, {"start": 545.44, "end": 550.52, "text": " let's say evolution, or that most humans have picked up through life."}, {"start": 550.52, "end": 555.6, "text": " Those are the things that you have to explicitly point out."}, {"start": 555.6, "end": 558.4, "text": " So and you require that."}, {"start": 558.4, "end": 560.88, "text": " And you have to point them out."}, {"start": 560.88, "end": 566.68, "text": " Sorry, explicitly describe them such that I as a developer of a system can build them"}, {"start": 566.68, "end": 569.9399999999999, "text": " into my system such that it's a fair comparison."}, {"start": 569.9399999999999, "end": 574.5799999999999, "text": " In the last chapters, we looked at the fact that a fair intelligence comparison is only"}, {"start": 574.5799999999999, "end": 579.72, "text": " fair if two systems that are compared to each other have the same amount of experience."}, {"start": 579.72, "end": 585.3000000000001, "text": " And here we control that by only providing a fixed amount of training data, and also"}, {"start": 585.3000000000001, "end": 588.0, "text": " have the same prior knowledge."}, {"start": 588.0, "end": 593.12, "text": " And here, we simply do that by listing the human priors that are required for the tasks"}, {"start": 593.12, "end": 595.32, "text": " that we think that humans have."}, {"start": 595.32, "end": 599.98, "text": " And then we enable the developers to explicitly build those into machines."}, {"start": 599.98, "end": 607.24, "text": " So I would maybe build a little calculator module into my AI that solves this tasks."}, {"start": 607.24, "end": 609.08, "text": " Okay."}, {"start": 609.08, "end": 615.4200000000001, "text": " So they say each task consists of a small number of demonstration examples, 3.3 on average,"}, {"start": 615.4200000000001, "end": 620.5600000000001, "text": " and a small number of test examples, generally one, although it might be two or three in"}, {"start": 620.5600000000001, "end": 622.0400000000001, "text": " rare cases."}, {"start": 622.0400000000001, "end": 624.36, "text": " Each example consists of an input grid and an output grid."}, {"start": 624.36, "end": 627.44, "text": " Each grid is a literal grid of symbols."}, {"start": 627.44, "end": 630.12, "text": " Each symbol is visualized by color."}, {"start": 630.12, "end": 633.76, "text": " There are 10 unique symbols, a grid can be any height or width between one by one and"}, {"start": 633.76, "end": 634.76, "text": " 30 by 30."}, {"start": 634.76, "end": 638.0400000000001, "text": " So it doesn't even need to be square, right."}, {"start": 638.04, "end": 644.7199999999999, "text": " And as I said, you need to provide your own output grid as an AI taking this test."}, {"start": 644.7199999999999, "end": 647.0, "text": " So here are the priors that this test assumes."}, {"start": 647.0, "end": 652.76, "text": " And we're going to look at some examples that make it explicit, like some tasks in the training"}, {"start": 652.76, "end": 656.24, "text": " set that where you can see these priors in action."}, {"start": 656.24, "end": 664.3199999999999, "text": " So there's an objectness prior, where the task assumes that the AI or the task tests,"}, {"start": 664.3199999999999, "end": 667.52, "text": " that the AI understands something about objects."}, {"start": 667.52, "end": 672.48, "text": " So these are tasks that you can only reasonably solve if you know something about objects,"}, {"start": 672.48, "end": 679.26, "text": " like you would, a human would recognize or would, you know, would recognize that these"}, {"start": 679.26, "end": 682.64, "text": " things might represent different objects, right."}, {"start": 682.64, "end": 689.12, "text": " Now that's mainly, I think also due to the black background helps, but you would even"}, {"start": 689.12, "end": 691.16, "text": " recognize this with another background."}, {"start": 691.16, "end": 696.36, "text": " Or here, the different colors indicate that those are two different things, even though"}, {"start": 696.36, "end": 702.4, "text": " those two pixels here touch and are different from black, you would recognize that those"}, {"start": 702.4, "end": 705.48, "text": " are two different things because they have different color."}, {"start": 705.48, "end": 711.4, "text": " But you would generally recognize one of these things as an individual object."}, {"start": 711.4, "end": 716.38, "text": " If you're not given anything, here you see, for example, a denoising task."}, {"start": 716.38, "end": 720.08, "text": " As a human, you can pretty quickly see what the task is about, right?"}, {"start": 720.08, "end": 722.6800000000001, "text": " There appear to be these green things."}, {"start": 722.68, "end": 726.9599999999999, "text": " They're all rectangles, and there appear to be these blue things."}, {"start": 726.9599999999999, "end": 729.9599999999999, "text": " And on the right side, there are no more blue things."}, {"start": 729.9599999999999, "end": 736.16, "text": " But the now it's not always that when there was a blue thing, there is now a green thing."}, {"start": 736.16, "end": 742.64, "text": " Only here where it was sort of inside a green thing is now a green pixel."}, {"start": 742.64, "end": 748.8399999999999, "text": " Whenever there was a blue pixel outside in this black area, then there is now black."}, {"start": 748.84, "end": 752.9200000000001, "text": " So this is sort of like the blue things were noise and you're able to remove it."}, {"start": 752.9200000000001, "end": 756.48, "text": " This already tests a lot of assumptions."}, {"start": 756.48, "end": 760.1600000000001, "text": " A lot of these priors, a lot of understanding of the world."}, {"start": 760.1600000000001, "end": 763.0400000000001, "text": " So there are objects, right?"}, {"start": 763.0400000000001, "end": 769.52, "text": " Objects, human understands that objects are square in this case, or rectangles."}, {"start": 769.52, "end": 775.8000000000001, "text": " The human understands that we need to remove the blue things going over."}, {"start": 775.8, "end": 784.12, "text": " And the human understands that somehow this inside relation, right, if something is inside"}, {"start": 784.12, "end": 788.3599999999999, "text": " or outside of one of these rectangles, and that determines whether we have to turn the"}, {"start": 788.3599999999999, "end": 790.92, "text": " pixel green or black."}, {"start": 790.92, "end": 795.0, "text": " You can, I mean, think about how you would train a machine to do something like this."}, {"start": 795.0, "end": 800.12, "text": " It's not easy, especially if you don't know that this task is coming."}, {"start": 800.12, "end": 803.42, "text": " Imagine for all of these things, you don't know that the task is coming."}, {"start": 803.42, "end": 808.8399999999999, "text": " This is just one of 400 tasks that you know of, there are 600 tasks that you don't know"}, {"start": 808.8399999999999, "end": 816.92, "text": " of that are similar, but also, in a way completely different."}, {"start": 816.92, "end": 820.38, "text": " Here's another tasks that object influence via contact."}, {"start": 820.38, "end": 823.4799999999999, "text": " So this is your first demonstration example."}, {"start": 823.4799999999999, "end": 828.3199999999999, "text": " A human pretty quickly recognizes there appears to be red thing and a blue thing."}, {"start": 828.3199999999999, "end": 831.1999999999999, "text": " And then they appear to be together."}, {"start": 831.2, "end": 835.32, "text": " And then in the next thing, you see, oh, there appears to be a blue thing and the red thing"}, {"start": 835.32, "end": 837.4200000000001, "text": " in the next thing, they appear to be together."}, {"start": 837.4200000000001, "end": 843.1600000000001, "text": " And if you look here, it always appears to be the red thing going to the blue thing in"}, {"start": 843.1600000000001, "end": 844.48, "text": " the most direct way."}, {"start": 844.48, "end": 852.84, "text": " So in the, in the along the grid, that's all that the human needs to see two examples and"}, {"start": 852.84, "end": 858.58, "text": " the human, most humans will already make that inference and can now solve if there is like,"}, {"start": 858.58, "end": 865.82, "text": " if there now is a test example, where the blue thing is like, the blue thing is down"}, {"start": 865.82, "end": 866.94, "text": " here."}, {"start": 866.94, "end": 870.0, "text": " And the red thing is here like this."}, {"start": 870.0, "end": 874.32, "text": " And it asks you what comes next, you know, you know that the red thing is going down"}, {"start": 874.32, "end": 877.24, "text": " to the blue thing."}, {"start": 877.24, "end": 879.7, "text": " But it's very hard to train a machine to do this."}, {"start": 879.7, "end": 884.4000000000001, "text": " So I like this test, because it's sort of a different test."}, {"start": 884.4000000000001, "end": 887.8000000000001, "text": " And I believe the test, these tests weren't procedurally generated."}, {"start": 887.8, "end": 894.76, "text": " These tests were actually generated by show lay or, you know, by by actual humans."}, {"start": 894.76, "end": 896.8399999999999, "text": " That's pretty cool."}, {"start": 896.8399999999999, "end": 900.9399999999999, "text": " And 1000 tasks like this, it's going to be very hard to solve."}, {"start": 900.9399999999999, "end": 905.68, "text": " There are even more abstract priors like goal directedness."}, {"start": 905.68, "end": 911.56, "text": " So now you here you can already see this a little bit in that you can say, well, the"}, {"start": 911.56, "end": 914.8, "text": " red thing wants to go to the blue thing."}, {"start": 914.8, "end": 919.3599999999999, "text": " So there is a notion of time involved, maybe."}, {"start": 919.3599999999999, "end": 922.74, "text": " There's also counting and numbers and numbers prior."}, {"start": 922.74, "end": 925.68, "text": " So here you see like a time process."}, {"start": 925.68, "end": 931.4399999999999, "text": " So in this demonstration example, you see blue things here, red big thing."}, {"start": 931.4399999999999, "end": 936.2199999999999, "text": " And then the next the output grid is this green thing."}, {"start": 936.2199999999999, "end": 941.28, "text": " And as a human immediately recognize, okay, so it shoots out from the blue thing, the"}, {"start": 941.28, "end": 946.64, "text": " green thing shoots from the blue thing hits the red wall and goes here."}, {"start": 946.64, "end": 949.38, "text": " Try to make a machine understand this."}, {"start": 949.38, "end": 951.0799999999999, "text": " This is insane, right?"}, {"start": 951.0799999999999, "end": 957.06, "text": " So if you look at the more examples, it all it appears that the blue thing always comes"}, {"start": 957.06, "end": 960.1, "text": " from somewhere like the side of the image."}, {"start": 960.1, "end": 965.24, "text": " And the green thing comes out obviously, from whatever is not at the at the border of the"}, {"start": 965.24, "end": 971.92, "text": " image and then bounces off the red thing if it hits the red thing."}, {"start": 971.92, "end": 976.2, "text": " Now here you can, you can already see what's going to happen."}, {"start": 976.2, "end": 982.4, "text": " Remember your AI would need to first determine aha, okay, all of these output grids, they"}, {"start": 982.4, "end": 985.26, "text": " seem to be the same as the input grid."}, {"start": 985.26, "end": 990.6, "text": " So it would need to explicitly construct the output grid in the same manner as the input"}, {"start": 990.6, "end": 995.04, "text": " grid because it understands this right, this is not the same in every task, then it needs"}, {"start": 995.04, "end": 998.8, "text": " to recognize the red thing that stays in every one."}, {"start": 998.8, "end": 1003.36, "text": " So it needs to put the red thing here right from from here."}, {"start": 1003.36, "end": 1007.36, "text": " And then it needs to recognize the blue thing stays as well."}, {"start": 1007.36, "end": 1016.02, "text": " And then most, most shockingly needs to recognize, okay, I will draw a line in pixels and lines"}, {"start": 1016.02, "end": 1019.0799999999999, "text": " in pixels are hard here."}, {"start": 1019.08, "end": 1025.04, "text": " And then as soon as it would hit the red thing, it bounces off into the other direction."}, {"start": 1025.04, "end": 1030.66, "text": " So from just these three examples, the machine has to understand that and correctly output"}, {"start": 1030.66, "end": 1035.56, "text": " the exact solution, not an approximate solution, the exact solution."}, {"start": 1035.56, "end": 1043.28, "text": " Okay, so yeah, there are these basic geometry and topology priors like lines, rectangular"}, {"start": 1043.28, "end": 1051.44, "text": " shapes, symmetries, rotations, translations, shape upscaling, containing, being contained,"}, {"start": 1051.44, "end": 1054.8, "text": " drawing lines, connecting points, and so on."}, {"start": 1054.8, "end": 1057.24, "text": " Now, let's look at some more examples."}, {"start": 1057.24, "end": 1059.94, "text": " These are fun, right?"}, {"start": 1059.94, "end": 1062.2, "text": " Check out this one here."}, {"start": 1062.2, "end": 1068.7, "text": " So you see green, red, and then somehow the green connected to the red."}, {"start": 1068.7, "end": 1073.52, "text": " So this is an example of that has many of these priors in many of these concepts in"}, {"start": 1073.52, "end": 1078.38, "text": " there is goal directedness, you can already sort of form the hypothesis that the green"}, {"start": 1078.38, "end": 1080.52, "text": " wants to go to the red."}, {"start": 1080.52, "end": 1088.92, "text": " But also you see that somehow it sort of appears to the blue things seem to be maybe obstacles"}, {"start": 1088.92, "end": 1095.3600000000001, "text": " and it appears to change direction when it encounters an obstacle like here."}, {"start": 1095.36, "end": 1101.9199999999998, "text": " So here, you see the example, and you probably confirm so your hypothesis could be it always"}, {"start": 1101.9199999999998, "end": 1108.1999999999998, "text": " goes until it hits and then it changes direction towards the red thing, right always towards"}, {"start": 1108.1999999999998, "end": 1112.86, "text": " red thing because it's not always towards the right because you return towards the left."}, {"start": 1112.86, "end": 1116.6, "text": " So it goes somehow towards the red thing."}, {"start": 1116.6, "end": 1120.5, "text": " And so it's pretty ambiguous in this situation."}, {"start": 1120.5, "end": 1124.3799999999999, "text": " But you can also make the assumption that it if it's ambiguous, it goes towards the"}, {"start": 1124.38, "end": 1127.7800000000002, "text": " middle maybe maybe."}, {"start": 1127.7800000000002, "end": 1135.48, "text": " So here, again, now we're actually confirming probably so we go towards the red thing, which"}, {"start": 1135.48, "end": 1139.8400000000001, "text": " would be towards this direction, then we hit an object, then we go towards the red thing"}, {"start": 1139.8400000000001, "end": 1141.7, "text": " until we hit an object."}, {"start": 1141.7, "end": 1144.96, "text": " And then we go here."}, {"start": 1144.96, "end": 1148.98, "text": " All also see that these grids here are not the same size."}, {"start": 1148.98, "end": 1154.16, "text": " So it's not always the case that the grids of in within the same tasks are even the same"}, {"start": 1154.16, "end": 1155.16, "text": " size."}, {"start": 1155.16, "end": 1159.78, "text": " So now here, you're again here AI would need to recognize what size of grid it needs to"}, {"start": 1159.78, "end": 1161.78, "text": " draw and what the result is."}, {"start": 1161.78, "end": 1168.78, "text": " So it would need to copy this entire grid and also change these pixels right here to"}, {"start": 1168.78, "end": 1172.3000000000002, "text": " be green pixels."}, {"start": 1172.3000000000002, "end": 1173.3000000000002, "text": " That's hard."}, {"start": 1173.3000000000002, "end": 1176.88, "text": " I mean, that's I find I find this to be pretty hard."}, {"start": 1176.88, "end": 1184.2600000000002, "text": " This is the line extrapolation and turning on obstacle and efficiently reaching a goal"}, {"start": 1184.2600000000002, "end": 1185.3000000000002, "text": " prior."}, {"start": 1185.3000000000002, "end": 1188.0600000000002, "text": " That's crazy."}, {"start": 1188.0600000000002, "end": 1189.0600000000002, "text": " And is there more?"}, {"start": 1189.0600000000002, "end": 1190.94, "text": " Yes, there is two more, I believe."}, {"start": 1190.94, "end": 1193.6000000000001, "text": " Yeah, those are the last examples."}, {"start": 1193.6000000000001, "end": 1201.0600000000002, "text": " So in this one, you can see right here, there appear to be objects, which there's this blue"}, {"start": 1201.0600000000002, "end": 1206.2600000000002, "text": " objects appear to be the same and there are these red and then the output grid is one"}, {"start": 1206.26, "end": 1207.82, "text": " of these blue objects."}, {"start": 1207.82, "end": 1212.54, "text": " Okay, so here we again see different objects, the output grid is one of them."}, {"start": 1212.54, "end": 1216.62, "text": " So as a human, you can already recognize the output grid is probably always going to be"}, {"start": 1216.62, "end": 1218.98, "text": " one of these objects."}, {"start": 1218.98, "end": 1223.8799999999999, "text": " And now we need to decide on which one so we can formulate the hypothesis that it's"}, {"start": 1223.8799999999999, "end": 1229.62, "text": " probably going to be the one that's the most like here, there's three of the blue ones"}, {"start": 1229.62, "end": 1233.02, "text": " here, there's four of the yellow ones, that's more than any other."}, {"start": 1233.02, "end": 1240.3, "text": " And this here confirms our hypothesis that the it's the object that appears most often."}, {"start": 1240.3, "end": 1245.66, "text": " Now again, see that there is this notion of objectness."}, {"start": 1245.66, "end": 1247.54, "text": " You need to upscale somehow."}, {"start": 1247.54, "end": 1250.5, "text": " No, this is not upscaling because the grid is the same size."}, {"start": 1250.5, "end": 1252.84, "text": " It's simply the image that's upscaled."}, {"start": 1252.84, "end": 1258.1, "text": " But you need to somehow focus be able to focus in on one of these objects, I need to count"}, {"start": 1258.1, "end": 1263.02, "text": " them you need to compare the counts via each other."}, {"start": 1263.02, "end": 1266.6999999999998, "text": " And now here you can pretty easily see that the output grid is going to contain one of"}, {"start": 1266.6999999999998, "end": 1271.1799999999998, "text": " those blue things as a human."}, {"start": 1271.1799999999998, "end": 1275.62, "text": " And here it's it's sort of a symmetry filling task."}, {"start": 1275.62, "end": 1281.8999999999999, "text": " Now as a human, you need one demonstration to get this."}, {"start": 1281.9, "end": 1289.3400000000001, "text": " Maybe you need more, but many tasks involve some sort of symmetry, okay, drawing the symmetrized"}, {"start": 1289.3400000000001, "end": 1295.02, "text": " version around the version of a shape around a marker, that's going to be fairly hard for"}, {"start": 1295.02, "end": 1302.22, "text": " a machine to learn without without the developer knowing that this task is coming."}, {"start": 1302.22, "end": 1304.22, "text": " Okay."}, {"start": 1304.22, "end": 1308.8200000000002, "text": " They highlight some differentiations to standard psychometric tests."}, {"start": 1308.82, "end": 1314.34, "text": " But what I find interesting here is that this thing, what a solution to arc may look like"}, {"start": 1314.34, "end": 1318.1, "text": " and what it would imply for AI applications."}, {"start": 1318.1, "end": 1320.9399999999998, "text": " They say we have found arc to be fully solvable by humans."}, {"start": 1320.9399999999998, "end": 1326.8999999999999, "text": " So they've set a human in front of every, every one of these tasks and it's solvable."}, {"start": 1326.8999999999999, "end": 1331.46, "text": " While many arc tasks are intellectually challenging human test takes us appear to be able to solve"}, {"start": 1331.46, "end": 1337.0, "text": " the majority of tasks on their first try without any practice or verbal explanations."}, {"start": 1337.0, "end": 1344.66, "text": " In effect, in this task, you get three tries at each at each of the at each of the problems"}, {"start": 1344.66, "end": 1350.44, "text": " you get three, three tries and the humans can already solve it in one."}, {"start": 1350.44, "end": 1356.84, "text": " So that just show you it shows you how cool humans are."}, {"start": 1356.84, "end": 1364.76, "text": " So here is a show they suggest a solution approach says by start by developing a domain"}, {"start": 1364.76, "end": 1371.62, "text": " specific language capable of expressing all possible situations, all possible solution"}, {"start": 1371.62, "end": 1375.34, "text": " programs for any arc task."}, {"start": 1375.34, "end": 1382.5, "text": " Since the exact set of arc tasks is purposely not formally definable, this may be challenging."}, {"start": 1382.5, "end": 1387.3799999999999, "text": " The space of tasks is defined as anything expressible in terms of arc pairs that would"}, {"start": 1387.3799999999999, "end": 1390.02, "text": " only involve core knowledge."}, {"start": 1390.02, "end": 1395.94, "text": " So core knowledge is this set of human priors that we discussed last time like objectness"}, {"start": 1395.94, "end": 1402.1399999999999, "text": " and symmetries and geometric shapes and navigation and so on."}, {"start": 1402.1399999999999, "end": 1409.3, "text": " So he asks you to basically develop a DSL that can capture all the different tasks."}, {"start": 1409.3, "end": 1414.74, "text": " So so kept basically define a formalism of these tasks."}, {"start": 1414.74, "end": 1418.22, "text": " But it's hard because you don't know what the tasks are going to be."}, {"start": 1418.22, "end": 1423.78, "text": " So your best bet is probably to make a formalism that completely over represents what the tasks"}, {"start": 1423.78, "end": 1426.54, "text": " can be right."}, {"start": 1426.54, "end": 1433.7, "text": " It would require hard coding the core knowledge priors from 3.1.2 in a sufficiently abstract"}, {"start": 1433.7, "end": 1440.46, "text": " and combinable program form to serve as a basis functions for a kind of human like reasoning"}, {"start": 1440.46, "end": 1441.6000000000001, "text": " DSL."}, {"start": 1441.6000000000001, "end": 1447.7, "text": " We believe that solving this specific sub problem is critical to a to general AI progress."}, {"start": 1447.7, "end": 1456.5800000000002, "text": " So he says whenever we can describe this is like saying that this AI progress will make"}, {"start": 1456.5800000000002, "end": 1461.1000000000001, "text": " a big step once we can formally describe human priors."}, {"start": 1461.1000000000001, "end": 1468.98, "text": " And while true, this I feel the hardness of this problem is as hard as actually building"}, {"start": 1468.98, "end": 1472.3, "text": " general artificial intelligence or very close to it."}, {"start": 1472.3, "end": 1482.58, "text": " So it is a bit of a like how to how to how to go how to build a GI step one build a GI"}, {"start": 1482.58, "end": 1488.34, "text": " that's sort of and not exactly but it's kind of what this says, right?"}, {"start": 1488.34, "end": 1495.06, "text": " If I could actually have this DSL to describe every single task and I could do it, you know,"}, {"start": 1495.06, "end": 1502.6599999999999, "text": " such that it is not not super over capturing all the tasks, then I would be able then I"}, {"start": 1502.6599999999999, "end": 1511.06, "text": " would have described human core knowledge in a sufficiently accurate degree that I could"}, {"start": 1511.06, "end": 1515.54, "text": " just you know, build a GI."}, {"start": 1515.54, "end": 1520.96, "text": " But he goes on says given a task use the DSL to generate a set of candidate programs that"}, {"start": 1520.96, "end": 1524.78, "text": " turn the input grids into the corresponding output grids."}, {"start": 1524.78, "end": 1529.82, "text": " This step would reuse and recombine sub programs that previously proved useful in other arc"}, {"start": 1529.82, "end": 1531.22, "text": " tasks."}, {"start": 1531.22, "end": 1535.02, "text": " So it says, whenever you have captured the core knowledge or whenever you have captured"}, {"start": 1535.02, "end": 1540.78, "text": " the problem space in a formal language, you can simply use that formal language to express"}, {"start": 1540.78, "end": 1542.44, "text": " whatever your input is."}, {"start": 1542.44, "end": 1546.58, "text": " So the that turn the input grids into the corresponding output grids."}, {"start": 1546.58, "end": 1551.98, "text": " So you would put in these demonstration examples and describe this with your formal language"}, {"start": 1551.98, "end": 1557.38, "text": " that you have and you can somehow reuse and recombine sub programs that previously proved"}, {"start": 1557.38, "end": 1558.38, "text": " useful."}, {"start": 1558.38, "end": 1566.6200000000001, "text": " So basically asking you to write to come up with source code that would generate these"}, {"start": 1566.6200000000001, "end": 1573.02, "text": " demonstration examples in the language of your DSL."}, {"start": 1573.02, "end": 1576.88, "text": " And then he says select top candidates among these programs."}, {"start": 1576.88, "end": 1585.1000000000001, "text": " So you would generate multiple versions of source code that generates these these things"}, {"start": 1585.1000000000001, "end": 1590.22, "text": " based on a criterion such as a program simplicity or program likelihood."}, {"start": 1590.22, "end": 1594.5200000000002, "text": " Note that we do not expect that merely selecting the simplest possible program that works on"}, {"start": 1594.5200000000002, "end": 1599.74, "text": " training pairs will generalize well to test pairs."}, {"start": 1599.74, "end": 1605.5600000000002, "text": " And then use the top three candidates to generate output grids for the test examples."}, {"start": 1605.56, "end": 1612.7, "text": " So I hope the the approach here, I feel it makes sense, but it is sort of over hopeful"}, {"start": 1612.7, "end": 1613.84, "text": " in in my mind."}, {"start": 1613.84, "end": 1617.36, "text": " And that's mainly because of of step one."}, {"start": 1617.36, "end": 1622.1, "text": " So step one asks you to come up with like a programming language that can capture all"}, {"start": 1622.1, "end": 1628.7, "text": " the tasks in this all the tasks in the data set, even though you don't know what the tasks"}, {"start": 1628.7, "end": 1635.46, "text": " are, and that has this human core knowledge in inside of it in a in a formally describable"}, {"start": 1635.46, "end": 1636.46, "text": " way."}, {"start": 1636.46, "end": 1641.54, "text": " And then once you have that programming language, you would, if you're given this task where"}, {"start": 1641.54, "end": 1647.58, "text": " you have, you know, a bunch of these demonstration, you have a bunch of these demonstration things,"}, {"start": 1647.58, "end": 1655.52, "text": " and then you have the test thing, you would generate all the programs that would produce"}, {"start": 1655.52, "end": 1661.64, "text": " these demonstration examples, or that would given the demo given the input grade would"}, {"start": 1661.64, "end": 1665.44, "text": " produce the output grid, right, you would generate all the programs."}, {"start": 1665.44, "end": 1671.0800000000002, "text": " And then you would select somehow among all these programs, the one that you think generalizes"}, {"start": 1671.0800000000002, "end": 1678.64, "text": " the most and you would use that program to put this in and get out the solution."}, {"start": 1678.64, "end": 1683.24, "text": " They say it's probably it's not always the simplest program, not always the shortest"}, {"start": 1683.24, "end": 1690.52, "text": " program, maybe who knows, like, I feel step one is the kind of the crucial issue here."}, {"start": 1690.52, "end": 1700.24, "text": " Okay, so they say they make some claims here and about what this what this would bring"}, {"start": 1700.24, "end": 1704.72, "text": " the community, we posit that the existence of human level arc solver would represent"}, {"start": 1704.72, "end": 1710.8799999999999, "text": " the ability to program an AI from demonstrations alone, only requiring a handful of demonstrations"}, {"start": 1710.8799999999999, "end": 1717.92, "text": " to specify complex tasks to do a wide range of human relatable tasks of a kind that would"}, {"start": 1717.92, "end": 1724.52, "text": " normally require human level human like fluid intelligence."}, {"start": 1724.52, "end": 1728.8400000000001, "text": " As supporting evidence, we note that human performance on psychometric intelligent tests,"}, {"start": 1728.8400000000001, "end": 1733.8000000000002, "text": " which are similar to our is predictive of success across all human cognitive tasks."}, {"start": 1733.8000000000002, "end": 1738.52, "text": " Further, we posit that since an arc solver and human intelligence would be both founded"}, {"start": 1738.52, "end": 1743.3200000000002, "text": " on the same knowledge priors, the scope of application of an arc solver would be closer"}, {"start": 1743.32, "end": 1748.6399999999999, "text": " to that of human cognition, making it such a solver both practically valuable and easy"}, {"start": 1748.6399999999999, "end": 1755.36, "text": " to interact with, and would produce behavior that is in line with human expectations."}, {"start": 1755.36, "end": 1762.8, "text": " Okay, so they're making the same argument that anyone before has made, but they condition"}, {"start": 1762.8, "end": 1764.26, "text": " it on some things."}, {"start": 1764.26, "end": 1769.72, "text": " And this is, I think, the conclusion of the entire article here of on the measure of intelligence,"}, {"start": 1769.72, "end": 1774.2, "text": " because people had this hope and they say that here claims are highly speculative and"}, {"start": 1774.2, "end": 1780.28, "text": " may prove incorrect, much like Newell's 1973 hopes that progress on chess playing would"}, {"start": 1780.28, "end": 1787.52, "text": " translate into meaningful progress and achieving a broad range of cognitive abilities, especially"}, {"start": 1787.52, "end": 1795.46, "text": " if arc turns out to feature unforeseen vulnerabilities to unintelligent shortcuts."}, {"start": 1795.46, "end": 1802.5, "text": " This is the AI effect, and basically means that whenever you think a task, the solving"}, {"start": 1802.5, "end": 1808.3, "text": " of a task represents AI, and then you actually see the solution, then the solution turns"}, {"start": 1808.3, "end": 1812.52, "text": " out to be not AI in the eyes of the human."}, {"start": 1812.52, "end": 1816.96, "text": " So the human at first, they would say, Oh, this task really requires intelligence, and"}, {"start": 1816.96, "end": 1820.88, "text": " then someone solves the task, and they'll see all that's not intelligence, you can hack"}, {"start": 1820.88, "end": 1822.48, "text": " your way to that."}, {"start": 1822.48, "end": 1827.24, "text": " And the expectation is that in this arc challenge, there might be a hacky way to that."}, {"start": 1827.24, "end": 1834.88, "text": " But I mean, the good question is, when at what is there even a task like this arc challenge"}, {"start": 1834.88, "end": 1835.88, "text": " here?"}, {"start": 1835.88, "end": 1842.24, "text": " Could that is there even a possibility of a task where you wouldn't say that?"}, {"start": 1842.24, "end": 1844.6, "text": " And I'm not so sure about this."}, {"start": 1844.6, "end": 1847.84, "text": " They seem to be more hopeful than I am."}, {"start": 1847.84, "end": 1853.24, "text": " But at least they say, the arc challenge is founded on the same priors as a human has,"}, {"start": 1853.24, "end": 1857.72, "text": " it gives you the same amount of experience as a human has, right."}, {"start": 1857.72, "end": 1861.32, "text": " And therefore, it is much more comparable to human intelligence."}, {"start": 1861.32, "end": 1870.9199999999998, "text": " All right, they go over some weaknesses right here, of criticizing their own thing."}, {"start": 1870.9199999999998, "end": 1872.28, "text": " Generalization is not quantified."}, {"start": 1872.28, "end": 1878.12, "text": " So they have a measure of generalization in the previous chapter, but they don't use it"}, {"start": 1878.12, "end": 1880.0, "text": " right here."}, {"start": 1880.0, "end": 1884.2, "text": " Test validity is not established, data set size and diversity may be limited, and so"}, {"start": 1884.2, "end": 1885.6399999999999, "text": " on."}, {"start": 1885.6399999999999, "end": 1894.48, "text": " But I, in my mind, this, I would not consider this as like an AGI task or anything like"}, {"start": 1894.48, "end": 1895.48, "text": " this."}, {"start": 1895.48, "end": 1900.6, "text": " I'm pretty sure the solution to this will come in a form again, where people don't really"}, {"start": 1900.6, "end": 1903.98, "text": " think it's, it exhibits intelligence."}, {"start": 1903.98, "end": 1906.62, "text": " But I do like the task as such."}, {"start": 1906.62, "end": 1913.12, "text": " And as a machine learner, I am very excited to think about how machine learning can go"}, {"start": 1913.12, "end": 1916.0, "text": " about solving this task."}, {"start": 1916.0, "end": 1922.3999999999999, "text": " And especially with what we've seen from something like GPT-3, that has exactly this kind of"}, {"start": 1922.3999999999999, "end": 1927.3799999999999, "text": " structure where you train on a giant data set, blah, blah, blah, you pre train your"}, {"start": 1927.38, "end": 1934.6000000000001, "text": " language model, but then at inference time, you input a bunch of these demonstration examples,"}, {"start": 1934.6000000000001, "end": 1937.22, "text": " and you ask it for the next output."}, {"start": 1937.22, "end": 1943.88, "text": " So I feel that might be a good start for for doing it."}, {"start": 1943.88, "end": 1951.24, "text": " The question of course, is what, what then do you pre train this model on this GPT-3"}, {"start": 1951.24, "end": 1952.5800000000002, "text": " for ARC?"}, {"start": 1952.5800000000002, "end": 1954.88, "text": " What's the pre training data set for it?"}, {"start": 1954.88, "end": 1961.14, "text": " And I guess that's going to be the challenge and probably going to require people to specifically"}, {"start": 1961.14, "end": 1968.1200000000001, "text": " program all of these priors into a data set generator for pre training."}, {"start": 1968.1200000000001, "end": 1969.3200000000002, "text": " So that would be my approach."}, {"start": 1969.3200000000002, "end": 1974.64, "text": " My approach would be write a data set generator for pre training and GPT-3 model to do these"}, {"start": 1974.64, "end": 1976.24, "text": " kind of tasks."}, {"start": 1976.24, "end": 1982.8400000000001, "text": " And in order to write the data set generator, you'd have to basically program in all of"}, {"start": 1982.84, "end": 1989.4399999999998, "text": " these priors and that's not going to be easy because your best bet is to sort of put yourself"}, {"start": 1989.4399999999998, "end": 1994.0, "text": " into the shoes of shoal and be like, oh, if I were to design a task, what kind of things"}, {"start": 1994.0, "end": 1996.76, "text": " would I do and then try to capture that?"}, {"start": 1996.76, "end": 1998.3999999999999, "text": " That's going to be your best bet."}, {"start": 1998.3999999999999, "end": 2005.32, "text": " Your most honest bet with respect to the challenge is to try to as faithfully as possible implement"}, {"start": 2005.32, "end": 2011.28, "text": " something like an objectness prior where cohesion and persistence are captured."}, {"start": 2011.28, "end": 2016.0, "text": " That would be the most scientifically sound approach to my approach."}, {"start": 2016.0, "end": 2021.26, "text": " All right, so that was my take on the ARC data set."}, {"start": 2021.26, "end": 2025.84, "text": " If you have any comments, I'm very excited to hear comments on this."}, {"start": 2025.84, "end": 2029.36, "text": " If you have already tried the ARC challenge, have some insight."}, {"start": 2029.36, "end": 2033.62, "text": " I also welcome comments on that."}, {"start": 2033.62, "end": 2035.04, "text": " And with that, I'll see you next time."}, {"start": 2035.04, "end": 2042.04, "text": " Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=q6Kyvy1zLwQ
BERTology Meets Biology: Interpreting Attention in Protein Language Models (Paper Explained)
Proteins are the workhorses of almost all cellular functions and a core component of life. But despite their versatility, all proteins are built as sequences of the same 20 amino acids. These sequences can be analyzed with tools from NLP. This paper investigates the attention mechanism of a BERT model that has been trained on protein sequence data and discovers that the language model has implicitly learned non-trivial higher-order biological properties of proteins. OUTLINE: 0:00 - Intro & Overview 1:40 - From DNA to Proteins 5:20 - BERT for Amino Acid Sequences 8:50 - The Structure of Proteins 12:40 - Investigating Biological Properties by Inspecting BERT 17:45 - Amino Acid Substitution 24:55 - Contact Maps 30:15 - Binding Sites 33:45 - Linear Probes 35:25 - Conclusion & Comments Paper: https://arxiv.org/abs/2006.15222 Code: https://github.com/salesforce/provis My Video on BERT: https://youtu.be/-9evrZnBorM My Video on Attention: https://youtu.be/iDulhoQ2pro Abstract: Transformer architectures have proven to learn useful representations for protein classification and generation tasks. However, these representations present challenges in interpretability. Through the lens of attention, we analyze the inner workings of the Transformer and explore how the model discerns structural and functional properties of proteins. We show that attention (1) captures the folding structure of proteins, connecting amino acids that are far apart in the underlying sequence, but spatially close in the three-dimensional structure, (2) targets binding sites, a key functional component of proteins, and (3) focuses on progressively more complex biophysical properties with increasing layer depth. We also present a three-dimensional visualization of the interaction between attention and protein structure. Our findings align with known biological processes and provide a tool to aid discovery in protein engineering and synthetic biology. The code for visualization and analysis is available at this https URL. Authors: Jesse Vig, Ali Madani, Lav R. Varshney, Caiming Xiong, Richard Socher, Nazneen Fatema Rajani Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there. Today we'll look at Bertology meets Biology, Interpreting Attention in Protein Language Models by Jesse Wigg, Ali Madani, Lav R. Varshney, Kaiming Hsiang, Richard Zucker and Nazneen Fatima Rajani. This paper is a investigative paper into models that are trained on biological data, specifically into BERT models, actually into a one specific BERT model that is trained on protein sequences. Now it is trained to simply perform language modeling on these protein sequences, but out of this language model you can then inspect this BERT model and read important biological data of these proteins, higher order data from the attention heads of the BERT model, which is pretty interesting. Basically means that the information of these higher order functions is at some point encoded in the structure of the language of the protein sequence. So we're going to go through what this means and how this comes about and what they did in order to investigate. I think this is a pretty cool investigative work and probably very promising for future research. Yeah, as always if you like content like this, consider sharing it out and leaving a like. Also tell me what you think in the comments. So biology. Really quick for people who maybe have never heard this. In your every cell you have this thing called DNA, which basically is a an encoding of all of your biological functions. Now usually biological functions are realized through proteins. So DNA is basically a building plan for all of your proteins. This happens in the following two steps. First there is this transcription step where RNA is built. This is basically a copy of your DNA but is only single strand as you can see right here. And then there is a translation step that finally translates the RNA into the protein. What will end up is just a sequence of these beads right here. Now these beads are what are called amino acids. So a protein is simply a chain of these amino acids. There are 20 different amino acids and the order of these amino acids in the chain makes the function of the protein. Now specifically we know about these proteins that it seems to be very important how their three-dimensional shape is. So a lot of these different amino acids have different chemical properties. Some are sort of I think negatively charged, some are neutral, some are acids and so on. So they have very different chemical properties. So once you build this protein and you kind of release it into the cell it will curl up into a three-dimensional structure. So this one might be you know doing something like this and sort of form a circle or something like this. Just because these proteins here they kind of attract each other maybe electrically and thus the protein forms a circle and the function of the protein is very much related to its shape. So if it is a circle it could maybe you know trap something else in here. So you really have to think of these things like kind of tools. There are proteins that cut other proteins and they are really shaped sort of like a scissor that exactly fits these other proteins such that you can effectively cut them. So sometimes you can substitute an amino acid for a different amino acid like this here. If it doesn't change the shape very often you're fine. The protein function isn't changed. But if you change a different amino acid that is sort of vital to the shape and the shape changes then your protein very often loses function. So mutations in DNA sometimes lead to mutations in protein, not always because there is some redundancy in this translation step from RNA. But if they do lead to a different amino acid it doesn't actually mean that the function changes. So there is sort of value in analyzing the sequence of the structure of proteins rather than the structure of DNA. Of course it's also important to analyze the structure of DNA but it is also it is equally important to analyze the structure of proteins because they not all the information is in the sequence, not all the obvious information is in the sequence. So what does this paper do? This paper goes and takes a model that has been trained on protein data. So if you look at this protein it is simply a sequence of amino acids and these amino acids they all have names. I think I have a table somewhere here. Yes, so these are the different amino acids that exist and you can see a protein is simply a sequence of these names. So usually they're abbreviated by like a three letter abbreviation or just a one letter abbreviation. So a protein might be A, V, M, M, V, A, G and so on. And this is just a string of text, right? So what I can do is I can train a language model on this. A language model is simply a model that takes a piece of text and tells you what's the next piece of text. So what's the next letter, what's the next word, in this case what's the next amino acid. And we can use tools from NLP for that. Specifically we can train a BERT model. Now BERT works a bit differently than a standard language model. BERT does what is called masked language modeling. So you would take this string, you would feed it into a BERT model right here. And I've made an entire video on BERT if you want to check that out. And what you'll do by inputting that you'll mask out some of the tokens. So you'll maybe mask out this one, mask out this one and then you ask the model to reconstruct those. You say that here's an M and here is an A without seeing them. So the model somehow has to learn from the surrounding amino acids what this amino acid could be, right? So it has to reconstruct this sequence. So the hope here is in natural language is that BERT somehow learns something about language itself. By being able to reconstruct these things it has learned something about language, about which words appear together and when. It might even learn very long distance relationships between words just because it has to predict those. And the idea carries over to biology. So we might hope that a BERT trained on an amino acid sequence will learn something about the language of proteins, about the amino acid sequence. And our goal here is to ask can we somehow infer the 3D shape of a protein, which is the important part, from its sequence right here. So given its sequence, can we infer the 3D shape? Now as I understand it usually this has to be done in like a simulation. So you would you would build this in a simulator and then you do like some sort of a molecule simulation to see how this ends up in a 3D shape. You could train a model to just predict the 3D shape but in this case we're just interested what does the BERT model learn about the 3D shape while only ever having been trained on predicting the next or predicting the sequence of amino acids. So it's never been trained to look at the 3D shape. And that's our goal here. So specifically we'll look at two different things. So here you can see examples of proteins and their high level structure. So in these proteins what you call the primary structure is this sequence of amino acid. This is simply which amino acids are in which order. There is a thing called the secondary structures and we often observe that spans of these amino acids like substrings form these what are called these helixes as you can see here or these sheets. I don't know how they're strands in English. We call them sheets or I think these are the alpha helixes and these are the beta sheets and there is also a turns. I think this here might be a turn. So there are these kind of secondary structures and then the tertiary structure is how these this is still one this is one protein. This is one unbroken chain of amino acid and you can see this here kind of forms this double ring which would be its tertiary structure. Very important for predicting the tertiary structure is to predict when two amino acids are close to each other. So if we have a chain right here and the chain as we saw before kind of turns and bends on itself then these two amino acids here are very close in close contact and to predict which amino acids are in close contact to each other helps you determine the the tertiary structure. So that's a consequence of it. So we wonder does BERT know intrinsically which of these amino acids are going to end up being in contact with each other without ever having been trained to do it. The second thing we're interested in are binding sites. So here, you might not be able to see, but we made this example before where this sort of forms a loop and then I say can trap something here right like another molecule and this is what what we would call a binding site. A binding site is a one amino acid that maybe through the structure of the surrounding amino acid as well but also through its properties and how it is exposed in 3D shape acts as sort of a receptor for other molecules. It binds to other things. It can, so think of your hemoglobin that that traps the the oxygen in your blood or something like this. It is where a chemical reaction or a reaction with something else will happen. That's a binding site and we are interested does BERT, the BERT that is only trained on a language modeling objective know which ones are the binding sites because you know that would be very interesting and not something BERT was trained on. By the way, I particularly liked Richard Soccer's tweet on this. I think he tweeted out, oh BERT trained only on language model can predict binding sites and biological properties and formulated it like it was you know like GPT-3 was formulated like if we train on Wikipedia our model can do math. I thought it was kind of a satire headline. If we train on Wikipedia our model can predict biology and also it can tie your shoes and cook your dinner. Yeah but so it's trained on language modeling on biological data and now that makes sense. So they're going to look at two different things or actually more than two different things but they formulate this in an abstract way right here. So what they'll look at is the so-called properties. The property F and this property F can be for example that a amino acid is a binding site. The property F can also be that two amino acids are in contact with each other. So F always takes I and J. If in the case for example where this is the contact property then it simply is the indicator function for when I and J are in contact. And if it is a just a binding site then I think we are looking at J. At the token level property we define to be an indicator that returns 1 if the property is present in token J. Okay so whenever J is a binding site then that holds. So what we're looking at are these attention heads in BERT. If you don't know BERT has an attention mechanism which basically means from layer to layer each token can attend to all other tokens. So here the amino acid sequence I've drawn it twice and the next layer representation of this amino acid will be able to gather information from all of the other amino acid through an attention mechanism through a dynamic routing algorithm. I've made a video on attention is all you need if you want to find out more how this works. Now what we're interested in is the strength of these connections. So the hypothesis is if molecule here is 1, 2, 3, 4, 5, and 6. If molecule 1 and 3 are contact sites then maybe we will find a layer where this connection between 1 and 3 is very strong. That would indicate that there is a connection site or that would indicate that BERT has learned something about the connection sites. Okay if we find this repeatedly so if we look at many many proteins and whenever we know that there is a contact between two things and then we observe that the corresponding attention is very high then we can be pretty sure that BERT has learned something about contact between amino acids. Okay the same goes for binding sites. So if 4 here is a binding site and then all the connections all the attention that the higher layer gets from 4 so all the information routed away from 4 is very strong that means all these other tokens are paying special attention to the token number 4 to this amino acid. And if we find that there is a big correlation with this being a binding site then we can reasonably conclude that BERT has learned something about binding sites. Alright so we're going to do a correlative analysis for proteins where we know the binding sites where we know the contacts right we can analyze them we can run simulations therefore we can know them. So we're going to look at this quantity right here which is simply a normalized quantity. So we're going to look at the attention in a given attention head so as you know BERT has many layers with many attention heads and we're going to look at whether or not this property is active and just normalize it by the total attention in that head so that we get some kind of a percentage number. That's the first task we're basically going to look at how does the attention correlate with these properties. And the second task we're going to do is this probing task. So a probing task is like a linear probe in like a classifier. So what we're going to do is we're going to take a layer right here and even though it's an intermediate layer we're simply going to run it through a linear classifier and then decide is this a binding site for example or not. Is a given amino acid a binding site or not? Is a given pair a contact or not? So this is kind of a linear probe but this sort of takes a backseat in this paper. The analysis is really on the attention heads and what the attention heads learn. And that's already it. They take a pre-trained BERT model so there are these BERT models that are already trained on these protein databases and first they look simply can we find attention heads that correlate with a given amino acid. So here you see the attention to the amino acid. This is proline I believe and this is phenylalanine. Is that the same in English? Yes, phenylalanine and proline right here. So you can see that the plots here are there's almost no attention pretty much throughout the network that pays special attention to the amino acid proline except this head right here seems to have if you look at the scale over like a 70% of attention always goes to proline in this particular head. So this is layer 1 head number 11 focuses 78% of its attention on proline. Now this is not that special if you think about it because in language models as well in natural language models you might want to think that you have some mechanism in your neural network that's especially specialized on like a very particular word in the language because that might just be a often occurring very particular word. For example in English maybe the is very important or the word what these are like very indicative very often occurring words so it is reasonable to expect to find an attention head that pays a lot of attention to these things especially here where our vocabulary size is 20 instead of like 30,000 in natural language. And the same goes for this phenylalanine where you can see that in the last layer and in the first layer you have attention and also in the proline you have in the last layer. So why does this make sense? Because what we would expect from like single tokens these are not interactions yet these are not biological functions yet. So we know that in the lower layers of a neural network we have these kind of basic features basic feature extractors and here these basic feature extractors appear to be simply paying attention to one specific token in the vocabulary a lot. So they kind of these heads sort of specialize for single for single amino acids. And the same in the last layer so in the very last layer the task of the very last layer is to prepare for the classification task. So if you remember the BERT model you have layer layer layer layer and at the end you'll have to predict which ones are masked down here. So at the end you have to predict single amino acids again so if there's a proline masked here you'll have to predict the proline. So it also makes sense that the last layers would very much specialize to single tokens. So this does make sense. Now our question is going to be do we find the biological function where would you expect them? We would expect the let's say the tertiary, sorry the secondary structures which are sort of one level higher than the primary structures we would expect to find them maybe here and then we would expect to find the tertiary structures maybe somewhere here okay because these are most highest level. And then it goes it goes back again or maybe it's like we find the tertiary structures rather here and here again and then in the middle we'll find the the most high level the tertiary structures or yeah blue secondary. This drawing is getting too too too weird but there could be multiple scenarios but that could fit here but until now it sort of makes sense. So they do an additional investigation where as I told you sometimes you can substitute an amino acid and nothing really happens right and in fact that this probably happens in you right now you probably might have some mutation that changed some amino acid and you don't even realize because it's just it's fine. No notice. So the biologists can build these matrices of how much you can substitute proteins with each other. So here you see this BLOSUM62 substitution scores which are very I guess very high if you can substitute two protein, two amino acids with each other and the effect is negligible. And it's very low if it's the the other way around. Now this is interesting so far but you compare this to this matrix right here. This is the attention similarity. So what we'll do is for each two amino acids we take those two attention things, those two attention matrices and we'll calculate the correlation between the attention matrices. And our hypothesis is that the more correlated the attention patterns are between the two amino acids the more likely we are to substitute them because as a direct result of our language model our language model is it's reconstructing right these things. So our language model is going to treat if in natural language is like a a synonym right is our language model is going to treat synonyms very similar to each other because they're synonyms they can be exchanged. So a good language model should learn that they are almost the same and therefore the attention pattern is going to be almost the same. So a high correlation we hypothesize is a means that the function of the amino acid is similar and therefore we can substitute it easily. So this here is the matrix of the correlations between each two attention patterns of these amino acid. And if you compare the two right here they look extremely similar. Just have a look for a little while and you'll see that the patterns they do not match perfectly but they are very very similar. The dark spots are in the same places the light spots are in the same places. So this already makes a good case that the language model here has learned something about biology. Now what we want to do is we want to investigate higher order higher order functions. So here we're interested in these contact maps right. So how likely is it that two amino acids are in contact and we'll look at it through the lens of attention as we did before. So here is the percentage of each head of each head's attention that is aligned with contact maps averaged over a data set suggesting that head 12 4 is uniquely specialized for contact prediction. So look at this this this head here is just spiking. So remember before we said our analysis is whenever whenever we're basically measuring the correlation of two things being in contact because we know it from our simulator or from our data set the correlation of that with an attention connection being particularly strong. And we find it in this attention head right here. So this layer 12 head number four will always peek out whenever two things are in contact. Now you can see that it's it's not like always it's like 25 percent of its attention but significantly more than anything else right here. In fact if you group the things by this attention you can build the following plot. So you can see right here probability two amino acids are in contact as a function of attention between the amino acids in head 12 4 showing attention approximates perfectly calibrated estimator which would be the green line. So here we simply for each for each pairs two amino acids for each pair of amino acids we plot we make a histogram right here of what they're sorry not a histogram we plot the probability if they have the attention weight point nine we plot how likely is it that they are in contact. So this is this if we just look at the data and we simply take this attention weight as a measure as a predictor of being in contact we get the blue curve and the green curve would be if we could perfectly predict from this attention head what the probability of contact would be and you can see that the fit is fairly good you can't predict with super high accuracy but the fit is fairly good and you can see the general trend that as the attention in this head rises the probability of the two amino acids being in contact with each other also rises. So we can sort of confidently say that BERT has learned something about a higher level biological structure just from the language modeling objective. How can we interpret this? This must somehow mean that it is possible it is vital for reconstructing the sequence from its surrounding so if we delete this right here if these two are in contact in the 3D structure that makes probably probably means that this thing right here is a very good predictor of what was here. If we mask this out and we're asked to reconstruct which amino acid was there then it probably helps to look at its neighbors right it probably always helps to look at one's neighbors especially also in natural language but if these two are in contact they have very special connection to each other it's very you can basically read out from this one which one this was. This is sort of like if you have a sentence and you say I don't know I can't come up with one right now but if it's like and then there is a name like Mark and then and then there is him right and you would expect if I drop out okay let's do it the other way around if I drop out him then from the text right here you can probably determine that it is some sort of pronoun but then you go back and you see it's Mark okay so it's not like it's not like it or some or she it's probably he or him this is sort of the analogous structure right here in biology. The second thing we're looking at is these binding sites. Now these are single properties of different amino acids and we're simply looking at all the incoming or sorry all the other tokens that focuses their attention. Why is this important? Because these binding sites are central to the structure of the or to the function of the protein right if this here is a binding site then that's a very central important point of the protein. So a lot of these other things are going to be determined by what this binding site is. This binding site needs to have a very particular function and therefore probably needs to be a very particular amino acid and the other things here are sort of supporting this binding site because they form the 3d structure around it and so on. So you would expect a lot of attention to be put on this binding site and what do we find? We find that it's a bit more murky than before so you can see that the attention is kind of spread out. Percentage of each head's attention that focuses on binding sites especially in the deeper layers binding sites are targeted at much higher frequency than would occur by chance. Head 71 has the highest percentage with 34%. So also here you can see that it is spread out but this is because multiple heads are now focusing on these binding sites because probably binding sites come in different variations so you'll have lots of heads specializing on attending to binding sites and they say it is much higher frequency than would occur by chance and you can see here this head is the highest with 34% of its attention focused on binding sites. You can also see the general trend of the attention being rather in the later layers which we would expect from a tertiary structure. Now yeah it would be interesting here. Here you also see that actually most of the things are in the in the last layer which points to points to rather maybe lower lower level information because we reasoned before about the last layer or I was just wrong but also in a general trend you can see that the attention is rather shifted towards the later layers because this is sort of a higher order function. Okay if you look at the same calibration experiment you can see that the picture is not as clear. There is the general trend at the beginning but then it sort of flattens out so you can sort of differentiate the very probably not a binding site from the somewhat probably a binding site but it's not a perfectly calibrated classifier and that might just be because there are many things specializing in different types of binding sites so you can't just go to this one head so this is just for this one head. You can't just go to that one and expect that to classify all the binding sites because you might want to be you might want to combine all of the high ranking ones here to form a classifier. The last experiment they do is these linear probes which where they just go and they just build classifiers from different parts of the network and you can see right here that what is predicted and how well they work. So each bar here is going to be the difference of performance so this is differential performance of diagnostic classifier by layer sorted by task order in figure 8. Each plot shows the change in performance between the given layer and the previous layer. So a bar up shows it's performing better than the previous layer bar down shows it's performing worse than the previous layer. So you see right here that these are the secondary structures right here and you can see that there is a lot of performance in the earlier layers right here and sort of not that high performance in the later layers whereas for the tertiary structures the binding site and the contact you can see that there is a bit of performance in places but it sort of tends to be more towards the middle certainly more at towards the middle of the end of the network than the secondary structures which sort of makes sense with our hypothesis. You can also see this here where they show the percent of attention focused as a function of layer and the red is the center of mass and you can see that as the secondary structures this their center of mass is at a lower layer in general than the tertiary functions. All of this is not perfect of course but it's still an open question I guess whether or not it's not perfect because we haven't built a strong enough language model yet. Do I want to say GPT-4 is now for biology and not for language or is it because there is really you need you really can't very well predict these things just from a language model. I mean you should technically all the information is there but maybe the language model objective as such isn't able to capture that information. So yeah this was the paper it's pretty simple they have in the appendix they have a lot of these additional experiments or full experiments I believe for all the amino acids and so on and I invite you to check that out. In general I like this kind of work because it's very applied it's and it can you know tell us something about the nature of both these language models and the biological things that we that we care about in biology. Okay I'm just talking crap right now thanks for being here I hope you enjoyed it and bye bye.
[{"start": 0.0, "end": 5.92, "text": " Hi there. Today we'll look at Bertology meets Biology, Interpreting Attention in"}, {"start": 5.92, "end": 12.040000000000001, "text": " Protein Language Models by Jesse Wigg, Ali Madani, Lav R. Varshney, Kaiming Hsiang,"}, {"start": 12.040000000000001, "end": 20.04, "text": " Richard Zucker and Nazneen Fatima Rajani. This paper is a investigative paper into"}, {"start": 20.04, "end": 25.64, "text": " models that are trained on biological data, specifically into BERT models,"}, {"start": 25.64, "end": 32.76, "text": " actually into a one specific BERT model that is trained on protein sequences. Now"}, {"start": 32.76, "end": 39.480000000000004, "text": " it is trained to simply perform language modeling on these protein sequences, but"}, {"start": 39.480000000000004, "end": 45.8, "text": " out of this language model you can then inspect this BERT model and read"}, {"start": 45.8, "end": 51.8, "text": " important biological data of these proteins, higher order data from the"}, {"start": 51.8, "end": 56.16, "text": " attention heads of the BERT model, which is pretty interesting. Basically means"}, {"start": 56.16, "end": 62.0, "text": " that the information of these higher order functions is at some point encoded"}, {"start": 62.0, "end": 68.24, "text": " in the structure of the language of the protein sequence. So we're going to go"}, {"start": 68.24, "end": 74.2, "text": " through what this means and how this comes about and what they did in order"}, {"start": 74.2, "end": 79.56, "text": " to investigate. I think this is a pretty cool investigative work and probably"}, {"start": 79.56, "end": 87.72, "text": " very promising for future research. Yeah, as always if you like content like"}, {"start": 87.72, "end": 93.44, "text": " this, consider sharing it out and leaving a like. Also tell me what you think in"}, {"start": 93.44, "end": 101.96000000000001, "text": " the comments. So biology. Really quick for people who maybe have never heard"}, {"start": 101.96000000000001, "end": 109.04, "text": " this. In your every cell you have this thing called DNA, which basically is a"}, {"start": 109.04, "end": 114.88000000000001, "text": " an encoding of all of your biological functions. Now usually biological"}, {"start": 114.88000000000001, "end": 120.84, "text": " functions are realized through proteins. So DNA is basically a building plan for"}, {"start": 120.84, "end": 126.16000000000001, "text": " all of your proteins. This happens in the following two steps. First there is this"}, {"start": 126.16000000000001, "end": 132.8, "text": " transcription step where RNA is built. This is basically a copy of your DNA but"}, {"start": 132.8, "end": 137.04000000000002, "text": " is only single strand as you can see right here. And then there is a"}, {"start": 137.04, "end": 143.79999999999998, "text": " translation step that finally translates the RNA into the protein. What will end"}, {"start": 143.79999999999998, "end": 149.51999999999998, "text": " up is just a sequence of these beads right here. Now these beads are what are"}, {"start": 149.51999999999998, "end": 155.12, "text": " called amino acids. So a protein is simply a chain of these amino acids."}, {"start": 155.12, "end": 161.6, "text": " There are 20 different amino acids and the order of these amino acids in the"}, {"start": 161.6, "end": 166.95999999999998, "text": " chain makes the function of the protein. Now specifically we know about these"}, {"start": 166.96, "end": 172.72, "text": " proteins that it seems to be very important how their three-dimensional"}, {"start": 172.72, "end": 177.52, "text": " shape is. So a lot of these different amino acids have different chemical"}, {"start": 177.52, "end": 184.68, "text": " properties. Some are sort of I think negatively charged, some are neutral, some"}, {"start": 184.68, "end": 189.16, "text": " are acids and so on. So they have very different chemical properties. So once"}, {"start": 189.16, "end": 194.8, "text": " you build this protein and you kind of release it into the cell it will curl up"}, {"start": 194.8, "end": 198.8, "text": " into a three-dimensional structure. So this one might be you know doing"}, {"start": 198.8, "end": 205.56, "text": " something like this and sort of form a circle or something like this."}, {"start": 205.56, "end": 210.88000000000002, "text": " Just because these proteins here they kind of attract each other maybe"}, {"start": 210.88000000000002, "end": 216.60000000000002, "text": " electrically and thus the protein forms a circle and the function of the protein"}, {"start": 216.60000000000002, "end": 221.92000000000002, "text": " is very much related to its shape. So if it is a circle it could maybe you know"}, {"start": 221.92, "end": 226.0, "text": " trap something else in here. So you really have to think of these things"}, {"start": 226.0, "end": 231.07999999999998, "text": " like kind of tools. There are proteins that cut other proteins and they are"}, {"start": 231.07999999999998, "end": 237.95999999999998, "text": " really shaped sort of like a scissor that exactly fits these other proteins"}, {"start": 237.95999999999998, "end": 245.2, "text": " such that you can effectively cut them. So sometimes you can substitute an"}, {"start": 245.2, "end": 250.64, "text": " amino acid for a different amino acid like this here. If it doesn't change the"}, {"start": 250.64, "end": 257.52, "text": " shape very often you're fine. The protein function isn't changed."}, {"start": 257.52, "end": 262.88, "text": " But if you change a different amino acid that is sort of vital to the shape and"}, {"start": 262.88, "end": 270.56, "text": " the shape changes then your protein very often loses function. So mutations in DNA"}, {"start": 270.56, "end": 278.03999999999996, "text": " sometimes lead to mutations in protein, not always because there is some"}, {"start": 278.04, "end": 282.72, "text": " redundancy in this translation step from RNA. But if they do lead to a"}, {"start": 282.72, "end": 288.12, "text": " different amino acid it doesn't actually mean that the function changes. So there"}, {"start": 288.12, "end": 294.84000000000003, "text": " is sort of value in analyzing the sequence of the structure of proteins"}, {"start": 294.84000000000003, "end": 298.64000000000004, "text": " rather than the structure of DNA. Of course it's also important to analyze"}, {"start": 298.64000000000004, "end": 304.56, "text": " the structure of DNA but it is also it is equally important to analyze the"}, {"start": 304.56, "end": 311.44, "text": " structure of proteins because they not all the information is in the sequence,"}, {"start": 311.44, "end": 318.24, "text": " not all the obvious information is in the sequence. So what does this paper do?"}, {"start": 318.24, "end": 324.76, "text": " This paper goes and takes a model that has been trained on protein data. So if"}, {"start": 324.76, "end": 329.84000000000003, "text": " you look at this protein it is simply a sequence of amino acids and these amino"}, {"start": 329.84, "end": 335.76, "text": " acids they all have names. I think I have a table somewhere here. Yes, so these are"}, {"start": 335.76, "end": 343.32, "text": " the different amino acids that exist and you can see a protein is simply a"}, {"start": 343.32, "end": 348.67999999999995, "text": " sequence of these names. So usually they're abbreviated by like a three"}, {"start": 348.67999999999995, "end": 354.23999999999995, "text": " letter abbreviation or just a one letter abbreviation. So a protein might be A, V,"}, {"start": 354.24, "end": 364.0, "text": " M, M, V, A, G and so on. And this is just a string of text, right? So what I can do"}, {"start": 364.0, "end": 369.2, "text": " is I can train a language model on this. A language model is simply a model that"}, {"start": 369.2, "end": 375.08, "text": " takes a piece of text and tells you what's the next piece of text. So what's"}, {"start": 375.08, "end": 379.92, "text": " the next letter, what's the next word, in this case what's the next amino acid. And"}, {"start": 379.92, "end": 386.08000000000004, "text": " we can use tools from NLP for that. Specifically we can train a BERT model."}, {"start": 386.08000000000004, "end": 390.84000000000003, "text": " Now BERT works a bit differently than a standard language model. BERT does"}, {"start": 390.84000000000003, "end": 395.04, "text": " what is called masked language modeling. So you would take this string, you would"}, {"start": 395.04, "end": 400.72, "text": " feed it into a BERT model right here. And I've made an entire video on BERT if"}, {"start": 400.72, "end": 405.96000000000004, "text": " you want to check that out. And what you'll do by inputting that you'll mask"}, {"start": 405.96, "end": 410.2, "text": " out some of the tokens. So you'll maybe mask out this one, mask out this one and"}, {"start": 410.2, "end": 415.71999999999997, "text": " then you ask the model to reconstruct those. You say that here's an M and here"}, {"start": 415.71999999999997, "end": 419.96, "text": " is an A without seeing them. So the model somehow has to learn from the"}, {"start": 419.96, "end": 427.67999999999995, "text": " surrounding amino acids what this amino acid could be, right? So it has to"}, {"start": 427.67999999999995, "end": 434.44, "text": " reconstruct this sequence. So the hope here is in natural language is that BERT"}, {"start": 434.44, "end": 440.88, "text": " somehow learns something about language itself. By being able to reconstruct"}, {"start": 440.88, "end": 445.0, "text": " these things it has learned something about language, about which words appear"}, {"start": 445.0, "end": 449.88, "text": " together and when. It might even learn very long distance relationships between"}, {"start": 449.88, "end": 457.0, "text": " words just because it has to predict those. And the idea carries over to"}, {"start": 457.0, "end": 465.0, "text": " biology. So we might hope that a BERT trained on an amino acid sequence will"}, {"start": 465.0, "end": 471.12, "text": " learn something about the language of proteins, about the amino"}, {"start": 471.12, "end": 479.04, "text": " acid sequence. And our goal here is to ask can we somehow infer the 3D"}, {"start": 479.04, "end": 484.32, "text": " shape of a protein, which is the important part, from its sequence right"}, {"start": 484.32, "end": 491.44, "text": " here. So given its sequence, can we infer the 3D shape? Now as I understand it"}, {"start": 491.44, "end": 496.15999999999997, "text": " usually this has to be done in like a simulation. So you would you would build"}, {"start": 496.15999999999997, "end": 502.44, "text": " this in a simulator and then you do like some sort of a molecule simulation to"}, {"start": 502.44, "end": 507.84, "text": " see how this ends up in a 3D shape. You could train a model to just predict the"}, {"start": 507.84, "end": 512.36, "text": " 3D shape but in this case we're just interested what does the BERT model learn"}, {"start": 512.36, "end": 518.76, "text": " about the 3D shape while only ever having been trained on predicting the"}, {"start": 518.76, "end": 524.24, "text": " next or predicting the sequence of amino acids. So it's never been trained to"}, {"start": 524.24, "end": 530.12, "text": " look at the 3D shape. And that's our goal here. So specifically we'll look at two"}, {"start": 530.12, "end": 534.5600000000001, "text": " different things. So here you can see examples of proteins and their high"}, {"start": 534.5600000000001, "end": 540.16, "text": " level structure. So in these proteins what you call the primary structure is"}, {"start": 540.16, "end": 546.28, "text": " this sequence of amino acid. This is simply which amino acids are in which"}, {"start": 546.28, "end": 551.68, "text": " order. There is a thing called the secondary structures and we often"}, {"start": 551.68, "end": 558.1999999999999, "text": " observe that spans of these amino acids like substrings form these what are"}, {"start": 558.1999999999999, "end": 565.1999999999999, "text": " called these helixes as you can see here or these sheets. I don't know how they're"}, {"start": 565.2, "end": 571.24, "text": " strands in English. We call them sheets or I think these are the alpha helixes"}, {"start": 571.24, "end": 576.48, "text": " and these are the beta sheets and there is also a turns. I think this here might"}, {"start": 576.48, "end": 582.1600000000001, "text": " be a turn. So there are these kind of secondary structures and then the"}, {"start": 582.1600000000001, "end": 587.76, "text": " tertiary structure is how these this is still one this is one protein. This is"}, {"start": 587.76, "end": 592.2, "text": " one unbroken chain of amino acid and you can see this here kind of forms this"}, {"start": 592.2, "end": 597.9200000000001, "text": " double ring which would be its tertiary structure. Very important for"}, {"start": 597.9200000000001, "end": 604.6400000000001, "text": " predicting the tertiary structure is to predict when two amino acids are close"}, {"start": 604.6400000000001, "end": 609.96, "text": " to each other. So if we have a chain right here and the chain as we saw"}, {"start": 609.96, "end": 615.6, "text": " before kind of turns and bends on itself then these two amino acids here are very"}, {"start": 615.6, "end": 622.8000000000001, "text": " close in close contact and to predict which amino acids are in close contact"}, {"start": 622.8000000000001, "end": 628.52, "text": " to each other helps you determine the the tertiary structure. So that's a"}, {"start": 628.52, "end": 636.5600000000001, "text": " consequence of it. So we wonder does BERT know intrinsically which of these"}, {"start": 636.5600000000001, "end": 640.76, "text": " amino acids are going to end up being in contact with each other without ever"}, {"start": 640.76, "end": 646.28, "text": " having been trained to do it. The second thing we're interested in are binding"}, {"start": 646.28, "end": 652.68, "text": " sites. So here, you might not be able to see, but we made this example before"}, {"start": 652.68, "end": 657.64, "text": " where this sort of forms a loop and then I say can trap something here right like"}, {"start": 657.64, "end": 663.24, "text": " another molecule and this is what what we would call a binding site. A binding"}, {"start": 663.24, "end": 671.52, "text": " site is a one amino acid that maybe through the structure of the surrounding"}, {"start": 671.52, "end": 676.8, "text": " amino acid as well but also through its properties and how it is exposed in 3D"}, {"start": 676.8, "end": 683.8, "text": " shape acts as sort of a receptor for other molecules. It binds to other things."}, {"start": 683.8, "end": 691.04, "text": " It can, so think of your hemoglobin that that traps the the oxygen in your blood"}, {"start": 691.04, "end": 698.8399999999999, "text": " or something like this. It is where a chemical reaction or a reaction with"}, {"start": 698.8399999999999, "end": 703.7199999999999, "text": " something else will happen. That's a binding site and we are interested does"}, {"start": 703.7199999999999, "end": 710.5999999999999, "text": " BERT, the BERT that is only trained on a language modeling objective know which"}, {"start": 710.5999999999999, "end": 716.16, "text": " ones are the binding sites because you know that would be very interesting and"}, {"start": 716.16, "end": 721.1999999999999, "text": " not something BERT was trained on. By the way, I particularly liked Richard"}, {"start": 721.1999999999999, "end": 727.24, "text": " Soccer's tweet on this. I think he tweeted out, oh BERT trained only on"}, {"start": 727.24, "end": 732.48, "text": " language model can predict binding sites and biological properties and formulated"}, {"start": 732.48, "end": 737.6, "text": " it like it was you know like GPT-3 was formulated like if we train on Wikipedia"}, {"start": 737.6, "end": 743.88, "text": " our model can do math. I thought it was kind of a satire headline. If we train on"}, {"start": 743.88, "end": 749.16, "text": " Wikipedia our model can predict biology and also it can tie your shoes and cook"}, {"start": 749.16, "end": 755.64, "text": " your dinner. Yeah but so it's trained on language modeling on biological data and"}, {"start": 755.64, "end": 762.64, "text": " now that makes sense. So they're going to look at two different things or actually"}, {"start": 762.64, "end": 767.96, "text": " more than two different things but they formulate this in an abstract way right"}, {"start": 767.96, "end": 775.52, "text": " here. So what they'll look at is the so-called properties. The property F and"}, {"start": 775.52, "end": 783.36, "text": " this property F can be for example that a amino acid is a binding site. The"}, {"start": 783.36, "end": 789.2800000000001, "text": " property F can also be that two amino acids are in contact with each other. So"}, {"start": 789.2800000000001, "end": 796.1600000000001, "text": " F always takes I and J. If in the case for example where this is the contact"}, {"start": 796.16, "end": 802.92, "text": " property then it simply is the indicator function for when I and J are in"}, {"start": 802.92, "end": 814.88, "text": " contact. And if it is a just a binding site then I think we are looking at J. At"}, {"start": 814.88, "end": 819.3199999999999, "text": " the token level property we define to be an indicator that returns 1 if the"}, {"start": 819.32, "end": 826.5200000000001, "text": " property is present in token J. Okay so whenever J is a binding site then that"}, {"start": 826.5200000000001, "end": 831.96, "text": " holds. So what we're looking at are these attention heads in BERT. If you don't"}, {"start": 831.96, "end": 836.7600000000001, "text": " know BERT has an attention mechanism which basically means from layer to"}, {"start": 836.7600000000001, "end": 843.08, "text": " layer each token can attend to all other tokens. So here the amino acid sequence"}, {"start": 843.08, "end": 848.84, "text": " I've drawn it twice and the next layer representation of this amino acid will"}, {"start": 848.84, "end": 853.5600000000001, "text": " be able to gather information from all of the other amino acid through an"}, {"start": 853.5600000000001, "end": 858.2, "text": " attention mechanism through a dynamic routing algorithm. I've made a video on"}, {"start": 858.2, "end": 863.8000000000001, "text": " attention is all you need if you want to find out more how this works. Now what"}, {"start": 863.8000000000001, "end": 870.9200000000001, "text": " we're interested in is the strength of these connections. So the hypothesis is"}, {"start": 870.92, "end": 881.04, "text": " if molecule here is 1, 2, 3, 4, 5, and 6. If molecule 1 and 3 are contact sites"}, {"start": 881.04, "end": 890.12, "text": " then maybe we will find a layer where this connection between 1 and 3 is very"}, {"start": 890.12, "end": 896.12, "text": " strong. That would indicate that there is a connection site or that would"}, {"start": 896.12, "end": 901.5600000000001, "text": " indicate that BERT has learned something about the connection sites. Okay if we"}, {"start": 901.5600000000001, "end": 906.88, "text": " find this repeatedly so if we look at many many proteins and whenever we know"}, {"start": 906.88, "end": 911.8, "text": " that there is a contact between two things and then we observe that the"}, {"start": 911.8, "end": 918.28, "text": " corresponding attention is very high then we can be pretty sure that BERT has"}, {"start": 918.28, "end": 924.6, "text": " learned something about contact between amino acids. Okay the same goes for"}, {"start": 924.6, "end": 932.44, "text": " binding sites. So if 4 here is a binding site and then all the"}, {"start": 932.44, "end": 938.36, "text": " connections all the attention that the higher layer gets from 4 so all the"}, {"start": 938.36, "end": 943.32, "text": " information routed away from 4 is very strong that means all these other tokens"}, {"start": 943.32, "end": 948.4, "text": " are paying special attention to the token number 4 to this amino acid. And"}, {"start": 948.4, "end": 955.0, "text": " if we find that there is a big correlation with this being a binding site then we"}, {"start": 955.0, "end": 960.24, "text": " can reasonably conclude that BERT has learned something about binding sites."}, {"start": 960.24, "end": 965.0799999999999, "text": " Alright so we're going to do a correlative analysis for proteins where"}, {"start": 965.0799999999999, "end": 970.36, "text": " we know the binding sites where we know the contacts right we can analyze them"}, {"start": 970.36, "end": 977.6, "text": " we can run simulations therefore we can know them. So we're going to look at this"}, {"start": 977.6, "end": 981.5600000000001, "text": " quantity right here which is simply a normalized quantity. So we're going to"}, {"start": 981.5600000000001, "end": 986.9200000000001, "text": " look at the attention in a given attention head so as you know BERT has"}, {"start": 986.9200000000001, "end": 992.76, "text": " many layers with many attention heads and we're going to look at whether or"}, {"start": 992.76, "end": 997.6800000000001, "text": " not this property is active and just normalize it by the total attention in"}, {"start": 997.6800000000001, "end": 1003.36, "text": " that head so that we get some kind of a percentage number. That's the first task"}, {"start": 1003.36, "end": 1007.36, "text": " we're basically going to look at how does the attention correlate with these"}, {"start": 1007.36, "end": 1013.52, "text": " properties. And the second task we're going to do is this probing task. So a"}, {"start": 1013.52, "end": 1019.36, "text": " probing task is like a linear probe in like a classifier. So what we're going to"}, {"start": 1019.36, "end": 1026.64, "text": " do is we're going to take a layer right here and even though it's an"}, {"start": 1026.64, "end": 1031.28, "text": " intermediate layer we're simply going to run it through a linear classifier and"}, {"start": 1031.28, "end": 1037.6399999999999, "text": " then decide is this a binding site for example or not. Is a given"}, {"start": 1037.6399999999999, "end": 1044.84, "text": " amino acid a binding site or not? Is a given pair a contact or not? So this is"}, {"start": 1044.84, "end": 1049.6, "text": " kind of a linear probe but this sort of takes a backseat in this paper. The"}, {"start": 1049.6, "end": 1053.6399999999999, "text": " analysis is really on the attention heads and what the attention heads learn."}, {"start": 1053.6399999999999, "end": 1059.8, "text": " And that's already it. They take a pre-trained BERT model so there are"}, {"start": 1059.8, "end": 1064.8, "text": " these BERT models that are already trained on these protein databases and"}, {"start": 1064.8, "end": 1072.44, "text": " first they look simply can we find attention heads that correlate with a"}, {"start": 1072.44, "end": 1079.6, "text": " given amino acid. So here you see the attention to the amino acid. This is"}, {"start": 1079.6, "end": 1085.76, "text": " proline I believe and this is phenylalanine. Is that the same in"}, {"start": 1085.76, "end": 1095.48, "text": " English? Yes, phenylalanine and proline right here. So you can see that"}, {"start": 1095.48, "end": 1104.68, "text": " the plots here are there's almost no attention pretty much throughout the"}, {"start": 1104.68, "end": 1111.2, "text": " network that pays special attention to the amino acid proline except this head"}, {"start": 1111.2, "end": 1117.16, "text": " right here seems to have if you look at the scale over like a 70% of attention"}, {"start": 1117.16, "end": 1122.3600000000001, "text": " always goes to proline in this particular head. So this is layer 1 head"}, {"start": 1122.3600000000001, "end": 1133.88, "text": " number 11 focuses 78% of its attention on proline. Now this is not that special"}, {"start": 1133.88, "end": 1137.72, "text": " if you think about it because in language models as well in natural"}, {"start": 1137.72, "end": 1142.48, "text": " language models you might want to think that you have some mechanism in your"}, {"start": 1142.48, "end": 1146.24, "text": " neural network that's especially specialized on like a very particular"}, {"start": 1146.24, "end": 1151.32, "text": " word in the language because that might just be a often occurring very"}, {"start": 1151.32, "end": 1158.28, "text": " particular word. For example in English maybe the is very important or the word"}, {"start": 1158.28, "end": 1164.84, "text": " what these are like very indicative very often occurring words so it is"}, {"start": 1164.84, "end": 1168.56, "text": " reasonable to expect to find an attention head that pays a lot of"}, {"start": 1168.56, "end": 1173.1999999999998, "text": " attention to these things especially here where our vocabulary size is 20"}, {"start": 1173.1999999999998, "end": 1179.9599999999998, "text": " instead of like 30,000 in natural language. And the same goes for this"}, {"start": 1179.9599999999998, "end": 1186.52, "text": " phenylalanine where you can see that in the last layer and in the"}, {"start": 1186.52, "end": 1189.9599999999998, "text": " first layer you have attention and also in the proline you have in the last"}, {"start": 1189.9599999999998, "end": 1194.3999999999999, "text": " layer. So why does this make sense? Because what we would expect from like"}, {"start": 1194.4, "end": 1198.68, "text": " single tokens these are not interactions yet these are not biological functions"}, {"start": 1198.68, "end": 1204.64, "text": " yet. So we know that in the lower layers of a neural network we have these kind"}, {"start": 1204.64, "end": 1209.52, "text": " of basic features basic feature extractors and here these basic feature"}, {"start": 1209.52, "end": 1216.52, "text": " extractors appear to be simply paying attention to one specific token in the"}, {"start": 1216.52, "end": 1222.16, "text": " vocabulary a lot. So they kind of these heads sort of specialize for single"}, {"start": 1222.16, "end": 1228.16, "text": " for single amino acids. And the same in the last layer so in the very last layer"}, {"start": 1228.16, "end": 1235.88, "text": " the task of the very last layer is to prepare for the classification task. So"}, {"start": 1235.88, "end": 1241.2, "text": " if you remember the BERT model you have layer layer layer layer and at the"}, {"start": 1241.2, "end": 1246.16, "text": " end you'll have to predict which ones are masked down here. So at the end you"}, {"start": 1246.16, "end": 1252.0800000000002, "text": " have to predict single amino acids again so if there's a proline masked here"}, {"start": 1252.08, "end": 1256.84, "text": " you'll have to predict the proline. So it also makes sense that the last layers"}, {"start": 1256.84, "end": 1266.6399999999999, "text": " would very much specialize to single tokens. So this does make sense. Now our"}, {"start": 1266.6399999999999, "end": 1271.84, "text": " question is going to be do we find the biological function where would you"}, {"start": 1271.84, "end": 1276.8, "text": " expect them? We would expect the let's say the tertiary, sorry the secondary"}, {"start": 1276.8, "end": 1281.28, "text": " structures which are sort of one level higher than the primary structures we"}, {"start": 1281.28, "end": 1285.48, "text": " would expect to find them maybe here and then we would expect to find the"}, {"start": 1285.48, "end": 1291.04, "text": " tertiary structures maybe somewhere here okay because these are most highest"}, {"start": 1291.04, "end": 1297.36, "text": " level. And then it goes it goes back again or maybe it's like we find the"}, {"start": 1297.36, "end": 1304.68, "text": " tertiary structures rather here and here again and then in the middle we'll find"}, {"start": 1304.68, "end": 1310.2, "text": " the the most high level the tertiary structures or yeah blue secondary. This"}, {"start": 1310.2, "end": 1317.28, "text": " drawing is getting too too too weird but there could be multiple scenarios but"}, {"start": 1317.28, "end": 1323.6000000000001, "text": " that could fit here but until now it sort of makes sense. So they do an"}, {"start": 1323.6000000000001, "end": 1328.72, "text": " additional investigation where as I told you sometimes you can substitute an"}, {"start": 1328.72, "end": 1334.64, "text": " amino acid and nothing really happens right and in fact that this probably"}, {"start": 1334.64, "end": 1340.04, "text": " happens in you right now you probably might have some mutation that changed"}, {"start": 1340.04, "end": 1347.1599999999999, "text": " some amino acid and you don't even realize because it's just it's fine. No"}, {"start": 1347.1599999999999, "end": 1354.1599999999999, "text": " notice. So the biologists can build these matrices of how much you can substitute"}, {"start": 1354.1599999999999, "end": 1360.92, "text": " proteins with each other. So here you see this BLOSUM62 substitution scores which"}, {"start": 1360.92, "end": 1367.76, "text": " are very I guess very high if you can substitute two protein, two amino acids"}, {"start": 1367.76, "end": 1376.32, "text": " with each other and the effect is negligible. And it's very low if it's the"}, {"start": 1376.32, "end": 1381.6, "text": " the other way around. Now this is interesting so far but you compare this"}, {"start": 1381.6, "end": 1387.2, "text": " to this matrix right here. This is the attention similarity. So what we'll do is"}, {"start": 1387.2, "end": 1393.76, "text": " for each two amino acids we take those two attention things, those two attention"}, {"start": 1393.76, "end": 1397.8799999999999, "text": " matrices and we'll calculate the correlation between the attention"}, {"start": 1397.8799999999999, "end": 1404.32, "text": " matrices. And our hypothesis is that the more correlated the attention patterns"}, {"start": 1404.32, "end": 1409.8, "text": " are between the two amino acids the more likely we are to substitute them"}, {"start": 1409.8, "end": 1416.2, "text": " because as a direct result of our language model our language model is"}, {"start": 1416.2, "end": 1424.8400000000001, "text": " it's reconstructing right these things. So our language model is going to treat"}, {"start": 1424.8400000000001, "end": 1431.16, "text": " if in natural language is like a a synonym right is our language model is"}, {"start": 1431.16, "end": 1435.68, "text": " going to treat synonyms very similar to each other because they're synonyms they"}, {"start": 1435.68, "end": 1440.76, "text": " can be exchanged. So a good language model should learn that they are almost"}, {"start": 1440.76, "end": 1444.8400000000001, "text": " the same and therefore the attention pattern is going to be almost the same."}, {"start": 1444.84, "end": 1453.56, "text": " So a high correlation we hypothesize is a means that the function of the amino"}, {"start": 1453.56, "end": 1459.4399999999998, "text": " acid is similar and therefore we can substitute it easily. So this here is the"}, {"start": 1459.4399999999998, "end": 1465.4399999999998, "text": " matrix of the correlations between each two attention patterns of these amino"}, {"start": 1465.4399999999998, "end": 1473.08, "text": " acid. And if you compare the two right here they look extremely similar. Just"}, {"start": 1473.08, "end": 1479.12, "text": " have a look for a little while and you'll see that the patterns they do not"}, {"start": 1479.12, "end": 1485.28, "text": " match perfectly but they are very very similar. The dark spots are in the same"}, {"start": 1485.28, "end": 1491.28, "text": " places the light spots are in the same places. So this already makes a good case"}, {"start": 1491.28, "end": 1498.04, "text": " that the language model here has learned something about biology. Now what we want"}, {"start": 1498.04, "end": 1505.96, "text": " to do is we want to investigate higher order higher order functions. So here"}, {"start": 1506.24, "end": 1513.76, "text": " we're interested in these contact maps right. So how likely is it that two"}, {"start": 1513.76, "end": 1518.6399999999999, "text": " amino acids are in contact and we'll look at it through the lens of attention"}, {"start": 1518.6399999999999, "end": 1523.96, "text": " as we did before. So here is the percentage of each head of each head's"}, {"start": 1523.96, "end": 1530.0, "text": " attention that is aligned with contact maps averaged over a data set suggesting"}, {"start": 1530.0, "end": 1533.8400000000001, "text": " that head 12 4 is uniquely specialized for contact prediction. So look at this"}, {"start": 1533.8400000000001, "end": 1544.16, "text": " this this head here is just spiking. So remember before we said our analysis is"}, {"start": 1544.16, "end": 1551.44, "text": " whenever whenever we're basically measuring the correlation of two things"}, {"start": 1551.44, "end": 1556.96, "text": " being in contact because we know it from our simulator or from our data set the"}, {"start": 1556.96, "end": 1562.72, "text": " correlation of that with an attention connection being particularly strong. And"}, {"start": 1562.72, "end": 1571.24, "text": " we find it in this attention head right here. So this layer 12 head number four"}, {"start": 1571.24, "end": 1577.0, "text": " will always peek out whenever two things are in contact. Now you can see that it's"}, {"start": 1577.0, "end": 1582.84, "text": " it's not like always it's like 25 percent of its attention but significantly more"}, {"start": 1582.84, "end": 1589.92, "text": " than anything else right here. In fact if you group the things by this attention"}, {"start": 1589.92, "end": 1594.92, "text": " you can build the following plot. So you can see right here probability two"}, {"start": 1594.92, "end": 1600.72, "text": " amino acids are in contact as a function of attention between the amino acids in"}, {"start": 1600.72, "end": 1606.76, "text": " head 12 4 showing attention approximates perfectly calibrated estimator which"}, {"start": 1606.76, "end": 1612.64, "text": " would be the green line. So here we simply for each for each pairs two"}, {"start": 1612.64, "end": 1620.24, "text": " amino acids for each pair of amino acids we plot we make a histogram right here"}, {"start": 1620.24, "end": 1630.08, "text": " of what they're sorry not a histogram we plot the probability if they have the"}, {"start": 1630.08, "end": 1637.72, "text": " attention weight point nine we plot how likely is it that they are in contact. So"}, {"start": 1637.72, "end": 1643.04, "text": " this is this if we just look at the data and we simply take this attention weight"}, {"start": 1643.04, "end": 1648.36, "text": " as a measure as a predictor of being in contact we get the blue curve and the"}, {"start": 1648.36, "end": 1654.24, "text": " green curve would be if we could perfectly predict from this attention"}, {"start": 1654.24, "end": 1658.6399999999999, "text": " head what the probability of contact would be and you can see that the fit is"}, {"start": 1658.64, "end": 1665.3600000000001, "text": " fairly good you can't predict with super high accuracy but the fit is fairly good"}, {"start": 1665.3600000000001, "end": 1672.5600000000002, "text": " and you can see the general trend that as the attention in this head rises the"}, {"start": 1672.5600000000002, "end": 1680.76, "text": " probability of the two amino acids being in contact with each other also rises. So"}, {"start": 1680.76, "end": 1687.1200000000001, "text": " we can sort of confidently say that BERT has learned something about a higher"}, {"start": 1687.12, "end": 1692.2399999999998, "text": " level biological structure just from the language modeling"}, {"start": 1692.2399999999998, "end": 1699.84, "text": " objective. How can we interpret this? This must somehow mean that it is"}, {"start": 1699.84, "end": 1708.0, "text": " possible it is vital for reconstructing the sequence from its"}, {"start": 1708.0, "end": 1715.84, "text": " surrounding so if we delete this right here if these two are in"}, {"start": 1715.84, "end": 1723.52, "text": " contact in the 3D structure that makes probably probably means that this thing"}, {"start": 1723.52, "end": 1728.72, "text": " right here is a very good predictor of what was here. If we mask this out"}, {"start": 1728.72, "end": 1732.36, "text": " and we're asked to reconstruct which amino acid was there then it probably"}, {"start": 1732.36, "end": 1736.4399999999998, "text": " helps to look at its neighbors right it probably always helps to look at one's"}, {"start": 1736.4399999999998, "end": 1742.8, "text": " neighbors especially also in natural language but if these two are in contact"}, {"start": 1742.8, "end": 1748.96, "text": " they have very special connection to each other it's very"}, {"start": 1748.96, "end": 1756.12, "text": " you can basically read out from this one which one this was. This is sort of like"}, {"start": 1756.12, "end": 1762.0, "text": " if you have a sentence and you say"}, {"start": 1762.0, "end": 1773.16, "text": " I don't know I can't come up with one right now but if it's like"}, {"start": 1773.16, "end": 1780.12, "text": " and then there is a name like Mark and then and then there is him"}, {"start": 1780.12, "end": 1786.68, "text": " right and you would expect if I drop out okay let's do it the other way around if"}, {"start": 1786.68, "end": 1793.5600000000002, "text": " I drop out him then from the text right here you can probably determine that it"}, {"start": 1793.5600000000002, "end": 1798.48, "text": " is some sort of pronoun but then you go back and you see it's Mark okay so it's"}, {"start": 1798.48, "end": 1809.16, "text": " not like it's not like it or some or she it's probably he or him this is sort of"}, {"start": 1809.16, "end": 1816.96, "text": " the analogous structure right here in biology. The second thing we're looking"}, {"start": 1816.96, "end": 1824.44, "text": " at is these binding sites. Now these are single properties of different"}, {"start": 1824.44, "end": 1829.3600000000001, "text": " amino acids and we're simply looking at all the incoming or sorry all the"}, {"start": 1829.3600000000001, "end": 1834.0800000000002, "text": " other tokens that focuses their attention. Why is this important? Because"}, {"start": 1834.08, "end": 1840.24, "text": " these binding sites are central to the structure of the or to the function of"}, {"start": 1840.24, "end": 1844.48, "text": " the protein right if this here is a binding site then that's a very central"}, {"start": 1844.48, "end": 1851.8799999999999, "text": " important point of the protein. So a lot of these other things are going to be"}, {"start": 1851.8799999999999, "end": 1857.1599999999999, "text": " determined by what this binding site is. This binding site needs to have a very"}, {"start": 1857.1599999999999, "end": 1860.4399999999998, "text": " particular function and therefore probably needs to be a very"}, {"start": 1860.44, "end": 1866.0, "text": " particular amino acid and the other things here are sort of supporting this"}, {"start": 1866.0, "end": 1870.52, "text": " binding site because they form the 3d structure around it and so on. So you"}, {"start": 1870.52, "end": 1877.2, "text": " would expect a lot of attention to be put on this binding site and what do we"}, {"start": 1877.2, "end": 1885.0, "text": " find? We find that it's a bit more murky than before so you can see that the"}, {"start": 1885.0, "end": 1889.1200000000001, "text": " attention is kind of spread out. Percentage of each head's attention that"}, {"start": 1889.12, "end": 1893.2399999999998, "text": " focuses on binding sites especially in the deeper layers binding sites are"}, {"start": 1893.2399999999998, "end": 1898.84, "text": " targeted at much higher frequency than would occur by chance. Head 71 has the"}, {"start": 1898.84, "end": 1906.6399999999999, "text": " highest percentage with 34%. So also here you can see that it is spread out but"}, {"start": 1906.6399999999999, "end": 1911.8, "text": " this is because multiple heads are now focusing on these binding sites because"}, {"start": 1911.8, "end": 1916.76, "text": " probably binding sites come in different variations so you'll have lots of heads"}, {"start": 1916.76, "end": 1921.84, "text": " specializing on attending to binding sites and they say it is much higher"}, {"start": 1921.84, "end": 1926.8, "text": " frequency than would occur by chance and you can see here this head is the"}, {"start": 1926.8, "end": 1932.12, "text": " highest with 34% of its attention focused on binding sites. You can also"}, {"start": 1932.12, "end": 1937.64, "text": " see the general trend of the attention being rather in the later layers which"}, {"start": 1937.64, "end": 1943.8, "text": " we would expect from a tertiary structure. Now yeah it would be"}, {"start": 1943.8, "end": 1948.96, "text": " interesting here. Here you also see that actually most of the things are in the"}, {"start": 1948.96, "end": 1956.12, "text": " in the last layer which points to points to rather maybe lower lower level"}, {"start": 1956.12, "end": 1960.0, "text": " information because we reasoned before about the last layer or I was just wrong"}, {"start": 1960.0, "end": 1964.9199999999998, "text": " but also in a general trend you can see that the attention is rather shifted"}, {"start": 1964.9199999999998, "end": 1973.3999999999999, "text": " towards the later layers because this is sort of a higher order function. Okay if"}, {"start": 1973.4, "end": 1979.6000000000001, "text": " you look at the same calibration experiment you can see that the"}, {"start": 1979.6000000000001, "end": 1982.96, "text": " picture is not as clear. There is the general trend at the beginning but then"}, {"start": 1982.96, "end": 1990.0800000000002, "text": " it sort of flattens out so you can sort of differentiate the very probably not"}, {"start": 1990.0800000000002, "end": 1994.7, "text": " a binding site from the somewhat probably a binding site but it's not a"}, {"start": 1994.7, "end": 1999.72, "text": " perfectly calibrated classifier and that might just be because there are many"}, {"start": 1999.72, "end": 2004.8, "text": " things specializing in different types of binding sites so you can't just go"}, {"start": 2004.8, "end": 2010.04, "text": " to this one head so this is just for this one head. You can't just go to that"}, {"start": 2010.04, "end": 2015.68, "text": " one and expect that to classify all the binding sites because you might want to"}, {"start": 2015.68, "end": 2023.44, "text": " be you might want to combine all of the high ranking ones here to form a"}, {"start": 2023.44, "end": 2029.3600000000001, "text": " classifier. The last experiment they do is these linear probes which where they"}, {"start": 2029.36, "end": 2034.1999999999998, "text": " just go and they just build classifiers from different parts of the network and"}, {"start": 2034.1999999999998, "end": 2040.24, "text": " you can see right here that what is predicted and how well they work. So each"}, {"start": 2040.24, "end": 2045.08, "text": " bar here is going to be the difference of performance so this is differential"}, {"start": 2045.08, "end": 2050.44, "text": " performance of diagnostic classifier by layer sorted by task order in figure 8."}, {"start": 2050.44, "end": 2054.8399999999997, "text": " Each plot shows the change in performance between the given layer and"}, {"start": 2054.84, "end": 2061.56, "text": " the previous layer. So a bar up shows it's performing better than the"}, {"start": 2061.56, "end": 2065.08, "text": " previous layer bar down shows it's performing worse than the previous layer."}, {"start": 2065.08, "end": 2071.04, "text": " So you see right here that these are the secondary structures right here and"}, {"start": 2071.04, "end": 2075.6800000000003, "text": " you can see that there is a lot of performance in the earlier layers right"}, {"start": 2075.6800000000003, "end": 2081.0, "text": " here and sort of not that high performance in the later layers whereas"}, {"start": 2081.0, "end": 2085.48, "text": " for the tertiary structures the binding site and the contact you can see that"}, {"start": 2085.48, "end": 2092.6, "text": " there is a bit of performance in places but it sort of tends to be more"}, {"start": 2092.6, "end": 2097.2, "text": " towards the middle certainly more at towards the middle of the end of the"}, {"start": 2097.2, "end": 2103.32, "text": " network than the secondary structures which sort of makes sense with our"}, {"start": 2103.32, "end": 2108.8, "text": " hypothesis. You can also see this here where they show the percent of attention"}, {"start": 2108.8, "end": 2115.0, "text": " focused as a function of layer and the red is the center of mass and you can"}, {"start": 2115.0, "end": 2121.92, "text": " see that as the secondary structures this their center of mass is at a lower"}, {"start": 2121.92, "end": 2129.2400000000002, "text": " layer in general than the tertiary functions. All of this is not perfect of"}, {"start": 2129.2400000000002, "end": 2135.0800000000004, "text": " course but it's still an open question I guess whether or not it's not perfect"}, {"start": 2135.08, "end": 2141.92, "text": " because we haven't built a strong enough language model yet. Do I want to say GPT-4"}, {"start": 2141.92, "end": 2147.84, "text": " is now for biology and not for language or is it because there is really"}, {"start": 2147.84, "end": 2155.72, "text": " you need you really can't very well predict these things just from a"}, {"start": 2155.72, "end": 2159.2799999999997, "text": " language model. I mean you should technically all the information is there"}, {"start": 2159.28, "end": 2166.0, "text": " but maybe the language model objective as such isn't able to capture that"}, {"start": 2166.0, "end": 2172.1200000000003, "text": " information. So yeah this was the paper it's pretty simple they have in the"}, {"start": 2172.1200000000003, "end": 2176.2000000000003, "text": " appendix they have a lot of these additional experiments or full"}, {"start": 2176.2000000000003, "end": 2180.96, "text": " experiments I believe for all the amino acids and so on and I invite you to"}, {"start": 2180.96, "end": 2187.0800000000004, "text": " check that out. In general I like this kind of work because it's very applied"}, {"start": 2187.08, "end": 2192.64, "text": " it's and it can you know tell us something about the nature of both these"}, {"start": 2192.64, "end": 2200.16, "text": " language models and the biological things that we that we care about in"}, {"start": 2200.16, "end": 2207.16, "text": " biology. Okay I'm just talking crap right now thanks for being here I hope you"}, {"start": 2207.16, "end": 2217.72, "text": " enjoyed it and bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=1VdEw_mGjFk
GShard: Scaling Giant Models with Conditional Computation and Automatic Sharding (Paper Explained)
Google builds a 600 billion parameter transformer to do massively multilingual, massive machine translation. Interestingly, the larger model scale does not come from increasing depth of the transformer, but from increasing width in the feedforward layers, combined with a hard routing to parallelize computations on up to 2048 TPUs. A very detailed engineering paper! OUTLINE: 0:00 - Intro & Overview 4:10 - Main Results 5:10 - Mixture-of-Experts 16:00 - Difference to Scaling Classic Transformers 18:50 - Backpropagation in Mixture-of-Experts 20:05 - MoE Routing Algorithm in GShard 38:20 - GShard Einsum Examples 47:40 - Massively Multilingual Translation 56:00 - Results 1:11:30 - Conclusion & Comments ERRATA: I said the computation of MoE scales linearly, but actually, it's sub(!)-linear. Paper: https://arxiv.org/abs/2006.16668 Abstract: Neural network scaling has been critical for improving the model quality in many real-world machine learning applications with vast amounts of training data and compute. Although this trend of scaling is affirmed to be a sure-fire approach for better model quality, there are challenges on the path such as the computation cost, ease of programming, and efficient implementation on parallel devices. GShard is a module composed of a set of lightweight annotation APIs and an extension to the XLA compiler. It provides an elegant way to express a wide range of parallel computation patterns with minimal changes to the existing model code. GShard enabled us to scale up multilingual neural machine translation Transformer model with Sparsely-Gated Mixture-of-Experts beyond 600 billion parameters using automatic sharding. We demonstrate that such a giant model can efficiently be trained on 2048 TPU v3 accelerators in 4 days to achieve far superior quality for translation from 100 languages to English compared to the prior art. Authors: Dmitry Lepikhin, HyoukJoong Lee, Yuanzhong Xu, Dehao Chen, Orhan Firat, Yanping Huang, Maxim Krikun, Noam Shazeer, Zhifeng Chen Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
OpenAI has a 175 billion parameter model. You thought that was large? That's cute. Check out Google's 600 billion parameter model, 600 billion floating point numbers doing things at the same time. This has absolutely become a body part measuring competitions between companies. Google be like, Oh, GPT-3, I spit on you, I spit on you and your little tiny 175 billion. Okay, let's stop kidding. This is a giant model that Google has trained right here. The paper we're going to look at today is called G shard scaling giant models with conditional computation and automatic sharding by Dimitri Lepikin et al of Google. And this paper basically tells the story of how they built this 600 billion parameter model, how actually they attempted to build a model that had a trillion parameters, but just didn't manage to quite train it. And this is all using this system called G shard. So I haven't actually seen the code out for G shard yet, but I'm going to maybe assume that this is something that they're going to release at some point, who knows? Or maybe I just haven't seen it yet. So this is basically describing a system on how to train these giant models. So if you if you have watched my video on GPT-3, which of course was this 175 billion parameter model of open AI, which already was record breaking. You this paper, the paper was very much like, oh, we built a model and look at what things it can do. So that was the open AI paper. This paper here is like the complete opposite. It basically says, Oh, yeah, we do language model. But But here is how we built the model, which is, you know, equally cool. So open AI basically just made everything bigger. And here they say to make everything even bigger, you need some tricks and how to build models. And they've basically, they've developed this entire framework to build these giant models. And this paper mainly describes that framework. And the actual task here, which is machine translation, is almost sort of a side thing in the paper. It's it's all it's just a task to showcase what this system can do. So this is very much an engineering paper, rather than that much than a machine learning paper. And that's how you have to look at it right here. That being said, the machine learning results are of course, quite impressive. If you look at this graph, here, you have a quality gain. It's a difference in blue score. And this is a quality score for machine translation over the previous state of the art. So over their baseline, which, as you can see, here, you have 37 billion weights, 150 billion weights and 600 billion weights, which they only train. They train for you know, 2000 and on 2048 TPUs for just four days. That's they stress this is very efficient because they just have to train it for four days on 2000 TPUs. Absolutely crazy. So let's have a look at what this paper does. If you enjoy this, if you enjoyed this at the end, consider you know, sharing the video out if you like it. And tell me what you think about this stuff in the comments. Alright, so we'll go through the abstract and then we'll go through highlighted sections of the paper because the paper is 23 pages long, so I won't be able to cover everything just kind of give you the the high level ideas and highlight a few things. But actually, let's not go into the abstract. Let's go into Yeah, these results first. So as you can see, they managed to continue the trend, the trend in NLP has always been in at least since, you know, transformers were invented, the bigger the better, like larger model, larger data, more compute means better performance. And it's sort of unbroken here, as you can see, if you increase the number of parameters in these models, you do get a very, very big gain in these blur score, though it sort of seems to be kind of a logarithmic scaling, like you have to you have to keep doubling and doubling and doubling the, the number of weights sort of like Moore's law in computation. But you do see that at the same time, the training wall time is going down and the computational cost, the computational cost of these models, it doesn't scale, quadratically, like you would expect it scales linearly. And that's the big difference here in how these authors scale their model, rather than how the open AI authors scale their model. So in a traditional model in traditional transformer looks like this. You have these blocks of attention. If you don't know what this is, I have a video called attention is all you need. I explain how the attention blocks in transformers work. So this is nothing different. These are just transformers standard transformers, there is an encoder and a decoder, everything works as you know, so you have these blocks, you have n blocks, these are the number of layers that you have. And in these blocks, you always have an attention layer, and then a feed forward layer that acts on the tokens. So without repeating too much what an attention mechanism does, basically, in you have inputs tokens. So this is a sequence. It's technically a set processing unit, but we use it for sequences of text. So here you have six tokens, a sentence of maybe six words. And then you transform it with the attention layer, by having this attention mechanism that routes information from tokens to from positions to other positions, maybe like this route is here route this here. And then you have a feed forward network that is applied on a per token basis. So each of these tokens now goes through this feed forward network, and is kind of transformed. So the embedding of that token is transformed by that feed forward network. Now every token does this. And it's always the same feed forward network. So this network here is the same as this network. Now, usually, when we talk about scaling transformers, we talk about this part right here, we talk about the attention mechanism. And also we talk about this part, the number of layers. So, you know, we talk about scaling the number of transformer layers, more layers, more layers, more layers. And if we want to scale the attention mechanism, what that basically means is, we have we increased the context size of the text we can input. So transformers are very limited by the size of this context right here, that they can take the like the original transformer started with something like 512 tokens that they were able to take because this attention mechanism has quadratic complexity. This went up and the open AI GPT-3, I believe, had a context size of 2048 tokens, which if it scales quadratically, that's quite an achievement. And also it stacked the layers very, very deep. Now, in this paper, they scale the transformers differently, they basically leave the context size. And I believe that their context size is 1024. So significantly smaller than the open AI context size, and they don't scale the layers. So their largest transformer is 36 layers, whereas I believe GPT-3 was maybe correct me, but I think it was like 90 or 100 layers or something like this, at least significantly larger than this. Instead, what they scale is this part right here, the feet forward layers. This might seem counterintuitive. But they basically, they basically say, what if we didn't only have one feet forward network right here, but we had many, right, we don't always have the same, we have many, many feet forward networks, different ones that can do different things. And that's what they call experts. Each one of these feet forward layers is an expert. And then you have yet another routing mechanism, kind of like in attention, you have a routing mechanism that decides which tokens go where, okay, so this token here, this token here, this token here, and the sort of the implication being that different tokens, different parts of the input you want to transform require a different kind of transformations here. And these different experts can sort of specialize in how they transform the input. Now, their task here is going to be machine translation as a multi task setup. So what you'll have is you'll have all kinds of languages like French and German, what's the, and maybe like a lot of languages, I don't know any other languages. And you want to translate all of them to English, and you want to do it using the same model. Right. So these experts here, they might specialize in, you know, the individual languages, like maybe you will have to handle a pronoun differently, if it comes from German than if it comes from French, you want to do it with the same model at the same time. That means you maybe want to have the one expert specialize in German pronouns and one expert specialize in French pronouns. Also, you can think of the experts as maybe one specializes in question words, it doesn't matter which language they're from, and the other one specializes in some sort of other kind of linguistic feature. In any case, this number of experts here is if you want to scale that up, then that becomes the bottleneck of the transformer, they go up to 2000 2048 experts in parallel. So that doesn't fit into a single accelerator anymore. And that's why the entire system has to be sharded. And that's what they call G shard. So G shard, the main application here is going to be how, how can we build this giant model in on many, many distributed computers, where the attention mechanism isn't the problem, the attention mechanism, we just distribute, like we do data parallelism, the attention, it lives on all the computers. It lives on all of the accelerators, it synchronizes, and so on. But the experts here, there's only so this expert lives on machine a this expert lives on machine B, this expert lives on machine C. And then we do a hard routing. So we don't do a soft routing, like an attention, we do a hard routing where one token goes to one or at maximum two experts. So this is sent to these machines. And then after the machines, you kind of gather all the results back right here. So G shard is the system that enables this sharding of these experts, and the everything in between everything that is necessary, but it can also be applied to shard any computation. And that's why it's so cool. So here you see what, what they do, they always they take these transformers. And they always consider a block of two transformer layers. So this is a block of two transformer layers, you can see there is twice the attention. And there's twice this feed forward. So in one point, this feed forward is just a regular everything, all the tokens go through the same network. So that's like a classic transformer. But here, you have a lot of these different experts, and the tokens are routed to these experts. It's important that the tokens are hard routed, right? If the tokens were soft routed, you don't you don't gain anything, because every token has to go through every expert. But here, the tokens are hard routed to the expert, which means that you can, if you if I have an input size of 1024 tokens, maybe only 10 go to this one, and maybe only 10 of that those go to this one. Now you also have a batch size, of course, I haven't actually looked at what the batch size here is, but you usually have quite a large batch size in these things like maybe a batch size of 1000 as well. So ultimately, what you'll end up is, you know, 1000 times 10 tokens going to the first expert and so on. But still, you can significantly parallelize this computation. Okay. So this this, if you use G shard, this is going to result in the following in the thing on the right, where you have two machines, this is machine one, and this is machine two, you can see that the machines will what happened here. Oh, someone made the PowerPoint mistake. So you can see that the the attention, everything is shared between the machine. So this here and this here, these are synchronized, the weights are synchronized, right, you simply do a data sharing. But here, you can see that you have model parallelism, model parallel mixture of experts, where on the first machine, you have the first expert, and then you have E devices. And on the last one, you have the last expert. And then it's all routed out and routed in again. And then you can continue your transformer. And this is layer after layer. So what's the problem here? The problem is that an operation like this is going to come to incur significant sort of overhead in terms of communication and so on, if you were to do it naively, and it's going to be a real pain to program this. And that's why G shard is made to do all of this automatically. And you don't, you don't incur much of a cost, because you distribute. So what's the difference to the old scaling? Why don't they just make transformers larger in number of layers? And that's because this this is, I guess, what open AI ran into as well. If you make transformers simply larger in number of layers, sorry, if you make it transformers larger in the attention mechanism, it just won't fit into memory at some point, and you'll you'll have to share that somehow. And you can do this with G shard. If you scale it in number of layers, that incurs significant cost where you have to wait, because you have to forward propagate, and then you have to backward propagate in your training sequence. And if you have just too many layers, then a lot of the a lot of the frameworks get at their limit, where at some point, they say, Well, I still have to wait for the signal to come back in order to continue. And they explore this in this benchmark right here. You can see they say, the largest model, the 600 billion parameter model that achieved the best translation quality was trained with 2000 TPU v3 course for three days, a total cost of 22 TPU couriers. In contrast, training all 100 bilingual baseline models would have required 29 couriers. So the model here is faster than if you train them individually. But if you want to train a single transformer that is just very deep, and achieves reasonable performance, you have to invest a lot more. Our best quality dense single transformer model 2.3 billion parameters. So it's also significantly smaller. Achieving this was trained with g pipe, which is a previous framework. So g pipe is kind of a task runner that also distributes computation was trained with g pipe on 2048 TPU course for six weeks, or a total of 235 TPU couriers. By the way, for if you if you have $1 per TPU hour, that'll only cost a lonely, I guess, set you back about 2 million or so, easy peasy. Or even 200,000 just, you know, a tiny, tiny bit of, of money. But you can see that this transformer model that is dense, which means that is a classic transformer where you stack the transformer layers, you stack them, you stack them, you stack them. It in fact, it has 96 layers, their baseline 96 layer transformer model, that's sort of what opening I did, they just kept stacking the transformer layers, you get a model that has less parameters and trains for much longer, and its performance is only about this good. Whereas here, if you scale not into depth, but into width of these experts, and it's not dense, but it's shorted, which means it calculates this in a in a kind of sparsified way, because it has this hard routing, you can scale up to a lot more parameters. So 600 billion parameters over 200 times more parameters than the deep model, and you can get a much better performance. Okay, so this is what is different here, it scales into these experts, rather than scaling into depth or, or size of the attention mechanism itself. Alright, the question, I guess that you come up with if you're a machine learner is how do you back propagate if you route if here you route to these different experts, and you do a hard routing, like here, how do you back propagate the signal because it seems like you need a soft routing, but this has been handled. In fact, these mixture of experts has been introduced previously in a paper I think called outrageously large language models or something like this. And, and so they've introduced that, you know, it, it still works. So back prop still works through. So basically, you have a back prop path through here. And because you put a little bit of noise in this routing, every path gets explored a few times, and therefore you have enough back prop signal to make it work, it can it could technically fail, but they do observe generally that it does work if you do this kind of hard routing with a bit of noise. Alright, so where do we go from here? As I said, this is an engineering paper, and it's a long engineering paper. So they, they set up their, they set up a lot of a lot of the details of engineering directly in the paper, which we're not used to in the machine learning world, they really detail how they shard things and so on. Which is pretty cool. But, um, I invite you to look at the paper yourself, if you really want to know what's going on right here. Suffice to say, they, as you can see, right here, what they do is, this is the input right here. And then they have this weight matrix, which is a this routing. This is learned routing weights. Okay. So you have trainable weights that decide how to route the input, and that's dependent on the input. So you have a bunch of inputs that comes from the lower layer. And this matrix right here determines where to route them, basically says, okay, the input is a vector like this, I know that must probably go to the expert number three. Okay, and you have a softmax across that. So it's a really, it's an assignment to it's a soft assignment to the experts. So once you've done the soft assignment to the expert, you do a hard assignment by collecting the top two. For each token, you say, you collect the top two experts, and you only send it to the top two experts, and you ignore all else, which is not a lot right there. At times, there are 2000 experts in the system. And, yeah, you distribute and you have some noise. So with a random probability, you actually don't even send it to the second expert, you just leave it at the first one. And with some noise, you send it also to the second one. And I think that that noise is part of what it of what makes the system work a bit. And then you also have this auxiliary loss right here that you add on top, which just makes sure that you distribute evenly. So this encourages the system to distribute the tokens evenly, because sorry, what it penalizes is a this here is the mean assignment to each expert. So it penalizes whenever the mean assignment is out of out of line, basically. So a distribution assignment to the expert where one expert gets a lot of tokens, because I don't know, it happens to be really good at something. So all the tokens are routed to it, and the other expert don't get a lot that's penalized. So you encourage the system to distribute tokens evenly between those experts. And then there are also like upper limits where you drop tokens and so on. They really built a system that is out for performance, rather than machine learning correctness. So they demonstrate how to do this in in sort of code with their system. And the cool thing about their system is that you don't have to do much. What you'll have to do is just specify which tensors are sharded at along which dimensions and the system does the rest. So this is pretty cool. So this here is this mixture of experts, mixture of experts as you would write it in code. And they make use a lot of this Einstein sum notation. If you don't know what the Einstein sum notation is, it's a general notation to describe matrix or tensor multiplications. So a for example, if you were to multiply two matrices, you could have a string there. You describe it as a string and it comes from how Einstein wrote up the kind of tensor contractions in his work. So if you want to multiply two matrices, you can't you could put the string a b, b c goes to a c. So this and then you put two matrices right here. This would tell it, OK, I have a one matrix. I'm going to call the axis a and b. I have another matrix or tensor where I'm going to call the axis b and c. Now I have the resulting tensor and I want the first axis to be a and the a is this one. And I want the last axis to be c and the c is this one. And b is nowhere. B is not in the output, which means it should contract over b. So it should sum along b. Sorry, it should multiply along b and then add. So it should contract over b. So this here describes a regular matrix matrix multiplication. Now, if I could do something else, I could do something like a just a element wise product. An element wise product would be something like this. a b comma a b goes to a b, which means here I have a in the first input and here I have a again. And I'm so you already see that you can even though these are different tensors, you can call the axis the same, which means that they're going to somehow be multiplied together. Now, if you leave it away here, it means that it's going to be contracted and therefore the axis no longer exists. But here we don't leave it away, which simply means that these axes are going to be multiplied together. And the same for b right here. So this describes an element wise product. You can go really funky with this. So this here would be a row wise dot product where a is for all the a's its element wise, but then over b, it's contracted. So, you know, you can go you can go wild with the Einstein sum notation. You can describe a lot of things with it. So here is this algorithm to distribute the computation among these different experts. So you have the inputs and the weight matrix for the they call this the gates function. That's the routing function to these experts. So what do we do? We first of all, we have these tensors. They have these grouping, this grouping dimension right here. So they come along to along groups, which in our case, we could maybe say these are batches or the batch dimension. So they come across groups and there is the sequence length and there is this M right here. That's going to be the feature dimension, the M. And you can see the M is contracted. So the M is no longer here. So the gating function is going to route each input token right here to one of the experts for each thing in the group. So you can see you can express this with an Einstein sum notation. Then you have a top two gating, which selects the top two from each of the last from each of the entries. And that gives you this dispatch mask and the sorry and the weights that you have to use at the end to combine. You can use the dispatch mask in order to distribute the inputs. So you have reshaped inputs and so on. So I'm not going to go through all of this right here, but you can express all of this in terms of the Einstein sum notation. And you can express pretty much any sort of computation that is along the line. You can express the attention mechanism and so on. You can express the feed forward layers in terms of these Einstein sum notations. And the underlying the underlined dimensions here are the dimensions where we want to shard the computation. So here, because we have this g underlined, that means that we are interested in sharding the computation along this axis. So this I said, this is the batch dimension. This is your classic data parallelism, which means that the first machine gets the first couple of data points, the second machine gets the second couple of data points and so on. And you can see in the weight matrix, there is no sharding, which means that the weight matrix lives on every machine as a copy of one another. This is different from from here, where you can see that what we're now going to do is here, it's still sharded according to the batch, but we now are going to shard this according to the different experts. So we're going to route whatever the inputs are in to these experts. And then we're going to execute the computations on the experts. So this is now sharded according to the experts. And at the end right here, you can see this is still sharded according to the experts. We're going to put it back together. And now it's sharded according to the groups again. That's what we said. We have the input right here, the inputs. And the inputs are maybe distributed according to the according to machines, right? We have these go through the first machine, these the second, these the third and so on. This is your classic data parallelism. But then we have all of these experts. And now all of a sudden, we're going to route these things to the individual experts and we're going to execute the computation in parallel on the experts. And then after that, we're going to put back together from wherever we got them now. So this goes here again. And so this is just the reverse of what we did before. So right like that. So you get all of the outputs again. I hope you kind of can imagine how this happens. So the first difference is that's sharded according to a different dimension. And the second difference is, is that when we shard in data parallelism, we execute the same computation on all the machines, which means that we have the same weight matrix. If we do X times W in a feed forward layer and we shard this thing here in data parallelism, what we do is we send the X to different machines. We split the X, we send it to different machines. This is X1, X2, X3, X4. But we always multiply it with the same weight matrix. That weight matrix lives on all of the machines and is regularly synchronized. It's kept synchronous in some way. Whereas if we shard X to the experts, then the experts have individual functions. So the expert one is different from the expert two is different from the expert three, and so on. Which means that before it wasn't important where X was routed, because we would execute the same computation. So we can just, you know, shard it according to you know, the first 10 go there, the next 10 go there. But here, it's now crucially important where they are routed to, to which expert. And that's why we learned the function that is going to route them. So this is learned. This is this first line here. These are the weights that we learn to route. Then we route right here. And we calculate your, your, we calculate the feed forward layers on the expert. You see that this WI and WO, they are the weight matrices of the feed forward layer. The feed forward layers are, you have your input, you multiply it by WI, you have a ReLU, ReLU, and then you multiply it by WO. So it's kind of a two layer feed forward network. So this two layer feed forward network, as you can see, this is sharded according to the experts. And then, and the important part is, of course, that here, the weight is also sharded according to the experts. And that's what makes each expert different. And then it's combined again down here. So I hope you kind of get the idea of what this algorithm does. And the fact that we shard according to these experts is in fact different than your regular sharding where you shard the data like the batch, the batches. But keep the model in parallel, keep the model synchronized. With their system right now, this is how easy this is. So before we simply stated our algorithm in Einstein sum notations, there is no way to underline code and that magically happened something that was simply for us to visualize. Now we want to apply their system in order to make this actually sharded. And with the G shard system, and as I said, I don't know if the code is out or it will be out. But with the G shard system, this is basically all that you have to do. So you have these functions, they're called split and replicate. What replicate does is it takes that weight tensor and it replicates it on all the machines and that keeps it synchronized, right? This is a computation where we simply want to shard out the different to the different machines, but keep it synchronized. And you can see if you do this, this is the operation. Then the system knows, ah, this here is replicated across the machines. So that means I'm going to distribute the data points according to this G dimension, according to the batch dimension and multiply it with this matrix. According to this Einstein sum notation string on all of the machines. And I'm going to keep this tensor in sync. OK, so the system knows. As opposed to that, you have you have the split tensor right here. So the split, what it does is it splits a computation here, the dispatch X with inputs. It splits it according to a axis index onto D different machines or into D different parts. So you see here you calculate the how you should do the routing. And the resulting tensors first dimension is this E dimension. And then you say that should be split according to this first dimension onto D different places. And these D different places are now separate. They don't have the they don't have to be kept in sync. Everyone has their own weights. And now when you do this, you know, according to this E dimension, you can see because we know Einstein sum notation now. You can see this E appears here, here and here. So this operation is going to be applied element wise. That means independent of each other in the direction of this dimension. The system understands that since this tensor is sharded according to that dimension. I have to execute this on each of these entries in separate with on each expert having their own weight matrix right here. I hope this is a bit clear that their system makes it super easy. You can basically do two things. You can say this thing here is my classic parallelism where I want to keep it in sync. And this thing here is where I want to split up and do different computation on the different parts. And then they have also a general function that is more powerful. Yeah, they and they you can auto partition and whatnot. So they have a they have this. We implemented the partitioner in the XLA compiler, which means that anything that can translate to XLA is a target for the system. And that's, you know, TensorFlow and PyTorch can do this. So technically, this can come to any of those systems. But of course, who has their 2000 TPUs lying around to make use of this? But no, I'm kidding. I mean, this I they here use it for transformers. But I am very excited to see what people can come up with for the system. I believe a system like this where it's super easy to to shard. And they have some you know, they talk about, OK, we do the single machine compiler. So the compiler is also fast and so on. I don't even want to go into this, but this is very well engineered, it seems. And they they they basically implement this for all of the operators. So I'm very excited to see what people can come up with outside of the traditional applications. I think there can be new types of models developed simply because we have a system like this that makes it easier. So, yeah, I'm excited. So here they show a bit how this works on the example of this Einstein sum notation. So here we want to do this thing here, which if you remember, this is the operation where we want to route the input to these experts. So we want to start with something that is sharded according to the batch dimension. That means that we we have different different parts of the batch on different machines. And we want to route this and finally end up with something that is sharded on the different experts. So this is what the system does is first you have these here are the different shards, right? You want to multiply this, as you can see, this and this right here means that this routing table is also sharded according to the same machines. So you have the zero is all on the same machine, the one is all on the same machine and so on. So what you want to do is you want to contract is there you want to contract according to this s dimension, right? Which we have we have omitted right here. And if you multiply that, sorry, OK, we omit the s. So this is not much of a this is not much of a of a graphic right here. But then they have this re-shard operation where they do and you don't have to worry about this. So from here to here, there is this re-shard operation that just shards it according to the according to e. Yep. I find this to be a bit more a bit more insightful. So if you have something like this, this which is a regular matrix multiplication, right? And you want to contract along b. This is exactly the example we had before. So here is a situation where our tensor is sharded according to the b dimension. And this tensor is also sharded according to the b dimension. And you want to do a matrix multiplication of the whole tensor. So what can you do? You're supposed to multiply these two matrices, but they are sharded on different machines. Now, if you consider what you actually have to do is you have to multiply each row here with each column here and that in an element wise fashion. So that distributes according to you have to multiply this by this plus this by this plus this by this plus the red by the red. So you can simply multiply the zero tensors together, the one tensors together, the two tensors together and the three tensors together. Each one will give you a full matrix and then you can simply add all of them in order to get your full result. This is illustrated down here. So what machine one does, it simply multiplies its shard by its own shard of the second matrix. Which will give it this thing here. And by the nature of how matrix multiplication is constructed, you can simply do an all reduce, which means you reduce you sum across all of the machines, and that will give you the full result. So this is a this is a an example of how this works. This is, you know, pretty simple. And I believe you may have seen something like this already when you were looking at just parallelizing matrix multiplication and so on. So this system handles this transparently, right? If you're sharded like this, this is what the system will do. However, if you are sharded differently, the system will act differently. So here is a system you want to do the same matrix multiplication, but the first tensor happens to be sharded according to the A dimension. The second tensor happens to be sharded according to the C dimension. And you want to end up with something that's sharded to the C dimension. Now we have an additional constraint here that here you can see, we kind of assume that this full thing here fits into memory, mainly because we want to obtain the full result you see here, A and C should not be sharded. So we assume that we can keep that in memory. But here we want the final result to be sharded according to C. Which opposes the additional constraint that it might be that the full matrix never fits into memory. So how are we going to calculate all of that? We can't do the same trick anymore. Now this G shard system apparently realizes itself when something is out of memory, and it can do a smart move around being out of memory using a loop, which basically means that it will compute entry by entry or block by block. So these are the matrices we have to multiply. And you can see that if I want to do multiply this by this, that's fine. I can do this on one machine. But and that will give me the block up here. But if I want the block up here, I have to multiply this by this, which is across two different machines. So what this system does is it's going into a while loop because it realizes there's not enough memory. And it kind of sends around these different slices to the different parts, each time computing a little piece. So here, first we do this by this, this is fine. But then we grab ourselves from the, we grab ourselves this one here, calculate the next little piece up here, then we grab ourselves the number two, calculate the piece here. And then so this is from zero, this is from two, the one we already had, and then we grab ourselves piece three, and multiply that until here, until we have this final slice that we want. Okay, so this goes in a while loop in multiple rounds, the system gets knows itself when it has to do this, and when it can calculate the full thing at once, because it fits into in memory. It's even smarter than that, in that it can do these halo exchanges. So if you have to do something like this, a convolution. Now in a convolution, what you'll do if you think of a, think of an image, and you want to do a convolution on it, but the image happens to be sharded, let's say the image is so large, it's sharded across nine different machines like this. Now if you want to do a convolution, that's pretty cool, you know, here, here, here, but here, all of a sudden, your convolution is across two different machines. So this system G shard will adapt automatically, and do these halo exchanges where it kind of sends around from this machine, it'll send something to this machine, such that it can do the convolution in that step, and vice versa. And then this can be a padded accordingly, as you can see. This, I think this is this is this was like super ugly to implement, if you just imagine that for each of these operations, you have to think about, okay, how can I express this with these MPI primitives, like dynamic slice and collective permute, and so on. It's just an absolute nightmare. And I'm very happy that other people have done this, and I will probably just get to use it. So there is a lot more to this system than I've just explained, I just tried to give you a flavor of what building a system like this means and how easy it is to use it like this. In order to implement all of this mixture of experts things, you simply go from this, which is a one a single machine implementation, how you would write it to this, which is now the same, it's almost the same code. But this now you can run on however many machines. And if you compile it with the system, it will do what you expect it to do in this sharded way. Completely crazy. Okay, so they apply this to massively multilingual massive machine translation. So two things, it's massively multilingual, and it's massive machine, which means, I guess, a lot of machines. And the reason here is twofold. So what they say is, we have massively multilingual translation, why don't they just look at, you know, single machine translation. And it has a very specific reason, namely, if you have massively multilingual translation, which means that you have a lot of different languages, and you all have to translate them, ideally, to all the other languages, or, you know, every language pair. But in this case, they only look at all the languages to English. I don't exactly know why, but I guess there must be some kind of reason. If you do this, then you can make use of two of a thing where there are languages that you just don't have much data on, like, I don't know, Basque or something like this. There's not that many people speaking Basque or Swiss German, there's not even a written form, a standard written form of Swiss German. So you just don't have as many resources. And for other languages, you have giant amounts of resources. And what you can make use of is this phenomenon called positive language transfer, where it happens that, for example, Swiss German is very close to German. Now they can't understand us, which is a giant advantage for us. But still, it shares a lot of similarities with German. So if you learn a lot about German, you can sort of transfer learn to Swiss German pretty easily. So if you have a system that does German and Swiss German at the same time, you can perform better on both languages because the Swiss German part of your model, the part of your model that does Swiss German profits from the German inputs as well. Now, don't understand me wrong, there is not an individual part of your model that for each language, it's all done at the same time. But still, you can imagine that, you know, some of these things will specialize in some of the languages. But the hope is that if you have German and Swiss German in the same training set, that if the model realizes what a question construct is in German, it will be able to apply that also to Swiss German with some minor modification. So there is a benefit of having these many languages, especially for the low resource languages. Okay, so as the number of languages sorry as the number of language pairs to be modeled within a single translation model increases positive language transfer starts to deliver large gains for low resource languages. Given the number of languages considered, which I believe is 100 here, M4 has a clear advantage on improving the low resource task. On the contrary for high resource languages, the increased number of tasks limit per task capacity within the model, resulting in lower translation quality compared to a models to to a models trained on a single language pair. This capacity bottleneck for high resource languages can be relaxed by increasing the model size to massive scale in order to satisfy the need for additional capacity. So basically, you're saying, we can, if we train all these languages together, that will help a lot for these low resource languages, but it might hurt the high resource languages because now, we would have enough data technically to train and French to English model on in, you know, this giant model, we could train that. And now that we have all these other languages in there, it just hurts us because we don't have enough parameters. And we can solve this, of course, by simply adding more parameters. So that's the solution, add more parameters, and you increase the capacity of the model, and you still get the benefits of the positive language transfer. So their investigations is going to be into how much can we scale this? And is there like a sweet spot? Where because if you if you increase the parameters too much, you counteract this positive language transfer again. So since, you know, since Swiss German and German can sort of benefit from each other. However, if we have too many parameters, so, and then we end up having all of these experts right here, and the tokens are always routed to these experts, and it always happens that all the Swiss German tokens are always routed to this expert and all the German tokens are always routed to that expert. There will be no sharing of weights, there will be this positive language transfer will not happen because we have too much capacity. So the goal is to find a sweet spot between positive language transfer and this capacity bottleneck. They do use an in house data set, which we don't have access to. But they say, the training corpus mined from the web contains parallel documents for 100 languages to and from English adding up to a total of 25 billion training examples. However, they only use from 100 languages to English, this result in approximately 13 billion training examples to be used for model training. So that's a lot. It's a lot of data, especially for translation is kind of noisy translation because it's mined from the web, but still, it's a lot of data. They have baselines. So the baselines are first of all, in order to form our baselines, we trained separate bilingual neural machine translation models for each language pair. So that means a single model for each language to English, to depending on the available training data per language. And then they also have a they also have a baseline, where they try open AI style to build as deep as single transformer as possible. And by that they mean, we also include a variant of a dense 96 layer transformer encoder decoder network trained with g pipe pipeline parallelism on the same data set as another baseline. So the difference again here is that this 96 layer is a dense transformer, which means that all of the tokens go through the same computation, and we don't shard the computation out to these experts, right? You shard according to the batch, but all of them go through the same parameters. And that means we can, we can only scale up the number of layers. And that severely limits the that severely limits the computational efficiency, even if we have, you know, your pipeline parallelism and so on. That hurts. They say training to convergence took over six weeks on 2000 TPU course. That's crazy. But I guess, yeah, you know, I was saying earlier that that I always thought we were happy. I always thought we were happy and machine learning because kind of the the hip science fields being biology, like genetics and and machine learning was thought like, oh, but these biology people, they always need like million dollar grants from government to run their experiments and we can just sit down with a laptop. This time is over. If you start a PhD now start applying for money to get TPUs. Yeah. Okay. In any case, here you can see what this does. So they compare a bunch of models right here. So this T, this is this big dense transformer, that's going to be one of our baselines. And the other baseline here is going to be the zero axis. The zero axis means this is the single model for that language pair. So only so for each language, they trained one model only on data from that language. And that's going to be the worst thing here, because this this multi language translation in one model will generally help you if you have enough parameters, you can see all the models here have enough parameters, such that the difference here that this is difference in blue is positive. Including this baseline model right here. So the baseline model, as you can see, has 2.3 billion parameters, even though it takes that much longer to train. And that's, as we said, a function of the fact that it's dense and deep, that hurts in training efficiency. And then you have these mixture of expert models. They always consider two things they consider different numbers of experts, you can see it goes from 128 to 2048 experts. And they consider a number different number of layers from 12 layers to 36 layers, 36 layers still being way smaller than the 96 layer transformer here. And that's the reason why it trains faster. So it, it doesn't train faster. So the reason it trains faster is because it has less layers. And then the reason it has more parameters is because it has a lot of these experts. And the art here is to constrain how much these more experts hurt you. So, you know, you could run into the same problem where if you scale up the experts, in fact, you do, it doesn't fit into memory anymore, and it's going to hurt you a lot in training efficiency, kind of like if you increase the number of layers. But the G shard system prevents that it lets you up the number of experts without incurring the cost. That being said, it does not let you up the number of layers, you're going to incur the same cost if you up the number of layers, as you have with the dense transformers. So does this help? It helps a lot. As you can see right here, there's a general trend upwards and what's the x axis, the x axis is low resource languages. So you can see that as we as we go to lower and lower resource languages, this multitask training, this multilingual translation improves significantly over the baseline where we only train a system for that language specifically. And these 10k examples, it's a it's a it's quite a bit, but it's not that much, especially since it's noisy data. So this is specifically good for low resource languages. But you can see also the high resource languages here benefit from the multilingual translation. And that's a function of the fact that we have, you know, large enough models. In fact, you can see the larger the models, the more the difference in blue is, and there's not really an end in sight. And they also see it say that they haven't seen convergence in training. So you can technically train this, you know, forever. Yeah, you can also see that the the lowest mixture of experts right here is almost on par with their big, dense transformer that took so much longer to train. Right. So this lowest model right here, I believe it took I don't want to go back, but it took it took hours or so or few hours to train. Whereas this 96 layer dense transformer took these six weeks to train. Though has to be said, the number of TPUs is not to be neglected. But if you're Google, you know, you just have them laying around. What's also interesting here, and you can start seeing this two things. First of all, you can see that the difference between here in between the dense transformer and this baseline model is very low for high resource languages, but gets larger for low resource languages. This is an indication that the dense transformer, it does more to share parameters between the languages because it shares parameters between all the things because all the tokens go through the same computation. So it is going to be a bit better in low resource languages, but still the general trend upwards holds even for the mixture of experts. The second thing is that you see there is a crossover here in these in these big in these biggest models. And what are the big models? One, the blue one is the one with 2048 experts, and the green one is the one with 500 experts. They're both as deep models. But all of a sudden, over here for the high resource languages, it's still true that if you up the number of parameters, you get a benefit. So up the number of experts as well, you get a benefit. But over here for the low resource languages, it's it, you see, it actually hurts you to up the number of experts. And that's the phenomenon. Exactly. We talked about before, if you have too many of these experts, and you do a hard routing, that means all the tokens go a different way. And that means you don't get any sharing benefit from the multilingual translation. And they investigate a lot. And they basically claim that their sweet spot of expert in their particular task appears to be somewhere in between these 2000 and this 500 expert number, where you can see it doesn't always help you to scale up the model. Though I have to say, maybe the transformers, maybe they need a resonant moment. So I believe in computer vision, it was sort of the same problem that we try to build deeper models and why like, okay, this, this is more width, but I think there might be some breakthrough on the horizon where someone just figures out how to train these giant models, even more giant transformer models with deeper layers. And then there's a new new era of transformers. However, this is not that effect. I'm sorry, I said this at the wrong place. This is not that effect. This is to show that in this case, we do benefit for the high resource languages because we increase capacity. But for the low resource languages, we suffer if we up the number of experts too much, because they don't share any parameters anymore between the languages or between the different parts. Like it's not a necessity that the different languages are going to be routed to different experts. But it's probably going to happen right there's no no hard coded thing that says if it's this language, it needs to go there. It just probably is going to happen this way because the different languages are going to be needed to be treated differently and therefore the system learns to route first and foremost, those two different experts. Here you can see the model sizes, including this 60 layer models model with 2000 experts that they didn't manage to train they said they had numerical instability, but that had 1 trillion parameters. I'm pretty sure they're, they're cool. They must be quite mad about this right? Like you have the trillion parameters, even though it's not that much bigger than the 600 billion that the trillion, it would be cool to write a paper like a trillion parameter model. But for now, they are at the 600 billion mark, and they simply want to tell you that they have actually compiled a model that's that big just didn't manage to train it. And yeah, that's here, here is where I wanted to say that maybe we're waiting for the resonant moment, where all of a sudden someone figures something out that makes the training of basically infinitely deep transformers possible like we made the training for almost infinitely deep. CNNs possible with Resnets. Okay, so they conclude this, and so they, that's the the investigation of what the number of experts and so on gives you. And here is a bit of a different investigation, where they more care about training efficiency. So they ask themselves, how many billion tokens of input do we need to reach a given cross entropy. So here, the more tokens you need, the lower your efficiency is right. You can see that the general trend is the following. If, if you up the number of layers, you get more efficient, you can see and just look at this column for now this point seven column, you can see it already pretty clearly. So here you go from 12 layers to 36, you gain efficiency. Here you gain here you gain pretty predictable, if you up the number of layers, you need to see fewer tokens to get to the same cross entropy. And in fact, you can get to a lower cross entropy all together at the end. We've known this for language models already. The other effect is of course, what happens if we go not deeper, but wider, if we increase these number of experts, if we increase this sparse computation. So here you can see, let's just look at the 12 layers for now, let's look at all the rows where there's 12 layers. So here, you get a significant advantage by upping the number of experts from 100 to 500. But then you hurt upping the number of experts to 2000. Right? So that's that's sort of your you're hurting efficiency by upping the number of experts too much. And the same if we look at the 36 layer, so you gain massive efficiency by upping the number of experts, but you lose that efficient part of that efficiency again, by increasing it even more. Now, we saw that the this model is still the best model, but it's not as efficient as that model. And that gives you another indication that there is sort of a sweet spot between these two things between the positive transfer and the bottleneck capacity that appears to be somewhere in between right here. So that's pretty interesting. Because we know about depth that you can basically up and up and up and get more efficient, but with not that much. Yeah, the largest model can be trained in under four days to achieving the best quality. Yes, yes, yes, but this is just a yeah. So here, oh, you can see the batch size in in tokens is quite, quite a bit. So yeah, if you have a thousand, if you have a context window of 1000, that means the batch size here was about 4000. So as as expected. Yeah, this is just easy peasy 22 TPU core years. I've seen someone on Twitter saying this. This is the new measure for computers. No, it's no longer like flops. It's TPU core years. Just mad, mad. And yeah. So 42 days to train this thing right here. Crazy, crazy, crazy. All right. They also have a number of investigations in other parts of efficiency, like per device memory consumption. You can see here that as you up the as you up the number of experts, you can see here, here, here, your weights don't go up because as you up the number of experts, you can just up the number of machines, and the per machine weight usage will be the same, right? Because the experts are independent of each other, each one has their own weight matrix. So you can just add machines and you keep your weight requirements the same. However, if you go deeper, then your weights increase because you're now deeper, you have more layers, you have your. So also your transformer weights will be higher and so on. So you go deeper right here. You see 3660 layers, your memory consumption increases for the weight. And also, this is the other big part in transformers, right? The activations that you have to save, because as we said, if you have a transformer and I have layer, layer, layer, layer, I basically have to keep around each of these signals in order to do back propagation. And that's why also the activation here increases as I go deeper. Now you can see percentually, it decreases again here. So what's happening? Technically, you don't have to keep these things around. You can also once the signal comes back, you can recompute them from the beginning or from an intermediate point. Now this increases computation, but saves the need to store the activations. And apparently G-shard, yet another thing it does is it will recompute as necessary the activations if it realizes that you don't have enough memory to store them. So all of this is pretty crazy, honestly. And they look at where the different computations go. And I don't want to go into this. And they have these micro benchmarks where they really show that the increase in complexity is really according to square root of n, because that's how long it takes to distribute along these experts. There's a lot to this paper and there's no time to go through all of it. I think this video is already way too long. I hope I have given you an impression of what's possible with this system. And as I said, I'm excited what people can come up with. Just to say that in the appendix here, they detail that they have done this for all the operations in XLA. So, for example, convolution. This is so ugly how you have to implement the convolution because you have to padding must be correct across these experts, across the sharded machines. So there are no experts anymore. This is just G-shard. The padding has to be correct. The strides have to be correct. Data needs to be exchanged according to the machines. The window size needs to be correct. Blah, blah, blah. Thank you for doing this and not having to do it myself. Yeah, I'm excited. As soon as the code's out, if I get hold of it, I'll link it or you'll find it once it's out. If it's already out, I'm just too dumb to see it. I enjoyed reading this. It's different than a machine learning paper. It kind of shows you what goes into engineering a system like this and how easy it can be if it's engineered well to then apply it. I think this is going to be extremely helpful to the community. And with that said, 23 pages later, see you next time. Bye bye.
[{"start": 0.0, "end": 24.0, "text": " OpenAI has a 175 billion parameter model. You thought that was large? That's cute. Check out Google's 600 billion parameter model, 600 billion floating point numbers doing things at the same time. This has absolutely become a body part measuring competitions between companies."}, {"start": 24.0, "end": 53.0, "text": " Google be like, Oh, GPT-3, I spit on you, I spit on you and your little tiny 175 billion. Okay, let's stop kidding. This is a giant model that Google has trained right here. The paper we're going to look at today is called G shard scaling giant models with conditional computation and automatic sharding by Dimitri Lepikin et al of Google."}, {"start": 53.0, "end": 73.0, "text": " And this paper basically tells the story of how they built this 600 billion parameter model, how actually they attempted to build a model that had a trillion parameters, but just didn't manage to quite train it. And this is all using this system called G shard."}, {"start": 73.0, "end": 87.0, "text": " So I haven't actually seen the code out for G shard yet, but I'm going to maybe assume that this is something that they're going to release at some point, who knows? Or maybe I just haven't seen it yet."}, {"start": 87.0, "end": 107.0, "text": " So this is basically describing a system on how to train these giant models. So if you if you have watched my video on GPT-3, which of course was this 175 billion parameter model of open AI, which already was record breaking."}, {"start": 107.0, "end": 122.0, "text": " You this paper, the paper was very much like, oh, we built a model and look at what things it can do. So that was the open AI paper. This paper here is like the complete opposite."}, {"start": 122.0, "end": 138.0, "text": " It basically says, Oh, yeah, we do language model. But But here is how we built the model, which is, you know, equally cool. So open AI basically just made everything bigger. And here they say to make everything even bigger, you need some tricks and how to build models."}, {"start": 138.0, "end": 154.0, "text": " And they've basically, they've developed this entire framework to build these giant models. And this paper mainly describes that framework. And the actual task here, which is machine translation, is almost sort of a side thing in the paper."}, {"start": 154.0, "end": 171.0, "text": " It's it's all it's just a task to showcase what this system can do. So this is very much an engineering paper, rather than that much than a machine learning paper. And that's how you have to look at it right here. That being said, the machine learning results are of course, quite impressive."}, {"start": 171.0, "end": 199.0, "text": " If you look at this graph, here, you have a quality gain. It's a difference in blue score. And this is a quality score for machine translation over the previous state of the art. So over their baseline, which, as you can see, here, you have 37 billion weights, 150 billion weights and 600 billion weights, which they only train."}, {"start": 199.0, "end": 214.0, "text": " They train for you know, 2000 and on 2048 TPUs for just four days. That's they stress this is very efficient because they just have to train it for four days on 2000 TPUs. Absolutely crazy."}, {"start": 214.0, "end": 232.0, "text": " So let's have a look at what this paper does. If you enjoy this, if you enjoyed this at the end, consider you know, sharing the video out if you like it. And tell me what you think about this stuff in the comments."}, {"start": 232.0, "end": 248.0, "text": " Alright, so we'll go through the abstract and then we'll go through highlighted sections of the paper because the paper is 23 pages long, so I won't be able to cover everything just kind of give you the the high level ideas and highlight a few things."}, {"start": 248.0, "end": 268.0, "text": " But actually, let's not go into the abstract. Let's go into Yeah, these results first. So as you can see, they managed to continue the trend, the trend in NLP has always been in at least since, you know, transformers were invented, the bigger the better, like larger model, larger data, more compute means better performance."}, {"start": 268.0, "end": 293.0, "text": " And it's sort of unbroken here, as you can see, if you increase the number of parameters in these models, you do get a very, very big gain in these blur score, though it sort of seems to be kind of a logarithmic scaling, like you have to you have to keep doubling and doubling and doubling the, the number of weights sort of like Moore's law in computation."}, {"start": 293.0, "end": 307.0, "text": " But you do see that at the same time, the training wall time is going down and the computational cost, the computational cost of these models, it doesn't scale, quadratically, like you would expect it scales linearly."}, {"start": 307.0, "end": 324.0, "text": " And that's the big difference here in how these authors scale their model, rather than how the open AI authors scale their model. So in a traditional model in traditional transformer looks like this."}, {"start": 324.0, "end": 348.0, "text": " You have these blocks of attention. If you don't know what this is, I have a video called attention is all you need. I explain how the attention blocks in transformers work. So this is nothing different. These are just transformers standard transformers, there is an encoder and a decoder, everything works as you know, so you have these blocks, you have n blocks, these are the number of layers that you have."}, {"start": 348.0, "end": 364.0, "text": " And in these blocks, you always have an attention layer, and then a feed forward layer that acts on the tokens. So without repeating too much what an attention mechanism does, basically, in you have inputs tokens."}, {"start": 364.0, "end": 389.0, "text": " So this is a sequence. It's technically a set processing unit, but we use it for sequences of text. So here you have six tokens, a sentence of maybe six words. And then you transform it with the attention layer, by having this attention mechanism that routes information from tokens to from positions to other positions, maybe like this route is here route this here."}, {"start": 389.0, "end": 406.0, "text": " And then you have a feed forward network that is applied on a per token basis. So each of these tokens now goes through this feed forward network, and is kind of transformed. So the embedding of that token is transformed by that feed forward network."}, {"start": 406.0, "end": 422.0, "text": " Now every token does this. And it's always the same feed forward network. So this network here is the same as this network. Now, usually, when we talk about scaling transformers, we talk about this part right here, we talk about the attention mechanism."}, {"start": 422.0, "end": 442.0, "text": " And also we talk about this part, the number of layers. So, you know, we talk about scaling the number of transformer layers, more layers, more layers, more layers. And if we want to scale the attention mechanism, what that basically means is, we have we increased the context size of the text we can input."}, {"start": 442.0, "end": 459.0, "text": " So transformers are very limited by the size of this context right here, that they can take the like the original transformer started with something like 512 tokens that they were able to take because this attention mechanism has quadratic complexity."}, {"start": 459.0, "end": 476.0, "text": " This went up and the open AI GPT-3, I believe, had a context size of 2048 tokens, which if it scales quadratically, that's quite an achievement. And also it stacked the layers very, very deep."}, {"start": 476.0, "end": 492.0, "text": " Now, in this paper, they scale the transformers differently, they basically leave the context size. And I believe that their context size is 1024. So significantly smaller than the open AI context size, and they don't scale the layers."}, {"start": 492.0, "end": 511.0, "text": " So their largest transformer is 36 layers, whereas I believe GPT-3 was maybe correct me, but I think it was like 90 or 100 layers or something like this, at least significantly larger than this. Instead, what they scale is this part right here, the feet forward layers."}, {"start": 511.0, "end": 532.0, "text": " This might seem counterintuitive. But they basically, they basically say, what if we didn't only have one feet forward network right here, but we had many, right, we don't always have the same, we have many, many feet forward networks, different ones that can do different things."}, {"start": 532.0, "end": 561.0, "text": " And that's what they call experts. Each one of these feet forward layers is an expert. And then you have yet another routing mechanism, kind of like in attention, you have a routing mechanism that decides which tokens go where, okay, so this token here, this token here, this token here, and the sort of the implication being that different tokens, different parts of the input you want to transform require a different kind of transformations here."}, {"start": 561.0, "end": 573.0, "text": " And these different experts can sort of specialize in how they transform the input. Now, their task here is going to be machine translation as a multi task setup."}, {"start": 573.0, "end": 594.0, "text": " So what you'll have is you'll have all kinds of languages like French and German, what's the, and maybe like a lot of languages, I don't know any other languages. And you want to translate all of them to English, and you want to do it using the same model."}, {"start": 594.0, "end": 610.0, "text": " Right. So these experts here, they might specialize in, you know, the individual languages, like maybe you will have to handle a pronoun differently, if it comes from German than if it comes from French, you want to do it with the same model at the same time."}, {"start": 610.0, "end": 633.0, "text": " That means you maybe want to have the one expert specialize in German pronouns and one expert specialize in French pronouns. Also, you can think of the experts as maybe one specializes in question words, it doesn't matter which language they're from, and the other one specializes in some sort of other kind of linguistic feature."}, {"start": 633.0, "end": 648.0, "text": " In any case, this number of experts here is if you want to scale that up, then that becomes the bottleneck of the transformer, they go up to 2000 2048 experts in parallel."}, {"start": 648.0, "end": 677.0, "text": " So that doesn't fit into a single accelerator anymore. And that's why the entire system has to be sharded. And that's what they call G shard. So G shard, the main application here is going to be how, how can we build this giant model in on many, many distributed computers, where the attention mechanism isn't the problem, the attention mechanism, we just distribute, like we do data parallelism, the attention, it lives on all the computers."}, {"start": 677.0, "end": 702.0, "text": " It lives on all of the accelerators, it synchronizes, and so on. But the experts here, there's only so this expert lives on machine a this expert lives on machine B, this expert lives on machine C. And then we do a hard routing. So we don't do a soft routing, like an attention, we do a hard routing where one token goes to one or at maximum two experts."}, {"start": 702.0, "end": 724.0, "text": " So this is sent to these machines. And then after the machines, you kind of gather all the results back right here. So G shard is the system that enables this sharding of these experts, and the everything in between everything that is necessary, but it can also be applied to shard any computation. And that's why it's so cool."}, {"start": 724.0, "end": 751.0, "text": " So here you see what, what they do, they always they take these transformers. And they always consider a block of two transformer layers. So this is a block of two transformer layers, you can see there is twice the attention. And there's twice this feed forward. So in one point, this feed forward is just a regular everything, all the tokens go through the same network."}, {"start": 751.0, "end": 770.0, "text": " So that's like a classic transformer. But here, you have a lot of these different experts, and the tokens are routed to these experts. It's important that the tokens are hard routed, right? If the tokens were soft routed, you don't you don't gain anything, because every token has to go through every expert."}, {"start": 770.0, "end": 799.0, "text": " But here, the tokens are hard routed to the expert, which means that you can, if you if I have an input size of 1024 tokens, maybe only 10 go to this one, and maybe only 10 of that those go to this one. Now you also have a batch size, of course, I haven't actually looked at what the batch size here is, but you usually have quite a large batch size in these things like maybe a batch size of 1000 as well."}, {"start": 799.0, "end": 811.0, "text": " So ultimately, what you'll end up is, you know, 1000 times 10 tokens going to the first expert and so on. But still, you can significantly parallelize this computation. Okay."}, {"start": 811.0, "end": 831.0, "text": " So this this, if you use G shard, this is going to result in the following in the thing on the right, where you have two machines, this is machine one, and this is machine two, you can see that the machines will what happened here. Oh, someone made the PowerPoint mistake."}, {"start": 831.0, "end": 846.0, "text": " So you can see that the the attention, everything is shared between the machine. So this here and this here, these are synchronized, the weights are synchronized, right, you simply do a data sharing."}, {"start": 846.0, "end": 866.0, "text": " But here, you can see that you have model parallelism, model parallel mixture of experts, where on the first machine, you have the first expert, and then you have E devices. And on the last one, you have the last expert."}, {"start": 866.0, "end": 876.0, "text": " And then it's all routed out and routed in again. And then you can continue your transformer. And this is layer after layer."}, {"start": 876.0, "end": 891.0, "text": " So what's the problem here? The problem is that an operation like this is going to come to incur significant sort of overhead in terms of communication and so on, if you were to do it naively, and it's going to be a real pain to program this."}, {"start": 891.0, "end": 902.0, "text": " And that's why G shard is made to do all of this automatically. And you don't, you don't incur much of a cost, because you distribute."}, {"start": 902.0, "end": 914.0, "text": " So what's the difference to the old scaling? Why don't they just make transformers larger in number of layers? And that's because this this is, I guess, what open AI ran into as well."}, {"start": 914.0, "end": 926.0, "text": " If you make transformers simply larger in number of layers, sorry, if you make it transformers larger in the attention mechanism, it just won't fit into memory at some point, and you'll you'll have to share that somehow."}, {"start": 926.0, "end": 940.0, "text": " And you can do this with G shard. If you scale it in number of layers, that incurs significant cost where you have to wait, because you have to forward propagate, and then you have to backward propagate in your training sequence."}, {"start": 940.0, "end": 956.0, "text": " And if you have just too many layers, then a lot of the a lot of the frameworks get at their limit, where at some point, they say, Well, I still have to wait for the signal to come back in order to continue."}, {"start": 956.0, "end": 962.0, "text": " And they explore this in this benchmark right here."}, {"start": 962.0, "end": 979.0, "text": " You can see they say, the largest model, the 600 billion parameter model that achieved the best translation quality was trained with 2000 TPU v3 course for three days, a total cost of 22 TPU couriers."}, {"start": 979.0, "end": 1000.0, "text": " In contrast, training all 100 bilingual baseline models would have required 29 couriers. So the model here is faster than if you train them individually. But if you want to train a single transformer that is just very deep, and achieves reasonable performance, you have to invest a lot more."}, {"start": 1000.0, "end": 1029.0, "text": " Our best quality dense single transformer model 2.3 billion parameters. So it's also significantly smaller. Achieving this was trained with g pipe, which is a previous framework. So g pipe is kind of a task runner that also distributes computation was trained with g pipe on 2048 TPU course for six weeks, or a total of 235 TPU couriers."}, {"start": 1029.0, "end": 1043.0, "text": " By the way, for if you if you have $1 per TPU hour, that'll only cost a lonely, I guess, set you back about 2 million or so, easy peasy."}, {"start": 1043.0, "end": 1050.0, "text": " Or even 200,000 just, you know, a tiny, tiny bit of, of money."}, {"start": 1050.0, "end": 1067.0, "text": " But you can see that this transformer model that is dense, which means that is a classic transformer where you stack the transformer layers, you stack them, you stack them, you stack them."}, {"start": 1067.0, "end": 1086.0, "text": " It in fact, it has 96 layers, their baseline 96 layer transformer model, that's sort of what opening I did, they just kept stacking the transformer layers, you get a model that has less parameters and trains for much longer, and its performance is only about this good."}, {"start": 1086.0, "end": 1103.0, "text": " Whereas here, if you scale not into depth, but into width of these experts, and it's not dense, but it's shorted, which means it calculates this in a in a kind of sparsified way, because it has this hard routing, you can scale up to a lot more parameters."}, {"start": 1103.0, "end": 1113.0, "text": " So 600 billion parameters over 200 times more parameters than the deep model, and you can get a much better performance."}, {"start": 1113.0, "end": 1127.0, "text": " Okay, so this is what is different here, it scales into these experts, rather than scaling into depth or, or size of the attention mechanism itself."}, {"start": 1127.0, "end": 1146.0, "text": " Alright, the question, I guess that you come up with if you're a machine learner is how do you back propagate if you route if here you route to these different experts, and you do a hard routing, like here, how do you back propagate the signal because it seems like you need a soft routing, but this has been handled."}, {"start": 1146.0, "end": 1161.0, "text": " In fact, these mixture of experts has been introduced previously in a paper I think called outrageously large language models or something like this. And, and so they've introduced that, you know, it, it still works."}, {"start": 1161.0, "end": 1166.0, "text": " So back prop still works through. So basically, you have a back prop path through here."}, {"start": 1166.0, "end": 1188.0, "text": " And because you put a little bit of noise in this routing, every path gets explored a few times, and therefore you have enough back prop signal to make it work, it can it could technically fail, but they do observe generally that it does work if you do this kind of hard routing with a bit of noise."}, {"start": 1188.0, "end": 1205.0, "text": " Alright, so where do we go from here? As I said, this is an engineering paper, and it's a long engineering paper. So they, they set up their, they set up a lot of a lot of the details of engineering directly in the paper, which we're not used to in the machine learning world,"}, {"start": 1205.0, "end": 1211.0, "text": " they really detail how they shard things and so on."}, {"start": 1211.0, "end": 1221.0, "text": " Which is pretty cool. But, um, I invite you to look at the paper yourself, if you really want to know what's going on right here."}, {"start": 1221.0, "end": 1230.0, "text": " Suffice to say, they, as you can see, right here, what they do is, this is the input right here."}, {"start": 1230.0, "end": 1239.0, "text": " And then they have this weight matrix, which is a this routing. This is learned routing weights. Okay."}, {"start": 1239.0, "end": 1249.0, "text": " So you have trainable weights that decide how to route the input, and that's dependent on the input. So you have a bunch of inputs that comes from the lower layer."}, {"start": 1249.0, "end": 1264.0, "text": " And this matrix right here determines where to route them, basically says, okay, the input is a vector like this, I know that must probably go to the expert number three."}, {"start": 1264.0, "end": 1272.0, "text": " Okay, and you have a softmax across that. So it's a really, it's an assignment to it's a soft assignment to the experts."}, {"start": 1272.0, "end": 1280.0, "text": " So once you've done the soft assignment to the expert, you do a hard assignment by collecting the top two."}, {"start": 1280.0, "end": 1291.0, "text": " For each token, you say, you collect the top two experts, and you only send it to the top two experts, and you ignore all else, which is not a lot right there."}, {"start": 1291.0, "end": 1300.0, "text": " At times, there are 2000 experts in the system. And, yeah, you distribute and you have some noise."}, {"start": 1300.0, "end": 1310.0, "text": " So with a random probability, you actually don't even send it to the second expert, you just leave it at the first one."}, {"start": 1310.0, "end": 1319.0, "text": " And with some noise, you send it also to the second one. And I think that that noise is part of what it of what makes the system work a bit."}, {"start": 1319.0, "end": 1328.0, "text": " And then you also have this auxiliary loss right here that you add on top, which just makes sure that you distribute evenly."}, {"start": 1328.0, "end": 1344.0, "text": " So this encourages the system to distribute the tokens evenly, because sorry, what it penalizes is a this here is the mean assignment to each expert."}, {"start": 1344.0, "end": 1351.0, "text": " So it penalizes whenever the mean assignment is out of out of line, basically."}, {"start": 1351.0, "end": 1359.0, "text": " So a distribution assignment to the expert where one expert gets a lot of tokens, because I don't know, it happens to be really good at something."}, {"start": 1359.0, "end": 1364.0, "text": " So all the tokens are routed to it, and the other expert don't get a lot that's penalized."}, {"start": 1364.0, "end": 1369.0, "text": " So you encourage the system to distribute tokens evenly between those experts."}, {"start": 1369.0, "end": 1382.0, "text": " And then there are also like upper limits where you drop tokens and so on. They really built a system that is out for performance, rather than machine learning correctness."}, {"start": 1382.0, "end": 1388.0, "text": " So they demonstrate how to do this in in sort of code with their system."}, {"start": 1388.0, "end": 1393.0, "text": " And the cool thing about their system is that you don't have to do much."}, {"start": 1393.0, "end": 1403.0, "text": " What you'll have to do is just specify which tensors are sharded at along which dimensions and the system does the rest."}, {"start": 1403.0, "end": 1414.0, "text": " So this is pretty cool. So this here is this mixture of experts, mixture of experts as you would write it in code."}, {"start": 1414.0, "end": 1418.0, "text": " And they make use a lot of this Einstein sum notation."}, {"start": 1418.0, "end": 1426.0, "text": " If you don't know what the Einstein sum notation is, it's a general notation to describe matrix or tensor multiplications."}, {"start": 1426.0, "end": 1434.0, "text": " So a for example, if you were to multiply two matrices, you could have a string there."}, {"start": 1434.0, "end": 1444.0, "text": " You describe it as a string and it comes from how Einstein wrote up the kind of tensor contractions in his work."}, {"start": 1444.0, "end": 1457.0, "text": " So if you want to multiply two matrices, you can't you could put the string a b, b c goes to a c."}, {"start": 1457.0, "end": 1464.0, "text": " So this and then you put two matrices right here. This would tell it, OK, I have a one matrix."}, {"start": 1464.0, "end": 1471.0, "text": " I'm going to call the axis a and b. I have another matrix or tensor where I'm going to call the axis b and c."}, {"start": 1471.0, "end": 1478.0, "text": " Now I have the resulting tensor and I want the first axis to be a and the a is this one."}, {"start": 1478.0, "end": 1484.0, "text": " And I want the last axis to be c and the c is this one. And b is nowhere."}, {"start": 1484.0, "end": 1491.0, "text": " B is not in the output, which means it should contract over b. So it should sum along b."}, {"start": 1491.0, "end": 1495.0, "text": " Sorry, it should multiply along b and then add. So it should contract over b."}, {"start": 1495.0, "end": 1501.0, "text": " So this here describes a regular matrix matrix multiplication."}, {"start": 1501.0, "end": 1508.0, "text": " Now, if I could do something else, I could do something like a just a element wise product."}, {"start": 1508.0, "end": 1512.0, "text": " An element wise product would be something like this."}, {"start": 1512.0, "end": 1527.0, "text": " a b comma a b goes to a b, which means here I have a in the first input and here I have a again."}, {"start": 1527.0, "end": 1534.0, "text": " And I'm so you already see that you can even though these are different tensors, you can call the axis the same,"}, {"start": 1534.0, "end": 1537.0, "text": " which means that they're going to somehow be multiplied together."}, {"start": 1537.0, "end": 1542.0, "text": " Now, if you leave it away here, it means that it's going to be contracted and therefore the axis no longer exists."}, {"start": 1542.0, "end": 1547.0, "text": " But here we don't leave it away, which simply means that these axes are going to be multiplied together."}, {"start": 1547.0, "end": 1555.0, "text": " And the same for b right here. So this describes an element wise product."}, {"start": 1555.0, "end": 1565.0, "text": " You can go really funky with this. So this here would be a row wise dot product where a is"}, {"start": 1565.0, "end": 1573.0, "text": " for all the a's its element wise, but then over b, it's contracted."}, {"start": 1573.0, "end": 1577.0, "text": " So, you know, you can go you can go wild with the Einstein sum notation."}, {"start": 1577.0, "end": 1581.0, "text": " You can describe a lot of things with it."}, {"start": 1581.0, "end": 1588.0, "text": " So here is this algorithm to distribute the computation among these different experts."}, {"start": 1588.0, "end": 1596.0, "text": " So you have the inputs and the weight matrix for the they call this the gates function."}, {"start": 1596.0, "end": 1602.0, "text": " That's the routing function to these experts. So what do we do?"}, {"start": 1602.0, "end": 1611.0, "text": " We first of all, we have these tensors. They have these grouping, this grouping dimension right here."}, {"start": 1611.0, "end": 1623.0, "text": " So they come along to along groups, which in our case, we could maybe say these are batches or the batch dimension."}, {"start": 1623.0, "end": 1631.0, "text": " So they come across groups and there is the sequence length and there is this M right here."}, {"start": 1631.0, "end": 1638.0, "text": " That's going to be the feature dimension, the M. And you can see the M is contracted."}, {"start": 1638.0, "end": 1652.0, "text": " So the M is no longer here. So the gating function is going to route each input token right here to one of the experts for each thing in the group."}, {"start": 1652.0, "end": 1656.0, "text": " So you can see you can express this with an Einstein sum notation."}, {"start": 1656.0, "end": 1668.0, "text": " Then you have a top two gating, which selects the top two from each of the last from each of the entries."}, {"start": 1668.0, "end": 1676.0, "text": " And that gives you this dispatch mask and the sorry and the weights that you have to use at the end to combine."}, {"start": 1676.0, "end": 1684.0, "text": " You can use the dispatch mask in order to distribute the inputs. So you have reshaped inputs and so on."}, {"start": 1684.0, "end": 1693.0, "text": " So I'm not going to go through all of this right here, but you can express all of this in terms of the Einstein sum notation."}, {"start": 1693.0, "end": 1699.0, "text": " And you can express pretty much any sort of computation that is along the line."}, {"start": 1699.0, "end": 1703.0, "text": " You can express the attention mechanism and so on."}, {"start": 1703.0, "end": 1708.0, "text": " You can express the feed forward layers in terms of these Einstein sum notations."}, {"start": 1708.0, "end": 1716.0, "text": " And the underlying the underlined dimensions here are the dimensions where we want to shard the computation."}, {"start": 1716.0, "end": 1730.0, "text": " So here, because we have this g underlined, that means that we are interested in sharding the computation along this axis."}, {"start": 1730.0, "end": 1736.0, "text": " So this I said, this is the batch dimension. This is your classic data parallelism,"}, {"start": 1736.0, "end": 1744.0, "text": " which means that the first machine gets the first couple of data points, the second machine gets the second couple of data points and so on."}, {"start": 1744.0, "end": 1756.0, "text": " And you can see in the weight matrix, there is no sharding, which means that the weight matrix lives on every machine as a copy of one another."}, {"start": 1756.0, "end": 1769.0, "text": " This is different from from here, where you can see that what we're now going to do is here, it's still sharded according to the batch,"}, {"start": 1769.0, "end": 1773.0, "text": " but we now are going to shard this according to the different experts."}, {"start": 1773.0, "end": 1782.0, "text": " So we're going to route whatever the inputs are in to these experts."}, {"start": 1782.0, "end": 1787.0, "text": " And then we're going to execute the computations on the experts."}, {"start": 1787.0, "end": 1794.0, "text": " So this is now sharded according to the experts. And at the end right here, you can see this is still sharded according to the experts."}, {"start": 1794.0, "end": 1801.0, "text": " We're going to put it back together. And now it's sharded according to the groups again."}, {"start": 1801.0, "end": 1807.0, "text": " That's what we said. We have the input right here, the inputs."}, {"start": 1807.0, "end": 1812.0, "text": " And the inputs are maybe distributed according to the according to machines, right?"}, {"start": 1812.0, "end": 1817.0, "text": " We have these go through the first machine, these the second, these the third and so on."}, {"start": 1817.0, "end": 1824.0, "text": " This is your classic data parallelism. But then we have all of these experts."}, {"start": 1824.0, "end": 1834.0, "text": " And now all of a sudden, we're going to route these things to the individual experts and we're going to execute the computation in parallel on the experts."}, {"start": 1834.0, "end": 1840.0, "text": " And then after that, we're going to put back together from wherever we got them now."}, {"start": 1840.0, "end": 1846.0, "text": " So this goes here again. And so this is just the reverse of what we did before."}, {"start": 1846.0, "end": 1854.0, "text": " So right like that. So you get all of the outputs again."}, {"start": 1854.0, "end": 1857.0, "text": " I hope you kind of can imagine how this happens."}, {"start": 1857.0, "end": 1860.0, "text": " So the first difference is that's sharded according to a different dimension."}, {"start": 1860.0, "end": 1871.0, "text": " And the second difference is, is that when we shard in data parallelism, we execute the same computation on all the machines, which means that we have the same weight matrix."}, {"start": 1871.0, "end": 1888.0, "text": " If we do X times W in a feed forward layer and we shard this thing here in data parallelism, what we do is we send the X to different machines."}, {"start": 1888.0, "end": 1894.0, "text": " We split the X, we send it to different machines. This is X1, X2, X3, X4."}, {"start": 1894.0, "end": 1901.0, "text": " But we always multiply it with the same weight matrix. That weight matrix lives on all of the machines and is regularly synchronized."}, {"start": 1901.0, "end": 1911.0, "text": " It's kept synchronous in some way. Whereas if we shard X to the experts, then the experts have individual functions."}, {"start": 1911.0, "end": 1919.0, "text": " So the expert one is different from the expert two is different from the expert three, and so on."}, {"start": 1919.0, "end": 1925.0, "text": " Which means that before it wasn't important where X was routed, because we would execute the same computation."}, {"start": 1925.0, "end": 1931.0, "text": " So we can just, you know, shard it according to you know, the first 10 go there, the next 10 go there."}, {"start": 1931.0, "end": 1935.0, "text": " But here, it's now crucially important where they are routed to, to which expert."}, {"start": 1935.0, "end": 1939.0, "text": " And that's why we learned the function that is going to route them."}, {"start": 1939.0, "end": 1945.0, "text": " So this is learned. This is this first line here. These are the weights that we learn to route."}, {"start": 1945.0, "end": 1954.0, "text": " Then we route right here. And we calculate your, your, we calculate the feed forward layers on the expert."}, {"start": 1954.0, "end": 1961.0, "text": " You see that this WI and WO, they are the weight matrices of the feed forward layer."}, {"start": 1961.0, "end": 1972.0, "text": " The feed forward layers are, you have your input, you multiply it by WI, you have a ReLU, ReLU, and then you multiply it by WO."}, {"start": 1972.0, "end": 1977.0, "text": " So it's kind of a two layer feed forward network."}, {"start": 1977.0, "end": 1984.0, "text": " So this two layer feed forward network, as you can see, this is sharded according to the experts."}, {"start": 1984.0, "end": 1993.0, "text": " And then, and the important part is, of course, that here, the weight is also sharded according to the experts."}, {"start": 1993.0, "end": 1999.0, "text": " And that's what makes each expert different. And then it's combined again down here."}, {"start": 1999.0, "end": 2003.0, "text": " So I hope you kind of get the idea of what this algorithm does."}, {"start": 2003.0, "end": 2013.0, "text": " And the fact that we shard according to these experts is in fact different than your regular sharding where you shard the data like the batch, the batches."}, {"start": 2013.0, "end": 2020.0, "text": " But keep the model in parallel, keep the model synchronized."}, {"start": 2020.0, "end": 2024.0, "text": " With their system right now, this is how easy this is."}, {"start": 2024.0, "end": 2033.0, "text": " So before we simply stated our algorithm in Einstein sum notations, there is no way to underline code and that magically happened something that was simply for us to visualize."}, {"start": 2033.0, "end": 2040.0, "text": " Now we want to apply their system in order to make this actually sharded."}, {"start": 2040.0, "end": 2046.0, "text": " And with the G shard system, and as I said, I don't know if the code is out or it will be out."}, {"start": 2046.0, "end": 2050.0, "text": " But with the G shard system, this is basically all that you have to do."}, {"start": 2050.0, "end": 2055.0, "text": " So you have these functions, they're called split and replicate."}, {"start": 2055.0, "end": 2066.0, "text": " What replicate does is it takes that weight tensor and it replicates it on all the machines and that keeps it synchronized, right?"}, {"start": 2066.0, "end": 2073.0, "text": " This is a computation where we simply want to shard out the different to the different machines, but keep it synchronized."}, {"start": 2073.0, "end": 2077.0, "text": " And you can see if you do this, this is the operation."}, {"start": 2077.0, "end": 2084.0, "text": " Then the system knows, ah, this here is replicated across the machines."}, {"start": 2084.0, "end": 2095.0, "text": " So that means I'm going to distribute the data points according to this G dimension, according to the batch dimension and multiply it with this matrix."}, {"start": 2095.0, "end": 2099.0, "text": " According to this Einstein sum notation string on all of the machines."}, {"start": 2099.0, "end": 2103.0, "text": " And I'm going to keep this tensor in sync."}, {"start": 2103.0, "end": 2105.0, "text": " OK, so the system knows."}, {"start": 2105.0, "end": 2113.0, "text": " As opposed to that, you have you have the split tensor right here."}, {"start": 2113.0, "end": 2125.0, "text": " So the split, what it does is it splits a computation here, the dispatch X with inputs."}, {"start": 2125.0, "end": 2135.0, "text": " It splits it according to a axis index onto D different machines or into D different parts."}, {"start": 2135.0, "end": 2142.0, "text": " So you see here you calculate the how you should do the routing."}, {"start": 2142.0, "end": 2147.0, "text": " And the resulting tensors first dimension is this E dimension."}, {"start": 2147.0, "end": 2154.0, "text": " And then you say that should be split according to this first dimension onto D different places."}, {"start": 2154.0, "end": 2156.0, "text": " And these D different places are now separate."}, {"start": 2156.0, "end": 2159.0, "text": " They don't have the they don't have to be kept in sync."}, {"start": 2159.0, "end": 2162.0, "text": " Everyone has their own weights."}, {"start": 2162.0, "end": 2171.0, "text": " And now when you do this, you know, according to this E dimension, you can see because we know Einstein sum notation now."}, {"start": 2171.0, "end": 2175.0, "text": " You can see this E appears here, here and here."}, {"start": 2175.0, "end": 2179.0, "text": " So this operation is going to be applied element wise."}, {"start": 2179.0, "end": 2184.0, "text": " That means independent of each other in the direction of this dimension."}, {"start": 2184.0, "end": 2191.0, "text": " The system understands that since this tensor is sharded according to that dimension."}, {"start": 2191.0, "end": 2203.0, "text": " I have to execute this on each of these entries in separate with on each expert having their own weight matrix right here."}, {"start": 2203.0, "end": 2208.0, "text": " I hope this is a bit clear that their system makes it super easy."}, {"start": 2208.0, "end": 2211.0, "text": " You can basically do two things."}, {"start": 2211.0, "end": 2216.0, "text": " You can say this thing here is my classic parallelism where I want to keep it in sync."}, {"start": 2216.0, "end": 2224.0, "text": " And this thing here is where I want to split up and do different computation on the different parts."}, {"start": 2224.0, "end": 2231.0, "text": " And then they have also a general function that is more powerful."}, {"start": 2231.0, "end": 2235.0, "text": " Yeah, they and they you can auto partition and whatnot."}, {"start": 2235.0, "end": 2240.0, "text": " So they have a they have this."}, {"start": 2240.0, "end": 2250.0, "text": " We implemented the partitioner in the XLA compiler, which means that anything that can translate to XLA is a target for the system."}, {"start": 2250.0, "end": 2255.0, "text": " And that's, you know, TensorFlow and PyTorch can do this."}, {"start": 2255.0, "end": 2260.0, "text": " So technically, this can come to any of those systems."}, {"start": 2260.0, "end": 2264.0, "text": " But of course, who has their 2000 TPUs lying around to make use of this?"}, {"start": 2264.0, "end": 2269.0, "text": " But no, I'm kidding. I mean, this I they here use it for transformers."}, {"start": 2269.0, "end": 2275.0, "text": " But I am very excited to see what people can come up with for the system."}, {"start": 2275.0, "end": 2281.0, "text": " I believe a system like this where it's super easy to to shard."}, {"start": 2281.0, "end": 2287.0, "text": " And they have some you know, they talk about, OK, we do the single machine compiler."}, {"start": 2287.0, "end": 2290.0, "text": " So the compiler is also fast and so on."}, {"start": 2290.0, "end": 2294.0, "text": " I don't even want to go into this, but this is very well engineered, it seems."}, {"start": 2294.0, "end": 2304.0, "text": " And they they they basically implement this for all of the operators."}, {"start": 2304.0, "end": 2311.0, "text": " So I'm very excited to see what people can come up with outside of the traditional applications."}, {"start": 2311.0, "end": 2318.0, "text": " I think there can be new types of models developed simply because we have a system like this that makes it easier."}, {"start": 2318.0, "end": 2319.0, "text": " So, yeah, I'm excited."}, {"start": 2319.0, "end": 2329.0, "text": " So here they show a bit how this works on the example of this Einstein sum notation."}, {"start": 2329.0, "end": 2338.0, "text": " So here we want to do this thing here, which if you remember, this is the operation where we want to route the input to these experts."}, {"start": 2338.0, "end": 2343.0, "text": " So we want to start with something that is sharded according to the batch dimension."}, {"start": 2343.0, "end": 2351.0, "text": " That means that we we have different different parts of the batch on different machines."}, {"start": 2351.0, "end": 2360.0, "text": " And we want to route this and finally end up with something that is sharded on the different experts."}, {"start": 2360.0, "end": 2367.0, "text": " So this is what the system does is first you have these here are the different shards, right?"}, {"start": 2367.0, "end": 2380.0, "text": " You want to multiply this, as you can see, this and this right here means that this routing table is also sharded according to the same machines."}, {"start": 2380.0, "end": 2387.0, "text": " So you have the zero is all on the same machine, the one is all on the same machine and so on."}, {"start": 2387.0, "end": 2397.0, "text": " So what you want to do is you want to contract is there you want to contract according to this s dimension, right?"}, {"start": 2397.0, "end": 2404.0, "text": " Which we have we have omitted right here."}, {"start": 2404.0, "end": 2408.0, "text": " And if you multiply that, sorry, OK, we omit the s."}, {"start": 2408.0, "end": 2413.0, "text": " So this is not much of a this is not much of a of a graphic right here."}, {"start": 2413.0, "end": 2419.0, "text": " But then they have this re-shard operation where they do and you don't have to worry about this."}, {"start": 2419.0, "end": 2432.0, "text": " So from here to here, there is this re-shard operation that just shards it according to the according to e."}, {"start": 2432.0, "end": 2439.0, "text": " Yep. I find this to be a bit more a bit more insightful."}, {"start": 2439.0, "end": 2450.0, "text": " So if you have something like this, this which is a regular matrix multiplication, right?"}, {"start": 2450.0, "end": 2455.0, "text": " And you want to contract along b. This is exactly the example we had before."}, {"start": 2455.0, "end": 2462.0, "text": " So here is a situation where our tensor is sharded according to the b dimension."}, {"start": 2462.0, "end": 2466.0, "text": " And this tensor is also sharded according to the b dimension."}, {"start": 2466.0, "end": 2470.0, "text": " And you want to do a matrix multiplication of the whole tensor."}, {"start": 2470.0, "end": 2476.0, "text": " So what can you do? You're supposed to multiply these two matrices, but they are sharded on different machines."}, {"start": 2476.0, "end": 2486.0, "text": " Now, if you consider what you actually have to do is you have to multiply each row here with each column here and that in an element wise fashion."}, {"start": 2486.0, "end": 2498.0, "text": " So that distributes according to you have to multiply this by this plus this by this plus this by this plus the red by the red."}, {"start": 2498.0, "end": 2510.0, "text": " So you can simply multiply the zero tensors together, the one tensors together, the two tensors together and the three tensors together."}, {"start": 2510.0, "end": 2518.0, "text": " Each one will give you a full matrix and then you can simply add all of them in order to get your full result."}, {"start": 2518.0, "end": 2529.0, "text": " This is illustrated down here. So what machine one does, it simply multiplies its shard by its own shard of the second matrix."}, {"start": 2529.0, "end": 2537.0, "text": " Which will give it this thing here. And by the nature of how matrix multiplication is constructed, you can simply do an all reduce,"}, {"start": 2537.0, "end": 2544.0, "text": " which means you reduce you sum across all of the machines, and that will give you the full result."}, {"start": 2544.0, "end": 2550.0, "text": " So this is a this is a an example of how this works. This is, you know, pretty simple."}, {"start": 2550.0, "end": 2559.0, "text": " And I believe you may have seen something like this already when you were looking at just parallelizing matrix multiplication and so on."}, {"start": 2559.0, "end": 2567.0, "text": " So this system handles this transparently, right? If you're sharded like this, this is what the system will do."}, {"start": 2567.0, "end": 2572.0, "text": " However, if you are sharded differently, the system will act differently."}, {"start": 2572.0, "end": 2579.0, "text": " So here is a system you want to do the same matrix multiplication, but the first tensor happens to be sharded according to the A dimension."}, {"start": 2579.0, "end": 2583.0, "text": " The second tensor happens to be sharded according to the C dimension."}, {"start": 2583.0, "end": 2589.0, "text": " And you want to end up with something that's sharded to the C dimension."}, {"start": 2589.0, "end": 2597.0, "text": " Now we have an additional constraint here that here you can see, we kind of assume that this full thing here fits into memory,"}, {"start": 2597.0, "end": 2605.0, "text": " mainly because we want to obtain the full result you see here, A and C should not be sharded."}, {"start": 2605.0, "end": 2612.0, "text": " So we assume that we can keep that in memory. But here we want the final result to be sharded according to C."}, {"start": 2612.0, "end": 2621.0, "text": " Which opposes the additional constraint that it might be that the full matrix never fits into memory."}, {"start": 2621.0, "end": 2626.0, "text": " So how are we going to calculate all of that? We can't do the same trick anymore."}, {"start": 2626.0, "end": 2633.0, "text": " Now this G shard system apparently realizes itself when something is out of memory,"}, {"start": 2633.0, "end": 2639.0, "text": " and it can do a smart move around being out of memory using a loop,"}, {"start": 2639.0, "end": 2645.0, "text": " which basically means that it will compute entry by entry or block by block."}, {"start": 2645.0, "end": 2652.0, "text": " So these are the matrices we have to multiply. And you can see that if I want to do multiply this by this, that's fine."}, {"start": 2652.0, "end": 2657.0, "text": " I can do this on one machine. But and that will give me the block up here."}, {"start": 2657.0, "end": 2665.0, "text": " But if I want the block up here, I have to multiply this by this, which is across two different machines."}, {"start": 2665.0, "end": 2672.0, "text": " So what this system does is it's going into a while loop because it realizes there's not enough memory."}, {"start": 2672.0, "end": 2681.0, "text": " And it kind of sends around these different slices to the different parts, each time computing a little piece."}, {"start": 2681.0, "end": 2693.0, "text": " So here, first we do this by this, this is fine. But then we grab ourselves from the, we grab ourselves this one here,"}, {"start": 2693.0, "end": 2700.0, "text": " calculate the next little piece up here, then we grab ourselves the number two, calculate the piece here."}, {"start": 2700.0, "end": 2707.0, "text": " And then so this is from zero, this is from two, the one we already had, and then we grab ourselves piece three,"}, {"start": 2707.0, "end": 2714.0, "text": " and multiply that until here, until we have this final slice that we want."}, {"start": 2714.0, "end": 2721.0, "text": " Okay, so this goes in a while loop in multiple rounds, the system gets knows itself when it has to do this,"}, {"start": 2721.0, "end": 2727.0, "text": " and when it can calculate the full thing at once, because it fits into in memory."}, {"start": 2727.0, "end": 2737.0, "text": " It's even smarter than that, in that it can do these halo exchanges. So if you have to do something like this, a convolution."}, {"start": 2737.0, "end": 2747.0, "text": " Now in a convolution, what you'll do if you think of a, think of an image, and you want to do a convolution on it,"}, {"start": 2747.0, "end": 2755.0, "text": " but the image happens to be sharded, let's say the image is so large, it's sharded across nine different machines like this."}, {"start": 2755.0, "end": 2762.0, "text": " Now if you want to do a convolution, that's pretty cool, you know, here, here, here, but here, all of a sudden,"}, {"start": 2762.0, "end": 2771.0, "text": " your convolution is across two different machines. So this system G shard will adapt automatically,"}, {"start": 2771.0, "end": 2779.0, "text": " and do these halo exchanges where it kind of sends around from this machine, it'll send something to this machine,"}, {"start": 2779.0, "end": 2789.0, "text": " such that it can do the convolution in that step, and vice versa. And then this can be a padded accordingly, as you can see."}, {"start": 2789.0, "end": 2796.0, "text": " This, I think this is this is this was like super ugly to implement, if you just imagine that for each of these operations,"}, {"start": 2796.0, "end": 2805.0, "text": " you have to think about, okay, how can I express this with these MPI primitives, like dynamic slice and collective permute, and so on."}, {"start": 2805.0, "end": 2815.0, "text": " It's just an absolute nightmare. And I'm very happy that other people have done this, and I will probably just get to use it."}, {"start": 2815.0, "end": 2825.0, "text": " So there is a lot more to this system than I've just explained, I just tried to give you a flavor of what building a system like this"}, {"start": 2825.0, "end": 2833.0, "text": " means and how easy it is to use it like this. In order to implement all of this mixture of experts things,"}, {"start": 2833.0, "end": 2845.0, "text": " you simply go from this, which is a one a single machine implementation, how you would write it to this, which is now the same,"}, {"start": 2845.0, "end": 2852.0, "text": " it's almost the same code. But this now you can run on however many machines. And if you compile it with the system,"}, {"start": 2852.0, "end": 2860.0, "text": " it will do what you expect it to do in this sharded way. Completely crazy."}, {"start": 2860.0, "end": 2867.0, "text": " Okay, so they apply this to massively multilingual massive machine translation."}, {"start": 2867.0, "end": 2877.0, "text": " So two things, it's massively multilingual, and it's massive machine, which means, I guess, a lot of machines."}, {"start": 2877.0, "end": 2887.0, "text": " And the reason here is twofold. So what they say is, we have massively multilingual translation,"}, {"start": 2887.0, "end": 2894.0, "text": " why don't they just look at, you know, single machine translation. And it has a very specific reason, namely,"}, {"start": 2894.0, "end": 2900.0, "text": " if you have massively multilingual translation, which means that you have a lot of different languages,"}, {"start": 2900.0, "end": 2908.0, "text": " and you all have to translate them, ideally, to all the other languages, or, you know, every language pair."}, {"start": 2908.0, "end": 2919.0, "text": " But in this case, they only look at all the languages to English. I don't exactly know why, but I guess there must be some kind of reason."}, {"start": 2919.0, "end": 2936.0, "text": " If you do this, then you can make use of two of a thing where there are languages that you just don't have much data on, like, I don't know, Basque or something like this."}, {"start": 2936.0, "end": 2945.0, "text": " There's not that many people speaking Basque or Swiss German, there's not even a written form, a standard written form of Swiss German."}, {"start": 2945.0, "end": 2952.0, "text": " So you just don't have as many resources. And for other languages, you have giant amounts of resources."}, {"start": 2952.0, "end": 2965.0, "text": " And what you can make use of is this phenomenon called positive language transfer, where it happens that, for example, Swiss German is very close to German."}, {"start": 2965.0, "end": 2974.0, "text": " Now they can't understand us, which is a giant advantage for us. But still, it shares a lot of similarities with German."}, {"start": 2974.0, "end": 2981.0, "text": " So if you learn a lot about German, you can sort of transfer learn to Swiss German pretty easily."}, {"start": 2981.0, "end": 2996.0, "text": " So if you have a system that does German and Swiss German at the same time, you can perform better on both languages because the Swiss German part of your model,"}, {"start": 2996.0, "end": 3011.0, "text": " the part of your model that does Swiss German profits from the German inputs as well. Now, don't understand me wrong, there is not an individual part of your model that for each language, it's all done at the same time."}, {"start": 3011.0, "end": 3016.0, "text": " But still, you can imagine that, you know, some of these things will specialize in some of the languages."}, {"start": 3016.0, "end": 3032.0, "text": " But the hope is that if you have German and Swiss German in the same training set, that if the model realizes what a question construct is in German, it will be able to apply that also to Swiss German with some minor modification."}, {"start": 3032.0, "end": 3040.0, "text": " So there is a benefit of having these many languages, especially for the low resource languages."}, {"start": 3040.0, "end": 3056.0, "text": " Okay, so as the number of languages sorry as the number of language pairs to be modeled within a single translation model increases positive language transfer starts to deliver large gains for low resource languages."}, {"start": 3056.0, "end": 3070.0, "text": " Given the number of languages considered, which I believe is 100 here, M4 has a clear advantage on improving the low resource task. On the contrary for high resource languages, the increased number of tasks limit per task capacity within the model,"}, {"start": 3070.0, "end": 3089.0, "text": " resulting in lower translation quality compared to a models to to a models trained on a single language pair. This capacity bottleneck for high resource languages can be relaxed by increasing the model size to massive scale in order to satisfy the need for additional capacity."}, {"start": 3089.0, "end": 3108.0, "text": " So basically, you're saying, we can, if we train all these languages together, that will help a lot for these low resource languages, but it might hurt the high resource languages because now, we would have enough data technically to train and French to English model on in, you know, this giant model, we could train that."}, {"start": 3108.0, "end": 3128.0, "text": " And now that we have all these other languages in there, it just hurts us because we don't have enough parameters. And we can solve this, of course, by simply adding more parameters. So that's the solution, add more parameters, and you increase the capacity of the model, and you still get the benefits of the positive language transfer."}, {"start": 3128.0, "end": 3145.0, "text": " So their investigations is going to be into how much can we scale this? And is there like a sweet spot? Where because if you if you increase the parameters too much, you counteract this positive language transfer again."}, {"start": 3145.0, "end": 3169.0, "text": " So since, you know, since Swiss German and German can sort of benefit from each other. However, if we have too many parameters, so, and then we end up having all of these experts right here, and the tokens are always routed to these experts, and it always happens that all the Swiss German tokens are always routed to this expert and all the German tokens are always routed to that expert."}, {"start": 3169.0, "end": 3185.0, "text": " There will be no sharing of weights, there will be this positive language transfer will not happen because we have too much capacity. So the goal is to find a sweet spot between positive language transfer and this capacity bottleneck."}, {"start": 3185.0, "end": 3202.0, "text": " They do use an in house data set, which we don't have access to. But they say, the training corpus mined from the web contains parallel documents for 100 languages to and from English adding up to a total of 25 billion training examples."}, {"start": 3202.0, "end": 3226.0, "text": " However, they only use from 100 languages to English, this result in approximately 13 billion training examples to be used for model training. So that's a lot. It's a lot of data, especially for translation is kind of noisy translation because it's mined from the web, but still, it's a lot of data."}, {"start": 3226.0, "end": 3238.0, "text": " They have baselines. So the baselines are first of all, in order to form our baselines, we trained separate bilingual neural machine translation models for each language pair."}, {"start": 3238.0, "end": 3247.0, "text": " So that means a single model for each language to English, to depending on the available training data per language."}, {"start": 3247.0, "end": 3274.0, "text": " And then they also have a they also have a baseline, where they try open AI style to build as deep as single transformer as possible. And by that they mean, we also include a variant of a dense 96 layer transformer encoder decoder network trained with g pipe pipeline parallelism on the same data set as another baseline."}, {"start": 3274.0, "end": 3287.0, "text": " So the difference again here is that this 96 layer is a dense transformer, which means that all of the tokens go through the same computation, and we don't shard the computation out to these experts, right?"}, {"start": 3287.0, "end": 3308.0, "text": " You shard according to the batch, but all of them go through the same parameters. And that means we can, we can only scale up the number of layers. And that severely limits the that severely limits the computational efficiency, even if we have, you know, your pipeline parallelism and so on."}, {"start": 3308.0, "end": 3319.0, "text": " That hurts. They say training to convergence took over six weeks on 2000 TPU course."}, {"start": 3319.0, "end": 3323.0, "text": " That's crazy."}, {"start": 3323.0, "end": 3327.0, "text": " But I guess, yeah, you know,"}, {"start": 3327.0, "end": 3333.0, "text": " I was saying earlier that that I always thought we were happy."}, {"start": 3333.0, "end": 3351.0, "text": " I always thought we were happy and machine learning because kind of the the hip science fields being biology, like genetics and and machine learning was thought like, oh, but these biology people, they always need like million dollar grants from government to run their experiments and we can just sit down with a laptop."}, {"start": 3351.0, "end": 3358.0, "text": " This time is over. If you start a PhD now start applying for money to get TPUs."}, {"start": 3358.0, "end": 3365.0, "text": " Yeah. Okay. In any case, here you can see what this does. So they compare a bunch of models right here."}, {"start": 3365.0, "end": 3381.0, "text": " So this T, this is this big dense transformer, that's going to be one of our baselines. And the other baseline here is going to be the zero axis. The zero axis means this is the single model for that language pair."}, {"start": 3381.0, "end": 3390.0, "text": " So only so for each language, they trained one model only on data from that language."}, {"start": 3390.0, "end": 3409.0, "text": " And that's going to be the worst thing here, because this this multi language translation in one model will generally help you if you have enough parameters, you can see all the models here have enough parameters, such that the difference here that this is difference in blue is positive."}, {"start": 3409.0, "end": 3427.0, "text": " Including this baseline model right here. So the baseline model, as you can see, has 2.3 billion parameters, even though it takes that much longer to train. And that's, as we said, a function of the fact that it's dense and deep, that hurts in training efficiency."}, {"start": 3427.0, "end": 3439.0, "text": " And then you have these mixture of expert models. They always consider two things they consider different numbers of experts, you can see it goes from 128 to 2048 experts."}, {"start": 3439.0, "end": 3452.0, "text": " And they consider a number different number of layers from 12 layers to 36 layers, 36 layers still being way smaller than the 96 layer transformer here."}, {"start": 3452.0, "end": 3460.0, "text": " And that's the reason why it trains faster. So it, it doesn't train faster."}, {"start": 3460.0, "end": 3472.0, "text": " So the reason it trains faster is because it has less layers. And then the reason it has more parameters is because it has a lot of these experts."}, {"start": 3472.0, "end": 3493.0, "text": " And the art here is to constrain how much these more experts hurt you. So, you know, you could run into the same problem where if you scale up the experts, in fact, you do, it doesn't fit into memory anymore, and it's going to hurt you a lot in training efficiency, kind of like if you increase the number of layers."}, {"start": 3493.0, "end": 3511.0, "text": " But the G shard system prevents that it lets you up the number of experts without incurring the cost. That being said, it does not let you up the number of layers, you're going to incur the same cost if you up the number of layers, as you have with the dense transformers."}, {"start": 3511.0, "end": 3522.0, "text": " So does this help? It helps a lot. As you can see right here, there's a general trend upwards and what's the x axis, the x axis is low resource languages."}, {"start": 3522.0, "end": 3540.0, "text": " So you can see that as we as we go to lower and lower resource languages, this multitask training, this multilingual translation improves significantly over the baseline where we only train a system for that language specifically."}, {"start": 3540.0, "end": 3548.0, "text": " And these 10k examples, it's a it's a it's quite a bit, but it's not that much, especially since it's noisy data."}, {"start": 3548.0, "end": 3558.0, "text": " So this is specifically good for low resource languages. But you can see also the high resource languages here benefit from the multilingual translation."}, {"start": 3558.0, "end": 3570.0, "text": " And that's a function of the fact that we have, you know, large enough models. In fact, you can see the larger the models, the more the difference in blue is, and there's not really an end in sight."}, {"start": 3570.0, "end": 3579.0, "text": " And they also see it say that they haven't seen convergence in training. So you can technically train this, you know, forever."}, {"start": 3579.0, "end": 3593.0, "text": " Yeah, you can also see that the the lowest mixture of experts right here is almost on par with their big, dense transformer that took so much longer to train."}, {"start": 3593.0, "end": 3604.0, "text": " Right. So this lowest model right here, I believe it took I don't want to go back, but it took it took hours or so or few hours to train."}, {"start": 3604.0, "end": 3612.0, "text": " Whereas this 96 layer dense transformer took these six weeks to train."}, {"start": 3612.0, "end": 3621.0, "text": " Though has to be said, the number of TPUs is not to be neglected. But if you're Google, you know, you just have them laying around."}, {"start": 3621.0, "end": 3645.0, "text": " What's also interesting here, and you can start seeing this two things. First of all, you can see that the difference between here in between the dense transformer and this baseline model is very low for high resource languages, but gets larger for low resource languages."}, {"start": 3645.0, "end": 3658.0, "text": " This is an indication that the dense transformer, it does more to share parameters between the languages because it shares parameters between all the things because all the tokens go through the same computation."}, {"start": 3658.0, "end": 3667.0, "text": " So it is going to be a bit better in low resource languages, but still the general trend upwards holds even for the mixture of experts."}, {"start": 3667.0, "end": 3676.0, "text": " The second thing is that you see there is a crossover here in these in these big in these biggest models."}, {"start": 3676.0, "end": 3686.0, "text": " And what are the big models? One, the blue one is the one with 2048 experts, and the green one is the one with 500 experts."}, {"start": 3686.0, "end": 3698.0, "text": " They're both as deep models. But all of a sudden, over here for the high resource languages, it's still true that if you up the number of parameters, you get a benefit."}, {"start": 3698.0, "end": 3709.0, "text": " So up the number of experts as well, you get a benefit. But over here for the low resource languages, it's it, you see, it actually hurts you to up the number of experts."}, {"start": 3709.0, "end": 3720.0, "text": " And that's the phenomenon. Exactly. We talked about before, if you have too many of these experts, and you do a hard routing, that means all the tokens go a different way."}, {"start": 3720.0, "end": 3725.0, "text": " And that means you don't get any sharing benefit from the multilingual translation."}, {"start": 3725.0, "end": 3746.0, "text": " And they investigate a lot. And they basically claim that their sweet spot of expert in their particular task appears to be somewhere in between these 2000 and this 500 expert number, where you can see it doesn't always help you to scale up the model."}, {"start": 3746.0, "end": 3765.0, "text": " Though I have to say, maybe the transformers, maybe they need a resonant moment. So I believe in computer vision, it was sort of the same problem that we try to build deeper models and why like, okay, this, this is more width, but"}, {"start": 3765.0, "end": 3776.0, "text": " I think there might be some breakthrough on the horizon where someone just figures out how to train these giant models, even more giant transformer models with deeper layers."}, {"start": 3776.0, "end": 3786.0, "text": " And then there's a new new era of transformers. However, this is not that effect. I'm sorry, I said this at the wrong place. This is not that effect."}, {"start": 3786.0, "end": 3806.0, "text": " This is to show that in this case, we do benefit for the high resource languages because we increase capacity. But for the low resource languages, we suffer if we up the number of experts too much, because they don't share any parameters anymore between the languages or between the different parts."}, {"start": 3806.0, "end": 3821.0, "text": " Like it's not a necessity that the different languages are going to be routed to different experts. But it's probably going to happen right there's no no hard coded thing that says if it's this language, it needs to go there."}, {"start": 3821.0, "end": 3834.0, "text": " It just probably is going to happen this way because the different languages are going to be needed to be treated differently and therefore the system learns to route first and foremost, those two different experts."}, {"start": 3834.0, "end": 3848.0, "text": " Here you can see the model sizes, including this 60 layer models model with 2000 experts that they didn't manage to train they said they had numerical instability, but that had 1 trillion parameters."}, {"start": 3848.0, "end": 3865.0, "text": " I'm pretty sure they're, they're cool. They must be quite mad about this right? Like you have the trillion parameters, even though it's not that much bigger than the 600 billion that the trillion, it would be cool to write a paper like a trillion parameter model."}, {"start": 3865.0, "end": 3894.0, "text": " But for now, they are at the 600 billion mark, and they simply want to tell you that they have actually compiled a model that's that big just didn't manage to train it. And yeah, that's here, here is where I wanted to say that maybe we're waiting for the resonant moment, where all of a sudden someone figures something out that makes the training of basically infinitely deep transformers possible like we made the training for almost infinitely deep."}, {"start": 3894.0, "end": 3901.0, "text": " CNNs possible with Resnets."}, {"start": 3901.0, "end": 3918.0, "text": " Okay, so they conclude this, and so they, that's the the investigation of what the number of experts and so on gives you. And here is a bit of a different investigation, where they more care about training efficiency."}, {"start": 3918.0, "end": 3933.0, "text": " So they ask themselves, how many billion tokens of input do we need to reach a given cross entropy. So here, the more tokens you need, the lower your efficiency is right."}, {"start": 3933.0, "end": 3951.0, "text": " You can see that the general trend is the following. If, if you up the number of layers, you get more efficient, you can see and just look at this column for now this point seven column, you can see it already pretty clearly."}, {"start": 3951.0, "end": 3966.0, "text": " So here you go from 12 layers to 36, you gain efficiency. Here you gain here you gain pretty predictable, if you up the number of layers, you need to see fewer tokens to get to the same cross entropy."}, {"start": 3966.0, "end": 3976.0, "text": " And in fact, you can get to a lower cross entropy all together at the end. We've known this for language models already."}, {"start": 3976.0, "end": 3986.0, "text": " The other effect is of course, what happens if we go not deeper, but wider, if we increase these number of experts, if we increase this sparse computation."}, {"start": 3986.0, "end": 3994.0, "text": " So here you can see, let's just look at the 12 layers for now, let's look at all the rows where there's 12 layers."}, {"start": 3994.0, "end": 4009.0, "text": " So here, you get a significant advantage by upping the number of experts from 100 to 500. But then you hurt upping the number of experts to 2000. Right?"}, {"start": 4009.0, "end": 4030.0, "text": " So that's that's sort of your you're hurting efficiency by upping the number of experts too much. And the same if we look at the 36 layer, so you gain massive efficiency by upping the number of experts, but you lose that efficient part of that efficiency again, by increasing it even more."}, {"start": 4030.0, "end": 4055.0, "text": " Now, we saw that the this model is still the best model, but it's not as efficient as that model. And that gives you another indication that there is sort of a sweet spot between these two things between the positive transfer and the bottleneck capacity that appears to be somewhere in between right here."}, {"start": 4055.0, "end": 4066.0, "text": " So that's pretty interesting. Because we know about depth that you can basically up and up and up and get more efficient, but with not that much."}, {"start": 4066.0, "end": 4081.0, "text": " Yeah, the largest model can be trained in under four days to achieving the best quality. Yes, yes, yes, but this is just a yeah."}, {"start": 4081.0, "end": 4091.0, "text": " So here, oh, you can see the batch size in in tokens is quite, quite a bit."}, {"start": 4091.0, "end": 4101.0, "text": " So yeah, if you have a thousand, if you have a context window of 1000, that means the batch size here was about 4000."}, {"start": 4101.0, "end": 4106.0, "text": " So as as expected."}, {"start": 4106.0, "end": 4115.0, "text": " Yeah, this is just easy peasy 22 TPU core years. I've seen someone on Twitter saying this. This is the new measure for computers."}, {"start": 4115.0, "end": 4120.0, "text": " No, it's no longer like flops. It's TPU core years."}, {"start": 4120.0, "end": 4125.0, "text": " Just mad, mad. And yeah."}, {"start": 4125.0, "end": 4131.0, "text": " So 42 days to train this thing right here. Crazy, crazy, crazy."}, {"start": 4131.0, "end": 4140.0, "text": " All right. They also have a number of investigations in other parts of efficiency, like per device memory consumption."}, {"start": 4140.0, "end": 4155.0, "text": " You can see here that as you up the as you up the number of experts, you can see here, here, here, your weights don't go up because as you up the number of experts,"}, {"start": 4155.0, "end": 4161.0, "text": " you can just up the number of machines, and the per machine weight usage will be the same, right?"}, {"start": 4161.0, "end": 4168.0, "text": " Because the experts are independent of each other, each one has their own weight matrix."}, {"start": 4168.0, "end": 4173.0, "text": " So you can just add machines and you keep your weight requirements the same."}, {"start": 4173.0, "end": 4183.0, "text": " However, if you go deeper, then your weights increase because you're now deeper, you have more layers, you have your."}, {"start": 4183.0, "end": 4190.0, "text": " So also your transformer weights will be higher and so on. So you go deeper right here."}, {"start": 4190.0, "end": 4197.0, "text": " You see 3660 layers, your memory consumption increases for the weight."}, {"start": 4197.0, "end": 4201.0, "text": " And also, this is the other big part in transformers, right?"}, {"start": 4201.0, "end": 4210.0, "text": " The activations that you have to save, because as we said, if you have a transformer and I have layer, layer, layer, layer,"}, {"start": 4210.0, "end": 4217.0, "text": " I basically have to keep around each of these signals in order to do back propagation."}, {"start": 4217.0, "end": 4223.0, "text": " And that's why also the activation here increases as I go deeper."}, {"start": 4223.0, "end": 4229.0, "text": " Now you can see percentually, it decreases again here. So what's happening?"}, {"start": 4229.0, "end": 4232.0, "text": " Technically, you don't have to keep these things around."}, {"start": 4232.0, "end": 4238.0, "text": " You can also once the signal comes back, you can recompute them from the beginning or from an intermediate point."}, {"start": 4238.0, "end": 4243.0, "text": " Now this increases computation, but saves the need to store the activations."}, {"start": 4243.0, "end": 4257.0, "text": " And apparently G-shard, yet another thing it does is it will recompute as necessary the activations if it realizes that you don't have enough memory to store them."}, {"start": 4257.0, "end": 4261.0, "text": " So all of this is pretty crazy, honestly."}, {"start": 4261.0, "end": 4269.0, "text": " And they look at where the different computations go."}, {"start": 4269.0, "end": 4274.0, "text": " And I don't want to go into this."}, {"start": 4274.0, "end": 4283.0, "text": " And they have these micro benchmarks where they really show that the increase in complexity is really according to square root of n,"}, {"start": 4283.0, "end": 4292.0, "text": " because that's how long it takes to distribute along these experts."}, {"start": 4292.0, "end": 4297.0, "text": " There's a lot to this paper and there's no time to go through all of it."}, {"start": 4297.0, "end": 4299.0, "text": " I think this video is already way too long."}, {"start": 4299.0, "end": 4304.0, "text": " I hope I have given you an impression of what's possible with this system."}, {"start": 4304.0, "end": 4309.0, "text": " And as I said, I'm excited what people can come up with."}, {"start": 4309.0, "end": 4317.0, "text": " Just to say that in the appendix here, they detail that they have done this for all the operations in XLA."}, {"start": 4317.0, "end": 4328.0, "text": " So, for example, convolution. This is so ugly how you have to implement the convolution because you have to padding must be correct across these experts, across the sharded machines."}, {"start": 4328.0, "end": 4331.0, "text": " So there are no experts anymore. This is just G-shard."}, {"start": 4331.0, "end": 4335.0, "text": " The padding has to be correct. The strides have to be correct."}, {"start": 4335.0, "end": 4341.0, "text": " Data needs to be exchanged according to the machines. The window size needs to be correct. Blah, blah, blah."}, {"start": 4341.0, "end": 4347.0, "text": " Thank you for doing this and not having to do it myself."}, {"start": 4347.0, "end": 4357.0, "text": " Yeah, I'm excited. As soon as the code's out, if I get hold of it, I'll link it or you'll find it once it's out."}, {"start": 4357.0, "end": 4360.0, "text": " If it's already out, I'm just too dumb to see it."}, {"start": 4360.0, "end": 4364.0, "text": " I enjoyed reading this. It's different than a machine learning paper."}, {"start": 4364.0, "end": 4373.0, "text": " It kind of shows you what goes into engineering a system like this and how easy it can be if it's engineered well to then apply it."}, {"start": 4373.0, "end": 4377.0, "text": " I think this is going to be extremely helpful to the community."}, {"start": 4377.0, "end": 4395.0, "text": " And with that said, 23 pages later, see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=DYBmD88vpiA
Object-Centric Learning with Slot Attention (Paper Explained)
Visual scenes are often comprised of sets of independent objects. Yet, current vision models make no assumptions about the nature of the pictures they look at. By imposing an objectness prior, this paper a module that is able to recognize permutation-invariant sets of objects from pixels in both supervised and unsupervised settings. It does so by introducing a slot attention module that combines an attention mechanism with dynamic routing. OUTLINE: 0:00 - Intro & Overview 1:40 - Problem Formulation 4:30 - Slot Attention Architecture 13:30 - Slot Attention Algorithm 21:30 - Iterative Routing Visualization 29:15 - Experiments 36:20 - Inference Time Flexibility 38:35 - Broader Impact Statement 42:05 - Conclusion & Comments Paper: https://arxiv.org/abs/2006.15055 My Video on Facebook's DETR: https://youtu.be/T35ba_VXkMY My Video on Attention: https://youtu.be/iDulhoQ2pro My Video on Capsules: https://youtu.be/nXGHJTtFYRU Abstract: Learning object-centric representations of complex scenes is a promising step towards enabling efficient abstract reasoning from low-level perceptual features. Yet, most deep learning approaches learn distributed representations that do not capture the compositional properties of natural scenes. In this paper, we present the Slot Attention module, an architectural component that interfaces with perceptual representations such as the output of a convolutional neural network and produces a set of task-dependent abstract representations which we call slots. These slots are exchangeable and can bind to any object in the input by specializing through a competitive procedure over multiple rounds of attention. We empirically demonstrate that Slot Attention can extract object-centric representations that enable generalization to unseen compositions when trained on unsupervised object discovery and supervised property prediction tasks. Authors: Francesco Locatello, Dirk Weissenborn, Thomas Unterthiner, Aravindh Mahendran, Georg Heigold, Jakob Uszkoreit, Alexey Dosovitskiy, Thomas Kipf Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we'll look at Object-Centric Learning with Slot Attention by Francesco Locatelli, Thomas Kipf and others of Google Brain, ETH Zurich and MPI. On a high level, this paper recognizes scenes of objects from single pixels and it's best I show you a picture of what's going on. So you have scenes like this, where there is some sort of an arrangement of objects and there are multiple tasks you can do here, specifically they consider the task of unsupervised recognition of objects which they call object discovery and supervised classification of objects. The difficulty being that these are sets of objects so there is no ordering to the sets. They do this via a thing they call slot attention that basically is a permutation invariant attention mechanism over these objects in both the supervised and unsupervised domain and they do this in a fashion where they iteratively route the attention in order to make the different slots compete for attention over these objects. So that's the sort of high level. If you are in this field, you probably know right now what's going on. If you're not, we'll dive into it together. So stay tuned. If you like content like this, consider sharing it out, leaving a like or tell me what you think about it in the comment. I appreciate any suggestion for making these videos better and so people can learn more from it. Alright, so the problem I've already described the problem a little bit but let's go a bit deeper here. You have images like this and the images we're considering are going to be images that have some sort of arrangement of objects or what we humans would call objects. In this case, you can see there is this gray square, not sorry, this gray cube right here. There is a smaller green cube and then there is a yellow cylinder. Now in the task of object discovery, what you're supposed to do is you're simply supposed to say that there is an object right here, there is an object about here, and there is an object here, right? So basically, you're supposed to point to the pixels where there are objects and you're supposed to segment the objects from each other. You can see right here that this model, we don't know how it works yet, but it separates the left cube here, the bottom cube here, and the top right cylinder right here. In the task of set prediction, you're supposed to say what objects there are. So you're supposed to say there is a gray cube right here, a green cube right here, and there is a yellow cylinder right there. Actually, you don't have to say where they are, I guess. There are many different variants of this task. But mainly, you're supposed to classify them, meaning you have to say there is a gray cube there. I believe in this case, it's with coordinates, but you can do it without the difficulty here, of course, being that these are sets. So there is no natural order in it. So if you say there is a green cube and a yellow cylinder, it's going to be the same as there is a yellow cylinder and a green cube. So you have to build an architecture that is somehow invariant with respect to the labels. And we've seen a lot of the concepts in this video in this paper before. This video is sort of a a kind of a mash together of different concepts of other places. So what you'll see is, for example, this property of the fact that here you see are the labels for these objects. This could be there is a green cube. There is a gray cube. And you'll have to come up with an architecture that if here you predict that green cube, you consider it correct, even though the corresponding label isn't the one for the green cube. And we saw this, for example, in this DETR architecture by Facebook, where they use a matching loss, but we'll get into that. Okay, so these are the tasks, the tasks are object discovery and set prediction. So how does this paper deal with this, they use this thing called a slot attention module. Now the slot attention module is in essence, it's pretty simple. What it does is it has these different slots right here, as you can see, and it divides the input into features. So you can see there is a CNN encoder because we're working with pixels, it's natural that we want to encode these into a CNN. The CNN will probably downsample the image a bit and divide subdivided into this grid right here. So you have a fairly coarse grid, the grid is actually not a bit finer than you see here. This is just for example. But you'll have ultimately a number of features. So each pixel right here is going to be a feature, each feature will have not only this one channel as you see here, but many, many channels of information down here. So the CNN will encode each of these regions in the picture into a feature vector. And then you have these slots. So what you'll want to do, we maybe look at this, so you'll have the features right here. These are your features. And you'll have the slots and the slots, let's say there are fewer slots than features to three, three slots, four slots, as in this case, four slots. What you'll want to do is you'll want to assign the features to the slots. So you maybe say, okay, this feature right here, and this feature right here, they go to this slot, and then these two features go to this slot, and this these two go to this, and that feature goes to that. And that's equivalent to basically subdividing the picture into these slots. Ultimately your goal is going to be to say that these features right here, these pixels right here, are going maybe into that slot. And then these ones right here are going into that slot. And these ones here going into that slot, and the rest, so all of their background is going into that one. You can see that if you have a system like this, if you can train it correctly, then it becomes pretty easy to so it becomes super easy to classify it right here, because you can just take each slot and independently classify it, right? Because you already know, you already have assigned all the pixels where the object appears into that slot, you can just super easily predict a class from it. So we're almost at the end. So you now predict for each slot a class or a description of the object, whatever you want to predict. And this is the exact same thing as in this Facebook paper now, where for each for each of these slots, we've predicted a bounding box. The question is, how do you assign this to the labels? And that's pretty easy that there's this thing called the Hungarian matching that basically what you're saying is you want to be as forthcoming as possible, right? So if you predict a gray cube somewhere, and there is a gray cube somewhere here, you want to match them, you'll say, Okay, I'm going to give you the benefit of the doubt. And I'm going to do your model, I'm going to assume with the gray cube, you meant that gray cube right here. And if there is the yellow rectangle, and yellow rectangle somewhere over there, you don't incur any penalty as long as you predict the correct things. Now only whenever you predict like a second yellow rectangle, so both of these slots now, so this slot and this slot for some reason, they predict a yellow rectangle, this one correctly, and this one was assigned this object, and it incorrectly predicts a yellow rectangle, sorry, other way around. This one incorrectly predicts a yellow rectangle where there's no second yellow rectangle in our label set, there's only this, maybe this green cube, then this will be a mistake because it can't be matched, it will be matched to the one where it has the least loss, but it will be matched to something that's not a yellow rectangle. And therefore, that's going to be a mistake. So this is how you calculate the loss function with this matching algorithm. And you can calculate that matching in a deterministic fashion, so you can back propagate through it. So you can see, if this slot assignment works, we'll have a pretty easy time then calculating the classes coming up with a loss, the same for the unsupervised object discovery. What we'll do is we'll run these things through this slot decoder. Now this slot decoder is very similar to an generator in GANs. For example, it takes a hidden representation as input. Now the hidden representation here is going to be these, these slots, and it's going to up sample it into an image. If we train the whole if if we have a good slot assignment mechanism, we can pretty easily train a decoder like this, right with any method you want. In this case, I believe they use some yeah, some sort of up sampling up convolution architecture right here. And they use the L2, they minimize the reconstruction error between the end the output image and the input image. So it's sort of like a variational auto encoder or just auto encoder objective in this case. Alright, so we know how to encode a picture into hidden representation using a standard convolutional neural network. And we know once our slot attention mechanism works, we pretty much know how to go from there. So the question is, what is this slot attention mechanism? Now what we're supposed to do is we're supposed to again assign each one of the features into a slot and in a very specific fashion. So if you think about the pixels right here, there can be multiple of these pixels or multiple of the regions, multiple features can be assigned to one slot. But we'd rather not have the same feature assigned to multiple slots. So each slot takes in many features, but the features should be this divided between the slots such that only one slot attends to a feature. And by me saying attend, you probably already know where this is going. So if you have the features, and you consider the slots, right, and we just look at a single feature for now, what we'll do is we'll have an attention mechanism from the slots going into the features. So if you don't know what an attention mechanism is, I have this video called attention is all you need, where I explain this. But briefly, the features, they will emit something that's called a key, which is a vector, and then the slots will emit a query, which are also vectors. And the sir, the the information is now routed by agreement of key and query. In this case, this thing, this this feature right here would be routed to this slot. Now, it would be routed to both slots, but it wouldn't be routed as much to the bottom slot. And we make sure that this happens by using a softmax assignment. So if this is like nine, and this is four, what we'll do is a softmax assignment such that after that, so we have a proper distribution, which would be something like after the softmax be something like 0.9 and 0.1 right here. So you can see that the attention is fairly hard. So this is basically it's a differentiable way to assign these things. Okay, so an attention mechanism fulfills the property that we want to basically assign features to the slots in a way that the slots compete for the features. As you can see right here, if this slot here matches the feature the best, it come it out competes the other slot because at the end, this has to be normalized to one because of the softmax. So this competition is the heart of the slot attention mechanism. And this is this is how it works. So this is the slot attention module, as you can see. So you'll take your inputs, and they have lots of layer norms in here, but disregard the layer norms. So what you'll do is you'll calculate the agreement between the inputs and the slots. Now you might wonder in a standard attention mechanism, you'll have input signal coming from here, which is like maybe these are the input signals. And then you construct the keys and the queries for the next layer, you construct all from that input signal, right? And also the values, by the way, you construct everything from that input signal. But in this case, we'll have many features and we'll only have a fixed amount of slots right here. So where do these slots come from? Where do the the signal for the keys come from? In the Facebook DETR paper, we saw that these are learned embeddings. However, in this case, right here, these are not learned, the slots are initialized randomly. So at the beginning of each thing, the slots are initialized randomly. You can think of this as an attention mechanism, where you have the attention module right here. And then at the beginning, you simply have randomly initialized positional embedding or randomly initialized slots. And then the image is going to be encoded through a CNN right here, giving you a bunch of these features. And then you'll have cross attention between these features and the slots. And that will give you the next layer right here. Okay. All right, so you want to calculate the routing between the inputs and the slots. And then you want to perform a softmax over the slots, which will give you this competitive nature between the slots. So all the slots are going to compete for the to be routed for the features to be routed to them. And then this is simply the second part of the attention mechanism. So you will have a weighted mean. Now this is a slightly different from an attention mechanism, because in a real attention mechanism, you'll have a weighted sum right here, here you will have a weighted mean, but it's basically such that you can have a different amount of slots and the kind of values will stay the same. That's why you do the mean. So you weight them up and the values are simply a function of the inputs. This is like in a standard attention mechanism, then what you'll do, you can see that this is now called updates. Okay, so you start with the slots randomly. And then you use the slots to route the information. You take the inputs, and you use that information routing to calculate the updates. Now you put the updates through a GRU with the state being the previous slots. And then you add that to the slots, either this says optional residual MLP. So what you can do is you will have a residual MLP or not. This is a fairly complicated thing.But if you think of it, it is just a transformer. So what they describe here, sorry, the purpose of this GRU here, of course, is that the GRU is a recurrent unit. And you can see right here that they do this multiple times. So once you start with the random slots, right, but then you update the slots and you go, you go again. Okay, so you do this. First of all, you'll have the features, and you'll just have random slots. And then you do a bit of routing. Okay, okay, so now we have a bit of routing. Cool. You update these slots to be the next set of slots. And then you take the same features and route them again. So you you route them again. And this is supposed to be kind of this iterative procedure. You might have seen this in capsule networks. I've done a video on capsule networks, where exactly this type of iterative routing, you always have the same routing functions, right? These functions for value, and key and query are always the same. But you do this iteratively many times in a row. This is like a transformer with weight sharing. It's exactly the same, right? So you have these slots, you initialize them randomly, you do your query times keys, your softmax times the value right here. And this transformer even has this plus this MLP layer right here, right? This, the transformer has that in there. And then you simply do it again. So up here, you have the next transformer layer, but instead of being its own layer, you'll copy the so it's it's weight shared. It's a transformer with weight sharing between the modules, and the inputs, they are also copied up here. This the side inputs. All right, it's otherwise it's the it's the same thing except that these aren't produced by an encoder that is also a transformer, they're actually produced by a CNN. And the weights here are shared. The only difference is that in between here, they also have like this gru this gru thing, but they do an ablation on it. And it's actually not that important. So you could might as well just leave it away. It brings only very few benefits. So this is how I want how I think of this model. This is a multi layer a T layer transformer with weight sharing in for the individual layers where the inputs the input positional encoding are randomly initialized each time. Okay, now they they really stress this random initialization, because this differs from the detr paper in that in the detr paper, these things here are learned. And the detr paper, we have also this kind of object detection thing. And it what will happen when you learn these is that for example, this one right here, might specialize in objects that are sort of on the top left of the image. And this one might specialize in objects that are kind of long and in the middle and so on. And this one might specialize to something else. Now I can't tell you what works better or whatnot. It seems like you can, if I were to implement something like this, I might want to go with the Facebook one and then just have more right here. In this paper, they opt for having fewer, but because they're fewer, if you learn them, they become, I guess, too specialized, and you will need to keep them agnostic. So you don't want to learn them, you simply want to randomly initialize them each time and via via the iterative routing via the weight sharing, they will be sort of assigned correctly. Alright, I hope you could follow this. Yeah, if you if you want to anthropomorphize this, you could think of each of these slots starts out just randomly. And then just by sheer coincidence through this attention mechanism, they happen to be assigned a couple of these features. Now, because we train the model to perform well, because they're already assigned these features in the next layer, they'll basically ask through the query function, they'll ask for more of that, they'll basically say, Oh, I'm now responsible kind of for the gray pixels, give me more of the gray pixels, right? Give me give me more of that. And then in the next layer, even more of that even more of that. And you'll see in the, in the investigations into what happens exactly this type of thing happening. So if we skip ahead to the experiments, where they show what happens through the iterations, you can see this right here. So the attention, the attention maps of these slots, you can see that in after the first step, you can see that, you know, it's slot two right here is assigned kind of these both of these objects slot three is already pretty. So the first step kind of learns to segment a little bit of the image, but not, you know, too well slot for it. Also the attention map here is pretty, pretty wonky. But if you in the next step, and this is kind of crucial. Actually the these slots, they specialize the slot to realize as well, I have a lot of these, these blue pixels, I'm gonna give me more of those, right? Give me more of those. So it gets all the blue pixel while slot four has a lot of these golden pixels says, give me more of that of those golden stuff that's also regionally right next to that. And since these two compete, I'm pretty sure slot two would also ask for more of the golden pixels because it has a lot of golden pixels. But it competes with slot four because of the softmax. So all of the golden pixels are assigned to slot four and not slot two, while all of the blue pixels that slot for surely asks for as well, are assigned to slot two in the next iteration. So I actually consider iteration one is for you take the randomly initialized slots and you kind of assign them stuff. So this is mainly the, this is now mainly the transformer layer learning to segment. But then step two is where the magic really happens is where the slots, they kind of realize what's assigned to them and they ask for more of it. And through the competition, you'll get this separation into objects, right? So the whole thing is trained end to end, which basically means that these functions get really good at doing this kind of segmentation. And then in subsequent iterations, you can just see this effect, multiplying even more and more, right? But I might even you might even be able to think that you might want to separate step one and the subsequent steps, because step one is sort of seems fundamentally different from steps two, three, four, and so on. Because step one is this kind of assignment process, and then the other steps are refinement. So if I were to take this model and make it better, I would try to have a special like not weight sharing between steps, the first step, and the subsequent steps. But what do I know these? Apparently, it works. Okay, you can also look at the reconstruction since their objective is to reconstruct. So basically what each slot outputs, each slot out, if you reconstruct each slot here, these are the different slots, each slot is supposed to output a picture of reconstruction. Now, if we consider that each slot is responsible for an object, you might very well say, okay, this slot here gives me a picture with just the object in it that it's supposed to reconstruct. And then this slot here gives me a picture with just the object that it is supposed to reconstruct. Now, how do you know how to combine these pictures, especially since they might be overlapping and so on. So the way you do it is you actually output four channels. So you output R, G, B, and A. So A being the alpha channel, so each slot also has to decide where the object is that it reconstructs. And so each so this, this here might be okay, everything here is alpha one, and including the shadow, maybe maybe there's a little shadow, and everything else is alpha zero. And then the alpha maps, you combine also via a softmax to ensure that they sum up to one. So you combine the pictures, including their alpha maps. That means you can basically reconstruct from the slots where the where the objects are. Now you'll know you'll notice this is this thing here, you'll notice that they often use for example, here, four different slots, because even though the image has three different objects, why is that? Because you need to reconstruct the entire image. So you need at least one slot for the background, and that's always what you can see right here. So if you have the sorry, the reconstruction, you'll see that slot two with time with iterations it reconstructs this cube slot three reconstructs the ball slot for reconstructs the yellow cylinder and slot one reconstructs the background. Okay, also here, if you see the attention masks, you see that the slot one will be responsible for the background here, the background is significantly darker than in these others, though they do say the background doesn't really tend to go to one slot in particular, it tends to kind of spread out across all the slots. And this might mean more investigation. Yeah, so they have these different tasks right here, for example, to segment these Tetris blocks here, and you can see the segmentations, it works pretty, pretty well. Now why does this work so well? It's probably because of the data sets. So these kinds of data sets, they come, you know, they're produced by a generator and the generator specifically has these these objects right here, and it sort of in it arranges them in an independent fashion, the background is really clean, right, the objects themselves are really clean and geometric and so on. And they're, they're kind of arranged in a random fashion. And then there's a render of that. So this is like super, super duper clean data set. And I guess that has a lot to do with why these methods work so well, because they can just assume okay, an object is generally, you know, spatially something, some geometric shape that I know, it's close together, it's pretty independent from its surrounding, and it's trained with objects that are almost zero correlated, like there's zero correlation between the objects in the training data set. So I wouldn't yet apply this much to to real world problems, but it is an interesting thought right here. So that's the sort of idea behind the paper, I hope you got that they do a lot of experiments. And here is a bit where my quarrels start. So they say that they compare, for example, with the with these in the unsupervised object discovery experiments, they have this data set called clever. And this data set has these images with sort of, I believe, clever six has all up to six different objects. Now this is already one of the things this is not a specifically quarrel with this model. But if your data set has six things, they all they give like, they give seven slots because they know that the data set has at most six things, which means they can always cover all the things now it works when there's less objects. But I think the knowledge of how many objects there's going to be is also a big part of why these models work and why maybe it's not entirely ready yet for the real world. But anyway, they compare to these two baselines. They're called iodine, which also employs kind of a recurrent architecture, but not with an attention mechanism, and Monet, and they say, yada yada yada, this replaces lot of them. No, that's not it. For the Monet iodine DSP and baselines, we compare with the published numbers, as we use the same experimental setup. So they say they use the same experimental setup. And that's why they don't reimplement these models. But they use the published numbers in their respective papers, which is something you can do. This is often, I guess, these machine translation papers, and so on, they do this, just because, you know, it's a lot to run these things. However, here, I'm a bit skeptical first, yes, because it is it is Google. So they do have a lot of resources available to technically run these things. I've seen at least Monet has an implementation by the author, or I've seen one of them the other one also, there is an implementation, and there's eight authors on this particular paper. So I yeah, I, this would be okay. They say as we use the same experimental setup. So in that case, if you have the same setup, it's more okay. But it really depends on you really having the same setup. And this is a bit where it kind of falls. So for example, one example right here is, they say we train the woman using the atom optimizer with a learning rate and 60. So on they use a single GPU. We further make use of learning rate warm up to prevent early saturation of the attention mechanism and an exponential decay, decay schedule in the learning rate, which we found to reduce variance. So I've checked these other models, and none of them talks about learning rate warm up and nowhere in their code is their learning rate warm up. Now, you might you might argue, okay, this is specific to this model, it might need this. But if you look at the results, right here, for example, you see that they don't outperform these other models by too much. So you can see right here, this is on par. This here outperforms this one a little bit. But then also the star here means that they have left out one of the denotes that one outlier was excluded from evaluation, I guess, which is valid if it's a super outlier. But in this case, I would categorize this model as a different way of doing doing things and not necessarily outperforming the others. So this also, if you look at the ablations, the differences here are minuscule. And in these ablations that they show, every single thing they do, like gives them a little bit of a boost, and you just make it kind of across the line to reach state of the art. I'd rather have research move in a direction where we just show cool ideas and that they work and that's what this paper does to to be fair. What I do have more of a problem with a little bit is this here. On Clever 6, we can use a batch size of up to 64 on a single v100 GPU as opposed to four in this iodine baseline, right, compared to iodine, our model is significantly more efficient in terms of both memory consumption and runtime, which is, you know, something I believe. But this characterization that they use a batch size of four, and here in this paper, they can use a size up to 64 on a single v100 GPU. I've read the iodine paper, and the iodine paper says, yes, they do use a batch size of four on one GPU. So they also use one GPU. But they say their GPU has a RAM of 12 gigabytes. And 12 gigabyte RAM GPUs that points to something like Ti, either I guess a 1080 or a 2080 or something like this. This is not a v100. The v100 come in 16, or probably Google has the 32 gigabyte version. So this is a 32 gigabyte GPU that is significantly better than the Ti GPUs. These v100 they cost like five or 10 times more than the Ti GPUs. And to simply say, we have also one GPU and we can run up to a batch size of 64 and they can only run a batch size of four. It seems, I don't know, it seems sort of overstating what you can do now. Maybe I'm wrong. Maybe they have actually tested this other model and concluded also on their GPUs, it can only run to a batch size of four. But I highly doubt it, because in their, here the paper is cited and in their paper, they explicitly name that they use for a batch size of four for their 12 gigabyte GPUs. So yeah, in this, that just kind of pulls through. So there's the, there's the minuscule improvements. And then there's the ablations of all these tricks where everyone just gives you a little bit. And then there is this kind of very, very, very favorable comparison, wordsmithy a bit, which gives a bit of a bitter taste to what I think is actually a very, very cool method. Because why is this method so cool? Because for example, these slots here, they are trained to also absorb the background, right? So you can technically at inference time, increase the number of slots, even though you've trained with just with a few slots, right? You can, you can increase the number of slots, and the model can just handle it and they show it right here in these results. Here you can, this data set has six objects, and this data set has 10 objects. Now the model has only been trained over on six objects, and they can just up the number of slots at inference time, and it'll work also very well. Also they can now up the number of iterations since these are all weight shared these iterations, right, we've looked at it, there's there's weight sharing between the iterations. There is nothing stopping you from just piling on here because it's weight shared, you don't need any more weights, you can just refine this iteration. And since the iteration themselves are refining these attention masks, anyway, you might as well at inference time, refine them some more. They have an ablation where they show that technically, like three, two or three iterations at training time gives them the best result, I guess just because of gradient propagation, because more layers means you have to propagate the gradient back more. But at inference time, you can just up these iterations. And as you can see right here, you get better and better. So this these results are, are pretty cool. They respect the property that sets should be permutation invariant, and, and so on. This routing view of the transformer is pretty cool, even though it's you can look at it as a transformer with weight sharing or an iterative routing protocol, like in capsules. So all of this I find to be very, very cool idea. And I think that's how we should look at this, this paper. So before I am too critical of this paper, I want to say that I really like the idea and the algorithm here, the implementation. Yeah. So that was the paper at last, I actually want to look at the broader impact statement just because I've I've complained about brought the need for broader impact statements. So I just want to kind of go just read them and just like look how how the different companies have the different institutions, how the different people how the community reacts to them, crafts them and so on. So this one I find particularly interesting. Let's go through it. It says the slot detention module allows to learn object centric representation from perceptual input, okay. As such, it is a general module that can be used in a wide range of domains and applications. In our paper, we only consider artificially generated data set under well controlled settings, where slots are expected to specialize to objects. However, the specializations of our model is implicit and fully driven by the downstream task. We remark that as a concrete measure to assess whether the module is specialized in unwanted ways. One can visualize the attention masks to understand how the input features are distributed across the slots. While more work is required to properly address the usefulness of the attention coefficients in explaining the overall predictions of the network, especially if the input features are not human interpretable, we argue that they may serve as a step towards more transparent and interpretable predictions. This is a I mean, it's a fine statement, but it's not a broader impact statement, right? If you followed a bit what the broader impact statement is supposed to be, this is not one. Okay, the closest this comes to a broader impact statement is said, as such, it is a general model that can be used in a wide range of domains and applications, and maybe a little bit that you can visualize the attention masks to understand how the input features are distributed. But the broader impact statement is supposed to give you a preview of how this might affect society at large, while this here just kind of lists properties of the model for the research community and sort of for this, for the application of this model, as, as you know, the introspection of the model itself, this says nothing about society as such. So maybe, you know, maybe that's, I think that the smarter people will turn the broader impact statement into more of an introduction section, because that's something you usually put in a conclusion, or in an introduction, where you say, look, here are some things our model can do. And this is what we might be useful for. And this is how you could introspect it, and so on. And since the broader impact statement, especially at NeurIPS, you were allowed to put the broader impact statement on the main paper, so not in the appendix, but it wouldn't count towards your page limit. It's, I guess, pretty foreseeable that what people are going to start to do is simply put more of their paper into the broader impact section kind of cloaked in the veneer of a broader impact statement. But I this is, this is clearly not what what the broader impact statement was originally supposed to be. Now, I don't know if this is good or bad. I just think these authors are, you know, they're doing, I think, a good thing here by simply telling us actually something useful about the model. But that's just my opinion. I do thank you for being with me here. I know this was a bit ranty, flip flopping back and forth between the different things. We haven't looked at set prediction at all. We've only looked at these kind of masks, but I invite you to go through the paper yourself and check it out. It's pretty cool. And they do describe a lot of things in pretty detail. The appendix is very long and has very many ablations. And this is something I do appreciate. And with that, bye bye and see you next time.
[{"start": 0.0, "end": 5.6000000000000005, "text": " Hi there, today we'll look at Object-Centric Learning with Slot Attention by Francesco"}, {"start": 5.6000000000000005, "end": 11.44, "text": " Locatelli, Thomas Kipf and others of Google Brain, ETH Zurich and MPI."}, {"start": 11.44, "end": 17.36, "text": " On a high level, this paper recognizes scenes of objects from single pixels and it's best"}, {"start": 17.36, "end": 20.52, "text": " I show you a picture of what's going on."}, {"start": 20.52, "end": 26.16, "text": " So you have scenes like this, where there is some sort of an arrangement of objects"}, {"start": 26.16, "end": 31.060000000000002, "text": " and there are multiple tasks you can do here, specifically they consider the task of unsupervised"}, {"start": 31.060000000000002, "end": 36.28, "text": " recognition of objects which they call object discovery and supervised classification of"}, {"start": 36.28, "end": 37.28, "text": " objects."}, {"start": 37.28, "end": 42.96, "text": " The difficulty being that these are sets of objects so there is no ordering to the sets."}, {"start": 42.96, "end": 50.72, "text": " They do this via a thing they call slot attention that basically is a permutation invariant"}, {"start": 50.72, "end": 56.76, "text": " attention mechanism over these objects in both the supervised and unsupervised domain"}, {"start": 56.76, "end": 63.28, "text": " and they do this in a fashion where they iteratively route the attention in order to make the different"}, {"start": 63.28, "end": 68.52, "text": " slots compete for attention over these objects."}, {"start": 68.52, "end": 70.64, "text": " So that's the sort of high level."}, {"start": 70.64, "end": 74.75999999999999, "text": " If you are in this field, you probably know right now what's going on."}, {"start": 74.75999999999999, "end": 77.98, "text": " If you're not, we'll dive into it together."}, {"start": 77.98, "end": 80.24, "text": " So stay tuned."}, {"start": 80.24, "end": 85.32, "text": " If you like content like this, consider sharing it out, leaving a like or tell me what you"}, {"start": 85.32, "end": 86.96, "text": " think about it in the comment."}, {"start": 86.96, "end": 94.17999999999999, "text": " I appreciate any suggestion for making these videos better and so people can learn more"}, {"start": 94.17999999999999, "end": 95.56, "text": " from it."}, {"start": 95.56, "end": 100.94, "text": " Alright, so the problem I've already described the problem a little bit but let's go a bit"}, {"start": 100.94, "end": 102.03999999999999, "text": " deeper here."}, {"start": 102.03999999999999, "end": 106.91999999999999, "text": " You have images like this and the images we're considering are going to be images that have"}, {"start": 106.92, "end": 111.8, "text": " some sort of arrangement of objects or what we humans would call objects."}, {"start": 111.8, "end": 118.38, "text": " In this case, you can see there is this gray square, not sorry, this gray cube right here."}, {"start": 118.38, "end": 124.02000000000001, "text": " There is a smaller green cube and then there is a yellow cylinder."}, {"start": 124.02000000000001, "end": 130.34, "text": " Now in the task of object discovery, what you're supposed to do is you're simply supposed"}, {"start": 130.34, "end": 137.34, "text": " to say that there is an object right here, there is an object about here, and there is"}, {"start": 137.34, "end": 139.68, "text": " an object here, right?"}, {"start": 139.68, "end": 145.7, "text": " So basically, you're supposed to point to the pixels where there are objects and you're"}, {"start": 145.7, "end": 148.76, "text": " supposed to segment the objects from each other."}, {"start": 148.76, "end": 154.28, "text": " You can see right here that this model, we don't know how it works yet, but it separates"}, {"start": 154.28, "end": 162.42000000000002, "text": " the left cube here, the bottom cube here, and the top right cylinder right here."}, {"start": 162.42000000000002, "end": 169.96, "text": " In the task of set prediction, you're supposed to say what objects there are."}, {"start": 169.96, "end": 175.48, "text": " So you're supposed to say there is a gray cube right here, a green cube right here,"}, {"start": 175.48, "end": 178.92000000000002, "text": " and there is a yellow cylinder right there."}, {"start": 178.92000000000002, "end": 182.76, "text": " Actually, you don't have to say where they are, I guess."}, {"start": 182.76, "end": 185.6, "text": " There are many different variants of this task."}, {"start": 185.6, "end": 192.23999999999998, "text": " But mainly, you're supposed to classify them, meaning you have to say there is a gray cube"}, {"start": 192.23999999999998, "end": 193.23999999999998, "text": " there."}, {"start": 193.23999999999998, "end": 197.88, "text": " I believe in this case, it's with coordinates, but you can do it without the difficulty here,"}, {"start": 197.88, "end": 200.14, "text": " of course, being that these are sets."}, {"start": 200.14, "end": 202.57999999999998, "text": " So there is no natural order in it."}, {"start": 202.57999999999998, "end": 207.57999999999998, "text": " So if you say there is a green cube and a yellow cylinder, it's going to be the same"}, {"start": 207.57999999999998, "end": 212.6, "text": " as there is a yellow cylinder and a green cube."}, {"start": 212.6, "end": 219.28, "text": " So you have to build an architecture that is somehow invariant with respect to the labels."}, {"start": 219.28, "end": 224.0, "text": " And we've seen a lot of the concepts in this video in this paper before."}, {"start": 224.0, "end": 230.74, "text": " This video is sort of a a kind of a mash together of different concepts of other places."}, {"start": 230.74, "end": 237.92, "text": " So what you'll see is, for example, this property of the fact that here you see are the labels"}, {"start": 237.92, "end": 238.95999999999998, "text": " for these objects."}, {"start": 238.95999999999998, "end": 241.54, "text": " This could be there is a green cube."}, {"start": 241.54, "end": 243.67999999999998, "text": " There is a gray cube."}, {"start": 243.67999999999998, "end": 249.76, "text": " And you'll have to come up with an architecture that if here you predict that green cube,"}, {"start": 249.76, "end": 255.95999999999998, "text": " you consider it correct, even though the corresponding label isn't the one for the green cube."}, {"start": 255.95999999999998, "end": 261.03999999999996, "text": " And we saw this, for example, in this DETR architecture by Facebook, where they use a"}, {"start": 261.03999999999996, "end": 263.48, "text": " matching loss, but we'll get into that."}, {"start": 263.48, "end": 268.6, "text": " Okay, so these are the tasks, the tasks are object discovery and set prediction."}, {"start": 268.6, "end": 277.0, "text": " So how does this paper deal with this, they use this thing called a slot attention module."}, {"start": 277.0, "end": 281.94, "text": " Now the slot attention module is in essence, it's pretty simple."}, {"start": 281.94, "end": 289.48, "text": " What it does is it has these different slots right here, as you can see, and it divides"}, {"start": 289.48, "end": 291.68, "text": " the input into features."}, {"start": 291.68, "end": 296.48, "text": " So you can see there is a CNN encoder because we're working with pixels, it's natural that"}, {"start": 296.48, "end": 299.32, "text": " we want to encode these into a CNN."}, {"start": 299.32, "end": 306.98, "text": " The CNN will probably downsample the image a bit and divide subdivided into this grid"}, {"start": 306.98, "end": 308.0, "text": " right here."}, {"start": 308.0, "end": 312.98, "text": " So you have a fairly coarse grid, the grid is actually not a bit finer than you see here."}, {"start": 312.98, "end": 315.8, "text": " This is just for example."}, {"start": 315.8, "end": 319.32, "text": " But you'll have ultimately a number of features."}, {"start": 319.32, "end": 324.36, "text": " So each pixel right here is going to be a feature, each feature will have not only this"}, {"start": 324.36, "end": 329.96000000000004, "text": " one channel as you see here, but many, many channels of information down here."}, {"start": 329.96000000000004, "end": 337.14, "text": " So the CNN will encode each of these regions in the picture into a feature vector."}, {"start": 337.14, "end": 340.0, "text": " And then you have these slots."}, {"start": 340.0, "end": 346.24, "text": " So what you'll want to do, we maybe look at this, so you'll have the features right here."}, {"start": 346.24, "end": 349.12, "text": " These are your features."}, {"start": 349.12, "end": 355.48, "text": " And you'll have the slots and the slots, let's say there are fewer slots than features to"}, {"start": 355.48, "end": 363.0, "text": " three, three slots, four slots, as in this case, four slots."}, {"start": 363.0, "end": 368.34000000000003, "text": " What you'll want to do is you'll want to assign the features to the slots."}, {"start": 368.34000000000003, "end": 374.16, "text": " So you maybe say, okay, this feature right here, and this feature right here, they go"}, {"start": 374.16, "end": 380.72, "text": " to this slot, and then these two features go to this slot, and this these two go to"}, {"start": 380.72, "end": 383.28000000000003, "text": " this, and that feature goes to that."}, {"start": 383.28000000000003, "end": 388.96000000000004, "text": " And that's equivalent to basically subdividing the picture into these slots."}, {"start": 388.96000000000004, "end": 392.98, "text": " Ultimately your goal is going to be to say that these features right here, these pixels"}, {"start": 392.98, "end": 397.92, "text": " right here, are going maybe into that slot."}, {"start": 397.92, "end": 402.32000000000005, "text": " And then these ones right here are going into that slot."}, {"start": 402.32, "end": 407.2, "text": " And these ones here going into that slot, and the rest, so all of their background is"}, {"start": 407.2, "end": 408.59999999999997, "text": " going into that one."}, {"start": 408.59999999999997, "end": 413.12, "text": " You can see that if you have a system like this, if you can train it correctly, then"}, {"start": 413.12, "end": 418.56, "text": " it becomes pretty easy to so it becomes super easy to classify it right here, because you"}, {"start": 418.56, "end": 422.71999999999997, "text": " can just take each slot and independently classify it, right?"}, {"start": 422.71999999999997, "end": 427.6, "text": " Because you already know, you already have assigned all the pixels where the object appears"}, {"start": 427.6, "end": 434.66, "text": " into that slot, you can just super easily predict a class from it."}, {"start": 434.66, "end": 436.04, "text": " So we're almost at the end."}, {"start": 436.04, "end": 441.24, "text": " So you now predict for each slot a class or a description of the object, whatever you"}, {"start": 441.24, "end": 442.76000000000005, "text": " want to predict."}, {"start": 442.76000000000005, "end": 449.40000000000003, "text": " And this is the exact same thing as in this Facebook paper now, where for each for each"}, {"start": 449.40000000000003, "end": 452.8, "text": " of these slots, we've predicted a bounding box."}, {"start": 452.8, "end": 456.96000000000004, "text": " The question is, how do you assign this to the labels?"}, {"start": 456.96, "end": 465.35999999999996, "text": " And that's pretty easy that there's this thing called the Hungarian matching that basically"}, {"start": 465.35999999999996, "end": 469.68, "text": " what you're saying is you want to be as forthcoming as possible, right?"}, {"start": 469.68, "end": 475.29999999999995, "text": " So if you predict a gray cube somewhere, and there is a gray cube somewhere here, you want"}, {"start": 475.29999999999995, "end": 479.47999999999996, "text": " to match them, you'll say, Okay, I'm going to give you the benefit of the doubt."}, {"start": 479.47999999999996, "end": 485.41999999999996, "text": " And I'm going to do your model, I'm going to assume with the gray cube, you meant that"}, {"start": 485.42, "end": 487.8, "text": " gray cube right here."}, {"start": 487.8, "end": 494.12, "text": " And if there is the yellow rectangle, and yellow rectangle somewhere over there, you"}, {"start": 494.12, "end": 497.78000000000003, "text": " don't incur any penalty as long as you predict the correct things."}, {"start": 497.78000000000003, "end": 506.0, "text": " Now only whenever you predict like a second yellow rectangle, so both of these slots now,"}, {"start": 506.0, "end": 510.68, "text": " so this slot and this slot for some reason, they predict a yellow rectangle, this one"}, {"start": 510.68, "end": 515.62, "text": " correctly, and this one was assigned this object, and it incorrectly predicts a yellow"}, {"start": 515.62, "end": 518.6, "text": " rectangle, sorry, other way around."}, {"start": 518.6, "end": 522.72, "text": " This one incorrectly predicts a yellow rectangle where there's no second yellow rectangle in"}, {"start": 522.72, "end": 529.92, "text": " our label set, there's only this, maybe this green cube, then this will be a mistake because"}, {"start": 529.92, "end": 534.32, "text": " it can't be matched, it will be matched to the one where it has the least loss, but it"}, {"start": 534.32, "end": 537.44, "text": " will be matched to something that's not a yellow rectangle."}, {"start": 537.44, "end": 539.92, "text": " And therefore, that's going to be a mistake."}, {"start": 539.92, "end": 544.0799999999999, "text": " So this is how you calculate the loss function with this matching algorithm."}, {"start": 544.0799999999999, "end": 549.4799999999999, "text": " And you can calculate that matching in a deterministic fashion, so you can back propagate through"}, {"start": 549.4799999999999, "end": 550.76, "text": " it."}, {"start": 550.76, "end": 558.04, "text": " So you can see, if this slot assignment works, we'll have a pretty easy time then calculating"}, {"start": 558.04, "end": 564.06, "text": " the classes coming up with a loss, the same for the unsupervised object discovery."}, {"start": 564.06, "end": 568.8399999999999, "text": " What we'll do is we'll run these things through this slot decoder."}, {"start": 568.84, "end": 574.48, "text": " Now this slot decoder is very similar to an generator in GANs."}, {"start": 574.48, "end": 578.44, "text": " For example, it takes a hidden representation as input."}, {"start": 578.44, "end": 584.6, "text": " Now the hidden representation here is going to be these, these slots, and it's going to"}, {"start": 584.6, "end": 587.5, "text": " up sample it into an image."}, {"start": 587.5, "end": 594.2800000000001, "text": " If we train the whole if if we have a good slot assignment mechanism, we can pretty easily"}, {"start": 594.2800000000001, "end": 598.32, "text": " train a decoder like this, right with any method you want."}, {"start": 598.32, "end": 603.7600000000001, "text": " In this case, I believe they use some yeah, some sort of up sampling up convolution architecture"}, {"start": 603.7600000000001, "end": 604.96, "text": " right here."}, {"start": 604.96, "end": 614.44, "text": " And they use the L2, they minimize the reconstruction error between the end the output image and"}, {"start": 614.44, "end": 615.98, "text": " the input image."}, {"start": 615.98, "end": 623.1600000000001, "text": " So it's sort of like a variational auto encoder or just auto encoder objective in this case."}, {"start": 623.16, "end": 630.1999999999999, "text": " Alright, so we know how to encode a picture into hidden representation using a standard"}, {"start": 630.1999999999999, "end": 632.16, "text": " convolutional neural network."}, {"start": 632.16, "end": 638.36, "text": " And we know once our slot attention mechanism works, we pretty much know how to go from"}, {"start": 638.36, "end": 639.36, "text": " there."}, {"start": 639.36, "end": 642.54, "text": " So the question is, what is this slot attention mechanism?"}, {"start": 642.54, "end": 649.56, "text": " Now what we're supposed to do is we're supposed to again assign each one of the features into"}, {"start": 649.56, "end": 652.18, "text": " a slot and in a very specific fashion."}, {"start": 652.18, "end": 657.76, "text": " So if you think about the pixels right here, there can be multiple of these pixels or multiple"}, {"start": 657.76, "end": 662.04, "text": " of the regions, multiple features can be assigned to one slot."}, {"start": 662.04, "end": 669.92, "text": " But we'd rather not have the same feature assigned to multiple slots."}, {"start": 669.92, "end": 679.4799999999999, "text": " So each slot takes in many features, but the features should be this divided between the"}, {"start": 679.48, "end": 682.44, "text": " slots such that only one slot attends to a feature."}, {"start": 682.44, "end": 686.32, "text": " And by me saying attend, you probably already know where this is going."}, {"start": 686.32, "end": 693.88, "text": " So if you have the features, and you consider the slots, right, and we just look at a single"}, {"start": 693.88, "end": 700.5600000000001, "text": " feature for now, what we'll do is we'll have an attention mechanism from the slots going"}, {"start": 700.5600000000001, "end": 702.2, "text": " into the features."}, {"start": 702.2, "end": 706.6, "text": " So if you don't know what an attention mechanism is, I have this video called attention is"}, {"start": 706.6, "end": 708.76, "text": " all you need, where I explain this."}, {"start": 708.76, "end": 715.2, "text": " But briefly, the features, they will emit something that's called a key, which is a"}, {"start": 715.2, "end": 722.04, "text": " vector, and then the slots will emit a query, which are also vectors."}, {"start": 722.04, "end": 730.6, "text": " And the sir, the the information is now routed by agreement of key and query."}, {"start": 730.6, "end": 735.76, "text": " In this case, this thing, this this feature right here would be routed to this slot."}, {"start": 735.76, "end": 741.28, "text": " Now, it would be routed to both slots, but it wouldn't be routed as much to the bottom"}, {"start": 741.28, "end": 742.28, "text": " slot."}, {"start": 742.28, "end": 747.52, "text": " And we make sure that this happens by using a softmax assignment."}, {"start": 747.52, "end": 753.0, "text": " So if this is like nine, and this is four, what we'll do is a softmax assignment such"}, {"start": 753.0, "end": 759.52, "text": " that after that, so we have a proper distribution, which would be something like after the softmax"}, {"start": 759.52, "end": 763.48, "text": " be something like 0.9 and 0.1 right here."}, {"start": 763.48, "end": 769.22, "text": " So you can see that the attention is fairly hard."}, {"start": 769.22, "end": 773.8000000000001, "text": " So this is basically it's a differentiable way to assign these things."}, {"start": 773.8000000000001, "end": 780.8000000000001, "text": " Okay, so an attention mechanism fulfills the property that we want to basically assign"}, {"start": 780.8000000000001, "end": 786.0, "text": " features to the slots in a way that the slots compete for the features."}, {"start": 786.0, "end": 793.44, "text": " As you can see right here, if this slot here matches the feature the best, it come it out"}, {"start": 793.44, "end": 798.6, "text": " competes the other slot because at the end, this has to be normalized to one because of"}, {"start": 798.6, "end": 799.9, "text": " the softmax."}, {"start": 799.9, "end": 806.62, "text": " So this competition is the heart of the slot attention mechanism."}, {"start": 806.62, "end": 812.48, "text": " And this is this is how it works."}, {"start": 812.48, "end": 817.0, "text": " So this is the slot attention module, as you can see."}, {"start": 817.0, "end": 820.96, "text": " So you'll take your inputs, and they have lots of layer norms in here, but disregard"}, {"start": 820.96, "end": 823.28, "text": " the layer norms."}, {"start": 823.28, "end": 829.0, "text": " So what you'll do is you'll calculate the agreement between the inputs and the slots."}, {"start": 829.0, "end": 836.9, "text": " Now you might wonder in a standard attention mechanism, you'll have input signal coming"}, {"start": 836.9, "end": 840.24, "text": " from here, which is like maybe these are the input signals."}, {"start": 840.24, "end": 847.44, "text": " And then you construct the keys and the queries for the next layer, you construct all from"}, {"start": 847.44, "end": 849.64, "text": " that input signal, right?"}, {"start": 849.64, "end": 854.92, "text": " And also the values, by the way, you construct everything from that input signal."}, {"start": 854.92, "end": 861.26, "text": " But in this case, we'll have many features and we'll only have a fixed amount of slots"}, {"start": 861.26, "end": 862.26, "text": " right here."}, {"start": 862.26, "end": 864.24, "text": " So where do these slots come from?"}, {"start": 864.24, "end": 867.74, "text": " Where do the the signal for the keys come from?"}, {"start": 867.74, "end": 872.08, "text": " In the Facebook DETR paper, we saw that these are learned embeddings."}, {"start": 872.08, "end": 878.6, "text": " However, in this case, right here, these are not learned, the slots are initialized randomly."}, {"start": 878.6, "end": 883.54, "text": " So at the beginning of each thing, the slots are initialized randomly."}, {"start": 883.54, "end": 889.0, "text": " You can think of this as an attention mechanism, where you have the attention module right"}, {"start": 889.0, "end": 890.16, "text": " here."}, {"start": 890.16, "end": 895.6, "text": " And then at the beginning, you simply have randomly initialized positional embedding"}, {"start": 895.6, "end": 898.28, "text": " or randomly initialized slots."}, {"start": 898.28, "end": 905.9200000000001, "text": " And then the image is going to be encoded through a CNN right here, giving you a bunch"}, {"start": 905.9200000000001, "end": 908.62, "text": " of these features."}, {"start": 908.62, "end": 913.52, "text": " And then you'll have cross attention between these features and the slots."}, {"start": 913.52, "end": 917.28, "text": " And that will give you the next layer right here."}, {"start": 917.28, "end": 919.08, "text": " Okay."}, {"start": 919.08, "end": 928.6, "text": " All right, so you want to calculate the routing between the inputs and the slots."}, {"start": 928.6, "end": 933.7800000000001, "text": " And then you want to perform a softmax over the slots, which will give you this competitive"}, {"start": 933.7800000000001, "end": 934.98, "text": " nature between the slots."}, {"start": 934.98, "end": 940.5, "text": " So all the slots are going to compete for the to be routed for the features to be routed"}, {"start": 940.5, "end": 942.5400000000001, "text": " to them."}, {"start": 942.5400000000001, "end": 946.5200000000001, "text": " And then this is simply the second part of the attention mechanism."}, {"start": 946.52, "end": 949.6, "text": " So you will have a weighted mean."}, {"start": 949.6, "end": 953.88, "text": " Now this is a slightly different from an attention mechanism, because in a real attention mechanism,"}, {"start": 953.88, "end": 958.8199999999999, "text": " you'll have a weighted sum right here, here you will have a weighted mean, but it's basically"}, {"start": 958.8199999999999, "end": 964.02, "text": " such that you can have a different amount of slots and the kind of values will stay"}, {"start": 964.02, "end": 966.0, "text": " the same."}, {"start": 966.0, "end": 967.5, "text": " That's why you do the mean."}, {"start": 967.5, "end": 973.18, "text": " So you weight them up and the values are simply a function of the inputs."}, {"start": 973.18, "end": 980.38, "text": " This is like in a standard attention mechanism, then what you'll do, you can see that this"}, {"start": 980.38, "end": 981.7199999999999, "text": " is now called updates."}, {"start": 981.7199999999999, "end": 986.0799999999999, "text": " Okay, so you start with the slots randomly."}, {"start": 986.0799999999999, "end": 991.6999999999999, "text": " And then you use the slots to route the information."}, {"start": 991.6999999999999, "end": 998.76, "text": " You take the inputs, and you use that information routing to calculate the updates."}, {"start": 998.76, "end": 1006.4399999999999, "text": " Now you put the updates through a GRU with the state being the previous slots."}, {"start": 1006.4399999999999, "end": 1015.36, "text": " And then you add that to the slots, either this says optional residual MLP."}, {"start": 1015.36, "end": 1020.86, "text": " So what you can do is you will have a residual MLP or not."}, {"start": 1020.86, "end": 1032.64, "text": " This is a fairly complicated thing.But if you think of it, it is just a transformer."}, {"start": 1032.64, "end": 1038.92, "text": " So what they describe here, sorry, the purpose of this GRU here, of course, is that the GRU"}, {"start": 1038.92, "end": 1040.58, "text": " is a recurrent unit."}, {"start": 1040.58, "end": 1044.34, "text": " And you can see right here that they do this multiple times."}, {"start": 1044.34, "end": 1051.84, "text": " So once you start with the random slots, right, but then you update the slots and you go,"}, {"start": 1051.84, "end": 1053.28, "text": " you go again."}, {"start": 1053.28, "end": 1055.8, "text": " Okay, so you do this."}, {"start": 1055.8, "end": 1060.5, "text": " First of all, you'll have the features, and you'll just have random slots."}, {"start": 1060.5, "end": 1062.3999999999999, "text": " And then you do a bit of routing."}, {"start": 1062.3999999999999, "end": 1065.52, "text": " Okay, okay, so now we have a bit of routing."}, {"start": 1065.52, "end": 1066.52, "text": " Cool."}, {"start": 1066.52, "end": 1072.9199999999998, "text": " You update these slots to be the next set of slots."}, {"start": 1072.92, "end": 1078.44, "text": " And then you take the same features and route them again."}, {"start": 1078.44, "end": 1080.0600000000002, "text": " So you you route them again."}, {"start": 1080.0600000000002, "end": 1083.44, "text": " And this is supposed to be kind of this iterative procedure."}, {"start": 1083.44, "end": 1085.4, "text": " You might have seen this in capsule networks."}, {"start": 1085.4, "end": 1090.16, "text": " I've done a video on capsule networks, where exactly this type of iterative routing, you"}, {"start": 1090.16, "end": 1092.48, "text": " always have the same routing functions, right?"}, {"start": 1092.48, "end": 1100.68, "text": " These functions for value, and key and query are always the same."}, {"start": 1100.68, "end": 1104.5800000000002, "text": " But you do this iteratively many times in a row."}, {"start": 1104.5800000000002, "end": 1108.54, "text": " This is like a transformer with weight sharing."}, {"start": 1108.54, "end": 1110.28, "text": " It's exactly the same, right?"}, {"start": 1110.28, "end": 1118.64, "text": " So you have these slots, you initialize them randomly, you do your query times keys, your"}, {"start": 1118.64, "end": 1122.9, "text": " softmax times the value right here."}, {"start": 1122.9, "end": 1127.52, "text": " And this transformer even has this plus this MLP layer right here, right?"}, {"start": 1127.52, "end": 1131.56, "text": " This, the transformer has that in there."}, {"start": 1131.56, "end": 1135.04, "text": " And then you simply do it again."}, {"start": 1135.04, "end": 1141.24, "text": " So up here, you have the next transformer layer, but instead of being its own layer,"}, {"start": 1141.24, "end": 1145.16, "text": " you'll copy the so it's it's weight shared."}, {"start": 1145.16, "end": 1151.68, "text": " It's a transformer with weight sharing between the modules, and the inputs, they are also"}, {"start": 1151.68, "end": 1153.72, "text": " copied up here."}, {"start": 1153.72, "end": 1155.96, "text": " This the side inputs."}, {"start": 1155.96, "end": 1161.88, "text": " All right, it's otherwise it's the it's the same thing except that these aren't produced"}, {"start": 1161.88, "end": 1166.88, "text": " by an encoder that is also a transformer, they're actually produced by a CNN."}, {"start": 1166.88, "end": 1168.96, "text": " And the weights here are shared."}, {"start": 1168.96, "end": 1175.7, "text": " The only difference is that in between here, they also have like this gru this gru thing,"}, {"start": 1175.7, "end": 1177.16, "text": " but they do an ablation on it."}, {"start": 1177.16, "end": 1179.22, "text": " And it's actually not that important."}, {"start": 1179.22, "end": 1182.32, "text": " So you could might as well just leave it away."}, {"start": 1182.32, "end": 1186.74, "text": " It brings only very few benefits."}, {"start": 1186.74, "end": 1189.96, "text": " So this is how I want how I think of this model."}, {"start": 1189.96, "end": 1197.72, "text": " This is a multi layer a T layer transformer with weight sharing in for the individual"}, {"start": 1197.72, "end": 1207.56, "text": " layers where the inputs the input positional encoding are randomly initialized each time."}, {"start": 1207.56, "end": 1214.04, "text": " Okay, now they they really stress this random initialization, because this differs from"}, {"start": 1214.04, "end": 1219.08, "text": " the detr paper in that in the detr paper, these things here are learned."}, {"start": 1219.08, "end": 1223.28, "text": " And the detr paper, we have also this kind of object detection thing."}, {"start": 1223.28, "end": 1228.8799999999999, "text": " And it what will happen when you learn these is that for example, this one right here,"}, {"start": 1228.8799999999999, "end": 1234.52, "text": " might specialize in objects that are sort of on the top left of the image."}, {"start": 1234.52, "end": 1238.72, "text": " And this one might specialize in objects that are kind of long and in the middle and so"}, {"start": 1238.72, "end": 1239.72, "text": " on."}, {"start": 1239.72, "end": 1241.82, "text": " And this one might specialize to something else."}, {"start": 1241.82, "end": 1245.56, "text": " Now I can't tell you what works better or whatnot."}, {"start": 1245.56, "end": 1251.36, "text": " It seems like you can, if I were to implement something like this, I might want to go with"}, {"start": 1251.36, "end": 1255.34, "text": " the Facebook one and then just have more right here."}, {"start": 1255.34, "end": 1260.6399999999999, "text": " In this paper, they opt for having fewer, but because they're fewer, if you learn them,"}, {"start": 1260.64, "end": 1266.2800000000002, "text": " they become, I guess, too specialized, and you will need to keep them agnostic."}, {"start": 1266.2800000000002, "end": 1270.76, "text": " So you don't want to learn them, you simply want to randomly initialize them each time"}, {"start": 1270.76, "end": 1277.8400000000001, "text": " and via via the iterative routing via the weight sharing, they will be sort of assigned"}, {"start": 1277.8400000000001, "end": 1279.8400000000001, "text": " correctly."}, {"start": 1279.8400000000001, "end": 1285.5600000000002, "text": " Alright, I hope you could follow this."}, {"start": 1285.56, "end": 1291.3999999999999, "text": " Yeah, if you if you want to anthropomorphize this, you could think of each of these slots"}, {"start": 1291.3999999999999, "end": 1293.56, "text": " starts out just randomly."}, {"start": 1293.56, "end": 1298.32, "text": " And then just by sheer coincidence through this attention mechanism, they happen to be"}, {"start": 1298.32, "end": 1300.9199999999998, "text": " assigned a couple of these features."}, {"start": 1300.9199999999998, "end": 1305.56, "text": " Now, because we train the model to perform well, because they're already assigned these"}, {"start": 1305.56, "end": 1309.6399999999999, "text": " features in the next layer, they'll basically ask through the query function, they'll ask"}, {"start": 1309.6399999999999, "end": 1315.36, "text": " for more of that, they'll basically say, Oh, I'm now responsible kind of for the gray pixels,"}, {"start": 1315.36, "end": 1317.2199999999998, "text": " give me more of the gray pixels, right?"}, {"start": 1317.2199999999998, "end": 1318.8799999999999, "text": " Give me give me more of that."}, {"start": 1318.8799999999999, "end": 1321.8, "text": " And then in the next layer, even more of that even more of that."}, {"start": 1321.8, "end": 1328.36, "text": " And you'll see in the, in the investigations into what happens exactly this type of thing"}, {"start": 1328.36, "end": 1329.36, "text": " happening."}, {"start": 1329.36, "end": 1335.6, "text": " So if we skip ahead to the experiments, where they show what happens through the iterations,"}, {"start": 1335.6, "end": 1337.3799999999999, "text": " you can see this right here."}, {"start": 1337.3799999999999, "end": 1344.9199999999998, "text": " So the attention, the attention maps of these slots, you can see that in after the first"}, {"start": 1344.92, "end": 1351.6000000000001, "text": " step, you can see that, you know, it's slot two right here is assigned kind of these both"}, {"start": 1351.6000000000001, "end": 1354.38, "text": " of these objects slot three is already pretty."}, {"start": 1354.38, "end": 1360.0800000000002, "text": " So the first step kind of learns to segment a little bit of the image, but not, you know,"}, {"start": 1360.0800000000002, "end": 1361.46, "text": " too well slot for it."}, {"start": 1361.46, "end": 1366.1000000000001, "text": " Also the attention map here is pretty, pretty wonky."}, {"start": 1366.1000000000001, "end": 1372.3000000000002, "text": " But if you in the next step, and this is kind of crucial."}, {"start": 1372.3, "end": 1377.08, "text": " Actually the these slots, they specialize the slot to realize as well, I have a lot"}, {"start": 1377.08, "end": 1380.82, "text": " of these, these blue pixels, I'm gonna give me more of those, right?"}, {"start": 1380.82, "end": 1381.82, "text": " Give me more of those."}, {"start": 1381.82, "end": 1386.6599999999999, "text": " So it gets all the blue pixel while slot four has a lot of these golden pixels says, give"}, {"start": 1386.6599999999999, "end": 1391.8, "text": " me more of that of those golden stuff that's also regionally right next to that."}, {"start": 1391.8, "end": 1396.68, "text": " And since these two compete, I'm pretty sure slot two would also ask for more of the golden"}, {"start": 1396.68, "end": 1399.8, "text": " pixels because it has a lot of golden pixels."}, {"start": 1399.8, "end": 1403.56, "text": " But it competes with slot four because of the softmax."}, {"start": 1403.56, "end": 1408.56, "text": " So all of the golden pixels are assigned to slot four and not slot two, while all of the"}, {"start": 1408.56, "end": 1415.0, "text": " blue pixels that slot for surely asks for as well, are assigned to slot two in the next"}, {"start": 1415.0, "end": 1416.0, "text": " iteration."}, {"start": 1416.0, "end": 1422.9199999999998, "text": " So I actually consider iteration one is for you take the randomly initialized slots and"}, {"start": 1422.9199999999998, "end": 1426.1599999999999, "text": " you kind of assign them stuff."}, {"start": 1426.16, "end": 1432.4, "text": " So this is mainly the, this is now mainly the transformer layer learning to segment."}, {"start": 1432.4, "end": 1439.5400000000002, "text": " But then step two is where the magic really happens is where the slots, they kind of realize"}, {"start": 1439.5400000000002, "end": 1442.66, "text": " what's assigned to them and they ask for more of it."}, {"start": 1442.66, "end": 1448.3200000000002, "text": " And through the competition, you'll get this separation into objects, right?"}, {"start": 1448.3200000000002, "end": 1452.48, "text": " So the whole thing is trained end to end, which basically means that these functions"}, {"start": 1452.48, "end": 1456.56, "text": " get really good at doing this kind of segmentation."}, {"start": 1456.56, "end": 1461.8, "text": " And then in subsequent iterations, you can just see this effect, multiplying even more"}, {"start": 1461.8, "end": 1464.16, "text": " and more, right?"}, {"start": 1464.16, "end": 1469.7, "text": " But I might even you might even be able to think that you might want to separate step"}, {"start": 1469.7, "end": 1475.2, "text": " one and the subsequent steps, because step one is sort of seems fundamentally different"}, {"start": 1475.2, "end": 1478.6, "text": " from steps two, three, four, and so on."}, {"start": 1478.6, "end": 1483.4399999999998, "text": " Because step one is this kind of assignment process, and then the other steps are refinement."}, {"start": 1483.4399999999998, "end": 1490.52, "text": " So if I were to take this model and make it better, I would try to have a special like"}, {"start": 1490.52, "end": 1497.4399999999998, "text": " not weight sharing between steps, the first step, and the subsequent steps."}, {"start": 1497.4399999999998, "end": 1499.4399999999998, "text": " But what do I know these?"}, {"start": 1499.4399999999998, "end": 1500.6399999999999, "text": " Apparently, it works."}, {"start": 1500.6399999999999, "end": 1506.8799999999999, "text": " Okay, you can also look at the reconstruction since their objective is to reconstruct."}, {"start": 1506.88, "end": 1514.3200000000002, "text": " So basically what each slot outputs, each slot out, if you reconstruct each slot here,"}, {"start": 1514.3200000000002, "end": 1519.6000000000001, "text": " these are the different slots, each slot is supposed to output a picture of reconstruction."}, {"start": 1519.6000000000001, "end": 1525.72, "text": " Now, if we consider that each slot is responsible for an object, you might very well say, okay,"}, {"start": 1525.72, "end": 1531.8000000000002, "text": " this slot here gives me a picture with just the object in it that it's supposed to reconstruct."}, {"start": 1531.8000000000002, "end": 1536.0400000000002, "text": " And then this slot here gives me a picture with just the object that it is supposed to"}, {"start": 1536.04, "end": 1537.04, "text": " reconstruct."}, {"start": 1537.04, "end": 1542.68, "text": " Now, how do you know how to combine these pictures, especially since they might be overlapping"}, {"start": 1542.68, "end": 1545.06, "text": " and so on."}, {"start": 1545.06, "end": 1548.8799999999999, "text": " So the way you do it is you actually output four channels."}, {"start": 1548.8799999999999, "end": 1557.3999999999999, "text": " So you output R, G, B, and A. So A being the alpha channel, so each slot also has to decide"}, {"start": 1557.3999999999999, "end": 1560.8799999999999, "text": " where the object is that it reconstructs."}, {"start": 1560.88, "end": 1570.5, "text": " And so each so this, this here might be okay, everything here is alpha one, and including"}, {"start": 1570.5, "end": 1577.5200000000002, "text": " the shadow, maybe maybe there's a little shadow, and everything else is alpha zero."}, {"start": 1577.5200000000002, "end": 1582.48, "text": " And then the alpha maps, you combine also via a softmax to ensure that they sum up to"}, {"start": 1582.48, "end": 1583.48, "text": " one."}, {"start": 1583.48, "end": 1587.5200000000002, "text": " So you combine the pictures, including their alpha maps."}, {"start": 1587.52, "end": 1596.92, "text": " That means you can basically reconstruct from the slots where the where the objects are."}, {"start": 1596.92, "end": 1601.76, "text": " Now you'll know you'll notice this is this thing here, you'll notice that they often"}, {"start": 1601.76, "end": 1607.52, "text": " use for example, here, four different slots, because even though the image has three different"}, {"start": 1607.52, "end": 1609.52, "text": " objects, why is that?"}, {"start": 1609.52, "end": 1613.0, "text": " Because you need to reconstruct the entire image."}, {"start": 1613.0, "end": 1619.9, "text": " So you need at least one slot for the background, and that's always what you can see right here."}, {"start": 1619.9, "end": 1627.2, "text": " So if you have the sorry, the reconstruction, you'll see that slot two with time with iterations"}, {"start": 1627.2, "end": 1632.76, "text": " it reconstructs this cube slot three reconstructs the ball slot for reconstructs the yellow"}, {"start": 1632.76, "end": 1637.8, "text": " cylinder and slot one reconstructs the background."}, {"start": 1637.8, "end": 1648.6399999999999, "text": " Okay, also here, if you see the attention masks, you see that the slot one will be responsible"}, {"start": 1648.6399999999999, "end": 1652.96, "text": " for the background here, the background is significantly darker than in these others,"}, {"start": 1652.96, "end": 1657.84, "text": " though they do say the background doesn't really tend to go to one slot in particular,"}, {"start": 1657.84, "end": 1661.04, "text": " it tends to kind of spread out across all the slots."}, {"start": 1661.04, "end": 1664.28, "text": " And this might mean more investigation."}, {"start": 1664.28, "end": 1670.72, "text": " Yeah, so they have these different tasks right here, for example, to segment these Tetris"}, {"start": 1670.72, "end": 1677.36, "text": " blocks here, and you can see the segmentations, it works pretty, pretty well."}, {"start": 1677.36, "end": 1680.76, "text": " Now why does this work so well?"}, {"start": 1680.76, "end": 1683.44, "text": " It's probably because of the data sets."}, {"start": 1683.44, "end": 1688.8, "text": " So these kinds of data sets, they come, you know, they're produced by a generator and"}, {"start": 1688.8, "end": 1695.28, "text": " the generator specifically has these these objects right here, and it sort of in it arranges"}, {"start": 1695.28, "end": 1700.3, "text": " them in an independent fashion, the background is really clean, right, the objects themselves"}, {"start": 1700.3, "end": 1703.12, "text": " are really clean and geometric and so on."}, {"start": 1703.12, "end": 1706.8, "text": " And they're, they're kind of arranged in a random fashion."}, {"start": 1706.8, "end": 1709.72, "text": " And then there's a render of that."}, {"start": 1709.72, "end": 1713.04, "text": " So this is like super, super duper clean data set."}, {"start": 1713.04, "end": 1718.92, "text": " And I guess that has a lot to do with why these methods work so well, because they can"}, {"start": 1718.92, "end": 1724.26, "text": " just assume okay, an object is generally, you know, spatially something, some geometric"}, {"start": 1724.26, "end": 1729.72, "text": " shape that I know, it's close together, it's pretty independent from its surrounding, and"}, {"start": 1729.72, "end": 1735.18, "text": " it's trained with objects that are almost zero correlated, like there's zero correlation"}, {"start": 1735.18, "end": 1739.04, "text": " between the objects in the training data set."}, {"start": 1739.04, "end": 1748.48, "text": " So I wouldn't yet apply this much to to real world problems, but it is an interesting thought"}, {"start": 1748.48, "end": 1749.8799999999999, "text": " right here."}, {"start": 1749.8799999999999, "end": 1757.76, "text": " So that's the sort of idea behind the paper, I hope you got that they do a lot of experiments."}, {"start": 1757.76, "end": 1762.84, "text": " And here is a bit where my quarrels start."}, {"start": 1762.84, "end": 1772.6399999999999, "text": " So they say that they compare, for example, with the with these in the unsupervised object"}, {"start": 1772.6399999999999, "end": 1777.32, "text": " discovery experiments, they have this data set called clever."}, {"start": 1777.32, "end": 1784.3, "text": " And this data set has these images with sort of, I believe, clever six has all up to six"}, {"start": 1784.3, "end": 1785.84, "text": " different objects."}, {"start": 1785.84, "end": 1790.9599999999998, "text": " Now this is already one of the things this is not a specifically quarrel with this model."}, {"start": 1790.96, "end": 1796.0, "text": " But if your data set has six things, they all they give like, they give seven slots"}, {"start": 1796.0, "end": 1801.8400000000001, "text": " because they know that the data set has at most six things, which means they can always"}, {"start": 1801.8400000000001, "end": 1805.4, "text": " cover all the things now it works when there's less objects."}, {"start": 1805.4, "end": 1810.72, "text": " But I think the knowledge of how many objects there's going to be is also a big part of"}, {"start": 1810.72, "end": 1818.72, "text": " why these models work and why maybe it's not entirely ready yet for the real world."}, {"start": 1818.72, "end": 1823.28, "text": " But anyway, they compare to these two baselines."}, {"start": 1823.28, "end": 1829.76, "text": " They're called iodine, which also employs kind of a recurrent architecture, but not"}, {"start": 1829.76, "end": 1839.0, "text": " with an attention mechanism, and Monet, and they say, yada yada yada, this replaces lot"}, {"start": 1839.0, "end": 1840.0, "text": " of them."}, {"start": 1840.0, "end": 1841.56, "text": " No, that's not it."}, {"start": 1841.56, "end": 1847.1000000000001, "text": " For the Monet iodine DSP and baselines, we compare with the published numbers, as we"}, {"start": 1847.1, "end": 1850.4399999999998, "text": " use the same experimental setup."}, {"start": 1850.4399999999998, "end": 1852.9199999999998, "text": " So they say they use the same experimental setup."}, {"start": 1852.9199999999998, "end": 1855.9199999999998, "text": " And that's why they don't reimplement these models."}, {"start": 1855.9199999999998, "end": 1862.3999999999999, "text": " But they use the published numbers in their respective papers, which is something you"}, {"start": 1862.3999999999999, "end": 1863.3999999999999, "text": " can do."}, {"start": 1863.3999999999999, "end": 1869.1, "text": " This is often, I guess, these machine translation papers, and so on, they do this, just because,"}, {"start": 1869.1, "end": 1872.36, "text": " you know, it's a lot to run these things."}, {"start": 1872.36, "end": 1877.9599999999998, "text": " However, here, I'm a bit skeptical first, yes, because it is it is Google."}, {"start": 1877.9599999999998, "end": 1883.84, "text": " So they do have a lot of resources available to technically run these things."}, {"start": 1883.84, "end": 1889.9599999999998, "text": " I've seen at least Monet has an implementation by the author, or I've seen one of them the"}, {"start": 1889.9599999999998, "end": 1894.4399999999998, "text": " other one also, there is an implementation, and there's eight authors on this particular"}, {"start": 1894.4399999999998, "end": 1895.4399999999998, "text": " paper."}, {"start": 1895.4399999999998, "end": 1900.28, "text": " So I yeah, I, this would be okay."}, {"start": 1900.28, "end": 1903.0, "text": " They say as we use the same experimental setup."}, {"start": 1903.0, "end": 1908.48, "text": " So in that case, if you have the same setup, it's more okay."}, {"start": 1908.48, "end": 1912.72, "text": " But it really depends on you really having the same setup."}, {"start": 1912.72, "end": 1918.3999999999999, "text": " And this is a bit where it kind of falls."}, {"start": 1918.3999999999999, "end": 1924.76, "text": " So for example, one example right here is, they say we train the woman using the atom"}, {"start": 1924.76, "end": 1926.8, "text": " optimizer with a learning rate and 60."}, {"start": 1926.8, "end": 1929.36, "text": " So on they use a single GPU."}, {"start": 1929.36, "end": 1934.12, "text": " We further make use of learning rate warm up to prevent early saturation of the attention"}, {"start": 1934.12, "end": 1941.26, "text": " mechanism and an exponential decay, decay schedule in the learning rate, which we found to reduce"}, {"start": 1941.26, "end": 1942.26, "text": " variance."}, {"start": 1942.26, "end": 1946.52, "text": " So I've checked these other models, and none of them talks about learning rate warm up and"}, {"start": 1946.52, "end": 1950.6399999999999, "text": " nowhere in their code is their learning rate warm up."}, {"start": 1950.6399999999999, "end": 1956.9799999999998, "text": " Now, you might you might argue, okay, this is specific to this model, it might need this."}, {"start": 1956.98, "end": 1963.28, "text": " But if you look at the results, right here, for example, you see that they don't outperform"}, {"start": 1963.28, "end": 1964.8, "text": " these other models by too much."}, {"start": 1964.8, "end": 1969.16, "text": " So you can see right here, this is on par."}, {"start": 1969.16, "end": 1972.1200000000001, "text": " This here outperforms this one a little bit."}, {"start": 1972.1200000000001, "end": 1979.14, "text": " But then also the star here means that they have left out one of the denotes that one"}, {"start": 1979.14, "end": 1984.72, "text": " outlier was excluded from evaluation, I guess, which is valid if it's a super outlier."}, {"start": 1984.72, "end": 1993.16, "text": " But in this case, I would categorize this model as a different way of doing doing things"}, {"start": 1993.16, "end": 1998.56, "text": " and not necessarily outperforming the others."}, {"start": 1998.56, "end": 2004.1200000000001, "text": " So this also, if you look at the ablations, the differences here are minuscule."}, {"start": 2004.1200000000001, "end": 2009.3600000000001, "text": " And in these ablations that they show, every single thing they do, like gives them a little"}, {"start": 2009.36, "end": 2016.1599999999999, "text": " bit of a boost, and you just make it kind of across the line to reach state of the art."}, {"start": 2016.1599999999999, "end": 2020.3999999999999, "text": " I'd rather have research move in a direction where we just show cool ideas and that they"}, {"start": 2020.3999999999999, "end": 2024.8999999999999, "text": " work and that's what this paper does to to be fair."}, {"start": 2024.8999999999999, "end": 2030.6599999999999, "text": " What I do have more of a problem with a little bit is this here."}, {"start": 2030.6599999999999, "end": 2037.8799999999999, "text": " On Clever 6, we can use a batch size of up to 64 on a single v100 GPU as opposed to four"}, {"start": 2037.88, "end": 2043.2800000000002, "text": " in this iodine baseline, right, compared to iodine, our model is significantly more efficient"}, {"start": 2043.2800000000002, "end": 2049.2000000000003, "text": " in terms of both memory consumption and runtime, which is, you know, something I believe."}, {"start": 2049.2000000000003, "end": 2056.1600000000003, "text": " But this characterization that they use a batch size of four, and here in this paper,"}, {"start": 2056.1600000000003, "end": 2059.96, "text": " they can use a size up to 64 on a single v100 GPU."}, {"start": 2059.96, "end": 2067.12, "text": " I've read the iodine paper, and the iodine paper says, yes, they do use a batch size"}, {"start": 2067.12, "end": 2069.48, "text": " of four on one GPU."}, {"start": 2069.48, "end": 2071.44, "text": " So they also use one GPU."}, {"start": 2071.44, "end": 2077.9, "text": " But they say their GPU has a RAM of 12 gigabytes."}, {"start": 2077.9, "end": 2086.7599999999998, "text": " And 12 gigabyte RAM GPUs that points to something like Ti, either I guess a 1080 or a 2080 or"}, {"start": 2086.7599999999998, "end": 2087.7599999999998, "text": " something like this."}, {"start": 2087.7599999999998, "end": 2088.92, "text": " This is not a v100."}, {"start": 2088.92, "end": 2095.2, "text": " The v100 come in 16, or probably Google has the 32 gigabyte version."}, {"start": 2095.2, "end": 2105.3199999999997, "text": " So this is a 32 gigabyte GPU that is significantly better than the Ti GPUs."}, {"start": 2105.3199999999997, "end": 2110.14, "text": " These v100 they cost like five or 10 times more than the Ti GPUs."}, {"start": 2110.14, "end": 2115.98, "text": " And to simply say, we have also one GPU and we can run up to a batch size of 64 and they"}, {"start": 2115.98, "end": 2118.9199999999996, "text": " can only run a batch size of four."}, {"start": 2118.9199999999996, "end": 2124.62, "text": " It seems, I don't know, it seems sort of overstating what you can do now."}, {"start": 2124.62, "end": 2125.62, "text": " Maybe I'm wrong."}, {"start": 2125.62, "end": 2130.04, "text": " Maybe they have actually tested this other model and concluded also on their GPUs, it"}, {"start": 2130.04, "end": 2134.2599999999998, "text": " can only run to a batch size of four."}, {"start": 2134.2599999999998, "end": 2139.2599999999998, "text": " But I highly doubt it, because in their, here the paper is cited and in their paper, they"}, {"start": 2139.2599999999998, "end": 2147.72, "text": " explicitly name that they use for a batch size of four for their 12 gigabyte GPUs."}, {"start": 2147.72, "end": 2154.02, "text": " So yeah, in this, that just kind of pulls through."}, {"start": 2154.02, "end": 2157.24, "text": " So there's the, there's the minuscule improvements."}, {"start": 2157.24, "end": 2161.58, "text": " And then there's the ablations of all these tricks where everyone just gives you a little"}, {"start": 2161.58, "end": 2162.58, "text": " bit."}, {"start": 2162.58, "end": 2169.74, "text": " And then there is this kind of very, very, very favorable comparison, wordsmithy a bit,"}, {"start": 2169.74, "end": 2178.8, "text": " which gives a bit of a bitter taste to what I think is actually a very, very cool method."}, {"start": 2178.8, "end": 2181.3, "text": " Because why is this method so cool?"}, {"start": 2181.3, "end": 2187.98, "text": " Because for example, these slots here, they are trained to also absorb the background,"}, {"start": 2187.98, "end": 2188.98, "text": " right?"}, {"start": 2188.98, "end": 2193.8, "text": " So you can technically at inference time, increase the number of slots, even though"}, {"start": 2193.8, "end": 2197.6800000000003, "text": " you've trained with just with a few slots, right?"}, {"start": 2197.6800000000003, "end": 2202.7200000000003, "text": " You can, you can increase the number of slots, and the model can just handle it and they"}, {"start": 2202.7200000000003, "end": 2209.04, "text": " show it right here in these results."}, {"start": 2209.04, "end": 2215.94, "text": " Here you can, this data set has six objects, and this data set has 10 objects."}, {"start": 2215.94, "end": 2219.92, "text": " Now the model has only been trained over on six objects, and they can just up the number"}, {"start": 2219.92, "end": 2224.66, "text": " of slots at inference time, and it'll work also very well."}, {"start": 2224.66, "end": 2229.22, "text": " Also they can now up the number of iterations since these are all weight shared these iterations,"}, {"start": 2229.22, "end": 2234.8, "text": " right, we've looked at it, there's there's weight sharing between the iterations."}, {"start": 2234.8, "end": 2240.0600000000004, "text": " There is nothing stopping you from just piling on here because it's weight shared, you don't"}, {"start": 2240.0600000000004, "end": 2243.92, "text": " need any more weights, you can just refine this iteration."}, {"start": 2243.92, "end": 2249.86, "text": " And since the iteration themselves are refining these attention masks, anyway, you might as"}, {"start": 2249.86, "end": 2252.94, "text": " well at inference time, refine them some more."}, {"start": 2252.94, "end": 2257.94, "text": " They have an ablation where they show that technically, like three, two or three iterations"}, {"start": 2257.94, "end": 2263.2000000000003, "text": " at training time gives them the best result, I guess just because of gradient propagation,"}, {"start": 2263.2, "end": 2267.3399999999997, "text": " because more layers means you have to propagate the gradient back more."}, {"start": 2267.3399999999997, "end": 2269.98, "text": " But at inference time, you can just up these iterations."}, {"start": 2269.98, "end": 2272.48, "text": " And as you can see right here, you get better and better."}, {"start": 2272.48, "end": 2276.3399999999997, "text": " So this these results are, are pretty cool."}, {"start": 2276.3399999999997, "end": 2282.8599999999997, "text": " They respect the property that sets should be permutation invariant, and, and so on."}, {"start": 2282.8599999999997, "end": 2288.46, "text": " This routing view of the transformer is pretty cool, even though it's you can look at it"}, {"start": 2288.46, "end": 2294.02, "text": " as a transformer with weight sharing or an iterative routing protocol, like in capsules."}, {"start": 2294.02, "end": 2299.0, "text": " So all of this I find to be very, very cool idea."}, {"start": 2299.0, "end": 2303.2400000000002, "text": " And I think that's how we should look at this, this paper."}, {"start": 2303.2400000000002, "end": 2309.94, "text": " So before I am too critical of this paper, I want to say that I really like the idea"}, {"start": 2309.94, "end": 2314.58, "text": " and the algorithm here, the implementation."}, {"start": 2314.58, "end": 2316.18, "text": " Yeah."}, {"start": 2316.18, "end": 2321.4199999999996, "text": " So that was the paper at last, I actually want to look at the broader impact statement"}, {"start": 2321.4199999999996, "end": 2326.3399999999997, "text": " just because I've I've complained about brought the need for broader impact statements."}, {"start": 2326.3399999999997, "end": 2333.74, "text": " So I just want to kind of go just read them and just like look how how the different companies"}, {"start": 2333.74, "end": 2338.8199999999997, "text": " have the different institutions, how the different people how the community reacts to them, crafts"}, {"start": 2338.8199999999997, "end": 2340.1, "text": " them and so on."}, {"start": 2340.1, "end": 2342.8199999999997, "text": " So this one I find particularly interesting."}, {"start": 2342.8199999999997, "end": 2343.8199999999997, "text": " Let's go through it."}, {"start": 2343.82, "end": 2348.5800000000004, "text": " It says the slot detention module allows to learn object centric representation from perceptual"}, {"start": 2348.5800000000004, "end": 2350.1800000000003, "text": " input, okay."}, {"start": 2350.1800000000003, "end": 2355.7400000000002, "text": " As such, it is a general module that can be used in a wide range of domains and applications."}, {"start": 2355.7400000000002, "end": 2360.6200000000003, "text": " In our paper, we only consider artificially generated data set under well controlled settings,"}, {"start": 2360.6200000000003, "end": 2363.1800000000003, "text": " where slots are expected to specialize to objects."}, {"start": 2363.1800000000003, "end": 2367.6200000000003, "text": " However, the specializations of our model is implicit and fully driven by the downstream"}, {"start": 2367.6200000000003, "end": 2368.6200000000003, "text": " task."}, {"start": 2368.62, "end": 2374.18, "text": " We remark that as a concrete measure to assess whether the module is specialized in unwanted"}, {"start": 2374.18, "end": 2375.18, "text": " ways."}, {"start": 2375.18, "end": 2379.58, "text": " One can visualize the attention masks to understand how the input features are distributed across"}, {"start": 2379.58, "end": 2380.94, "text": " the slots."}, {"start": 2380.94, "end": 2386.66, "text": " While more work is required to properly address the usefulness of the attention coefficients"}, {"start": 2386.66, "end": 2391.14, "text": " in explaining the overall predictions of the network, especially if the input features"}, {"start": 2391.14, "end": 2396.2999999999997, "text": " are not human interpretable, we argue that they may serve as a step towards more transparent"}, {"start": 2396.3, "end": 2399.02, "text": " and interpretable predictions."}, {"start": 2399.02, "end": 2403.86, "text": " This is a I mean, it's a fine statement, but it's not a broader impact statement, right?"}, {"start": 2403.86, "end": 2408.7000000000003, "text": " If you followed a bit what the broader impact statement is supposed to be, this is not one."}, {"start": 2408.7000000000003, "end": 2413.42, "text": " Okay, the closest this comes to a broader impact statement is said, as such, it is a"}, {"start": 2413.42, "end": 2418.7000000000003, "text": " general model that can be used in a wide range of domains and applications, and maybe a little"}, {"start": 2418.7000000000003, "end": 2425.1400000000003, "text": " bit that you can visualize the attention masks to understand how the input features are distributed."}, {"start": 2425.14, "end": 2430.62, "text": " But the broader impact statement is supposed to give you a preview of how this might affect"}, {"start": 2430.62, "end": 2437.06, "text": " society at large, while this here just kind of lists properties of the model for the research"}, {"start": 2437.06, "end": 2445.1, "text": " community and sort of for this, for the application of this model, as, as you know, the introspection"}, {"start": 2445.1, "end": 2449.46, "text": " of the model itself, this says nothing about society as such."}, {"start": 2449.46, "end": 2456.36, "text": " So maybe, you know, maybe that's, I think that the smarter people will turn the broader"}, {"start": 2456.36, "end": 2462.08, "text": " impact statement into more of an introduction section, because that's something you usually"}, {"start": 2462.08, "end": 2466.98, "text": " put in a conclusion, or in an introduction, where you say, look, here are some things"}, {"start": 2466.98, "end": 2468.1, "text": " our model can do."}, {"start": 2468.1, "end": 2469.82, "text": " And this is what we might be useful for."}, {"start": 2469.82, "end": 2474.06, "text": " And this is how you could introspect it, and so on."}, {"start": 2474.06, "end": 2479.38, "text": " And since the broader impact statement, especially at NeurIPS, you were allowed to put the broader"}, {"start": 2479.38, "end": 2484.26, "text": " impact statement on the main paper, so not in the appendix, but it wouldn't count towards"}, {"start": 2484.26, "end": 2485.98, "text": " your page limit."}, {"start": 2485.98, "end": 2491.54, "text": " It's, I guess, pretty foreseeable that what people are going to start to do is simply"}, {"start": 2491.54, "end": 2499.02, "text": " put more of their paper into the broader impact section kind of cloaked in the veneer of a"}, {"start": 2499.02, "end": 2500.5, "text": " broader impact statement."}, {"start": 2500.5, "end": 2508.78, "text": " But I this is, this is clearly not what what the broader impact statement was originally"}, {"start": 2508.78, "end": 2509.78, "text": " supposed to be."}, {"start": 2509.78, "end": 2511.78, "text": " Now, I don't know if this is good or bad."}, {"start": 2511.78, "end": 2517.5400000000004, "text": " I just think these authors are, you know, they're doing, I think, a good thing here"}, {"start": 2517.5400000000004, "end": 2521.86, "text": " by simply telling us actually something useful about the model."}, {"start": 2521.86, "end": 2524.26, "text": " But that's just my opinion."}, {"start": 2524.26, "end": 2527.7000000000003, "text": " I do thank you for being with me here."}, {"start": 2527.7000000000003, "end": 2531.9, "text": " I know this was a bit ranty, flip flopping back and forth between the different things."}, {"start": 2531.9, "end": 2535.0600000000004, "text": " We haven't looked at set prediction at all."}, {"start": 2535.06, "end": 2541.18, "text": " We've only looked at these kind of masks, but I invite you to go through the paper yourself"}, {"start": 2541.18, "end": 2542.54, "text": " and check it out."}, {"start": 2542.54, "end": 2544.1, "text": " It's pretty cool."}, {"start": 2544.1, "end": 2548.08, "text": " And they do describe a lot of things in pretty detail."}, {"start": 2548.08, "end": 2551.7, "text": " The appendix is very long and has very many ablations."}, {"start": 2551.7, "end": 2554.86, "text": " And this is something I do appreciate."}, {"start": 2554.86, "end": 2568.6600000000003, "text": " And with that, bye bye and see you next time."}]
Yannic Kilchner
https://www.youtube.com/watch?v=V79rRI05Lj4
Set Distribution Networks: a Generative Model for Sets of Images (Paper Explained)
We've become very good at making generative models for images and classes of images, but not yet of sets of images, especially when the number of sets is unknown and can contain sets that have never been encountered during training. This paper builds a probabilistic framework and a practical implementation of a generative model for sets of images based on variational methods. OUTLINE: 0:00 - Intro & Overview 1:25 - Problem Statement 8:05 - Architecture Overview 20:05 - Probabilistic Model 33:50 - Likelihood Function 40:30 - Model Architectures 44:20 - Loss Function & Optimization 47:30 - Results 58:45 - Conclusion Paper: https://arxiv.org/abs/2006.10705 Abstract: Images with shared characteristics naturally form sets. For example, in a face verification benchmark, images of the same identity form sets. For generative models, the standard way of dealing with sets is to represent each as a one hot vector, and learn a conditional generative model p(x|y). This representation assumes that the number of sets is limited and known, such that the distribution over sets reduces to a simple multinomial distribution. In contrast, we study a more generic problem where the number of sets is large and unknown. We introduce Set Distribution Networks (SDNs), a novel framework that learns to autoencode and freely generate sets. We achieve this by jointly learning a set encoder, set discriminator, set generator, and set prior. We show that SDNs are able to reconstruct image sets that preserve salient attributes of the inputs in our benchmark datasets, and are also able to generate novel objects/identities. We examine the sets generated by SDN with a pre-trained 3D reconstruction network and a face verification network, respectively, as a novel way to evaluate the quality of generated sets of images. Authors: Shuangfei Zhai, Walter Talbott, Miguel Angel Bautista, Carlos Guestrin, Josh M. Susskind Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we're looking at set distribution networks, a generative model for sets of images by Shuangfei Cai, Walter Tablet, Miguel Angel Bautista, Carlos Gestren and Josh M. Suskind of Apple. So this paper introduces a generative model for sets and it does so in an energy based model fashion. It will have an encoder, a decoder in form of a generator, it will have a discriminator and it will have all kinds of math but the end result is a model that can generate sets of images and by sets we mean it can generate different kind of views on the same identity of image and you'll see what that means and it can generate even sets that it has never seen before which makes it different from a class conditional GAN or something like this. So if I can't really describe it on a high level in a very concise fashion you'll just have to stick around and see what's going on right here. So if you like content like this feel also free to share it out and leave it a like, tell me in the comments what you like. This is going to be a fairly math heavy paper and I'll try my best to kind of distill it down to what's happening because ultimately it's not that difficult. All right so if you have a look at these samples right here these are examples of sets of images. Now without actually caring for top and bottom row they will have some meaning right here. Top row is always a row from the actual data set and the bottom row is the reconstruction of that set. Now you'll see that the images don't really have a correspondence so you see it's the same truck in the top and the bottom row but the orientation here isn't really shared or anything and that's because as we said this is a set network. So what you want to do in this problem setting is you want to take you want to build a model that can take this set right here from the data set and it can encode it into a latent description that we call Z. Z simply describes the set as a whole. So Z here would be sorry would be truck right it would sort of be the 3D model so not the class truck but the 3D information of the truck without having any information of the different views. And then you want to build another model that can generate from this low level representation of the set can generate the different views okay like each one of these by sort of rotating it so we want to build a model that understands just from the pixels that here we have sets of things that they somehow always share a commonality and in this case they always share their 3D structure right. What they don't share is the view where they rendered from. So our model is supposed to kind of parse the two apart and encode that 3D structure just from the pixels in this Z variable and then encode the fact that you can rotate it and look at it from different views into the generative model that then produces the different views okay. And the reason why there is no correspondence between the views is we simply regard these things as sets. So our final objective is simply going to be that the set on top is different views of that particular truck is going to be very similar to the set on the bottom which is also different views of that particular truck and that's what our model is supposed to do. Now you might know something like this from we can simply say well this this looks like a class conditional GAN right. I simply have the class truck and I you know I feed this to my generator and my discriminator and my encoder and so on and it will produce a the same truck and here that and here the bench and so on. The problem I guess becomes more apparent when you go to this different data set. So this is a face data set and again top row being the input and bottom row being the output. Now what is here what is supposed to be preserved you can kind of see in the images is sort of the identity of the person on the photo. Now you have to kind of glass and gloss around your human bias here. You as a human can tell extremely tiny differences between faces and therefore none of the actual identities are going to be preserved right. So this on the top I believe is Ali and on on the bottom here it's not Ali. But you'll have to sort of gloss around this and you'll see that what is preserved or what is supposed to be preserved is something like the rough identity of the person on the picture and also a little bit of the image compositions. So you see here in the background you often have sort of these sports backgrounds right where there's kind of a washed out stadium or whatnot and you can see that this is also preserved here. I think it's kind of a glamour glamour shots of this must be some sort of glamour model and you'll see that this as well is preserved. What is different within each set is of course the different views on the same identity right. So you have the same person and you have pictures of them in different of different views different lighting different hairstyles and so on. Here you even see you have the black and white image and the set that is produced also contains some black and white images. So this model this is already the trained model here is doing a fairly good job here. You can see that almost all the pictures have some sort of double like two people with one being sort of half in frame and it leads to fairly a fairly strange thing. I'm going to guess the model hasn't seen lots of that during training. I like I particularly like this. This is this is pretty good. Also here it we know that a lot of these face data sets they don't really have bald people all too often so you can see here this results in sort of kind of a weird Richard Branson type picture. In any case it does it does a fairly good job right. As you can see right here. And what's the problem with with these faces. Can't we just do a class conditional again where we basically say here this is Ali right and that's one class in our latent vector and then and so on. What we want to do is we want to train something like this that where we can give in a new identity that we haven't seen during training. In fact we want to train something where we don't even know how many sets there are going to be in the end. We simply wanted to want to train it in a way where we say look I'm going to give you a set and the set will have you know images of the same person. And you're going to sort of reconstruct that in a way where you output a set of images of that person concerning conserving the identity of the person and the rough style of the picture. So this is really different from a class conditional again as in we don't know how many classes there are and there can be new unseen ones during testing. So how do we go about something like this? And here here's where the thing starts. So we're going to dive into a bit of the math here and then into a bit of the reasoning. But ultimately what they are going to do is they're going to build and they're going to build three things. They're going to build an encoder a discriminator and a generator. So what does the encoder do? And remember our task here is going to be the way we train it is going to be by reconstruction at least one way we train it. So the encoder is going to take this set of images that we give it for example here different views of this car and is going to produce this representation this set representation. Now what should this what should a property be of the set representation? For example it should be independent of the ordering of these inputs right a set is simply a collection of objects it's independent of the ordering and it's also independent of the size in some way of course a bigger set gives you more information but the set identity the fact that this is this particular car is independent of how many views you have. So what they do is they build and they put each image through an encoder which is a convolutional neural network and I guess that gives them a hidden representation and encoding and embedding for each image and then they have this operation called pool and binaries and so these this does two things namely first of all it pools it simply averages these things so it goes one over n ci of xi or c of xi I guess. So this simply averages the these encodings right here and this already fulfills our property so this average is independent of the order of the images and also I can add more and I can add less in expectation the average will result in the same thing right so this here now we have basically lost the information of the order of the exact ordering and so on this is simply an average of these images it's a good representation for a set this is now if we give enough images this will be independent of the particular rendering position and it will only depend on the fact that this is that particular car if it's trained well of course and then the second thing is binaries and here you have to understand how these what exactly this set latent representation is how do we encode a set in latent space and as far as I understand it as far as I understand it what they do is they do the following so since they don't know how many sets there are they can't simply do the classic one hot vector so what you would do in a class conditional GAN is you would say I have a vector and maybe I have 10 classes so I'll make 10 entries right here is that 10 I don't know I'll make so if I have C classes I'll make C entries right and I'll put a zero in all of them and a one in where a one where my classes or something like this so this would be a valid encoding for a class conditional again to represent the identity of the class here however no we don't know and also we can't really make this continuous because other if you make this continuous you you wouldn't really encode the identity of the set it's you would encode more of a you would encode more of kind of a continuous latent space and then that becomes kind of different when you have new sets and so on so what they really want to do is they want to make this representation here be a description of the set itself but not a one hot so what do we do what they do is they do the same thing they have a vector but not of size C because they don't know C but of some dimensionality D okay this can be 10 this can be 4 this can be you know whatever just let's say it's 10 but we don't know how many classes there are what the model can do is it can encode each class as a binary vector a binary combination of negative ones and ones so it can put like a negative one here a one negative one negative one one one negative one and so on so what what does that give you now you you can encode much more than 10 classes in fact you can with this you can encode 2 to the 10 classes right and that's so it's not like it's not that it's not that they can encode an unlimited set of sets I have set identities but they can encode in this manner they can encode a lot right they can encode this many sets using a representation like this so this binarize operation it will take this output right here and basically clamp it to either one or negative one so the set will be encoded by a binary vector like this and then the generator and the discriminator take that information okay and we'll go we'll go over what what this architectural choice means but right now this you you know see that this is a this is a way to encode a large number of set identities in a low dimensional vector all right so there are two things now there are the discriminator and the generator so first of all the generator is pretty easy the generators task is to take this Z that we just saw which is the set identity and to generate different instances of that set right and for that it needs this noise here so if you know a generator from a from a GAN this it always kind of needs input noise in order to produce different outputs and that's this thing on the right here this Z prime they simply come from some sort of latent distribution I think they call this P of psi which is some like a uniform or a Gaussian or something you just sample some noise right and you combine it with this thing right here which is the set identity you concatenate it and then each one of these different Z will produce one different one different view right here okay so the generators task is simply take the set identity and combine each with some noise and produce some views of that set now the discriminators task right here is going to be to decide it's going to get a set of views of a set of pictures and it's going to have to decide is this set coming from the generator or is this set coming from the data set right now you can't simply compare images to each other like you would do in a regular GAN because they don't correspond to each other right but what should correspond to each other is this identity this Z identity so the discriminator is going to take also two inputs it's going to take this set right here or you know from the data set and it's going to take this right here this Z now this Z is going to be the set identity and that you get from the encoder right it's the same as you get right here you get it from the encoder which set you should produce and the same goes here so the discriminator knows the set discriminator knows for example I'm trying to produce that particular car and it gets a set of images that is supposedly of that particular car needs to decide does it come from the data set or from the generator so it uses the same encoder pipeline here it's just like a CNN giving you a latent representation and then it has two tasks the discriminator has two different tasks first of all this here is the regular GAN path so it there's an there's an MLP there is simply a pipeline that outputs a number and the number is does this come from the data set or does this come from the generator but then there is an additional pipeline that they have found to be vital to train the objective which is a reconstruction pipeline so this is more like a sort of like an auto encoder pipeline where they have a decoder they try to reconstruct the input set and they then compare it using mean squared error now here they try to reconstruct the input set really picture by picture not as a set but picture by picture so that's it's different from the set generator okay and this is this pipeline is just to stabilize the training but it also goes into this the output of the discriminator so sort of the discriminator is happier the more it can D the more it can reconstruct the images which seems kind of weird at the beginning but it you know they say it has helped in other GANs I'm not super familiar with GAN literature but it's just a another objective that you can add so this is going to be the overview right here so if everything works well we should be able to take a set from the data set X right which is going to be you know image it different images from the same person we should be able to feed that to the encoder get a latent representation Z for that set that somehow encodes here the identity of the person and now we don't if the encoder works really well we don't have to have seen that person before it will simply somehow encode the identity in that binary vector then we feed that to the generator together with some noise and we'll get out a set of pictures of different views of that same person or the person with a similar identity and pictures with similar kind of picture style and that if our discriminator works well will look very very similar to or will be images really of that same person and our discriminator if we plug that in right here will agree and we plug in the Z right here okay okay that's the overview now the math so think about this in this sort of probabilistic framework what they say is we have we denote an image set of size n as X and that it comes from the space of sets of images so capital X right here is going to be a set of images as you see here and this here is the space of all sets of images okay so what they want to do is they want to build a probabilistic model of that so a model where you can input a set and it'll tell you how likely is that now you don't you don't actually have to have a number as an output right here what they often do is they start with a formulation like this and what they end up with is simply a model that allows you to sample from this distribution right from which you can estimate the probability but ultimately what we want is a generator that can sample from this okay so how do they build it they decompose this into two parts and this is just a you know a decomposition this is standard decomposition of probability where you'll say okay what's the probability of a set X the probability of a set X is the probability of the latent code of that set times the conditional probability of that set given the latent code so already we we have we ask ourselves what's the probability of X and what we might ask is huh well X you know if I look at X it has these different images of of this this it has these different images of that thing whatever is on the image I can first ask what is the probability of that particular thing on the image and then conditioned on that what is the probability that I'll get these particular images right this is this simple decomposition already kind of builds up this model of encoding decoding so we'll go through that step this here is going to be a deterministic function our encoder and this here is going to be a probabilistic function the the decoder and it's probabilistic because every time you call it basically every time you call the generator it's going to give you a different output because you you're going to feed it different noise at the beginning okay so so this is going to be this is going to be our encoder here and this is going to be our decoder so they say here X is a Z is a deterministic function that maps a set X to an element in a discrete space Z okay this is a discrete space as opposed to maybe a regular autoencoder where you have a continuous space so here we want to discrete space and a lot of mathematical problems are going to arise from the fact that this Z is a discrete space and not a and not a continuous space so here P is a prior distribution with the support given by sub C which means all the Z vectors that have some sort of set associated with them which is a subset of all the Z so that basically means that if if we have a given encoder there not all of these binary vectors are going to be filled even you know with if we plug in all the world's faces into our encoder it might not fill all of the binary capabilities that we have so this prior is only defined on this support of this and here you already kind of see what what kind of mathematical hurdles you have to go through if you do something like this and all the math here is going or most of the math here is going to deal with the fact that we have this discrete thing and so on and a bit of a bit of a little bit of a of a caveat here also is that this here they mention this here is a prior you need a prior distribution on your Z variables and this is also not easy so really quickly what does it mean to have a prior distribution on this kind of thing because usually in a regular like auto encoder variational auto encoder right your latent your latent code you'll have a prior on it and that prior can be you know some some continuous thing like a Gaussian and even in a regular Gann as I said you you have your your noise distribution and so on what is a prior on that thing now you can say oh a uniform prior but again we would like to learn this prior such that it matches the data set well now they use a prior from a paper that's called made M A D E and really quickly what it does is it sort of kind of decomposes this thing so what you'll have is a neural network that outputs binary vectors like this and it will sort of output them in a fashion autoregressively so it will output one of them and then condition on that it will output the next condition on that it will output the next and this is such that the probability of this binary vector minus one one one minus one and so on is going to be decomposed into the probability that there is a minus one here times the probability that there is a one here given that there is a minus one here and so on and in different order I don't really want to go into this but just to show you that there is a lot of consideration of mathematical consideration if you really want to go about really want to go about this sort of thing in a formal fashion so they define two things first of all this prior okay it's a prior distribution that they can learn from the data set and then there is this conditional distribution this what you might call a generator right if you're given a Z a one of these binary codes what's the probability of a given set so you I tell you here it's a I don't know Scarlett Johansson what's the probability of these pictures being different views of Scarlett Johansson so that is going to be simply we're going to build this as an energy based model you can you can do this what you'll have to do is you'll have to define an energy and we'll just quickly discuss what that is and then you can build a construct like this where you'll say the probability of a given set is going to be the energy that assigned to that set divided by the energy that I'm going to assign to all of these other sets so this is it's a form of an energy based model you can phrase very many things in terms of these energy based models and Yann LeCun gave a talk about this at iClear I believe where he gives a lot of different examples of energy based models so I invite you to check this out I've also done a video on some of these energy based models and what you can do with them here it's simply to define this probabilistic model so what we need to do are two things we need to know what is this energy so what is this energy supposed to do this energy is going to be a function that gives you and now I have to think so its energy is going to be a function that gives you a high value if you are unhappy with the input and it gives you a low value if you are happy with the input okay so you see the negative exponential here which basically means if and also the energy is always positive so the best if you are super duper happy with what is what your input is into the function you'll output zero so if you output zero here you'll see that e to the exponential function of negative something is going to be quite small and no maybe I have it wrong maybe you output a really high number when you're really happy I'm not sure but it's one of the two so this comes this comes from from a physics from a physics background no no no I'm right so if you if you output if you're not happy you'll output a super high number here which will make this negative exponential be really close to zero and therefore the probability you say if I'm not happy the probability should be close to zero however if you're really happy you'll output a low number right here now the energy always has to be greater or equal to zero but the lower you go the higher this probability is going to be the bottom thing here is simply to normalize the distribution because in a probability distribution you always have to normalize because otherwise it's not a probability and this is what most of these models basically are fighting over how to normalize the distribution and what we're going to do is simply normalize it by sampling which is what most of these things do you can build energy based models without this which GANs are a variant of that but okay so what we need to do is we need to come up with this energy function that is going to be a high number when we're not happy with the input now what is the input the input is X and Z X and Z what does it mean we're not happy with the input it means that the the image X and you see X here is one of the images of the set that particular image isn't really congruent with the Z with the identity so you either you say what this this isn't really a picture of Scarlett Johansson so I'm going to assign this a high value however if you know if this is really any sort of picture of of that person then you're going to assign it a low value and how better to do this than to build a neural network to do that and this is going to be our discriminator so our discriminator is going to take the role of this energy function okay cool now I said you need to normalize and I kind of set it off the cuff and so on but the problem here is again we have this kind of sets and and so on so our probability as you'll notice is the probability of X given Z so we are already given the the the identity of the person so what do we need to normalize by we can't simply normalize by all the sets of images in the world like here it's in the integral we need to normalize by all the sets of images that are mapped to that same identity okay so in order to normalize the distribution we'll basically ask how likely is this set how happy are you with this particular set right here compared to all the sets that could exist that would map to the same identity all right that's why these indicator functions are here and as you can see the part here is simply a normalization where you say I'm just going to produce other I'll consider all the other possible sets of images that map to the same person and I'll simply divide by the energy of those in fact if you do it correctly this particular X is also in that particular set but usually it's going to be a fairly small part but to properly normalize of course you have to consider it as well now this bottom part here as I already said is going to be the main problem of most of these probabilistic methods and as I already said again it's usually approximated by simply sampling a bunch of these sets and not sampling a bunch of these sets and not a by enumerating all the possible sets of images and this sampling is going to make some further problems as we'll see I guess down here so here is what we optimize ultimately we optimize or one of the things we optimize is are we okay yeah so they say we apply maximum likelihood estimation to estimate the parameters of the thing we just defined where the negative log likelihood loss for an observed set in the training split is this so this is simply the negative log likelihood the log decomposes into a sum so this is going to be your prior and this is going to be your generator discriminator combo okay it's the generator producing images from that binary code and then the discriminator assigning high or low values to that produced images and also to images from the data set and the thing over here is simply going to be the prior over the Z distribution that we briefly discussed now again they have to have to do some tricks here where they say okay we can get rid of this support by using a normalized distribution over Z which is a bound on that true prior and so on so they're going to replace the DP with a p bar which is over the entire space of Z and that's going to be a bound but the interesting part I feel more is here where they consider the loss again of this conditional distribution on Z so you'll see the exact same quantity right here but now our loss is going to be the negative log of that now since it's the negative log you can decompose the division into a sum and this part up here you will see the indicator function here is a bit unnecessary because the the Z here is the Z that we're considering is going to be the Z of that particular set that we're considering and so this equality holds on the top so disregard this and this down here as I said is simply a filter to filter the space of all sets to the ones that correspond to the Z that we have in the energy function so this goes here because it's simply a log of an exponential and the negative signs cancel so you'll end up with this what does it mean you want to minimize this loss right here and part of that is going to be you want to minimize the energy function of these inputs okay you want you want to and this is now the case when it comes to from the data set right so when X and Z come from the data set and E is your discriminator then you want to make the output of the discriminator really small which means that you you want to train the discriminator to say I'm really really happy that this particular image comes together with this particular identity encoding now the in the in the if it comes from the generator of course you want to do the exact opposite you want to assign it a high value remember energy low means happy with the input okay and then the normalization down here is as I said the problem so you'll see it stated right here because it's under the the division it's going to get a pick up a negative sign which combines with this negative sign which gives you a positive sign right here now this part right here is going to be intractable because it it's not going to be feasible to enumerate all the sets of images it's not even going to be feasible to enumerate all the sets of images that just correspond to that particular identity and in fact it's not even going to be feasible to sample from that because we have no clue right we can't simply generate out of the ether true other pictures of the of a particular person what we can do of course is we can use our we can use our model to produce more images right of that particular identity so what we'll do is we'll replace this distribution with a variational distribution and we'll sample from that now this isn't exactly the same this isn't this log probability anymore and that's why first of all we have a bound here and not an equality this is this is called a variational approximation so we bound this quantity and we can only bound this quantity if we down here introduce the entropy of the variational distribution this is a fairly standard trick in variational approximation methods if you want to look more into this look into kind of a VAE explain variational autoencoders explained or anything like this will teach you how how these methods work and in case we replace a distribution with a distribution we can actually produce and what is that distribution look what we're supposed to do is we're supposed to produce a set of image given so sets of images here given particular Z and we can do that that's our generator right so we can use our generator to produce those samples and that's what they say here here we have derived a lower bound by introducing a variational distribution which we parameterize in the form of a generator okay so the generator is going to produce that distribution it's going to use this noise production so as you know the generator takes two things it takes the identity encoding and a bit of noise and is going to produce an output set or for each noise it's going to produce an output image very cool so that's that's the kind of math formulation behind this model now they have a model architectures right here but this is all fairly standard except for so for the prior they learned the prior on the Z space so you see you have Z being this binary vectors they say we use a standard autoregressive model made with three fully connected layers mainly for its simplicity and robustness and so again maybe you like it took me a while to get what this prior does this prior is supposed to say it's so it's not in again you have the Z vectors always being some sort of from the standard noise but what you can also do is you can learn better noise distribution a better input distribution for your again by basically making again for your input distribution so what you'll do is you'll have a Z zero right here and then you'll use a you'll learn again to learn better input distributions okay and this is what you do here with these with this prior on Z this is more standard in like VA is than it is in GANs but it exists so encoder say as a necessary option encoder for a set needs to satisfy the permutation variant property we opt to use a simple architecture design where we let this be the average right here so as you can see this is the average and then they they use this binarize operation and the binarize operation here is clamping the values to one or negative one and it is a straight through estimator which means that you will you back prop through it as if you hadn't clamped but you forward prop through it with clamping this is kind of a trick to get through discretization things discriminators job is to assign low energy to observed images and high energy to generated images given a set code Z we use an autoencoder based energy function implementation similar to twenty five and here they say we have found that this choice is important as it enables effective learning in early stages of training so that's why they do usually a discriminator would be the energy would be equal to this thing right here which is a small MLP that maps a the input to a real sorry you can't see that that maps the input to a real number either high energy I'm not happy low energy I'm very happy here they also include this thing right here which is a decoder so it's kind of a you can maybe think of it as a another little again another another another little generator or the the generator part of a VAE or of an autoencoder sorry not a VAE an autoencoder takes as input the encoding of the particular image and the identity and produces is going to produce something that's close to the output again observe that this is now with respect to a particular image so here we're trying to reconstruct that particular image because we have its input thing right here and we're it's not the same as the generator that is just asked to produce a some view some thing that corresponds to this particular identity vector okay the generator generates a set conditioned on a set code by sampling and random variables each of which is concatenated with Z and generates an image independently cool so the losses they they they now introduce some margin losses on the things here but basically you can just translate the what we have on top where we formulated negative log likelihood into the losses right here they do have some simplifications for example this to train the prior you what you are to train to train the encoder I think you have to make a bit of an approximation in that the encoder is supposed to match this this Z vector right and that's not differentiable by itself so they have this sort of L one approximation right here they leave away the entropy from the loss and they have found that to work well they introduced this margin losses right here I don't want to go into that too much but basically they simply in a way with some approximations they approximate I here it is the indicator function they approximate is this I was looking for that they they they optimize this log likelihood from above in the way where they always optimize they keep the generator constant and they optimize the rest of the pipeline so the encoder and the discriminator in the prior and then they keep that rest fixed and they encode the generator so what does that do before remember right here we had this this approximation right here where we said you know what comes out of this we're not really optimizing this we're optimizing we're minimizing a lower bound on it right so here's a quantity that we want to minimize but here's a lower bound and we'll just push that lower bound down by optimizing you know that doesn't tell us anything about this thing right here but there is actually more to it so by optimizing the discriminator and the encoder and so on we do minimize this lower bound so that this this loss right here you see this energy function will adjust that whenever we adjust our whenever we adjust our that particular loss our discriminator will adjust that energy function whenever we adjust our encoder we are going to adjust the part that generates the z vectors right here so we'll push this down but whenever we optimize our generator that's when we make this gap here smaller okay so we always do two steps first we or first or second in one step we reduce this and in the other step we'll bring these two closer together and as a result of course we hope that it's not just the bottom one going to up down up down up down but we hope that both of them reduce with time because the top one is the one we'll actually want to reduce that's our actual loss or our log likelihood and that is I guess going to happen in practice so what does this do so as I as we already saw here on top you have a set and you feed that through the encoder feed that through the encoder that gives you a z identity and then you feed that to the generator and the generator you can ask it you don't have to produce the same amount of images you can produce any amount of images you like they just chose to produce the same amount there's no correspondence but you see it's the same truck and here they manually align these so they just produce a bunch of images on the left is the data set and on the right I guess they just produced like a hundred images and then selected wherever the car looked like the closest to so they ordered them by by hand and that is to show that for example look at the the lighting on the car right here it's it's fairly similar I guess this one has red taillights and the other one hasn't but you can see that the the different views are pretty well captured by the generator and that just from all of these are created from one one binary encoding of this here so this is binary encoded to z and then all of these different views are created there's no image correspondence so that's pretty cool and another problem when you have with sets is how do you evaluate sets you can't you can't go and check for images or image closeness and so on so they have to do some 3d modeling they actually take now they take these images right here and they have to approximate their 3d shape and then compare that 3d shape with the 3d shape of the original thing in order to just as a quant quantitatively estimate how well they're doing in the faces the the same thing you input the top row into the encoder and you get back the bottom row we've already looked at that but again to evaluate this you actually have to go and use some sort of a face detector to recognize is that even is that the same person always and is it so you can evaluate two things you can evaluate are these right here all the same people so you can have a face detector kind of tell you whether or not these are the same people and the second thing is are these down here the same person as these up here right so those are the kinds of things how you can evaluate this and they've done this and it's a fairly interesting and the results here are not surprising when you look at the the images so these are curves curves from this face detector and of course for real images as you can see the this is simply the performance of the face detector so you do get some false positives if you if you want more true positives right so this is a standard curve right here because these face detectors are not perfect so in a given row right here in a given row even if that's from the real data set the face detector would sometimes fail and say no that's not the same person even though from the data set you know it is though the the to match the actual child photo from Ali with his adult photos is even like you can forgive the face detector so that's sort of the the gold standard we're trying to achieve and you can see within the reconstructed sets that that is achieved fairly fairly well so compared to uniform samples this is you know fairly fairly cool fairly close what is less close is this reckon and real and I believe that's when you compare the identity of the real row with the identity of the reconstructed row and that's here so that tells you already that it's the GAN or sorry the model doesn't always preserve the actual identity as seen by a face detector and I don't know what to say except yes that's what you see in the data right also you see that free samples I guess so you can do two things right you can give it a set like a row and encode that into the Z and then you can decode that again and basically reconstruct or you can just sample since you've learned a prior on the Z variable you can simply sample you can simply say give me some new identity maybe that I've never seen before right you have some binary vector and now generator please give me images of that identity and these two here are actually sampled like this and you can see again here it's remarkable that within the same row it's pretty much the the rough identity of the person is conserved right and these are these free samples right here I guess and they they do better than whenever you compare the reconstructed and real but they don't do as well as when you actually input a real data and then reconstruct this so this might be an indication that this prior isn't really working you know all too accurately and I do have my problems with this binary encoding right here because maybe I'm misunderstanding something but if you have these binary vectors as we said here the reason you know the reason why you do one hot encoding in class conditional GANs is you could you could simply say what am I doing a one hot encoding I'll simply say Z equals three for class three and Z equals four for class four like that it should be so easy why am I doing one hot and that's because these models see everything in a linear fashion so if you have class three and then I have class four and then I have class nine the model doesn't see that as three different classes the model sees this as these two are somehow closer together than this right so the reason why we do one hot vectors is that the model cannot do this the model has one independent dimension for each of the classes and whenever that particular dimension is high then it knows that that particular class is activated what this binary encoding here does is sort of it goes back to this thing right here where it says okay there are all of these different categories here it's like you have mini classes and the identity of whatever set you consider is now encoded in these mini classes so that I'm going to guess the first thing here might be something like does that person have blonde hair and the second thing might be does the image look generally bright or the images image set as a whole look generally bright or dark and and so on so I'm going to guess these things are encoded here and it'll sort of just end up being kind of a discrete GAN or a discrete autoencoder rather than what they believe but maybe that was their goal all along and I'm misunderstanding right here I just don't think this this binarization is gives you this sort of hoped expressiveness I think there's still a lot of dependence of whether or not a particular thing is on or off okay but enough ranting right here I want to look at the at some more of the samples because I've only shown you the reconstructions what I also find interesting is the free samples so here you can see uncurated shape net samples and on the left so here you can see this effect on from the learned order regressive prior and a uniform prior on the right and here you can see this effect of learning this prior so if I learn the prior it's going to give me back fairly okay objects if I don't learn the prior oh but if I learn the prior you know if I learned a prior really really well that basically means I'm only going to ever produce sets that were in the training data right if I learn like a perfect prior I'll see like wait this you know this particular identity here never shows up so I'm not going to output it and the uniform prior might actually output it and the generator is not going to be trained on that uniform prior so it's just going to give you kind of crap and here in the in the faces you see the same thing now again what I think I don't think that's happening what I think is happening is encoding these kind of micro characteristics not per se identity but it's encoding probably you know a hair color whatnot head shape and so on things like this and in each of these dimensions and that's what is then going to produce so these each row here is in is one sample from that prior on the left is learned which you see is working pretty well in terms of the output and on the right you see it's from the uniform prior now you also see here first of all that approximately identity is preserved but not as much in this uniform prior that's first and second you see that the images are much worse which means that the generator doesn't have as much training on that particular thing because I guess it comes from a prior that it hasn't seen during training all right and here lastly they have reconstructions if you give different number of views so the top row I guess is the input the this row is when you just have four different views so I guess just the first four or something like this input and the bottom one is when you have the full eight views and you can I guess see or even more that this increases with number of views so the the accuracy of this identity increases the more views you input of the set and they have a bunch of other things right here in the appendix I do invite you to look at this and I hope you sort of saw into a bit how you would go about something like this I I found it quite challenging the math because I'm mainly not used to this kind of variational math but I hope this gives you sort of an impression all right this was it from me tell me what you think and I'll see you next time bye bye
[{"start": 0.0, "end": 6.44, "text": " Hi there, today we're looking at set distribution networks, a generative model for sets of images"}, {"start": 6.44, "end": 13.120000000000001, "text": " by Shuangfei Cai, Walter Tablet, Miguel Angel Bautista, Carlos Gestren and Josh M. Suskind"}, {"start": 13.120000000000001, "end": 14.56, "text": " of Apple."}, {"start": 14.56, "end": 21.32, "text": " So this paper introduces a generative model for sets and it does so in an energy based"}, {"start": 21.32, "end": 22.82, "text": " model fashion."}, {"start": 22.82, "end": 29.36, "text": " It will have an encoder, a decoder in form of a generator, it will have a discriminator"}, {"start": 29.36, "end": 36.84, "text": " and it will have all kinds of math but the end result is a model that can generate sets"}, {"start": 36.84, "end": 45.46, "text": " of images and by sets we mean it can generate different kind of views on the same identity"}, {"start": 45.46, "end": 51.28, "text": " of image and you'll see what that means and it can generate even sets that it has never"}, {"start": 51.28, "end": 55.92, "text": " seen before which makes it different from a class conditional GAN or something like"}, {"start": 55.92, "end": 57.72, "text": " this."}, {"start": 57.72, "end": 63.839999999999996, "text": " So if I can't really describe it on a high level in a very concise fashion you'll just"}, {"start": 63.839999999999996, "end": 68.2, "text": " have to stick around and see what's going on right here."}, {"start": 68.2, "end": 74.24, "text": " So if you like content like this feel also free to share it out and leave it a like,"}, {"start": 74.24, "end": 75.52, "text": " tell me in the comments what you like."}, {"start": 75.52, "end": 81.28, "text": " This is going to be a fairly math heavy paper and I'll try my best to kind of distill it"}, {"start": 81.28, "end": 85.84, "text": " down to what's happening because ultimately it's not that difficult."}, {"start": 85.84, "end": 91.72, "text": " All right so if you have a look at these samples right here these are examples of sets of images."}, {"start": 91.72, "end": 97.44, "text": " Now without actually caring for top and bottom row they will have some meaning right here."}, {"start": 97.44, "end": 103.68, "text": " Top row is always a row from the actual data set and the bottom row is the reconstruction"}, {"start": 103.68, "end": 105.04, "text": " of that set."}, {"start": 105.04, "end": 111.64, "text": " Now you'll see that the images don't really have a correspondence so you see it's the"}, {"start": 111.64, "end": 116.72, "text": " same truck in the top and the bottom row but the orientation here isn't really shared or"}, {"start": 116.72, "end": 120.84, "text": " anything and that's because as we said this is a set network."}, {"start": 120.84, "end": 125.7, "text": " So what you want to do in this problem setting is you want to take you want to build a model"}, {"start": 125.7, "end": 132.84, "text": " that can take this set right here from the data set and it can encode it into a latent"}, {"start": 132.84, "end": 136.4, "text": " description that we call Z."}, {"start": 136.4, "end": 139.6, "text": " Z simply describes the set as a whole."}, {"start": 139.6, "end": 149.32, "text": " So Z here would be sorry would be truck right it would sort of be the 3D model so not the"}, {"start": 149.32, "end": 156.95999999999998, "text": " class truck but the 3D information of the truck without having any information of the"}, {"start": 156.95999999999998, "end": 158.84, "text": " different views."}, {"start": 158.84, "end": 165.12, "text": " And then you want to build another model that can generate from this low level representation"}, {"start": 165.12, "end": 172.20000000000002, "text": " of the set can generate the different views okay like each one of these by sort of rotating"}, {"start": 172.20000000000002, "end": 178.8, "text": " it so we want to build a model that understands just from the pixels that here we have sets"}, {"start": 178.8, "end": 185.12, "text": " of things that they somehow always share a commonality and in this case they always share"}, {"start": 185.12, "end": 187.84, "text": " their 3D structure right."}, {"start": 187.84, "end": 191.56, "text": " What they don't share is the view where they rendered from."}, {"start": 191.56, "end": 196.92000000000002, "text": " So our model is supposed to kind of parse the two apart and encode that 3D structure"}, {"start": 196.92000000000002, "end": 203.48, "text": " just from the pixels in this Z variable and then encode the fact that you can rotate it"}, {"start": 203.48, "end": 209.52, "text": " and look at it from different views into the generative model that then produces the different"}, {"start": 209.52, "end": 212.0, "text": " views okay."}, {"start": 212.0, "end": 217.66, "text": " And the reason why there is no correspondence between the views is we simply regard these"}, {"start": 217.66, "end": 219.36, "text": " things as sets."}, {"start": 219.36, "end": 226.32000000000002, "text": " So our final objective is simply going to be that the set on top is different views"}, {"start": 226.32000000000002, "end": 232.0, "text": " of that particular truck is going to be very similar to the set on the bottom which is"}, {"start": 232.0, "end": 238.96, "text": " also different views of that particular truck and that's what our model is supposed to do."}, {"start": 238.96, "end": 244.20000000000002, "text": " Now you might know something like this from we can simply say well this this looks like"}, {"start": 244.20000000000002, "end": 246.48000000000002, "text": " a class conditional GAN right."}, {"start": 246.48, "end": 253.84, "text": " I simply have the class truck and I you know I feed this to my generator and my discriminator"}, {"start": 253.84, "end": 259.56, "text": " and my encoder and so on and it will produce a the same truck and here that and here the"}, {"start": 259.56, "end": 261.56, "text": " bench and so on."}, {"start": 261.56, "end": 265.96, "text": " The problem I guess becomes more apparent when you go to this different data set."}, {"start": 265.96, "end": 274.8, "text": " So this is a face data set and again top row being the input and bottom row being the output."}, {"start": 274.8, "end": 280.48, "text": " Now what is here what is supposed to be preserved you can kind of see in the images is sort"}, {"start": 280.48, "end": 284.14, "text": " of the identity of the person on the photo."}, {"start": 284.14, "end": 288.2, "text": " Now you have to kind of glass and gloss around your human bias here."}, {"start": 288.2, "end": 296.04, "text": " You as a human can tell extremely tiny differences between faces and therefore none of the actual"}, {"start": 296.04, "end": 298.74, "text": " identities are going to be preserved right."}, {"start": 298.74, "end": 308.12, "text": " So this on the top I believe is Ali and on on the bottom here it's not Ali."}, {"start": 308.12, "end": 313.12, "text": " But you'll have to sort of gloss around this and you'll see that what is preserved or what"}, {"start": 313.12, "end": 319.88, "text": " is supposed to be preserved is something like the rough identity of the person on the picture"}, {"start": 319.88, "end": 323.3, "text": " and also a little bit of the image compositions."}, {"start": 323.3, "end": 330.68, "text": " So you see here in the background you often have sort of these sports backgrounds right"}, {"start": 330.68, "end": 335.52000000000004, "text": " where there's kind of a washed out stadium or whatnot and you can see that this is also"}, {"start": 335.52000000000004, "end": 336.72, "text": " preserved here."}, {"start": 336.72, "end": 342.56, "text": " I think it's kind of a glamour glamour shots of this must be some sort of glamour model"}, {"start": 342.56, "end": 346.04, "text": " and you'll see that this as well is preserved."}, {"start": 346.04, "end": 353.56, "text": " What is different within each set is of course the different views on the same identity right."}, {"start": 353.56, "end": 358.84000000000003, "text": " So you have the same person and you have pictures of them in different of different views different"}, {"start": 358.84000000000003, "end": 361.16, "text": " lighting different hairstyles and so on."}, {"start": 361.16, "end": 366.64000000000004, "text": " Here you even see you have the black and white image and the set that is produced also contains"}, {"start": 366.64000000000004, "end": 368.06, "text": " some black and white images."}, {"start": 368.06, "end": 375.24, "text": " So this model this is already the trained model here is doing a fairly good job here."}, {"start": 375.24, "end": 380.92, "text": " You can see that almost all the pictures have some sort of double like two people with one"}, {"start": 380.92, "end": 387.12, "text": " being sort of half in frame and it leads to fairly a fairly strange thing."}, {"start": 387.12, "end": 390.56, "text": " I'm going to guess the model hasn't seen lots of that during training."}, {"start": 390.56, "end": 394.08, "text": " I like I particularly like this."}, {"start": 394.08, "end": 395.64, "text": " This is this is pretty good."}, {"start": 395.64, "end": 402.86, "text": " Also here it we know that a lot of these face data sets they don't really have bald people"}, {"start": 402.86, "end": 409.16, "text": " all too often so you can see here this results in sort of kind of a weird Richard Branson"}, {"start": 409.16, "end": 411.5, "text": " type picture."}, {"start": 411.5, "end": 416.52000000000004, "text": " In any case it does it does a fairly good job right."}, {"start": 416.52000000000004, "end": 420.8, "text": " As you can see right here."}, {"start": 420.8, "end": 423.84000000000003, "text": " And what's the problem with with these faces."}, {"start": 423.84000000000003, "end": 429.88, "text": " Can't we just do a class conditional again where we basically say here this is Ali right"}, {"start": 429.88, "end": 435.04, "text": " and that's one class in our latent vector and then and so on."}, {"start": 435.04, "end": 440.04, "text": " What we want to do is we want to train something like this that where we can give in a new"}, {"start": 440.04, "end": 442.24, "text": " identity that we haven't seen during training."}, {"start": 442.24, "end": 447.12, "text": " In fact we want to train something where we don't even know how many sets there are going"}, {"start": 447.12, "end": 448.71999999999997, "text": " to be in the end."}, {"start": 448.71999999999997, "end": 453.88, "text": " We simply wanted to want to train it in a way where we say look I'm going to give you"}, {"start": 453.88, "end": 458.88, "text": " a set and the set will have you know images of the same person."}, {"start": 458.88, "end": 464.96, "text": " And you're going to sort of reconstruct that in a way where you output a set of images"}, {"start": 464.96, "end": 471.9, "text": " of that person concerning conserving the identity of the person and the rough style of the picture."}, {"start": 471.9, "end": 477.9, "text": " So this is really different from a class conditional again as in we don't know how many classes"}, {"start": 477.9, "end": 484.0, "text": " there are and there can be new unseen ones during testing."}, {"start": 484.0, "end": 489.0, "text": " So how do we go about something like this?"}, {"start": 489.0, "end": 491.62, "text": " And here here's where the thing starts."}, {"start": 491.62, "end": 496.8, "text": " So we're going to dive into a bit of the math here and then into a bit of the reasoning."}, {"start": 496.8, "end": 504.8, "text": " But ultimately what they are going to do is they're going to build and they're going to"}, {"start": 504.8, "end": 506.68, "text": " build three things."}, {"start": 506.68, "end": 513.78, "text": " They're going to build an encoder a discriminator and a generator."}, {"start": 513.78, "end": 516.66, "text": " So what does the encoder do?"}, {"start": 516.66, "end": 523.88, "text": " And remember our task here is going to be the way we train it is going to be by reconstruction"}, {"start": 523.88, "end": 526.56, "text": " at least one way we train it."}, {"start": 526.56, "end": 531.52, "text": " So the encoder is going to take this set of images that we give it for example here different"}, {"start": 531.52, "end": 539.9599999999999, "text": " views of this car and is going to produce this representation this set representation."}, {"start": 539.96, "end": 544.86, "text": " Now what should this what should a property be of the set representation?"}, {"start": 544.86, "end": 551.1600000000001, "text": " For example it should be independent of the ordering of these inputs right a set is simply"}, {"start": 551.1600000000001, "end": 556.2800000000001, "text": " a collection of objects it's independent of the ordering and it's also independent of"}, {"start": 556.2800000000001, "end": 562.24, "text": " the size in some way of course a bigger set gives you more information but the set identity"}, {"start": 562.24, "end": 568.2800000000001, "text": " the fact that this is this particular car is independent of how many views you have."}, {"start": 568.28, "end": 576.4, "text": " So what they do is they build and they put each image through an encoder which is a convolutional"}, {"start": 576.4, "end": 585.0799999999999, "text": " neural network and I guess that gives them a hidden representation and encoding and embedding"}, {"start": 585.0799999999999, "end": 590.76, "text": " for each image and then they have this operation called pool and binaries and so these this"}, {"start": 590.76, "end": 597.9599999999999, "text": " does two things namely first of all it pools it simply averages these things so it goes"}, {"start": 597.96, "end": 606.0400000000001, "text": " one over n ci of xi or c of xi I guess."}, {"start": 606.0400000000001, "end": 616.76, "text": " So this simply averages the these encodings right here and this already fulfills our property"}, {"start": 616.76, "end": 623.96, "text": " so this average is independent of the order of the images and also I can add more and"}, {"start": 623.96, "end": 629.84, "text": " I can add less in expectation the average will result in the same thing right so this"}, {"start": 629.84, "end": 636.72, "text": " here now we have basically lost the information of the order of the exact ordering and so"}, {"start": 636.72, "end": 643.0, "text": " on this is simply an average of these images it's a good representation for a set this"}, {"start": 643.0, "end": 648.5600000000001, "text": " is now if we give enough images this will be independent of the particular rendering"}, {"start": 648.56, "end": 655.28, "text": " position and it will only depend on the fact that this is that particular car if it's trained"}, {"start": 655.28, "end": 663.0, "text": " well of course and then the second thing is binaries and here you have to understand how"}, {"start": 663.0, "end": 672.04, "text": " these what exactly this set latent representation is how do we encode a set in latent space"}, {"start": 672.04, "end": 678.52, "text": " and as far as I understand it as far as I understand it what they do is they do the"}, {"start": 678.52, "end": 686.16, "text": " following so since they don't know how many sets there are they can't simply do the classic"}, {"start": 686.16, "end": 689.8199999999999, "text": " one hot vector so what you would do in a class conditional GAN is you would say I have a"}, {"start": 689.8199999999999, "end": 696.16, "text": " vector and maybe I have 10 classes so I'll make 10 entries right here is that 10 I don't"}, {"start": 696.16, "end": 704.28, "text": " know I'll make so if I have C classes I'll make C entries right and I'll put a zero in"}, {"start": 704.28, "end": 713.28, "text": " all of them and a one in where a one where my classes or something like this so this"}, {"start": 713.28, "end": 720.3199999999999, "text": " would be a valid encoding for a class conditional again to represent the identity of the class"}, {"start": 720.32, "end": 728.24, "text": " here however no we don't know and also we can't really make this continuous because"}, {"start": 728.24, "end": 734.72, "text": " other if you make this continuous you you wouldn't really encode the identity of the"}, {"start": 734.72, "end": 741.12, "text": " set it's you would encode more of a you would encode more of kind of a continuous latent"}, {"start": 741.12, "end": 747.6400000000001, "text": " space and then that becomes kind of different when you have new sets and so on so what they"}, {"start": 747.64, "end": 754.08, "text": " really want to do is they want to make this representation here be a description of the"}, {"start": 754.08, "end": 760.4399999999999, "text": " set itself but not a one hot so what do we do what they do is they do the same thing"}, {"start": 760.4399999999999, "end": 767.48, "text": " they have a vector but not of size C because they don't know C but of some dimensionality"}, {"start": 767.48, "end": 776.48, "text": " D okay this can be 10 this can be 4 this can be you know whatever just let's say it's 10"}, {"start": 776.48, "end": 783.88, "text": " but we don't know how many classes there are what the model can do is it can encode each"}, {"start": 783.88, "end": 790.96, "text": " class as a binary vector a binary combination of negative ones and ones so it can put like"}, {"start": 790.96, "end": 800.52, "text": " a negative one here a one negative one negative one one one negative one and so on so what"}, {"start": 800.52, "end": 806.28, "text": " what does that give you now you you can encode much more than 10 classes in fact you can"}, {"start": 806.28, "end": 813.92, "text": " with this you can encode 2 to the 10 classes right and that's so it's not like it's not"}, {"start": 813.92, "end": 822.36, "text": " that it's not that they can encode an unlimited set of sets I have set identities but they"}, {"start": 822.36, "end": 828.4399999999999, "text": " can encode in this manner they can encode a lot right they can encode this many sets"}, {"start": 828.44, "end": 835.5200000000001, "text": " using a representation like this so this binarize operation it will take this output right here"}, {"start": 835.5200000000001, "end": 842.7600000000001, "text": " and basically clamp it to either one or negative one so the set will be encoded by a binary"}, {"start": 842.7600000000001, "end": 850.2, "text": " vector like this and then the generator and the discriminator take that information okay"}, {"start": 850.2, "end": 855.6400000000001, "text": " and we'll go we'll go over what what this architectural choice means but right now this"}, {"start": 855.64, "end": 864.0, "text": " you you know see that this is a this is a way to encode a large number of set identities"}, {"start": 864.0, "end": 873.92, "text": " in a low dimensional vector all right so there are two things now there are the discriminator"}, {"start": 873.92, "end": 882.64, "text": " and the generator so first of all the generator is pretty easy the generators task is to take"}, {"start": 882.64, "end": 894.0, "text": " this Z that we just saw which is the set identity and to generate different instances of that"}, {"start": 894.0, "end": 899.88, "text": " set right and for that it needs this noise here so if you know a generator from a from"}, {"start": 899.88, "end": 905.38, "text": " a GAN this it always kind of needs input noise in order to produce different outputs and"}, {"start": 905.38, "end": 910.28, "text": " that's this thing on the right here this Z prime they simply come from some sort of latent"}, {"start": 910.28, "end": 917.4399999999999, "text": " distribution I think they call this P of psi which is some like a uniform or a Gaussian"}, {"start": 917.4399999999999, "end": 921.9599999999999, "text": " or something you just sample some noise right and you combine it with this thing right here"}, {"start": 921.9599999999999, "end": 927.4399999999999, "text": " which is the set identity you concatenate it and then each one of these different Z"}, {"start": 927.4399999999999, "end": 937.36, "text": " will produce one different one different view right here okay so the generators task is"}, {"start": 937.36, "end": 947.08, "text": " simply take the set identity and combine each with some noise and produce some views of"}, {"start": 947.08, "end": 954.48, "text": " that set now the discriminators task right here is going to be to decide it's going to"}, {"start": 954.48, "end": 964.4, "text": " get a set of views of a set of pictures and it's going to have to decide is this set coming"}, {"start": 964.4, "end": 972.16, "text": " from the generator or is this set coming from the data set right now you can't simply compare"}, {"start": 972.16, "end": 976.56, "text": " images to each other like you would do in a regular GAN because they don't correspond"}, {"start": 976.56, "end": 984.16, "text": " to each other right but what should correspond to each other is this identity this Z identity"}, {"start": 984.16, "end": 991.64, "text": " so the discriminator is going to take also two inputs it's going to take this set right"}, {"start": 991.64, "end": 1001.36, "text": " here or you know from the data set and it's going to take this right here this Z now this"}, {"start": 1001.36, "end": 1008.16, "text": " Z is going to be the set identity and that you get from the encoder right it's the same"}, {"start": 1008.16, "end": 1013.6, "text": " as you get right here you get it from the encoder which set you should produce and the"}, {"start": 1013.6, "end": 1020.6, "text": " same goes here so the discriminator knows the set discriminator knows for example I'm"}, {"start": 1020.6, "end": 1026.16, "text": " trying to produce that particular car and it gets a set of images that is supposedly"}, {"start": 1026.16, "end": 1030.8, "text": " of that particular car needs to decide does it come from the data set or from the generator"}, {"start": 1030.8, "end": 1038.3600000000001, "text": " so it uses the same encoder pipeline here it's just like a CNN giving you a latent representation"}, {"start": 1038.3600000000001, "end": 1047.76, "text": " and then it has two tasks the discriminator has two different tasks first of all this"}, {"start": 1047.76, "end": 1054.04, "text": " here is the regular GAN path so it there's an there's an MLP there is simply a pipeline"}, {"start": 1054.04, "end": 1059.6, "text": " that outputs a number and the number is does this come from the data set or does this come"}, {"start": 1059.6, "end": 1065.64, "text": " from the generator but then there is an additional pipeline that they have found to be vital"}, {"start": 1065.64, "end": 1070.94, "text": " to train the objective which is a reconstruction pipeline so this is more like a sort of like"}, {"start": 1070.94, "end": 1076.86, "text": " an auto encoder pipeline where they have a decoder they try to reconstruct the input"}, {"start": 1076.86, "end": 1084.36, "text": " set and they then compare it using mean squared error now here they try to reconstruct the"}, {"start": 1084.36, "end": 1090.8999999999999, "text": " input set really picture by picture not as a set but picture by picture so that's it's"}, {"start": 1090.8999999999999, "end": 1096.86, "text": " different from the set generator okay and this is this pipeline is just to stabilize"}, {"start": 1096.86, "end": 1105.24, "text": " the training but it also goes into this the output of the discriminator so sort of the"}, {"start": 1105.24, "end": 1112.08, "text": " discriminator is happier the more it can D the more it can reconstruct the images which"}, {"start": 1112.08, "end": 1118.32, "text": " seems kind of weird at the beginning but it you know they say it has helped in other GANs"}, {"start": 1118.32, "end": 1123.36, "text": " I'm not super familiar with GAN literature but it's just a another objective that you"}, {"start": 1123.36, "end": 1129.4, "text": " can add so this is going to be the overview right here so if everything works well we"}, {"start": 1129.4, "end": 1138.24, "text": " should be able to take a set from the data set X right which is going to be you know"}, {"start": 1138.24, "end": 1143.76, "text": " image it different images from the same person we should be able to feed that to the encoder"}, {"start": 1143.76, "end": 1149.8400000000001, "text": " get a latent representation Z for that set that somehow encodes here the identity of"}, {"start": 1149.8400000000001, "end": 1155.88, "text": " the person and now we don't if the encoder works really well we don't have to have seen"}, {"start": 1155.88, "end": 1161.6000000000001, "text": " that person before it will simply somehow encode the identity in that binary vector"}, {"start": 1161.6000000000001, "end": 1169.7600000000002, "text": " then we feed that to the generator together with some noise and we'll get out a set of"}, {"start": 1169.7600000000002, "end": 1177.3200000000002, "text": " pictures of different views of that same person or the person with a similar identity and"}, {"start": 1177.3200000000002, "end": 1184.72, "text": " pictures with similar kind of picture style and that if our discriminator works well will"}, {"start": 1184.72, "end": 1192.1000000000001, "text": " look very very similar to or will be images really of that same person and our discriminator"}, {"start": 1192.1000000000001, "end": 1200.4, "text": " if we plug that in right here will agree and we plug in the Z right here okay okay that's"}, {"start": 1200.4, "end": 1209.52, "text": " the overview now the math so think about this in this sort of probabilistic framework what"}, {"start": 1209.52, "end": 1217.56, "text": " they say is we have we denote an image set of size n as X and that it comes from the"}, {"start": 1217.56, "end": 1225.08, "text": " space of sets of images so capital X right here is going to be a set of images as you"}, {"start": 1225.08, "end": 1233.28, "text": " see here and this here is the space of all sets of images okay so what they want to do"}, {"start": 1233.28, "end": 1240.6399999999999, "text": " is they want to build a probabilistic model of that so a model where you can input a set"}, {"start": 1240.6399999999999, "end": 1245.68, "text": " and it'll tell you how likely is that now you don't you don't actually have to have"}, {"start": 1245.68, "end": 1251.3999999999999, "text": " a number as an output right here what they often do is they start with a formulation"}, {"start": 1251.3999999999999, "end": 1256.56, "text": " like this and what they end up with is simply a model that allows you to sample from this"}, {"start": 1256.56, "end": 1262.52, "text": " distribution right from which you can estimate the probability but ultimately what we want"}, {"start": 1262.52, "end": 1271.44, "text": " is a generator that can sample from this okay so how do they build it they decompose this"}, {"start": 1271.44, "end": 1276.12, "text": " into two parts and this is just a you know a decomposition this is standard decomposition"}, {"start": 1276.12, "end": 1284.6, "text": " of probability where you'll say okay what's the probability of a set X the probability"}, {"start": 1284.6, "end": 1293.6799999999998, "text": " of a set X is the probability of the latent code of that set times the conditional probability"}, {"start": 1293.6799999999998, "end": 1300.1599999999999, "text": " of that set given the latent code so already we we have we ask ourselves what's the probability"}, {"start": 1300.1599999999999, "end": 1310.06, "text": " of X and what we might ask is huh well X you know if I look at X it has these different"}, {"start": 1310.06, "end": 1318.24, "text": " images of of this this it has these different images of that thing whatever is on the image"}, {"start": 1318.24, "end": 1324.52, "text": " I can first ask what is the probability of that particular thing on the image and then"}, {"start": 1324.52, "end": 1333.1599999999999, "text": " conditioned on that what is the probability that I'll get these particular images right"}, {"start": 1333.16, "end": 1340.98, "text": " this is this simple decomposition already kind of builds up this model of encoding decoding"}, {"start": 1340.98, "end": 1348.8000000000002, "text": " so we'll go through that step this here is going to be a deterministic function our encoder"}, {"start": 1348.8000000000002, "end": 1353.8400000000001, "text": " and this here is going to be a probabilistic function the the decoder and it's probabilistic"}, {"start": 1353.8400000000001, "end": 1358.76, "text": " because every time you call it basically every time you call the generator it's going to"}, {"start": 1358.76, "end": 1363.14, "text": " give you a different output because you you're going to feed it different noise at the beginning"}, {"start": 1363.14, "end": 1373.64, "text": " okay so so this is going to be this is going to be our encoder here and this is going to"}, {"start": 1373.64, "end": 1386.0, "text": " be our decoder so they say here X is a Z is a deterministic function that maps a set X"}, {"start": 1386.0, "end": 1394.68, "text": " to an element in a discrete space Z okay this is a discrete space as opposed to maybe a"}, {"start": 1394.68, "end": 1402.28, "text": " regular autoencoder where you have a continuous space so here we want to discrete space and"}, {"start": 1402.28, "end": 1407.68, "text": " a lot of mathematical problems are going to arise from the fact that this Z is a discrete"}, {"start": 1407.68, "end": 1417.68, "text": " space and not a and not a continuous space so here P is a prior distribution with the"}, {"start": 1417.68, "end": 1426.48, "text": " support given by sub C which means all the Z vectors that have some sort of set associated"}, {"start": 1426.48, "end": 1433.52, "text": " with them which is a subset of all the Z so that basically means that if if we have a"}, {"start": 1433.52, "end": 1440.92, "text": " given encoder there not all of these binary vectors are going to be filled even you know"}, {"start": 1440.92, "end": 1449.12, "text": " with if we plug in all the world's faces into our encoder it might not fill all of the binary"}, {"start": 1449.12, "end": 1456.2, "text": " capabilities that we have so this prior is only defined on this support of this and here"}, {"start": 1456.2, "end": 1460.96, "text": " you already kind of see what what kind of mathematical hurdles you have to go through"}, {"start": 1460.96, "end": 1465.16, "text": " if you do something like this and all the math here is going or most of the math here"}, {"start": 1465.16, "end": 1472.6000000000001, "text": " is going to deal with the fact that we have this discrete thing and so on and a bit of"}, {"start": 1472.6000000000001, "end": 1481.98, "text": " a bit of a little bit of a of a caveat here also is that this here they mention this here"}, {"start": 1481.98, "end": 1492.18, "text": " is a prior you need a prior distribution on your Z variables and this is also not easy"}, {"start": 1492.18, "end": 1498.16, "text": " so really quickly what does it mean to have a prior distribution on this kind of thing"}, {"start": 1498.16, "end": 1504.44, "text": " because usually in a regular like auto encoder variational auto encoder right your latent"}, {"start": 1504.44, "end": 1511.1200000000001, "text": " your latent code you'll have a prior on it and that prior can be you know some some continuous"}, {"start": 1511.12, "end": 1517.56, "text": " thing like a Gaussian and even in a regular Gann as I said you you have your your noise"}, {"start": 1517.56, "end": 1524.7199999999998, "text": " distribution and so on what is a prior on that thing now you can say oh a uniform prior"}, {"start": 1524.7199999999998, "end": 1532.04, "text": " but again we would like to learn this prior such that it matches the data set well now"}, {"start": 1532.04, "end": 1538.12, "text": " they use a prior from a paper that's called made M A D E and really quickly what it does"}, {"start": 1538.12, "end": 1545.4399999999998, "text": " is it sort of kind of decomposes this thing so what you'll have is a neural network that"}, {"start": 1545.4399999999998, "end": 1554.12, "text": " outputs binary vectors like this and it will sort of output them in a fashion autoregressively"}, {"start": 1554.12, "end": 1559.28, "text": " so it will output one of them and then condition on that it will output the next condition"}, {"start": 1559.28, "end": 1564.32, "text": " on that it will output the next and this is such that the probability of this binary vector"}, {"start": 1564.32, "end": 1570.36, "text": " minus one one one minus one and so on is going to be decomposed into the probability that"}, {"start": 1570.36, "end": 1574.8799999999999, "text": " there is a minus one here times the probability that there is a one here given that there"}, {"start": 1574.8799999999999, "end": 1580.32, "text": " is a minus one here and so on and in different order I don't really want to go into this"}, {"start": 1580.32, "end": 1585.48, "text": " but just to show you that there is a lot of consideration of mathematical consideration"}, {"start": 1585.48, "end": 1591.08, "text": " if you really want to go about really want to go about this sort of thing in a formal"}, {"start": 1591.08, "end": 1598.08, "text": " fashion so they define two things first of all this prior okay it's a prior distribution"}, {"start": 1598.08, "end": 1604.96, "text": " that they can learn from the data set and then there is this conditional distribution"}, {"start": 1604.96, "end": 1612.24, "text": " this what you might call a generator right if you're given a Z a one of these binary"}, {"start": 1612.24, "end": 1619.9199999999998, "text": " codes what's the probability of a given set so you I tell you here it's a I don't know"}, {"start": 1619.92, "end": 1626.24, "text": " Scarlett Johansson what's the probability of these pictures being different views of"}, {"start": 1626.24, "end": 1634.4, "text": " Scarlett Johansson so that is going to be simply we're going to build this as an energy"}, {"start": 1634.4, "end": 1641.8000000000002, "text": " based model you can you can do this what you'll have to do is you'll have to define an energy"}, {"start": 1641.8000000000002, "end": 1646.5600000000002, "text": " and we'll just quickly discuss what that is and then you can build a construct like this"}, {"start": 1646.56, "end": 1653.9199999999998, "text": " where you'll say the probability of a given set is going to be the energy that assigned"}, {"start": 1653.9199999999998, "end": 1661.44, "text": " to that set divided by the energy that I'm going to assign to all of these other sets"}, {"start": 1661.44, "end": 1667.28, "text": " so this is it's a form of an energy based model you can phrase very many things in terms"}, {"start": 1667.28, "end": 1673.8, "text": " of these energy based models and Yann LeCun gave a talk about this at iClear I believe"}, {"start": 1673.8, "end": 1679.32, "text": " where he gives a lot of different examples of energy based models so I invite you to"}, {"start": 1679.32, "end": 1684.72, "text": " check this out I've also done a video on some of these energy based models and what you"}, {"start": 1684.72, "end": 1693.2, "text": " can do with them here it's simply to define this probabilistic model so what we need to"}, {"start": 1693.2, "end": 1699.44, "text": " do are two things we need to know what is this energy so what is this energy supposed"}, {"start": 1699.44, "end": 1706.48, "text": " to do this energy is going to be a function that gives you and now I have to think so"}, {"start": 1706.48, "end": 1715.04, "text": " its energy is going to be a function that gives you a high value if you are unhappy"}, {"start": 1715.04, "end": 1721.3600000000001, "text": " with the input and it gives you a low value if you are happy with the input okay so you"}, {"start": 1721.3600000000001, "end": 1729.3200000000002, "text": " see the negative exponential here which basically means if and also the energy is always positive"}, {"start": 1729.32, "end": 1737.28, "text": " so the best if you are super duper happy with what is what your input is into the function"}, {"start": 1737.28, "end": 1746.28, "text": " you'll output zero so if you output zero here you'll see that e to the exponential function"}, {"start": 1746.28, "end": 1754.8, "text": " of negative something is going to be quite small and no maybe I have it wrong maybe you"}, {"start": 1754.8, "end": 1765.1599999999999, "text": " output a really high number when you're really happy I'm not sure but it's one of the two"}, {"start": 1765.1599999999999, "end": 1773.2, "text": " so this comes this comes from from a physics from a physics background no no no I'm right"}, {"start": 1773.2, "end": 1778.8, "text": " so if you if you output if you're not happy you'll output a super high number here which"}, {"start": 1778.8, "end": 1784.52, "text": " will make this negative exponential be really close to zero and therefore the probability"}, {"start": 1784.52, "end": 1791.8, "text": " you say if I'm not happy the probability should be close to zero however if you're really"}, {"start": 1791.8, "end": 1797.6, "text": " happy you'll output a low number right here now the energy always has to be greater or"}, {"start": 1797.6, "end": 1803.6, "text": " equal to zero but the lower you go the higher this probability is going to be the bottom"}, {"start": 1803.6, "end": 1809.3799999999999, "text": " thing here is simply to normalize the distribution because in a probability distribution you"}, {"start": 1809.38, "end": 1817.4, "text": " always have to normalize because otherwise it's not a probability and this is what most"}, {"start": 1817.4, "end": 1824.88, "text": " of these models basically are fighting over how to normalize the distribution and what"}, {"start": 1824.88, "end": 1829.2600000000002, "text": " we're going to do is simply normalize it by sampling which is what most of these things"}, {"start": 1829.2600000000002, "end": 1838.0400000000002, "text": " do you can build energy based models without this which GANs are a variant of that but"}, {"start": 1838.04, "end": 1842.6399999999999, "text": " okay so what we need to do is we need to come up with this energy function that is going"}, {"start": 1842.6399999999999, "end": 1847.68, "text": " to be a high number when we're not happy with the input now what is the input the input"}, {"start": 1847.68, "end": 1856.36, "text": " is X and Z X and Z what does it mean we're not happy with the input it means that the"}, {"start": 1856.36, "end": 1861.8, "text": " the image X and you see X here is one of the images of the set that particular image isn't"}, {"start": 1861.8, "end": 1868.36, "text": " really congruent with the Z with the identity so you either you say what this this isn't"}, {"start": 1868.36, "end": 1875.86, "text": " really a picture of Scarlett Johansson so I'm going to assign this a high value however"}, {"start": 1875.86, "end": 1882.12, "text": " if you know if this is really any sort of picture of of that person then you're going"}, {"start": 1882.12, "end": 1887.96, "text": " to assign it a low value and how better to do this than to build a neural network to"}, {"start": 1887.96, "end": 1894.76, "text": " do that and this is going to be our discriminator so our discriminator is going to take the"}, {"start": 1894.76, "end": 1904.08, "text": " role of this energy function okay cool now I said you need to normalize and I kind of"}, {"start": 1904.08, "end": 1910.76, "text": " set it off the cuff and so on but the problem here is again we have this kind of sets and"}, {"start": 1910.76, "end": 1921.32, "text": " and so on so our probability as you'll notice is the probability of X given Z so we are"}, {"start": 1921.32, "end": 1927.16, "text": " already given the the the identity of the person so what do we need to normalize by"}, {"start": 1927.16, "end": 1933.08, "text": " we can't simply normalize by all the sets of images in the world like here it's in the"}, {"start": 1933.08, "end": 1942.0, "text": " integral we need to normalize by all the sets of images that are mapped to that same identity"}, {"start": 1942.0, "end": 1949.84, "text": " okay so in order to normalize the distribution we'll basically ask how likely is this set"}, {"start": 1949.84, "end": 1956.8799999999999, "text": " how happy are you with this particular set right here compared to all the sets that could"}, {"start": 1956.88, "end": 1964.92, "text": " exist that would map to the same identity all right that's why these indicator functions"}, {"start": 1964.92, "end": 1971.2800000000002, "text": " are here and as you can see the part here is simply a normalization where you say I'm"}, {"start": 1971.2800000000002, "end": 1977.1200000000001, "text": " just going to produce other I'll consider all the other possible sets of images that"}, {"start": 1977.1200000000001, "end": 1984.5600000000002, "text": " map to the same person and I'll simply divide by the energy of those in fact if you do it"}, {"start": 1984.56, "end": 1991.56, "text": " correctly this particular X is also in that particular set but usually it's going to be"}, {"start": 1991.56, "end": 1997.12, "text": " a fairly small part but to properly normalize of course you have to consider it as well"}, {"start": 1997.12, "end": 2002.08, "text": " now this bottom part here as I already said is going to be the main problem of most of"}, {"start": 2002.08, "end": 2007.6, "text": " these probabilistic methods and as I already said again it's usually approximated by simply"}, {"start": 2007.6, "end": 2016.7199999999998, "text": " sampling a bunch of these sets and not sampling a bunch of these sets and not a by enumerating"}, {"start": 2016.7199999999998, "end": 2025.48, "text": " all the possible sets of images and this sampling is going to make some further problems as"}, {"start": 2025.48, "end": 2036.4399999999998, "text": " we'll see I guess down here so here is what we optimize ultimately we optimize or one"}, {"start": 2036.44, "end": 2047.52, "text": " of the things we optimize is are we okay yeah so they say we apply maximum likelihood estimation"}, {"start": 2047.52, "end": 2053.4, "text": " to estimate the parameters of the thing we just defined where the negative log likelihood"}, {"start": 2053.4, "end": 2059.44, "text": " loss for an observed set in the training split is this so this is simply the negative log"}, {"start": 2059.44, "end": 2066.16, "text": " likelihood the log decomposes into a sum so this is going to be your prior and this is"}, {"start": 2066.16, "end": 2075.7999999999997, "text": " going to be your generator discriminator combo okay it's the generator producing images from"}, {"start": 2075.7999999999997, "end": 2082.5, "text": " that binary code and then the discriminator assigning high or low values to that produced"}, {"start": 2082.5, "end": 2088.08, "text": " images and also to images from the data set and the thing over here is simply going to"}, {"start": 2088.08, "end": 2097.7599999999998, "text": " be the prior over the Z distribution that we briefly discussed now again they have to"}, {"start": 2097.7599999999998, "end": 2103.92, "text": " have to do some tricks here where they say okay we can get rid of this support by using"}, {"start": 2103.92, "end": 2111.24, "text": " a normalized distribution over Z which is a bound on that true prior and so on so they're"}, {"start": 2111.24, "end": 2123.04, "text": " going to replace the DP with a p bar which is over the entire space of Z and that's going"}, {"start": 2123.04, "end": 2129.9199999999996, "text": " to be a bound but the interesting part I feel more is here where they consider the loss"}, {"start": 2129.9199999999996, "end": 2135.2799999999997, "text": " again of this conditional distribution on Z so you'll see the exact same quantity right"}, {"start": 2135.28, "end": 2142.6000000000004, "text": " here but now our loss is going to be the negative log of that now since it's the negative log"}, {"start": 2142.6000000000004, "end": 2150.6600000000003, "text": " you can decompose the division into a sum and this part up here you will see the indicator"}, {"start": 2150.6600000000003, "end": 2158.82, "text": " function here is a bit unnecessary because the the Z here is the Z that we're considering"}, {"start": 2158.82, "end": 2164.28, "text": " is going to be the Z of that particular set that we're considering and so this equality"}, {"start": 2164.28, "end": 2170.32, "text": " holds on the top so disregard this and this down here as I said is simply a filter to"}, {"start": 2170.32, "end": 2176.5600000000004, "text": " filter the space of all sets to the ones that correspond to the Z that we have in the energy"}, {"start": 2176.5600000000004, "end": 2184.32, "text": " function so this goes here because it's simply a log of an exponential and the negative signs"}, {"start": 2184.32, "end": 2190.7200000000003, "text": " cancel so you'll end up with this what does it mean you want to minimize this loss right"}, {"start": 2190.72, "end": 2198.24, "text": " here and part of that is going to be you want to minimize the energy function of these inputs"}, {"start": 2198.24, "end": 2205.64, "text": " okay you want you want to and this is now the case when it comes to from the data set"}, {"start": 2205.64, "end": 2213.16, "text": " right so when X and Z come from the data set and E is your discriminator then you want"}, {"start": 2213.16, "end": 2218.3599999999997, "text": " to make the output of the discriminator really small which means that you you want to train"}, {"start": 2218.36, "end": 2224.04, "text": " the discriminator to say I'm really really happy that this particular image comes together"}, {"start": 2224.04, "end": 2231.44, "text": " with this particular identity encoding now the in the in the if it comes from the generator"}, {"start": 2231.44, "end": 2235.3, "text": " of course you want to do the exact opposite you want to assign it a high value remember"}, {"start": 2235.3, "end": 2244.7200000000003, "text": " energy low means happy with the input okay and then the normalization down here is as"}, {"start": 2244.72, "end": 2253.8399999999997, "text": " I said the problem so you'll see it stated right here because it's under the the division"}, {"start": 2253.8399999999997, "end": 2257.3199999999997, "text": " it's going to get a pick up a negative sign which combines with this negative sign which"}, {"start": 2257.3199999999997, "end": 2263.7599999999998, "text": " gives you a positive sign right here now this part right here is going to be intractable"}, {"start": 2263.7599999999998, "end": 2269.56, "text": " because it it's not going to be feasible to enumerate all the sets of images it's not"}, {"start": 2269.56, "end": 2274.64, "text": " even going to be feasible to enumerate all the sets of images that just correspond to"}, {"start": 2274.64, "end": 2281.64, "text": " that particular identity and in fact it's not even going to be feasible to sample from"}, {"start": 2281.64, "end": 2288.08, "text": " that because we have no clue right we can't simply generate out of the ether true other"}, {"start": 2288.08, "end": 2298.42, "text": " pictures of the of a particular person what we can do of course is we can use our we can"}, {"start": 2298.42, "end": 2306.88, "text": " use our model to produce more images right of that particular identity so what we'll"}, {"start": 2306.88, "end": 2313.8, "text": " do is we'll replace this distribution with a variational distribution and we'll sample"}, {"start": 2313.8, "end": 2321.76, "text": " from that now this isn't exactly the same this isn't this log probability anymore and"}, {"start": 2321.76, "end": 2329.28, "text": " that's why first of all we have a bound here and not an equality this is this is called"}, {"start": 2329.28, "end": 2337.26, "text": " a variational approximation so we bound this quantity and we can only bound this quantity"}, {"start": 2337.26, "end": 2344.6200000000003, "text": " if we down here introduce the entropy of the variational distribution this is a fairly"}, {"start": 2344.6200000000003, "end": 2349.6000000000004, "text": " standard trick in variational approximation methods if you want to look more into this"}, {"start": 2349.6, "end": 2356.2999999999997, "text": " look into kind of a VAE explain variational autoencoders explained or anything like this"}, {"start": 2356.2999999999997, "end": 2362.4, "text": " will teach you how how these methods work and in case we replace a distribution with"}, {"start": 2362.4, "end": 2367.7599999999998, "text": " a distribution we can actually produce and what is that distribution look what we're"}, {"start": 2367.7599999999998, "end": 2377.3399999999997, "text": " supposed to do is we're supposed to produce a set of image given so sets of images here"}, {"start": 2377.34, "end": 2383.6800000000003, "text": " given particular Z and we can do that that's our generator right so we can use our generator"}, {"start": 2383.6800000000003, "end": 2391.2000000000003, "text": " to produce those samples and that's what they say here here we have derived a lower bound"}, {"start": 2391.2000000000003, "end": 2398.6000000000004, "text": " by introducing a variational distribution which we parameterize in the form of a generator"}, {"start": 2398.6000000000004, "end": 2404.6000000000004, "text": " okay so the generator is going to produce that distribution it's going to use this noise"}, {"start": 2404.6, "end": 2411.92, "text": " production so as you know the generator takes two things it takes the identity encoding"}, {"start": 2411.92, "end": 2418.96, "text": " and a bit of noise and is going to produce an output set or for each noise it's going"}, {"start": 2418.96, "end": 2428.1, "text": " to produce an output image very cool so that's that's the kind of math formulation behind"}, {"start": 2428.1, "end": 2435.7799999999997, "text": " this model now they have a model architectures right here but this is all fairly standard"}, {"start": 2435.7799999999997, "end": 2441.2799999999997, "text": " except for so for the prior they learned the prior on the Z space so you see you have Z"}, {"start": 2441.2799999999997, "end": 2448.5, "text": " being this binary vectors they say we use a standard autoregressive model made with"}, {"start": 2448.5, "end": 2453.88, "text": " three fully connected layers mainly for its simplicity and robustness and so again maybe"}, {"start": 2453.88, "end": 2460.6, "text": " you like it took me a while to get what this prior does this prior is supposed to say it's"}, {"start": 2460.6, "end": 2466.48, "text": " so it's not in again you have the Z vectors always being some sort of from the standard"}, {"start": 2466.48, "end": 2473.1600000000003, "text": " noise but what you can also do is you can learn better noise distribution a better input"}, {"start": 2473.1600000000003, "end": 2480.7000000000003, "text": " distribution for your again by basically making again for your input distribution so what"}, {"start": 2480.7, "end": 2487.68, "text": " you'll do is you'll have a Z zero right here and then you'll use a you'll learn again to"}, {"start": 2487.68, "end": 2496.74, "text": " learn better input distributions okay and this is what you do here with these with this"}, {"start": 2496.74, "end": 2508.04, "text": " prior on Z this is more standard in like VA is than it is in GANs but it exists so encoder"}, {"start": 2508.04, "end": 2513.86, "text": " say as a necessary option encoder for a set needs to satisfy the permutation variant property"}, {"start": 2513.86, "end": 2519.24, "text": " we opt to use a simple architecture design where we let this be the average right here"}, {"start": 2519.24, "end": 2528.12, "text": " so as you can see this is the average and then they they use this binarize operation"}, {"start": 2528.12, "end": 2533.7, "text": " and the binarize operation here is clamping the values to one or negative one and it is"}, {"start": 2533.7, "end": 2538.4399999999996, "text": " a straight through estimator which means that you will you back prop through it as if you"}, {"start": 2538.4399999999996, "end": 2544.02, "text": " hadn't clamped but you forward prop through it with clamping this is kind of a trick to"}, {"start": 2544.02, "end": 2553.12, "text": " get through discretization things discriminators job is to assign low energy to observed images"}, {"start": 2553.12, "end": 2558.3599999999997, "text": " and high energy to generated images given a set code Z we use an autoencoder based energy"}, {"start": 2558.3599999999997, "end": 2562.98, "text": " function implementation similar to twenty five and here they say we have found that"}, {"start": 2562.98, "end": 2570.66, "text": " this choice is important as it enables effective learning in early stages of training so that's"}, {"start": 2570.66, "end": 2575.5, "text": " why they do usually a discriminator would be the energy would be equal to this thing"}, {"start": 2575.5, "end": 2584.78, "text": " right here which is a small MLP that maps a the input to a real sorry you can't see"}, {"start": 2584.78, "end": 2590.68, "text": " that that maps the input to a real number either high energy I'm not happy low energy"}, {"start": 2590.68, "end": 2597.3599999999997, "text": " I'm very happy here they also include this thing right here which is a decoder so it's"}, {"start": 2597.3599999999997, "end": 2605.98, "text": " kind of a you can maybe think of it as a another little again another another another little"}, {"start": 2605.98, "end": 2614.54, "text": " generator or the the generator part of a VAE or of an autoencoder sorry not a VAE an autoencoder"}, {"start": 2614.54, "end": 2621.98, "text": " takes as input the encoding of the particular image and the identity and produces is going"}, {"start": 2621.98, "end": 2628.2599999999998, "text": " to produce something that's close to the output again observe that this is now with respect"}, {"start": 2628.2599999999998, "end": 2632.72, "text": " to a particular image so here we're trying to reconstruct that particular image because"}, {"start": 2632.72, "end": 2638.5, "text": " we have its input thing right here and we're it's not the same as the generator that is"}, {"start": 2638.5, "end": 2646.74, "text": " just asked to produce a some view some thing that corresponds to this particular identity"}, {"start": 2646.74, "end": 2654.08, "text": " vector okay the generator generates a set conditioned on a set code by sampling and"}, {"start": 2654.08, "end": 2660.54, "text": " random variables each of which is concatenated with Z and generates an image independently"}, {"start": 2660.54, "end": 2671.38, "text": " cool so the losses they they they now introduce some margin losses on the things here but"}, {"start": 2671.38, "end": 2676.7, "text": " basically you can just translate the what we have on top where we formulated negative"}, {"start": 2676.7, "end": 2682.2599999999998, "text": " log likelihood into the losses right here they do have some simplifications for example"}, {"start": 2682.26, "end": 2693.5400000000004, "text": " this to train the prior you what you are to train to train the encoder I think you have"}, {"start": 2693.5400000000004, "end": 2702.28, "text": " to make a bit of an approximation in that the encoder is supposed to match this this"}, {"start": 2702.28, "end": 2709.6600000000003, "text": " Z vector right and that's not differentiable by itself so they have this sort of L one"}, {"start": 2709.66, "end": 2714.98, "text": " approximation right here they leave away the entropy from the loss and they have found"}, {"start": 2714.98, "end": 2721.52, "text": " that to work well they introduced this margin losses right here I don't want to go into"}, {"start": 2721.52, "end": 2728.66, "text": " that too much but basically they simply in a way with some approximations they approximate"}, {"start": 2728.66, "end": 2734.94, "text": " I here it is the indicator function they approximate is this I was looking for that they they they"}, {"start": 2734.94, "end": 2739.94, "text": " optimize this log likelihood from above in the way where they always optimize they keep"}, {"start": 2739.94, "end": 2744.7000000000003, "text": " the generator constant and they optimize the rest of the pipeline so the encoder and the"}, {"start": 2744.7000000000003, "end": 2752.58, "text": " discriminator in the prior and then they keep that rest fixed and they encode the generator"}, {"start": 2752.58, "end": 2759.04, "text": " so what does that do before remember right here we had this this approximation right"}, {"start": 2759.04, "end": 2765.54, "text": " here where we said you know what comes out of this we're not really optimizing this we're"}, {"start": 2765.54, "end": 2770.98, "text": " optimizing we're minimizing a lower bound on it right so here's a quantity that we want"}, {"start": 2770.98, "end": 2776.62, "text": " to minimize but here's a lower bound and we'll just push that lower bound down by optimizing"}, {"start": 2776.62, "end": 2781.7, "text": " you know that doesn't tell us anything about this thing right here but there is actually"}, {"start": 2781.7, "end": 2790.64, "text": " more to it so by optimizing the discriminator and the encoder and so on we do minimize this"}, {"start": 2790.64, "end": 2797.08, "text": " lower bound so that this this loss right here you see this energy function will adjust that"}, {"start": 2797.08, "end": 2805.48, "text": " whenever we adjust our whenever we adjust our that particular loss our discriminator"}, {"start": 2805.48, "end": 2812.62, "text": " will adjust that energy function whenever we adjust our encoder we are going to adjust"}, {"start": 2812.62, "end": 2820.58, "text": " the part that generates the z vectors right here so we'll push this down but whenever"}, {"start": 2820.58, "end": 2827.4, "text": " we optimize our generator that's when we make this gap here smaller okay so we always do"}, {"start": 2827.4, "end": 2834.82, "text": " two steps first we or first or second in one step we reduce this and in the other step"}, {"start": 2834.82, "end": 2839.5800000000004, "text": " we'll bring these two closer together and as a result of course we hope that it's not"}, {"start": 2839.5800000000004, "end": 2846.1600000000003, "text": " just the bottom one going to up down up down up down but we hope that both of them reduce"}, {"start": 2846.1600000000003, "end": 2850.36, "text": " with time because the top one is the one we'll actually want to reduce that's our actual"}, {"start": 2850.36, "end": 2859.54, "text": " loss or our log likelihood and that is I guess going to happen in practice so what does this"}, {"start": 2859.54, "end": 2868.2799999999997, "text": " do so as I as we already saw here on top you have a set and you feed that through the encoder"}, {"start": 2868.2799999999997, "end": 2875.7, "text": " feed that through the encoder that gives you a z identity and then you feed that to the"}, {"start": 2875.7, "end": 2880.18, "text": " generator and the generator you can ask it you don't have to produce the same amount"}, {"start": 2880.18, "end": 2884.42, "text": " of images you can produce any amount of images you like they just chose to produce the same"}, {"start": 2884.42, "end": 2891.14, "text": " amount there's no correspondence but you see it's the same truck and here they manually"}, {"start": 2891.14, "end": 2895.58, "text": " align these so they just produce a bunch of images on the left is the data set and on"}, {"start": 2895.58, "end": 2899.62, "text": " the right I guess they just produced like a hundred images and then selected wherever"}, {"start": 2899.62, "end": 2906.86, "text": " the car looked like the closest to so they ordered them by by hand and that is to show"}, {"start": 2906.86, "end": 2914.7000000000003, "text": " that for example look at the the lighting on the car right here it's it's fairly similar"}, {"start": 2914.7000000000003, "end": 2920.42, "text": " I guess this one has red taillights and the other one hasn't but you can see that the"}, {"start": 2920.42, "end": 2927.38, "text": " the different views are pretty well captured by the generator and that just from all of"}, {"start": 2927.38, "end": 2933.78, "text": " these are created from one one binary encoding of this here so this is binary encoded to"}, {"start": 2933.78, "end": 2941.02, "text": " z and then all of these different views are created there's no image correspondence so"}, {"start": 2941.02, "end": 2946.3, "text": " that's pretty cool and another problem when you have with sets is how do you evaluate"}, {"start": 2946.3, "end": 2953.34, "text": " sets you can't you can't go and check for images or image closeness and so on so they"}, {"start": 2953.34, "end": 2960.98, "text": " have to do some 3d modeling they actually take now they take these images right here"}, {"start": 2960.98, "end": 2967.26, "text": " and they have to approximate their 3d shape and then compare that 3d shape with the 3d"}, {"start": 2967.26, "end": 2974.18, "text": " shape of the original thing in order to just as a quant quantitatively estimate how well"}, {"start": 2974.18, "end": 2981.18, "text": " they're doing in the faces the the same thing you input the top row into the encoder and"}, {"start": 2981.18, "end": 2988.9, "text": " you get back the bottom row we've already looked at that but again to evaluate this"}, {"start": 2988.9, "end": 2994.5, "text": " you actually have to go and use some sort of a face detector to recognize is that even"}, {"start": 2994.5, "end": 3002.54, "text": " is that the same person always and is it so you can evaluate two things you can evaluate"}, {"start": 3002.54, "end": 3009.9, "text": " are these right here all the same people so you can have a face detector kind of tell"}, {"start": 3009.9, "end": 3015.9, "text": " you whether or not these are the same people and the second thing is are these down here"}, {"start": 3015.9, "end": 3022.3, "text": " the same person as these up here right so those are the kinds of things how you can"}, {"start": 3022.3, "end": 3027.36, "text": " evaluate this and they've done this and it's a fairly interesting and the results here"}, {"start": 3027.36, "end": 3034.1, "text": " are not surprising when you look at the the images so these are curves curves from this"}, {"start": 3034.1, "end": 3039.82, "text": " face detector and of course for real images as you can see the this is simply the performance"}, {"start": 3039.82, "end": 3048.6200000000003, "text": " of the face detector so you do get some false positives if you if you want more true positives"}, {"start": 3048.6200000000003, "end": 3054.06, "text": " right so this is a standard curve right here because these face detectors are not perfect"}, {"start": 3054.06, "end": 3061.86, "text": " so in a given row right here in a given row even if that's from the real data set the"}, {"start": 3061.86, "end": 3065.86, "text": " face detector would sometimes fail and say no that's not the same person even though"}, {"start": 3065.86, "end": 3071.58, "text": " from the data set you know it is though the the to match the actual child photo from"}, {"start": 3071.58, "end": 3079.8, "text": " Ali with his adult photos is even like you can forgive the face detector so that's sort"}, {"start": 3079.8, "end": 3086.36, "text": " of the the gold standard we're trying to achieve and you can see within the reconstructed sets"}, {"start": 3086.36, "end": 3093.46, "text": " that that is achieved fairly fairly well so compared to uniform samples this is you know"}, {"start": 3093.46, "end": 3103.38, "text": " fairly fairly cool fairly close what is less close is this reckon and real and I believe"}, {"start": 3103.38, "end": 3111.18, "text": " that's when you compare the identity of the real row with the identity of the reconstructed"}, {"start": 3111.18, "end": 3118.64, "text": " row and that's here so that tells you already that it's the GAN or sorry the model doesn't"}, {"start": 3118.64, "end": 3126.44, "text": " always preserve the actual identity as seen by a face detector and I don't know what to"}, {"start": 3126.44, "end": 3133.3199999999997, "text": " say except yes that's what you see in the data right also you see that free samples"}, {"start": 3133.3199999999997, "end": 3139.62, "text": " I guess so you can do two things right you can give it a set like a row and encode that"}, {"start": 3139.62, "end": 3146.72, "text": " into the Z and then you can decode that again and basically reconstruct or you can just"}, {"start": 3146.72, "end": 3152.68, "text": " sample since you've learned a prior on the Z variable you can simply sample you can simply"}, {"start": 3152.68, "end": 3160.16, "text": " say give me some new identity maybe that I've never seen before right you have some binary"}, {"start": 3160.16, "end": 3168.16, "text": " vector and now generator please give me images of that identity and these two here are actually"}, {"start": 3168.16, "end": 3174.7, "text": " sampled like this and you can see again here it's remarkable that within the same row it's"}, {"start": 3174.7, "end": 3182.16, "text": " pretty much the the rough identity of the person is conserved right and these are these"}, {"start": 3182.16, "end": 3190.1, "text": " free samples right here I guess and they they do better than whenever you compare the reconstructed"}, {"start": 3190.1, "end": 3197.48, "text": " and real but they don't do as well as when you actually input a real data and then reconstruct"}, {"start": 3197.48, "end": 3207.44, "text": " this so this might be an indication that this prior isn't really working you know all too"}, {"start": 3207.44, "end": 3216.14, "text": " accurately and I do have my problems with this binary encoding right here because maybe"}, {"start": 3216.14, "end": 3223.12, "text": " I'm misunderstanding something but if you have these binary vectors as we said here the reason"}, {"start": 3223.12, "end": 3227.08, "text": " you know the reason why you do one hot encoding in class conditional GANs is you could you"}, {"start": 3227.08, "end": 3232.68, "text": " could simply say what am I doing a one hot encoding I'll simply say Z equals three for"}, {"start": 3232.68, "end": 3237.92, "text": " class three and Z equals four for class four like that it should be so easy why am I doing"}, {"start": 3237.92, "end": 3244.36, "text": " one hot and that's because these models see everything in a linear fashion so if you have"}, {"start": 3244.36, "end": 3252.68, "text": " class three and then I have class four and then I have class nine the model doesn't see"}, {"start": 3252.68, "end": 3258.3999999999996, "text": " that as three different classes the model sees this as these two are somehow closer"}, {"start": 3258.3999999999996, "end": 3266.72, "text": " together than this right so the reason why we do one hot vectors is that the model cannot"}, {"start": 3266.72, "end": 3272.16, "text": " do this the model has one independent dimension for each of the classes and whenever that"}, {"start": 3272.16, "end": 3279.2799999999997, "text": " particular dimension is high then it knows that that particular class is activated what"}, {"start": 3279.28, "end": 3285.2400000000002, "text": " this binary encoding here does is sort of it goes back to this thing right here where"}, {"start": 3285.2400000000002, "end": 3291.6800000000003, "text": " it says okay there are all of these different categories here it's like you have mini classes"}, {"start": 3291.6800000000003, "end": 3299.4, "text": " and the identity of whatever set you consider is now encoded in these mini classes so that"}, {"start": 3299.4, "end": 3305.48, "text": " I'm going to guess the first thing here might be something like does that person have blonde"}, {"start": 3305.48, "end": 3311.68, "text": " hair and the second thing might be does the image look generally bright or the images"}, {"start": 3311.68, "end": 3317.16, "text": " image set as a whole look generally bright or dark and and so on so I'm going to guess"}, {"start": 3317.16, "end": 3324.84, "text": " these things are encoded here and it'll sort of just end up being kind of a discrete GAN"}, {"start": 3324.84, "end": 3332.04, "text": " or a discrete autoencoder rather than what they believe but maybe that was their goal"}, {"start": 3332.04, "end": 3337.2799999999997, "text": " all along and I'm misunderstanding right here I just don't think this this binarization"}, {"start": 3337.2799999999997, "end": 3345.2599999999998, "text": " is gives you this sort of hoped expressiveness I think there's still a lot of dependence"}, {"start": 3345.2599999999998, "end": 3355.36, "text": " of whether or not a particular thing is on or off okay but enough ranting right here"}, {"start": 3355.36, "end": 3361.36, "text": " I want to look at the at some more of the samples because I've only shown you the reconstructions"}, {"start": 3361.36, "end": 3369.2400000000002, "text": " what I also find interesting is the free samples so here you can see uncurated shape net samples"}, {"start": 3369.2400000000002, "end": 3375.48, "text": " and on the left so here you can see this effect on from the learned order regressive prior"}, {"start": 3375.48, "end": 3380.96, "text": " and a uniform prior on the right and here you can see this effect of learning this prior"}, {"start": 3380.96, "end": 3386.92, "text": " so if I learn the prior it's going to give me back fairly okay objects if I don't learn"}, {"start": 3386.92, "end": 3396.4, "text": " the prior oh but if I learn the prior you know if I learned a prior really really well"}, {"start": 3396.4, "end": 3402.08, "text": " that basically means I'm only going to ever produce sets that were in the training data"}, {"start": 3402.08, "end": 3407.48, "text": " right if I learn like a perfect prior I'll see like wait this you know this particular"}, {"start": 3407.48, "end": 3412.52, "text": " identity here never shows up so I'm not going to output it and the uniform prior might actually"}, {"start": 3412.52, "end": 3419.32, "text": " output it and the generator is not going to be trained on that uniform prior so it's just"}, {"start": 3419.32, "end": 3428.28, "text": " going to give you kind of crap and here in the in the faces you see the same thing now"}, {"start": 3428.28, "end": 3432.92, "text": " again what I think I don't think that's happening what I think is happening is encoding these"}, {"start": 3432.92, "end": 3438.96, "text": " kind of micro characteristics not per se identity but it's encoding probably you know a hair"}, {"start": 3438.96, "end": 3446.32, "text": " color whatnot head shape and so on things like this and in each of these dimensions"}, {"start": 3446.32, "end": 3452.48, "text": " and that's what is then going to produce so these each row here is in is one sample from"}, {"start": 3452.48, "end": 3459.84, "text": " that prior on the left is learned which you see is working pretty well in terms of the"}, {"start": 3459.84, "end": 3468.0, "text": " output and on the right you see it's from the uniform prior now you also see here first"}, {"start": 3468.0, "end": 3475.92, "text": " of all that approximately identity is preserved but not as much in this uniform prior that's"}, {"start": 3475.92, "end": 3481.74, "text": " first and second you see that the images are much worse which means that the generator"}, {"start": 3481.74, "end": 3487.7, "text": " doesn't have as much training on that particular thing because I guess it comes from a prior"}, {"start": 3487.7, "end": 3494.8, "text": " that it hasn't seen during training all right and here lastly they have reconstructions"}, {"start": 3494.8, "end": 3501.48, "text": " if you give different number of views so the top row I guess is the input the this row"}, {"start": 3501.48, "end": 3505.44, "text": " is when you just have four different views so I guess just the first four or something"}, {"start": 3505.44, "end": 3510.6800000000003, "text": " like this input and the bottom one is when you have the full eight views and you can"}, {"start": 3510.6800000000003, "end": 3520.1600000000003, "text": " I guess see or even more that this increases with number of views so the the accuracy of"}, {"start": 3520.16, "end": 3527.72, "text": " this identity increases the more views you input of the set and they have a bunch of"}, {"start": 3527.72, "end": 3535.6, "text": " other things right here in the appendix I do invite you to look at this and I hope you"}, {"start": 3535.6, "end": 3544.44, "text": " sort of saw into a bit how you would go about something like this I I found it quite challenging"}, {"start": 3544.44, "end": 3550.12, "text": " the math because I'm mainly not used to this kind of variational math but I hope this gives"}, {"start": 3550.12, "end": 3556.0, "text": " you sort of an impression all right this was it from me tell me what you think and I'll"}, {"start": 3556.0, "end": 3580.92, "text": " see you next time bye bye"}]
Yannic Kilchner
https://www.youtube.com/watch?v=eI8xTdcZ6VY
Context R-CNN: Long Term Temporal Context for Per-Camera Object Detection (Paper Explained)
Object detection often does not occur in a vacuum. Static cameras, such as wildlife traps, collect lots of irregularly sampled data over a large time frame and often capture repeating or similar events. This model learns to dynamically incorporate other frames taken by the same camera into its object detection pipeline. OUTLINE: 0:00 - Intro & Overview 1:10 - Problem Formulation 2:10 - Static Camera Data 6:45 - Architecture Overview 10:00 - Short-Term Memory 15:40 - Long-Term Memory 20:10 - Quantitative Results 22:30 - Qualitative Results 30:10 - False Positives 32:50 - Appendix & Conclusion Paper: https://arxiv.org/abs/1912.03538 My Video On Attention Is All You Need: https://youtu.be/iDulhoQ2pro Abstract: In static monitoring cameras, useful contextual information can stretch far beyond the few seconds typical video understanding models might see: subjects may exhibit similar behavior over multiple days, and background objects remain static. Due to power and storage constraints, sampling frequencies are low, often no faster than one frame per second, and sometimes are irregular due to the use of a motion trigger. In order to perform well in this setting, models must be robust to irregular sampling rates. In this paper we propose a method that leverages temporal context from the unlabeled frames of a novel camera to improve performance at that camera. Specifically, we propose an attention-based approach that allows our model, Context R-CNN, to index into a long term memory bank constructed on a per-camera basis and aggregate contextual features from other frames to boost object detection performance on the current frame. We apply Context R-CNN to two settings: (1) species detection using camera traps, and (2) vehicle detection in traffic cameras, showing in both settings that Context R-CNN leads to performance gains over strong baselines. Moreover, we show that increasing the contextual time horizon leads to improved results. When applied to camera trap data from the Snapshot Serengeti dataset, Context R-CNN with context from up to a month of images outperforms a single-frame baseline by 17.9% mAP, and outperforms S3D (a 3d convolution based baseline) by 11.2% mAP. Authors: Sara Beery, Guanhang Wu, Vivek Rathod, Ronny Votel, Jonathan Huang Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we'll look at Context R-CNN, Long Term Temporal Context for Per Camera Object Detection by Sarah Beery, Guan Hong Wu, Vivek Rathod, Ronny Votel and Jonathan Huang. So on a high level, this paper tries to do object detection for cameras where you the camera is in the same place for a long time. For example, these wild trap cameras or traffic cameras right here. It proposes to do object detection by incorporating data from the images that the camera has seen in the past to help the detection in the current frame. And it does so via an attention mechanism that it runs over a memory of past data. So we're going to take a look at how this is done and how well it works. And yes, stick around if you want to know. As always, if you enjoy content like this, then consider sharing it out telling your friends about it. Subscribe if you haven't and tell me what you think in the comments. So the paper starts off and describes the problem and the problem is fairly simple. You want to do object detection in images. Object detection is the task of basically if you if I give you an image, you should tell me what is on the image and where. So in this case, here, you would have to draw me this bounding box and say, this is a deer. On the bottom, you would have to draw bounding boxes. Maybe they have to be rectangular, maybe not and say this is a bus. And here is a truck and here is another truck and here is a car and so on. So there can be many objects in an image, there can be one object, there can be objects of different classes, or there can be no objects at all. So this is just object detection. And there have been many papers on this. And specifically, there has been this rCNN. And this is the model that we're going to extend. So the rCNN model or specifically the faster rCNN model that we're going to build on is a model that simply detects these bounding boxes in single in single images. But now we consider the situation where we have a camera that records images for a long, long time. So in these wild trap cameras, they often sit there for months. And it's not that easy to make use of them. Because in addition to there being a lot of data, they have motion triggers. So that could be there is no nothing for a long time. And then there's a the the animal walks in the trap. And then you have a bunch of images, like one per second for 10 seconds. And then you have nothing again for like a day or two days. And then you have 10 images again, because another animal walks in or maybe doesn't, and so on and another. So you have irregular sampling frequencies, you have very, very different distance between the frames. All of this makes it very, very not suited for models like temporal convolutions, or things like LSTMs, because they don't work super well with data like this. Now, I know there are formulations where LSTMs can do this, but they don't work very well with these super long contexts and irregular sampling frequencies and so on. So the idea is if we have a frame right here, like this one, and we want to detect what's on it, we should be able to pull information from other frames that the same camera has seen, like from this one, or from this one, or from this one right here. And we should be able to do so in a dynamic way. Now, why could that help? If you look at, for example, down here, these images have been taken, they say images were taken on separate days. But you can see this thing right here is in both images. So or a very similar thing is probably that bus's regular route. So in in order to classify if whether or not this here is a bus, it might be very helpful to also look at this picture right here and see, ah, you know, it's about at the same location, it looks the same. And also it looks like a bus. So, you know, that that kind of gives evidence that this could be this other thing could also be a bus. Then also there are background objects. So sometimes the single frame detectors get confused, it might be labeling this here as a car, because just the lighting the exact lighting in this picture is just off by the correct amount that it is confused. But considering this picture over here, maybe it recognizes here, no, that's not a car. And it can bring over this evidence to that frame and, and consider, ah, maybe, maybe, you know, this is the same thing. So it's it's not a car. So this is this is not the same than simply adding training data, we really consider the fact here that these images, they come from the same camera that is in the same location, or maybe, you know, that is filming the same thing. So this all of this is going to be within the same camera, not just adding adding, ah, I ID training data. And with animals as well, like, often the same animal has like its regular route, or within these 10, these bursts of 10s, the same as animal will kind of walk around a bit and maybe, you know, here, it's half occluded, but maybe in a different image, you see, ah, here I see the nose. So it helps you make a better prediction. Also, animals are often in kind of crowds in and that helps if you see that there are other deer around the probability that this is a deer increases rapidly. So how are we going to do this, what we're going to do is we're going to build an attention mechanism that can do these kinds of look into the past, and some also a little bit of the future, as we will see, but mainly will look into other images from the same camera in a dynamic way. And we'll learn how to address those other images from a memory bank. So the architecture is described right here. Now, as you can see, we are still in the business of doing object detection. So what we'll do is we'll sort of hijack a existing object detector. And the object detector we're going to hijack is going to be this FRCNN, this faster R-CNN object detector. That's an object detector for a single frame problem. So that means you have one image, and you're supposed to detect what's on it. It has two stages, as you can see. So stage one, if you have an image, and let's say there's some stuff on it, stuff, stuff, stuff, there's stuff, okay. This is what stage one is supposed to do is it's supposed to extract regions of interest. This could be, okay, all of these are regions of interest. So it simply says, well, there is something, there might be something right here in these regions of interest. And then it describes each of these regions of interest using features. Okay, so it extracts these regions of interest, and each region of interest gets features assigned to it. So what these are, I think these are like seven by seven by 2048 features. But let's just say for the sake of describing it, that these are just a vector of features for each region of interest. So each region of interest is going to be associated with one vector of features that this model extracts. Okay, and the next region of interest also has a vector and the next region of interest also has a vector and so on. Stage two then takes each one of these takes each one of these vectors and assigns a class to it. So this would be deer right here. Okay, so stage one proposes regions of interest along with features, then stage two takes each of these regions of interest and classifies them basically. And I guess there's there's many in between stage like this is massively simplified. There's no maximum suppression, there is kind of an alignment stage where you can refine the the bounding box and so on. But in essence, these are two stages. And you can see that this system here, it goes in between the two stages. So all of this right here, we shove in between the two stages. So we'll still use the stage one, and we'll still use the stage two. But in between in this thing right here, we'll try to sort of pimp these features such that the stage two detector has an easier time classifying. Okay, so we're going to pimp these features by incorporating in because these features right now, if we just do it with vanilla, these are just from the current frame. And we're going to add to them information from other frames of the same camera. And we're going to do it in two different ways. So the first way, as you can see here, the first way is this short term memory. And the second way is the long term memory. Now, the two are slightly different. As you can guess, the short term memory is going to be only over a short time period around the current frame. And the long term memory is going to be basically across a very long time horizon into the past. You can see we're trying to classify this blue frame right here that what we call the key frame. So what we'll do is we'll run it through stage one, cool. So we have features for each region of interest. And then you can see this goes here and through these residual connections, this goes into stage two over here. So basically, stage two still receives the same input, it receives whatever stage one outputs for the keyframe. But we're going to add to that twice. So we're going to add two things as I as I said, so the short term memory is added right here. Now, how do we build the short term memory, we build the short term memory simply by considering all the frames around the keyframe. And this you can see right here, the current window around the keyframe, which can be like one frame around it, or two frames or three frames, just a few frames around the current frame. And this can be fairly helpful, as we said, for example, if the deer moves a bit, the car moves a bit, you know, it gets into a slightly different lighting and so on. This can help us very much to classify the current keyframe if we also have features from the surrounding frames. So for each of these surrounding frames, we also run them through the stage one detector to also extract regions of interest. And that all of these features go into this memory short term memory bank right here. There's different strategies, you don't always have to extract all of the regions of interest, you can also extract just the top one and so on. Or you can extract the mean, since these are fairly, you know, consistent, the cameras at the same place. There are many ways you can do this. But what you ultimately end up with is a short term memory bank that kind of is, so you'll have a bank and you have lots of these feature vectors in here for your region, your regions of interest of the surrounding frames. Now, if this here, if this here is your half occluded deer, right, so this is the half occluded deer, and you want to consider information from the surrounding frames, maybe in the next frame, so maybe this is three frames, like 123. And two is the key frame, maybe in the next frame, the deer moves a bit, and you see its nose. And that, this particular region of interest here is relevant. So how do you know, how do you now get from this entire memory, this feature vector that would be helpful? And the answer is you get it through an attention mechanism. You can see that right here, the way the short term memory is added is through this attention block. They describe the attention block right here, it is a fairly standard attention mechanism. So I've done a video on attention is all you need. If you don't know what an attention mechanism is, go check it out. But you can see it's it's very, very standard. So you have these input features, which are the features that come from the key frame. And you have the context features, which are all the features in your memory bank, you encode the input features with into a query using a fully connected layers and the context features into keys. And then you match the queries with the keys and the softmax in order to get a weighting over the context features. And then you aggregate the values from the context features. So this is a standard attention mechanism. What does it mean? It basically means that each of these vectors right here, they will emit a key that kind of describes what kind of information is contained in that vector. The vector over here will emit a query that describes what sort of information it is looking for to in order to describe what's in the region of interest as well as possible. And then you simply match the query with the keys to determine which key fits best to that query. And whichever one fits best, let's say this one here, then you take that vector from the memory bank and incorporate it together with your current information that you already have. So that's how you address things that from other frames using an attention mechanism. Okay, now, if this were all, you know, we could train this right now. We could train all of this because all of this is differentiable, right? This stage one detector right here is differentiable. It goes here and here, you know, the information, the attention mechanism is differentiable. The stage two detector is differentiable, all differentiable. Cool. We can train this end to end. Now what's the problem? The problem is this long term memory right here. So in this memory, ideally, we would want to fit, let's say an entire day, an entire week, or even an entire month of data from one of these cameras. And it's just not feasible that we expand this current window here to an entire month or an entire week. For many of those of those cameras, because even though they have a low frame rate, and so on, it's still too much in order to then be all differentiable, all back propagatable, and so on. So we can't really back prop in for these long term memory. In essence, what we want to do is exactly the same, we want to build up a memory of all of the regions of interest, or maybe selected regions or all of the best regions of interest, whatever heuristic strategy we have, of the past, whatever this camera has seen, let's say in the last month or in the current week, or something like this, we want to build all of this up, and then use an attention mechanism, just the same in order to incorporate it. But we, we have to come up with these things right here, in some other way, than a way where we can back prop. So we can't really use this stage one detector right here, because this is this is the one we're training. And so we have to back prop through it. Now, an easy proposal is to simply use it anyway, but do like a stop gradient on it. So we don't back prop through it. That is one way but this, the paper decides on a different way, the paper decides that all of the all of the past, basically, right here, right here, and so on. We'll take a pre trained object detector. So not the one we're training currently, but we'll take take a pre trained one that was pre trained either on something like cocoa, which is an object detection data set, or you can pre train it on cocoa and then fine tune it on a task you're interested in in a single frame fashion, in what for whatever way we'll take a pre trained object detector, or region of interest extractor. And that will give us for each frame in the past will give us also the regions of interest, along with the features. Okay. And these are the features that we then go and put into put into the memory bank. Sorry, my tablet just crashed a bit. There we go. Okay, so we'll take a pre trained extractor right here. That will give us features for regions of interest, we'll put that into the memory bank. And then we will use an attention mechanism to incorporate it. Now the attention mechanism we can train, but we cannot train the extractor for the features. And this is the difference to the short term memory where we can actually train the feature extractor in order to help us with you know, building the memory. Now the memory is simply built without a goal in mind, basically. And the attention mechanism, the attention mechanism basically has to learn that it doesn't work with features that are meant for its task, it works with features that have been originally created for a different tasks, and they're not going to change. But as we'll see, this, you know, can be handled. So that's what they do, they incorporate short term and long term memory into their stage two prediction, and then the stage two prediction simply takes in all of those features and classifies the class of the object. And that's the architecture of context or CNN, it's our CNN with long and short term context. So they describe very different ways of you know, how they built the memory and so on how they built the features. I didn't I kind of glossed over this right now. There's a lot of consideration in building these thing and you have to look at the paper, how they exactly do this. I'm more interested in the high level architecture and the sort of ideas behind it. So when they do this, they do outperform the, they do outperform the current or the single frame baselines by quite a bit. So this SS and this CCT are these wildlife data sets, whereas this CC, I think this is the city something city cam, these are this street data set. As you can see, they do outperform the single frame baseline by quite a bit. Now interesting, as you can see right here, as they increase the time horizon of this long term memory, so they they can they can now choose how much information do they want to put in that long term memory, as they increase the time horizon for one minute, one hour, one day, and so on, the performance goes up and up and up, which is, you know, a strong indication that these features actually help from the from the time horizon, because you don't have more parameters, you simply increase the amount of information in the memory bank. And if the performance goes up, you can make a very strong claim that these these this is actually due to the fact that you have more information in that memory bank couldn't really guess any other explanation right here. So they they do it, they do investigate different memory strategies, they do a lot of ablations right here, where they also say, Okay, what if we only have the short term attention? What if we only have the long term attention? What do only if we only have self attention, that means attention only into the current frame, but of across regions of interest, that's interesting, if you have like a herd of animals and so on, and they all help. But as you can see, the long term attention tends to help the most in this data set. And short term attention help helps a lot in this data set, if you just compare to the other owner, these are two different metrics, not data sets, sorry about that. But in essence, it helps the most when you combine the two. And that's, you know, that's pretty cool to see. So they do some qualitative results, which I find very interesting. For example, they can visualize what the attention weights of their models are. So here, you always have a very long timeframe, I think an entire month in this in this memory bank of the long term memory. Now, in the top classification, you see the large thing here, the large frame is the one you actually want to classify. And the other frames are the frames where the top attention score is so that the attention weights are the highest. So here, in order to classify this, what does the model pay attention to? Or which other frames does the model pay attention to? And you can see right here, they are all spread across the entire month, here is the timeline, the most attended two pictures are spread across the entire month, and almost all of them actually have that war talk in here. So this must be like its regular route. And the model recognizes that and pulls in information from all these other images in order to correctly classify it here. On the other hand, on the next example, this gazelle and tablet crashed right here. It also puts all the all the weight on top of the of images of that same gazelle. But you can see maybe that gazelle was only there for this one particular moment. And all the pictures this camera has of it is, you know, in the very few moments that the gazelle was around, you can see they all come here from the same point in time, or very, very close points in time. And you can see that it puts a lot of weight on wherever the gazelle is. So, you know, that's a pretty strong indication that it actually learns to pull in the correct information be that from long time horizon, or from a short time horizon, if necessary. You can also see right here, they visualize the top attention, where the top attention weights go in terms of how long the frames where the attention goes to is away from the frame that they're trying to classify. So these graphics are somewhat kind of weird to interpret. This here always means how much is the total time of the buffer. So the memory buffer here contains always pictures from the total from one hour before until one hour after the keyframe you want to classify. So this is the frame you want to classify at minute zero. And the memory buffer contains images from 60 minutes before to 60 minutes after. So it's not real time, right, you go back to your through your footage and you try to classify. So you can also pull out images from the future. You can see there's most attention is on the current frame, which makes sense. You're trying to classify the current frame, and then kind of falls off as you go further and further away. And this is across the entire data set. So this is not a specific example, which also makes sense, probably, in most of the time, the relevant information is, you know, next closer in time rather than farther away. But also, you can see that the distribution is pretty spread out. So it makes the model makes use of the entire range of time. And you can see that throughout even if you have an entire day in the buffer, or two days, even if you have entire week before and week after in the buffer, and even if you have an entire month here. And especially, if you look at when you have an entire week in the buffer, you can see the periodicity through the days. So that means the model tends to pay attention to images that are from the same time of day, compared to the current keyframe. That's a fairly, fairly good indication that the model has actually learned to address these this memory by its content, right? Now, night and day isn't super difficult, because you can just go on the brightness and so on. But still, it's pretty cool to see that this is actually happening. They do have some failure cases of the single frame model that their model is able to handle up here. And they make a lot of sense. So here, you can see that there's an object that's moving out of frame. And the single frame detector wasn't able to recognize this, probably because it's moving out of frame. Whereas this new this context RCNN is able to detect it probably because it looked at the frame just before it where the car was somewhere back here. And it could correctly classify it. Well, that's, well, just disregard my drawings. Here, it managed to recognize this animal in the back, whereas this old model, the single frame model hasn't also probably by looking either at frames next to it or by looking at other frames of herds of animals and realizing that usually when there's two elephants, there's more. Here, you can see that the object highly occluded. So we're talking about the object like at the very edge of the frame object poorly lit. This is particularly impressive. And also an example where the animals are often in herds. And if you see one deer, the likelihood that there's other deer is very high in this particular camera. And by aggregating information from different frames, you can see that maybe it's always the same patch of deer that comes by. And here, the single frame detector detects this patch here as a vehicle where it shouldn't. And of course, the new model, the context RCNN is able to recognize that this is present in all of the frames. And in most frames, the single object detector doesn't detect it as a vehicle. And so it can kind of carry over that information. Now, you can already see sort of what the downsides might be if the single object detector is like very, very, very sure that this is in in a single frame that this is a car, it could carry over that information to the other frame. So even though the single frame detector might have failed in that particular frame, if it fails super hard, it might, you know, shout that to all the other frames basically dominate the memory saying like, look, this is a car, I'm like pretty sure. And it will carry over that information to all of the other frames. And they say in one of the in one of these high confidence mistakes, it basically detected the same tree as a giraffe over and over again. What I find particularly interesting is they do look at so here they have this this curve of on the bottom, you have confidence threshold, so how confident the model is. And on the y axis, you have the number of false positives. And you can see that in the low confidence regime, the context our CNN has lower false positives than the single frame detector. And the green line here is when you only have positive boxes. So when you only include regions of interest where there is an actual object, which in this case is sort of hurtful, you also want the regions of interest where there is nothing, because that helps you avoid false positives in other frames. That's why the orange line is below the green line. But strangely here, in the high confidence regime, you can see that the single frame model has fewer false positives than the context our CNN and I like the text that they have to this. In figure seven, we can see that adding empty representations reduces the number of false positives across all confidence threshold compared to the same model with only positive representations. We investigated the 100 highest confidence false positives from context our CNN and found that in almost all of them in 97 out of 100, the model had correctly found and classified animals that were missed by human annotators. So basically, these graphs are even underestimating how good that model is because the model is seems, appears to be better than the human annotators of the test set. I find that to be pretty, pretty impressive. And here you can see failure modes, where they say, for example, when exploring the confident false positives on the snapshot Serengeti data set, yada, yada, yada, the three out of 100 images, so whatever was not fail human failure, were where context our CNN erroneously detected an animal where we're all of the same tree, highly confidently predicted to be a giraffe. So this is a failure mode when, when the model is highly confident, it might spill that over to other frames, because he we now aggregate the information within the same camera across the frames. To be said, of course, their train test split is such that there's not the same camera in the training data as in the testing data, they have different, different, entirely different cameras in the testing data than in the training data, just so there is no information leakage. Yeah, so that is the that's the model right here, how it works, it's it's pretty cool. It kind of wedges itself in between any single frame object detector that has these two stages. And, you know, it's a pretty neat idea to bring in context from from the past or even the future of the same camera. Just a quick glance at the appendix, they have lots of different examples right here. In one example, their camera kind of fell over and they say, well, it's still worked the camera with the system was still able to kind of do attention across this failure, this kind of tipping over off the camera. They have more examples right here, which I find pretty impressive, like the super low light things where it correctly detects like the possum. And yeah, I invite you to check out the paper, the code they say should be out soon. And I'll see you next time. Bye bye.
[{"start": 0.0, "end": 6.28, "text": " Hi there, today we'll look at Context R-CNN, Long Term Temporal Context for Per Camera"}, {"start": 6.28, "end": 12.040000000000001, "text": " Object Detection by Sarah Beery, Guan Hong Wu, Vivek Rathod, Ronny Votel and Jonathan"}, {"start": 12.040000000000001, "end": 19.36, "text": " Huang. So on a high level, this paper tries to do object detection for cameras where you"}, {"start": 19.36, "end": 24.36, "text": " the camera is in the same place for a long time. For example, these wild trap cameras"}, {"start": 24.36, "end": 32.2, "text": " or traffic cameras right here. It proposes to do object detection by incorporating data"}, {"start": 32.2, "end": 37.6, "text": " from the images that the camera has seen in the past to help the detection in the current"}, {"start": 37.6, "end": 47.64, "text": " frame. And it does so via an attention mechanism that it runs over a memory of past data. So"}, {"start": 47.64, "end": 52.84, "text": " we're going to take a look at how this is done and how well it works. And yes, stick"}, {"start": 52.84, "end": 58.64, "text": " around if you want to know. As always, if you enjoy content like this, then consider"}, {"start": 58.64, "end": 63.36, "text": " sharing it out telling your friends about it. Subscribe if you haven't and tell me what"}, {"start": 63.36, "end": 71.44, "text": " you think in the comments. So the paper starts off and describes the problem and the problem"}, {"start": 71.44, "end": 76.64, "text": " is fairly simple. You want to do object detection in images. Object detection is the task of"}, {"start": 76.64, "end": 82.0, "text": " basically if you if I give you an image, you should tell me what is on the image and where."}, {"start": 82.0, "end": 88.84, "text": " So in this case, here, you would have to draw me this bounding box and say, this is a deer."}, {"start": 88.84, "end": 94.1, "text": " On the bottom, you would have to draw bounding boxes. Maybe they have to be rectangular,"}, {"start": 94.1, "end": 100.0, "text": " maybe not and say this is a bus. And here is a truck and here is another truck and here"}, {"start": 100.0, "end": 107.76, "text": " is a car and so on. So there can be many objects in an image, there can be one object, there"}, {"start": 107.76, "end": 114.36, "text": " can be objects of different classes, or there can be no objects at all. So this is just"}, {"start": 114.36, "end": 119.0, "text": " object detection. And there have been many papers on this. And specifically, there has"}, {"start": 119.0, "end": 126.10000000000001, "text": " been this rCNN. And this is the model that we're going to extend. So the rCNN model or"}, {"start": 126.10000000000001, "end": 134.56, "text": " specifically the faster rCNN model that we're going to build on is a model that simply detects"}, {"start": 134.56, "end": 140.16, "text": " these bounding boxes in single in single images. But now we consider the situation where we"}, {"start": 140.16, "end": 149.28, "text": " have a camera that records images for a long, long time. So in these wild trap cameras,"}, {"start": 149.28, "end": 156.24, "text": " they often sit there for months. And it's not that easy to make use of them. Because"}, {"start": 156.24, "end": 161.68, "text": " in addition to there being a lot of data, they have motion triggers. So that could be"}, {"start": 161.68, "end": 167.48000000000002, "text": " there is no nothing for a long time. And then there's a the the animal walks in the trap."}, {"start": 167.48000000000002, "end": 173.6, "text": " And then you have a bunch of images, like one per second for 10 seconds. And then you"}, {"start": 173.6, "end": 178.26000000000002, "text": " have nothing again for like a day or two days. And then you have 10 images again, because"}, {"start": 178.26000000000002, "end": 183.84, "text": " another animal walks in or maybe doesn't, and so on and another. So you have irregular"}, {"start": 183.84, "end": 190.96, "text": " sampling frequencies, you have very, very different distance between the frames. All"}, {"start": 190.96, "end": 198.36, "text": " of this makes it very, very not suited for models like temporal convolutions, or things"}, {"start": 198.36, "end": 203.46, "text": " like LSTMs, because they don't work super well with data like this. Now, I know there"}, {"start": 203.46, "end": 211.24, "text": " are formulations where LSTMs can do this, but they don't work very well with these super"}, {"start": 211.24, "end": 218.64000000000001, "text": " long contexts and irregular sampling frequencies and so on. So the idea is if we have a frame"}, {"start": 218.64, "end": 224.67999999999998, "text": " right here, like this one, and we want to detect what's on it, we should be able to"}, {"start": 224.67999999999998, "end": 230.83999999999997, "text": " pull information from other frames that the same camera has seen, like from this one,"}, {"start": 230.83999999999997, "end": 236.56, "text": " or from this one, or from this one right here. And we should be able to do so in a dynamic"}, {"start": 236.56, "end": 241.76, "text": " way. Now, why could that help? If you look at, for example, down here, these images have"}, {"start": 241.76, "end": 248.48, "text": " been taken, they say images were taken on separate days. But you can see this thing"}, {"start": 248.48, "end": 255.76, "text": " right here is in both images. So or a very similar thing is probably that bus's regular"}, {"start": 255.76, "end": 263.44, "text": " route. So in in order to classify if whether or not this here is a bus, it might be very"}, {"start": 263.44, "end": 268.48, "text": " helpful to also look at this picture right here and see, ah, you know, it's about at"}, {"start": 268.48, "end": 274.28000000000003, "text": " the same location, it looks the same. And also it looks like a bus. So, you know, that"}, {"start": 274.28000000000003, "end": 279.44, "text": " that kind of gives evidence that this could be this other thing could also be a bus. Then"}, {"start": 279.44, "end": 287.0, "text": " also there are background objects. So sometimes the single frame detectors get confused, it"}, {"start": 287.0, "end": 292.28000000000003, "text": " might be labeling this here as a car, because just the lighting the exact lighting in this"}, {"start": 292.28, "end": 298.47999999999996, "text": " picture is just off by the correct amount that it is confused. But considering this"}, {"start": 298.47999999999996, "end": 305.2, "text": " picture over here, maybe it recognizes here, no, that's not a car. And it can bring over"}, {"start": 305.2, "end": 311.59999999999997, "text": " this evidence to that frame and, and consider, ah, maybe, maybe, you know, this is the same"}, {"start": 311.59999999999997, "end": 317.26, "text": " thing. So it's it's not a car. So this is this is not the same than simply adding training"}, {"start": 317.26, "end": 323.44, "text": " data, we really consider the fact here that these images, they come from the same camera"}, {"start": 323.44, "end": 331.12, "text": " that is in the same location, or maybe, you know, that is filming the same thing. So this"}, {"start": 331.12, "end": 338.0, "text": " all of this is going to be within the same camera, not just adding adding, ah, I ID training"}, {"start": 338.0, "end": 344.8, "text": " data. And with animals as well, like, often the same animal has like its regular route,"}, {"start": 344.8, "end": 351.44, "text": " or within these 10, these bursts of 10s, the same as animal will kind of walk around a"}, {"start": 351.44, "end": 357.48, "text": " bit and maybe, you know, here, it's half occluded, but maybe in a different image, you see, ah,"}, {"start": 357.48, "end": 365.2, "text": " here I see the nose. So it helps you make a better prediction. Also, animals are often"}, {"start": 365.2, "end": 372.98, "text": " in kind of crowds in and that helps if you see that there are other deer around the probability"}, {"start": 372.98, "end": 380.72, "text": " that this is a deer increases rapidly. So how are we going to do this, what we're going"}, {"start": 380.72, "end": 387.42, "text": " to do is we're going to build an attention mechanism that can do these kinds of look"}, {"start": 387.42, "end": 394.44, "text": " into the past, and some also a little bit of the future, as we will see, but mainly"}, {"start": 394.44, "end": 400.32, "text": " will look into other images from the same camera in a dynamic way. And we'll learn how"}, {"start": 400.32, "end": 408.54, "text": " to address those other images from a memory bank. So the architecture is described right"}, {"start": 408.54, "end": 416.6, "text": " here. Now, as you can see, we are still in the business of doing object detection. So"}, {"start": 416.6, "end": 422.82, "text": " what we'll do is we'll sort of hijack a existing object detector. And the object detector we're"}, {"start": 422.82, "end": 430.12, "text": " going to hijack is going to be this FRCNN, this faster R-CNN object detector. That's"}, {"start": 430.12, "end": 437.6, "text": " an object detector for a single frame problem. So that means you have one image, and you're"}, {"start": 437.6, "end": 444.56, "text": " supposed to detect what's on it. It has two stages, as you can see. So stage one, if you"}, {"start": 444.56, "end": 448.92, "text": " have an image, and let's say there's some stuff on it, stuff, stuff, stuff, there's"}, {"start": 448.92, "end": 454.76, "text": " stuff, okay. This is what stage one is supposed to do is it's supposed to extract regions"}, {"start": 454.76, "end": 461.24, "text": " of interest. This could be, okay, all of these are regions of interest. So it simply says,"}, {"start": 461.24, "end": 467.56, "text": " well, there is something, there might be something right here in these regions of interest. And"}, {"start": 467.56, "end": 474.96, "text": " then it describes each of these regions of interest using features. Okay, so it extracts"}, {"start": 474.96, "end": 480.21999999999997, "text": " these regions of interest, and each region of interest gets features assigned to it."}, {"start": 480.22, "end": 487.90000000000003, "text": " So what these are, I think these are like seven by seven by 2048 features. But let's"}, {"start": 487.90000000000003, "end": 495.52000000000004, "text": " just say for the sake of describing it, that these are just a vector of features for each"}, {"start": 495.52000000000004, "end": 500.56, "text": " region of interest. So each region of interest is going to be associated with one vector"}, {"start": 500.56, "end": 507.6, "text": " of features that this model extracts. Okay, and the next region of interest also has a"}, {"start": 507.6, "end": 514.96, "text": " vector and the next region of interest also has a vector and so on. Stage two then takes"}, {"start": 514.96, "end": 522.88, "text": " each one of these takes each one of these vectors and assigns a class to it. So this"}, {"start": 522.88, "end": 528.96, "text": " would be deer right here. Okay, so stage one proposes regions of interest along with features,"}, {"start": 528.96, "end": 536.62, "text": " then stage two takes each of these regions of interest and classifies them basically."}, {"start": 536.62, "end": 540.74, "text": " And I guess there's there's many in between stage like this is massively simplified. There's"}, {"start": 540.74, "end": 547.24, "text": " no maximum suppression, there is kind of an alignment stage where you can refine the the"}, {"start": 547.24, "end": 552.92, "text": " bounding box and so on. But in essence, these are two stages. And you can see that this"}, {"start": 552.92, "end": 559.72, "text": " system here, it goes in between the two stages. So all of this right here, we shove in between"}, {"start": 559.72, "end": 567.32, "text": " the two stages. So we'll still use the stage one, and we'll still use the stage two. But"}, {"start": 567.32, "end": 573.72, "text": " in between in this thing right here, we'll try to sort of pimp these features such that"}, {"start": 573.72, "end": 579.52, "text": " the stage two detector has an easier time classifying. Okay, so we're going to pimp"}, {"start": 579.52, "end": 585.1600000000001, "text": " these features by incorporating in because these features right now, if we just do it"}, {"start": 585.16, "end": 591.48, "text": " with vanilla, these are just from the current frame. And we're going to add to them information"}, {"start": 591.48, "end": 598.42, "text": " from other frames of the same camera. And we're going to do it in two different ways."}, {"start": 598.42, "end": 603.9599999999999, "text": " So the first way, as you can see here, the first way is this short term memory. And the"}, {"start": 603.9599999999999, "end": 611.1999999999999, "text": " second way is the long term memory. Now, the two are slightly different. As you can guess,"}, {"start": 611.2, "end": 617.08, "text": " the short term memory is going to be only over a short time period around the current"}, {"start": 617.08, "end": 622.76, "text": " frame. And the long term memory is going to be basically across a very long time horizon"}, {"start": 622.76, "end": 630.36, "text": " into the past. You can see we're trying to classify this blue frame right here that what"}, {"start": 630.36, "end": 634.6400000000001, "text": " we call the key frame. So what we'll do is we'll run it through stage one, cool. So we"}, {"start": 634.6400000000001, "end": 640.2, "text": " have features for each region of interest. And then you can see this goes here and through"}, {"start": 640.2, "end": 647.96, "text": " these residual connections, this goes into stage two over here. So basically, stage two"}, {"start": 647.96, "end": 653.88, "text": " still receives the same input, it receives whatever stage one outputs for the keyframe."}, {"start": 653.88, "end": 661.4000000000001, "text": " But we're going to add to that twice. So we're going to add two things as I as I said, so"}, {"start": 661.4000000000001, "end": 668.36, "text": " the short term memory is added right here. Now, how do we build the short term memory,"}, {"start": 668.36, "end": 673.92, "text": " we build the short term memory simply by considering all the frames around the keyframe. And this"}, {"start": 673.92, "end": 678.92, "text": " you can see right here, the current window around the keyframe, which can be like one"}, {"start": 678.92, "end": 685.4, "text": " frame around it, or two frames or three frames, just a few frames around the current frame."}, {"start": 685.4, "end": 690.6, "text": " And this can be fairly helpful, as we said, for example, if the deer moves a bit, the"}, {"start": 690.6, "end": 696.24, "text": " car moves a bit, you know, it gets into a slightly different lighting and so on. This"}, {"start": 696.24, "end": 703.88, "text": " can help us very much to classify the current keyframe if we also have features from the"}, {"start": 703.88, "end": 710.2, "text": " surrounding frames. So for each of these surrounding frames, we also run them through the stage"}, {"start": 710.2, "end": 720.88, "text": " one detector to also extract regions of interest. And that all of these features go into this"}, {"start": 720.88, "end": 725.3, "text": " memory short term memory bank right here. There's different strategies, you don't always"}, {"start": 725.3, "end": 731.64, "text": " have to extract all of the regions of interest, you can also extract just the top one and"}, {"start": 731.64, "end": 736.4, "text": " so on. Or you can extract the mean, since these are fairly, you know, consistent, the"}, {"start": 736.4, "end": 740.3599999999999, "text": " cameras at the same place. There are many ways you can do this. But what you ultimately"}, {"start": 740.3599999999999, "end": 748.8399999999999, "text": " end up with is a short term memory bank that kind of is, so you'll have a bank and you"}, {"start": 748.84, "end": 755.6, "text": " have lots of these feature vectors in here for your region, your regions of interest"}, {"start": 755.6, "end": 762.96, "text": " of the surrounding frames. Now, if this here, if this here is your half occluded deer, right,"}, {"start": 762.96, "end": 769.84, "text": " so this is the half occluded deer, and you want to consider information from the surrounding"}, {"start": 769.84, "end": 776.6800000000001, "text": " frames, maybe in the next frame, so maybe this is three frames, like 123. And two is"}, {"start": 776.68, "end": 781.52, "text": " the key frame, maybe in the next frame, the deer moves a bit, and you see its nose. And"}, {"start": 781.52, "end": 787.92, "text": " that, this particular region of interest here is relevant. So how do you know, how do you"}, {"start": 787.92, "end": 796.52, "text": " now get from this entire memory, this feature vector that would be helpful? And the answer"}, {"start": 796.52, "end": 802.0799999999999, "text": " is you get it through an attention mechanism. You can see that right here, the way the short"}, {"start": 802.08, "end": 807.08, "text": " term memory is added is through this attention block. They describe the attention block right"}, {"start": 807.08, "end": 812.9200000000001, "text": " here, it is a fairly standard attention mechanism. So I've done a video on attention is all you"}, {"start": 812.9200000000001, "end": 818.96, "text": " need. If you don't know what an attention mechanism is, go check it out. But you can"}, {"start": 818.96, "end": 824.32, "text": " see it's it's very, very standard. So you have these input features, which are the features"}, {"start": 824.32, "end": 830.46, "text": " that come from the key frame. And you have the context features, which are all the features"}, {"start": 830.46, "end": 836.9000000000001, "text": " in your memory bank, you encode the input features with into a query using a fully connected"}, {"start": 836.9000000000001, "end": 843.7, "text": " layers and the context features into keys. And then you match the queries with the keys"}, {"start": 843.7, "end": 849.4000000000001, "text": " and the softmax in order to get a weighting over the context features. And then you aggregate"}, {"start": 849.4000000000001, "end": 855.6, "text": " the values from the context features. So this is a standard attention mechanism. What does"}, {"start": 855.6, "end": 863.48, "text": " it mean? It basically means that each of these vectors right here, they will emit a key that"}, {"start": 863.48, "end": 870.32, "text": " kind of describes what kind of information is contained in that vector. The vector over"}, {"start": 870.32, "end": 877.2, "text": " here will emit a query that describes what sort of information it is looking for to in"}, {"start": 877.2, "end": 882.44, "text": " order to describe what's in the region of interest as well as possible. And then you"}, {"start": 882.44, "end": 889.8000000000001, "text": " simply match the query with the keys to determine which key fits best to that query. And whichever"}, {"start": 889.8000000000001, "end": 896.12, "text": " one fits best, let's say this one here, then you take that vector from the memory bank"}, {"start": 896.12, "end": 904.1400000000001, "text": " and incorporate it together with your current information that you already have. So that's"}, {"start": 904.1400000000001, "end": 912.08, "text": " how you address things that from other frames using an attention mechanism. Okay, now, if"}, {"start": 912.08, "end": 919.36, "text": " this were all, you know, we could train this right now. We could train all of this because"}, {"start": 919.36, "end": 925.36, "text": " all of this is differentiable, right? This stage one detector right here is differentiable."}, {"start": 925.36, "end": 932.0400000000001, "text": " It goes here and here, you know, the information, the attention mechanism is differentiable."}, {"start": 932.0400000000001, "end": 936.8000000000001, "text": " The stage two detector is differentiable, all differentiable. Cool. We can train this"}, {"start": 936.8, "end": 943.16, "text": " end to end. Now what's the problem? The problem is this long term memory right here. So in"}, {"start": 943.16, "end": 949.3599999999999, "text": " this memory, ideally, we would want to fit, let's say an entire day, an entire week, or"}, {"start": 949.3599999999999, "end": 956.9599999999999, "text": " even an entire month of data from one of these cameras. And it's just not feasible that we"}, {"start": 956.9599999999999, "end": 964.38, "text": " expand this current window here to an entire month or an entire week. For many of those"}, {"start": 964.38, "end": 969.08, "text": " of those cameras, because even though they have a low frame rate, and so on, it's still"}, {"start": 969.08, "end": 977.56, "text": " too much in order to then be all differentiable, all back propagatable, and so on. So we can't"}, {"start": 977.56, "end": 984.24, "text": " really back prop in for these long term memory. In essence, what we want to do is exactly"}, {"start": 984.24, "end": 992.08, "text": " the same, we want to build up a memory of all of the regions of interest, or maybe selected"}, {"start": 992.08, "end": 997.64, "text": " regions or all of the best regions of interest, whatever heuristic strategy we have, of the"}, {"start": 997.64, "end": 1003.1600000000001, "text": " past, whatever this camera has seen, let's say in the last month or in the current week,"}, {"start": 1003.1600000000001, "end": 1009.24, "text": " or something like this, we want to build all of this up, and then use an attention mechanism,"}, {"start": 1009.24, "end": 1015.1800000000001, "text": " just the same in order to incorporate it. But we, we have to come up with these things"}, {"start": 1015.18, "end": 1022.3199999999999, "text": " right here, in some other way, than a way where we can back prop. So we can't really use this"}, {"start": 1022.3199999999999, "end": 1029.3999999999999, "text": " stage one detector right here, because this is this is the one we're training. And so"}, {"start": 1029.3999999999999, "end": 1034.54, "text": " we have to back prop through it. Now, an easy proposal is to simply use it anyway, but do"}, {"start": 1034.54, "end": 1040.6399999999999, "text": " like a stop gradient on it. So we don't back prop through it. That is one way but this,"}, {"start": 1040.64, "end": 1048.3200000000002, "text": " the paper decides on a different way, the paper decides that all of the all of the past,"}, {"start": 1048.3200000000002, "end": 1054.92, "text": " basically, right here, right here, and so on. We'll take a pre trained object detector."}, {"start": 1054.92, "end": 1060.2800000000002, "text": " So not the one we're training currently, but we'll take take a pre trained one that was"}, {"start": 1060.2800000000002, "end": 1066.48, "text": " pre trained either on something like cocoa, which is an object detection data set, or"}, {"start": 1066.48, "end": 1072.24, "text": " you can pre train it on cocoa and then fine tune it on a task you're interested in in"}, {"start": 1072.24, "end": 1078.84, "text": " a single frame fashion, in what for whatever way we'll take a pre trained object detector,"}, {"start": 1078.84, "end": 1086.08, "text": " or region of interest extractor. And that will give us for each frame in the past will"}, {"start": 1086.08, "end": 1094.16, "text": " give us also the regions of interest, along with the features. Okay. And these are the"}, {"start": 1094.16, "end": 1102.2, "text": " features that we then go and put into put into the memory bank. Sorry, my tablet just"}, {"start": 1102.2, "end": 1111.48, "text": " crashed a bit. There we go. Okay, so we'll take a pre trained extractor right here. That"}, {"start": 1111.48, "end": 1116.0800000000002, "text": " will give us features for regions of interest, we'll put that into the memory bank. And then"}, {"start": 1116.0800000000002, "end": 1122.6000000000001, "text": " we will use an attention mechanism to incorporate it. Now the attention mechanism we can train,"}, {"start": 1122.6, "end": 1129.04, "text": " but we cannot train the extractor for the features. And this is the difference to the"}, {"start": 1129.04, "end": 1134.9599999999998, "text": " short term memory where we can actually train the feature extractor in order to help us"}, {"start": 1134.9599999999998, "end": 1140.9199999999998, "text": " with you know, building the memory. Now the memory is simply built without a goal in mind,"}, {"start": 1140.9199999999998, "end": 1146.9199999999998, "text": " basically. And the attention mechanism, the attention mechanism basically has to learn"}, {"start": 1146.9199999999998, "end": 1151.36, "text": " that it doesn't work with features that are meant for its task, it works with features"}, {"start": 1151.36, "end": 1157.08, "text": " that have been originally created for a different tasks, and they're not going to change. But"}, {"start": 1157.08, "end": 1164.6399999999999, "text": " as we'll see, this, you know, can be handled. So that's what they do, they incorporate short"}, {"start": 1164.6399999999999, "end": 1169.9199999999998, "text": " term and long term memory into their stage two prediction, and then the stage two prediction"}, {"start": 1169.9199999999998, "end": 1176.76, "text": " simply takes in all of those features and classifies the class of the object. And that's"}, {"start": 1176.76, "end": 1186.12, "text": " the architecture of context or CNN, it's our CNN with long and short term context. So they"}, {"start": 1186.12, "end": 1191.34, "text": " describe very different ways of you know, how they built the memory and so on how they"}, {"start": 1191.34, "end": 1197.52, "text": " built the features. I didn't I kind of glossed over this right now. There's a lot of consideration"}, {"start": 1197.52, "end": 1204.44, "text": " in building these thing and you have to look at the paper, how they exactly do this. I'm"}, {"start": 1204.44, "end": 1210.52, "text": " more interested in the high level architecture and the sort of ideas behind it. So when they"}, {"start": 1210.52, "end": 1219.76, "text": " do this, they do outperform the, they do outperform the current or the single frame baselines"}, {"start": 1219.76, "end": 1226.76, "text": " by quite a bit. So this SS and this CCT are these wildlife data sets, whereas this CC,"}, {"start": 1226.76, "end": 1234.54, "text": " I think this is the city something city cam, these are this street data set. As you can see,"}, {"start": 1234.54, "end": 1240.92, "text": " they do outperform the single frame baseline by quite a bit. Now interesting, as you can"}, {"start": 1240.92, "end": 1247.4, "text": " see right here, as they increase the time horizon of this long term memory, so they"}, {"start": 1247.4, "end": 1252.82, "text": " they can they can now choose how much information do they want to put in that long term memory,"}, {"start": 1252.82, "end": 1258.72, "text": " as they increase the time horizon for one minute, one hour, one day, and so on, the"}, {"start": 1258.72, "end": 1265.46, "text": " performance goes up and up and up, which is, you know, a strong indication that these features"}, {"start": 1265.46, "end": 1271.2, "text": " actually help from the from the time horizon, because you don't have more parameters, you"}, {"start": 1271.2, "end": 1279.6, "text": " simply increase the amount of information in the memory bank. And if the performance"}, {"start": 1279.6, "end": 1285.52, "text": " goes up, you can make a very strong claim that these these this is actually due to the"}, {"start": 1285.52, "end": 1290.1599999999999, "text": " fact that you have more information in that memory bank couldn't really guess any other"}, {"start": 1290.1599999999999, "end": 1298.6999999999998, "text": " explanation right here. So they they do it, they do investigate different memory strategies,"}, {"start": 1298.6999999999998, "end": 1303.76, "text": " they do a lot of ablations right here, where they also say, Okay, what if we only have"}, {"start": 1303.76, "end": 1308.8799999999999, "text": " the short term attention? What if we only have the long term attention? What do only"}, {"start": 1308.88, "end": 1313.64, "text": " if we only have self attention, that means attention only into the current frame, but"}, {"start": 1313.64, "end": 1319.3200000000002, "text": " of across regions of interest, that's interesting, if you have like a herd of animals and so"}, {"start": 1319.3200000000002, "end": 1324.68, "text": " on, and they all help. But as you can see, the long term attention tends to help the"}, {"start": 1324.68, "end": 1332.4, "text": " most in this data set. And short term attention help helps a lot in this data set, if you"}, {"start": 1332.4, "end": 1337.92, "text": " just compare to the other owner, these are two different metrics, not data sets, sorry"}, {"start": 1337.92, "end": 1346.76, "text": " about that. But in essence, it helps the most when you combine the two. And that's, you"}, {"start": 1346.76, "end": 1355.92, "text": " know, that's pretty cool to see. So they do some qualitative results, which I find very"}, {"start": 1355.92, "end": 1362.28, "text": " interesting. For example, they can visualize what the attention weights of their models"}, {"start": 1362.28, "end": 1370.6399999999999, "text": " are. So here, you always have a very long timeframe, I think an entire month in this"}, {"start": 1370.6399999999999, "end": 1376.8799999999999, "text": " in this memory bank of the long term memory. Now, in the top classification, you see the"}, {"start": 1376.8799999999999, "end": 1382.66, "text": " large thing here, the large frame is the one you actually want to classify. And the other"}, {"start": 1382.66, "end": 1390.3999999999999, "text": " frames are the frames where the top attention score is so that the attention weights are"}, {"start": 1390.4, "end": 1398.3400000000001, "text": " the highest. So here, in order to classify this, what does the model pay attention to?"}, {"start": 1398.3400000000001, "end": 1404.16, "text": " Or which other frames does the model pay attention to? And you can see right here, they are all"}, {"start": 1404.16, "end": 1410.92, "text": " spread across the entire month, here is the timeline, the most attended two pictures are"}, {"start": 1410.92, "end": 1416.88, "text": " spread across the entire month, and almost all of them actually have that war talk in"}, {"start": 1416.88, "end": 1425.68, "text": " here. So this must be like its regular route. And the model recognizes that and pulls in"}, {"start": 1425.68, "end": 1433.1200000000001, "text": " information from all these other images in order to correctly classify it here. On the"}, {"start": 1433.1200000000001, "end": 1445.5200000000002, "text": " other hand, on the next example, this gazelle and tablet crashed right here. It also puts"}, {"start": 1445.52, "end": 1451.84, "text": " all the all the weight on top of the of images of that same gazelle. But you can see maybe"}, {"start": 1451.84, "end": 1458.8799999999999, "text": " that gazelle was only there for this one particular moment. And all the pictures this camera has"}, {"start": 1458.8799999999999, "end": 1464.46, "text": " of it is, you know, in the very few moments that the gazelle was around, you can see they"}, {"start": 1464.46, "end": 1470.8, "text": " all come here from the same point in time, or very, very close points in time. And you"}, {"start": 1470.8, "end": 1478.56, "text": " can see that it puts a lot of weight on wherever the gazelle is. So, you know, that's a pretty"}, {"start": 1478.56, "end": 1482.8, "text": " strong indication that it actually learns to pull in the correct information be that"}, {"start": 1482.8, "end": 1490.76, "text": " from long time horizon, or from a short time horizon, if necessary. You can also see right"}, {"start": 1490.76, "end": 1501.8799999999999, "text": " here, they visualize the top attention, where the top attention weights go in terms of how long the"}, {"start": 1501.8799999999999, "end": 1509.0, "text": " frames where the attention goes to is away from the frame that they're trying to classify."}, {"start": 1509.0, "end": 1516.52, "text": " So these graphics are somewhat kind of weird to interpret. This here always means how much"}, {"start": 1516.52, "end": 1522.92, "text": " is the total time of the buffer. So the memory buffer here contains always pictures from"}, {"start": 1522.92, "end": 1529.76, "text": " the total from one hour before until one hour after the keyframe you want to classify. So"}, {"start": 1529.76, "end": 1535.6399999999999, "text": " this is the frame you want to classify at minute zero. And the memory buffer contains"}, {"start": 1535.6399999999999, "end": 1541.92, "text": " images from 60 minutes before to 60 minutes after. So it's not real time, right, you go"}, {"start": 1541.92, "end": 1546.5800000000002, "text": " back to your through your footage and you try to classify. So you can also pull out"}, {"start": 1546.5800000000002, "end": 1552.92, "text": " images from the future. You can see there's most attention is on the current frame, which"}, {"start": 1552.92, "end": 1557.92, "text": " makes sense. You're trying to classify the current frame, and then kind of falls off"}, {"start": 1557.92, "end": 1562.96, "text": " as you go further and further away. And this is across the entire data set. So this is"}, {"start": 1562.96, "end": 1568.64, "text": " not a specific example, which also makes sense, probably, in most of the time, the relevant"}, {"start": 1568.64, "end": 1574.72, "text": " information is, you know, next closer in time rather than farther away. But also, you can"}, {"start": 1574.72, "end": 1580.4, "text": " see that the distribution is pretty spread out. So it makes the model makes use of the"}, {"start": 1580.4, "end": 1585.44, "text": " entire range of time. And you can see that throughout even if you have an entire day"}, {"start": 1585.44, "end": 1591.4, "text": " in the buffer, or two days, even if you have entire week before and week after in the buffer,"}, {"start": 1591.4, "end": 1598.0, "text": " and even if you have an entire month here. And especially, if you look at when you have"}, {"start": 1598.0, "end": 1605.88, "text": " an entire week in the buffer, you can see the periodicity through the days. So that"}, {"start": 1605.88, "end": 1613.36, "text": " means the model tends to pay attention to images that are from the same time of day,"}, {"start": 1613.36, "end": 1619.04, "text": " compared to the current keyframe. That's a fairly, fairly good indication that the model"}, {"start": 1619.04, "end": 1625.72, "text": " has actually learned to address these this memory by its content, right? Now, night and"}, {"start": 1625.72, "end": 1631.16, "text": " day isn't super difficult, because you can just go on the brightness and so on. But still,"}, {"start": 1631.16, "end": 1637.48, "text": " it's pretty cool to see that this is actually happening. They do have some failure cases"}, {"start": 1637.48, "end": 1645.88, "text": " of the single frame model that their model is able to handle up here. And they make a"}, {"start": 1645.88, "end": 1653.76, "text": " lot of sense. So here, you can see that there's an object that's moving out of frame. And"}, {"start": 1653.76, "end": 1660.08, "text": " the single frame detector wasn't able to recognize this, probably because it's moving out of"}, {"start": 1660.08, "end": 1665.92, "text": " frame. Whereas this new this context RCNN is able to detect it probably because it looked"}, {"start": 1665.92, "end": 1673.32, "text": " at the frame just before it where the car was somewhere back here. And it could correctly"}, {"start": 1673.32, "end": 1682.0, "text": " classify it. Well, that's, well, just disregard my drawings. Here, it managed to recognize"}, {"start": 1682.0, "end": 1688.38, "text": " this animal in the back, whereas this old model, the single frame model hasn't also"}, {"start": 1688.38, "end": 1696.08, "text": " probably by looking either at frames next to it or by looking at other frames of herds"}, {"start": 1696.08, "end": 1703.58, "text": " of animals and realizing that usually when there's two elephants, there's more. Here,"}, {"start": 1703.58, "end": 1708.56, "text": " you can see that the object highly occluded. So we're talking about the object like at"}, {"start": 1708.56, "end": 1716.52, "text": " the very edge of the frame object poorly lit. This is particularly impressive. And also"}, {"start": 1716.52, "end": 1723.22, "text": " an example where the animals are often in herds. And if you see one deer, the likelihood"}, {"start": 1723.22, "end": 1731.04, "text": " that there's other deer is very high in this particular camera. And by aggregating information"}, {"start": 1731.04, "end": 1736.1599999999999, "text": " from different frames, you can see that maybe it's always the same patch of deer that comes"}, {"start": 1736.16, "end": 1746.1200000000001, "text": " by. And here, the single frame detector detects this patch here as a vehicle where it shouldn't."}, {"start": 1746.1200000000001, "end": 1751.76, "text": " And of course, the new model, the context RCNN is able to recognize that this is present"}, {"start": 1751.76, "end": 1759.24, "text": " in all of the frames. And in most frames, the single object detector doesn't detect"}, {"start": 1759.24, "end": 1766.44, "text": " it as a vehicle. And so it can kind of carry over that information. Now, you can already"}, {"start": 1766.44, "end": 1771.48, "text": " see sort of what the downsides might be if the single object detector is like very, very,"}, {"start": 1771.48, "end": 1779.2, "text": " very sure that this is in in a single frame that this is a car, it could carry over that"}, {"start": 1779.2, "end": 1784.96, "text": " information to the other frame. So even though the single frame detector might have failed"}, {"start": 1784.96, "end": 1789.8, "text": " in that particular frame, if it fails super hard, it might, you know, shout that to all"}, {"start": 1789.8, "end": 1793.72, "text": " the other frames basically dominate the memory saying like, look, this is a car, I'm like"}, {"start": 1793.72, "end": 1802.44, "text": " pretty sure. And it will carry over that information to all of the other frames. And they say in"}, {"start": 1802.44, "end": 1808.92, "text": " one of the in one of these high confidence mistakes, it basically detected the same tree"}, {"start": 1808.92, "end": 1818.4, "text": " as a giraffe over and over again. What I find particularly interesting is they do look at"}, {"start": 1818.4, "end": 1825.92, "text": " so here they have this this curve of on the bottom, you have confidence threshold, so"}, {"start": 1825.92, "end": 1833.1200000000001, "text": " how confident the model is. And on the y axis, you have the number of false positives. And"}, {"start": 1833.12, "end": 1842.2399999999998, "text": " you can see that in the low confidence regime, the context our CNN has lower false positives"}, {"start": 1842.2399999999998, "end": 1849.4199999999998, "text": " than the single frame detector. And the green line here is when you only have positive boxes."}, {"start": 1849.4199999999998, "end": 1856.4799999999998, "text": " So when you only include regions of interest where there is an actual object, which in"}, {"start": 1856.4799999999998, "end": 1862.56, "text": " this case is sort of hurtful, you also want the regions of interest where there is nothing,"}, {"start": 1862.56, "end": 1868.2, "text": " because that helps you avoid false positives in other frames. That's why the orange line"}, {"start": 1868.2, "end": 1872.84, "text": " is below the green line. But strangely here, in the high confidence regime, you can see"}, {"start": 1872.84, "end": 1879.8, "text": " that the single frame model has fewer false positives than the context our CNN and I like"}, {"start": 1879.8, "end": 1888.32, "text": " the text that they have to this. In figure seven, we can see that adding empty representations"}, {"start": 1888.32, "end": 1892.56, "text": " reduces the number of false positives across all confidence threshold compared to the same"}, {"start": 1892.56, "end": 1898.84, "text": " model with only positive representations. We investigated the 100 highest confidence"}, {"start": 1898.84, "end": 1905.52, "text": " false positives from context our CNN and found that in almost all of them in 97 out of 100,"}, {"start": 1905.52, "end": 1912.4399999999998, "text": " the model had correctly found and classified animals that were missed by human annotators."}, {"start": 1912.44, "end": 1922.3200000000002, "text": " So basically, these graphs are even underestimating how good that model is because the model is"}, {"start": 1922.3200000000002, "end": 1929.68, "text": " seems, appears to be better than the human annotators of the test set. I find that to"}, {"start": 1929.68, "end": 1937.28, "text": " be pretty, pretty impressive. And here you can see failure modes, where they say, for"}, {"start": 1937.28, "end": 1942.8799999999999, "text": " example, when exploring the confident false positives on the snapshot Serengeti data set,"}, {"start": 1942.8799999999999, "end": 1950.6, "text": " yada, yada, yada, the three out of 100 images, so whatever was not fail human failure, were"}, {"start": 1950.6, "end": 1957.96, "text": " where context our CNN erroneously detected an animal where we're all of the same tree,"}, {"start": 1957.96, "end": 1964.48, "text": " highly confidently predicted to be a giraffe. So this is a failure mode when, when the model"}, {"start": 1964.48, "end": 1970.64, "text": " is highly confident, it might spill that over to other frames, because he we now aggregate"}, {"start": 1970.64, "end": 1979.28, "text": " the information within the same camera across the frames. To be said, of course, their train"}, {"start": 1979.28, "end": 1984.76, "text": " test split is such that there's not the same camera in the training data as in the testing"}, {"start": 1984.76, "end": 1990.84, "text": " data, they have different, different, entirely different cameras in the testing data than"}, {"start": 1990.84, "end": 1998.1999999999998, "text": " in the training data, just so there is no information leakage. Yeah, so that is the"}, {"start": 1998.1999999999998, "end": 2004.04, "text": " that's the model right here, how it works, it's it's pretty cool. It kind of wedges itself"}, {"start": 2004.04, "end": 2010.08, "text": " in between any single frame object detector that has these two stages. And, you know,"}, {"start": 2010.08, "end": 2018.1999999999998, "text": " it's a pretty neat idea to bring in context from from the past or even the future of the"}, {"start": 2018.2, "end": 2023.32, "text": " same camera. Just a quick glance at the appendix, they have lots of different examples right"}, {"start": 2023.32, "end": 2028.44, "text": " here. In one example, their camera kind of fell over and they say, well, it's still worked"}, {"start": 2028.44, "end": 2035.06, "text": " the camera with the system was still able to kind of do attention across this failure,"}, {"start": 2035.06, "end": 2042.7, "text": " this kind of tipping over off the camera. They have more examples right here, which"}, {"start": 2042.7, "end": 2049.84, "text": " I find pretty impressive, like the super low light things where it correctly detects like"}, {"start": 2049.84, "end": 2057.54, "text": " the possum. And yeah, I invite you to check out the paper, the code they say should be"}, {"start": 2057.54, "end": 2076.64, "text": " out soon. And I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=Hdo81GtLC_4
Direct Feedback Alignment Scales to Modern Deep Learning Tasks and Architectures (Paper Explained)
Backpropagation is one of the central components of modern deep learning. However, it's not biologically plausible, which limits the applicability of deep learning to understand how the human brain works. Direct Feedback Alignment is a biologically plausible alternative and this paper shows that, contrary to previous research, it can be successfully applied to modern deep architectures and solve challenging tasks. OUTLINE: 0:00 - Intro & Overview 1:40 - The Problem with Backpropagation 10:25 - Direct Feedback Alignment 21:00 - My Intuition why DFA works 31:20 - Experiments Paper: https://arxiv.org/abs/2006.12878 Code: https://github.com/lightonai/dfa-scales-to-modern-deep-learning Referenced Paper by Arild Nøkland: https://arxiv.org/abs/1609.01596 Abstract: Despite being the workhorse of deep learning, the backpropagation algorithm is no panacea. It enforces sequential layer updates, thus preventing efficient parallelization of the training process. Furthermore, its biological plausibility is being challenged. Alternative schemes have been devised; yet, under the constraint of synaptic asymmetry, none have scaled to modern deep learning tasks and architectures. Here, we challenge this perspective, and study the applicability of Direct Feedback Alignment to neural view synthesis, recommender systems, geometric learning, and natural language processing. In contrast with previous studies limited to computer vision tasks, our findings show that it successfully trains a large range of state-of-the-art deep learning architectures, with performance close to fine-tuned backpropagation. At variance with common beliefs, our work supports that challenging tasks can be tackled in the absence of weight transport. Authors: Julien Launay, Iacopo Poli, François Boniface, Florent Krzakala Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there. Today we'll look at Direct Feedback Alignment Scales to Modern Deep Learning Tasks and Architectures by Giulia Loney, Jacopo Poli, Francois Boniface and Florian Crisakala. So this paper on a high level, it replaces the backpropagation algorithm in deep learning architectures with this algorithm called direct feedback alignment, which is more biologically plausible. The algorithm has been around for a while, but it hasn't yet been shown to be applicable to really modern big deep learning architectures and then perform on par with backprop on modern deep learning tasks. This paper, as I understand it, is the first one to demonstrate that it can do that. So this is very much an engineering paper, an applied paper, and we're going to mostly go into direct feedback alignment as such. And I don't think we're going to go too much into what the actual empirical findings are, because they even though they're impressive, and it's a good piece of engineering, I think they can be summarized pretty much by it, it works not yet on par with backpropagation, but into a promising direction. Alright, as always, if you like content like this, consider sharing it out and leaving a like and tell me in the comments what you like, of course, subscribe if you aren't yet that that is, you know, essential. Otherwise, how are we going to hear from me in the future? Okay, let's dive in. They say despite being the workhorse of deep learning, the backpropagation algorithm is no panacea. It enforces sequential layer updates thus preventing efficient parallelization of the training process. Furthermore, its biological plausibility is being challenged. Alternative schemes have been devised yet under the constraints of synaptic asymmetry. None have scaled to modern deep learning tasks and architectures. Here we challenge this perspective and study the applicability of direct feedback alignment to neural view synthesis, recommender systems, geometric learning and natural language processing. In contrast with previous studies, limited to computer vision tasks, our findings show that it successfully trains a large range of state of the art deep learning architectures with performance close to fine tuned backpropagation. At variance with common beliefs, our work supports that challenging tasks can be tackled in the absence of weight transport. So there's a lot to unpack in this particular abstract right here. So first of all, what's the problem with backpropagation? Backpropagation, they have they have two quarrels right here. First of all, it's preventing efficient parallelization of the training process. So what does that mean? So in backpropagation, I'm pretty sure you all know, it's basic backpropagation, but you have an input to a neural network. And the neural network has a bunch of layers. So the input will travel layer by layer. And at the end, you'll get some output and your output y hat, let's call it here what the neural network thinks the let's say it's a classifier thinks that the class of this particular x should be now in the data set, you have your true label, and then you compare that to your output label, and you can compute a loss function. Now, the whole question of the backpropagation algorithm is how do I need to change my layers of the neural network in order to make the loss as small as possible. And for that, you can use backpropagation, that means you can take that loss and you can backpropagate it down the layers in order to update each layer individually. So the first problem they have here with the backpropagation algorithm, and it's not, I mean, it's kind of a secondary problem, but it is that is sequential. So in order to update this layer right here, you need to have already back propagated to this layer, and then you need to back propagate further to this and to this layer. So it's a sequential task, you need to back propagate down the layers again, whereas what is more plausible, but what would be more efficient if if we could somehow update all the layers in parallel, but this is a minor quarrel. The bigger one is that backpropagation isn't biologically plausible. We know that in real neurons, you have your your dendrites, your inputs, and you have your axon, and the signal only travels in one direction, we don't know of a feedback mechanism in true neurons in the brain that would allow for information sort of to flow in the opposite direction, there is there is information flowing the opposite direction, but it's it's, I guess, I think it's too slow. And it's so it's not really, it can't be, there's no analogous way of backpropagation, there's no nothing in the brain that would take the role of the backpropagation algorithm. Specifically, if each layer is characterized by a weight matrix, right here, what backpropagation does is it uses the transpose of that weight matrix to back propagate. So these, these arrows to the front, right here, they use the weight matrices, and these arrows to the back, they use the transposes of the weight matrices. So the transposes of the weight matrices, sort of relay the information of what needs to change, that would be the loss, what needs to change to make the loss as small as possible, they relay this information down to the other layers. And we don't know of any biological analog, analogy to this mechanism right here, this transpose, it acts as sort of a layer inverse. And that is called weight transport. So weight transport means that you can you can do something like the transpose of the weights basically, to carry to bring information from the next layer back to this layer. And in biology, we don't have this. And in direct feedback alignment, we don't have this either. So direct feedback alignment, the next thing here in this abstract is the algorithm that they are going to apply here, direct feedback alignment, and we'll go into what it is, but it is more biologically plausible, in that what it does is it takes the loss somehow, and it distributes it globally to all of these layers like this. And it does so without requiring these transposes and also without requiring these sequential steps. So both of their proposed problems here would be solved by this. They say they say that in contrast with previous studies limited to computer vision tasks. So what people have tried to do is they have tried to apply this DFA algorithm to computer vision tasks. But in computer vision, most architectures are CNNs. And as I understand it, as far as I understand it, DFA can only right now be applied to linear layers. So something that is w x plus b, and then a non linearity. It cannot even though you can write to CNN as like a linear layer with constraints. As I read this paper, I think to interpret that you can only apply DFA to fully connected layers or things that look kind of like fully connected layers. So what they're going to do in their experiments is they're going to take these big architectures like transformers and replace parts of them with the parts that act as fully connected layers with with DFA updates. So well, they're not going to replace the layers, but they're going to replace the back propagation part of it with DFA updates. It remains to say that they still use back propagation at some places where they can't replace the updates with DFA. And that means where the layer isn't, you know, a fully connected layer or I guess it's too big, they somehow have to make it work. So often they will not update, for example, the embedding layers, and things like this. Okay, so what they're saying is they go away from computer vision tasks. Because if you go to computer vision, and CNNs rule that world, right, you can only do four feet forward layers, fully connected layers, you're going to lose already. And so, yeah, it's kind of an unfair fight in that in that sense. But even in absence of that, they say we apply this to neural view synthesis recommender systems, geometric learning and natural language processing. So these are quite diverse tasks. And they're going to be quite diverse architectures that they're applying it to, for example, in geometric learning, I believe they do graph neural networks. And there, there, they replace the, the usually in graph neural networks, there are fully connected layers that connect the two the vertices and the edges together and compute properties of them. So that's a pretty good point for using DFA, right? Because what you're looking for is state of the art tasks and architectures that still employ fully connected layers because there your algorithm can shine. Okay, so that's it. And they're basically going to show that this is performance is close to fine tuned back propagation. Right. So what is DFA? What is this direct feedback alignment? And for that, I actually want to jump papers right here and go to this other paper that describes DFA in a bit in a bit, not more detail, but in a graphic fashion. So this paper right here, direct feedback alignment provides learning in deep neural networks by RL Nocklund, sorry, Nocklund shows some theoretical properties about DFA. Now, I don't want to go into the theory right here or in the math, but I mainly like this paper for this particular graphic right here. So in the back propagation algorithm, as you can see, you forward propagate using these weight matrices, and then you back propagate using the transposes of the weight matrices. Now one step after that is this thing right here. It's called feedback alignment. It's not the same thing as direct feedback alignment. In feedback alignment, you simply say, Well, I won't back prop using these transposes because I can't because that's not biologically possible. What I'll do is I'll use other matrices. And these other matrices are going to be random matrices. And by random matrices, we really mean a matrix that is of you know, the correct shape, the same shape as this W transpose. But each entry is going to be sampled from a like a random Gaussian, right? Now, I don't mean like the distribution of Gaussians, but you fix this matrix once at the beginning of training by sampling from Gaussian, and then you leave it there. And that's going to be the matrix that you use for relaying the signal back through the layers. Now, you might protest and say, wait, that's not going to work. Because specifically, this thing right here, it you know that you need to know the weights here to know what you need to change in the lower layers, you need to somehow have that information in there, how are you going to know what to change? And that's a valid question. And I will give my opinion of why this works. Okay. In a second in two seconds. First, this is feedback alignment. So simply use random matrices to back propagate, so to say. And then you have direct feedback alignment and direct feedback alignment goes a step further. Because in feedback alignment, you still do this in a sequential manner. Direct feedback alignment simply takes whatever the top change should be the change to the top layer. So how do I need to change the top layer, and it back propagates that in a this global fashion to all the layers directly using random matrices, okay. And then this IFA we're not going to look at today, because that's not relevant for this other paper. But I hope you can sort of see the overview here. So let's go back. Scroll, scroll, scroll, scroll, scroll, scroll, scroll. Okay, so here is the mathematical formulation of all of this. And it pays to look at it to understand what's going on. So they characterize a neural network right here as having n layers. Each neural network is the following each neural each layer takes whatever is the output of the last layer, multiplies it by a weight matrix. And that's going to be your a quantity, you put a through a non linearity to obtain the next layers input. Okay, so the H is the output of this layer, and the input of the next layer. At the very end, your last output is going to be your estimation of the labels. So your last non linearity is probably going to be something like a, a softmax or something like this. Okay. So how can we how can we have this as a concept in our heads? If you have the neural network right here, what you want to do is you want to forward prop always using your weight matrix w, and then your non linearity of that particular layer. And then the last in the last layer, you get your y hat, as we saw before. Now the question is, how can we adjust? How can we adjust this w right here to make y hat more into the direction of y. And here it's in here, it's useful to think of the last layer as a vector output. Like usually we think of the loss function. But in all of these algorithms, they always start with the derivative of the loss function with respect to the last layer output, so a y, and a y is here right before the non linearity. If you remember, this was f of a y. And this here, I guess, is the softmax. So if this is a classifier, the a y here, those are the lockets. And that's the output of your last layer. So it, instead of having y and y hat, right, sorry, y hat right here, it pays to maybe think of the output as a vector, and the desired output as another vector. And the desired output is of course going to be one hot vector in the case of in the case of a classification. But it, you know, if you think of it like this, then you will recognize, okay, I need to change if this is my estimated output, and I want to achieve this output, I need to change it into this direction, right to get more into the same direction as the output I want. The entire question now becomes how do I tell the lower layers about this change right here? This is the change that I want to make in the lower layers? How do I get the lower layers such that they provide me with that signal with with the green signal instead of the red signal? So I need to propagate this blue difference. In the back propagation algorithm, you can simply ask the system, right? So we've built entire frameworks on being able to back propagate TensorFlow, pytorch, jacks, whatever. Because with back propagation, we can simply ask the system this question. So here is how should I change the weights of my layer to make the loss smaller? You can just ask that you can say, what's the gradient of the loss with respect to the to my weights, and the negative sign here is because you want to make the loss smaller. Okay, and that is going to be a straightforward calculation. How does that calculation go? It's going to involve this right here is the last layer's output. This right here, as you can see, over here is going to be this is going to be whatever comes back from the back propagation. So in back propagation, you always have to think of, if you want to update these weights, you need two quantities, you need whatever comes from the bottom or came from the bottom during the forward pass, and whatever comes from the top during the backward pass. And this quantity here is going to be the one that came from the top. And it's basically how you need to change the next layer in order to make the loss happier. And by using this right here, you pull it back to this layer. So how do I need to change this layer? And here you see that dreaded transpose of that weight matrix. This is what we can't do in biology. But this is what back propagation does. So it pulls back how you need to change the next layer, it pulls it back to this layer. So this quantity right here is basically how do I need to change the output of this particular layer in order to make the loss happier. And then you multiply it by the signal that comes from the bottom. And that will give you how you need to change your weights. Okay. So the green part is how does the output of the layer need to change and the multiplied by the blue part, it's how do the weights need to change. And of course, the non linearity is in there as well. But let's, let's just leave the non linearity away because it's really not important for this particular thing. So this is what backprop does. What does DFA do? DFA here, again asks, how should I change the weights of layer i and DFA says, Well, first, you need to compute this thing right here. This is you see the derivative of the loss with respect to a y now a y is the output of the last layer. These are in in our case, for example, your log it's okay, note that this is still a gradient. So it's not like we can't differentiate anymore, we simply can't do back propagation from layer to layer. Okay, so this is the quantity. How do we need to change the last layer's output? And we're going to take that and simply feed it through this random matrix, and then multiply again, let's leave this away, multiply it by the by this thing right here. So if I get my colors correct, like this, again, you have your neural network, you want to update these weights, the green is what comes from the top. Now it doesn't come from the next layer, but the green actually comes from all the way at the end. Sorry, you can't see that I still have to get used to that new frame of view. So the green comes all the way from the end, and the blue comes from down here. Okay, so this is weird, right? Because especially because this is just modulated by a random matrix. So how can this possibly work? That's the question. And I, you know, I had some thoughts, but I haven't read too much about it. So I might be completely wrong. Or this might be completely known in the community. I have no idea. I'll just give my opinion right here. So first of all, you have to see if to compare this to backprop. So what's actually changing is this green part right here, right? We agree that this is the thing that's changing. And what do we say, does the green part mean, the green part basically tells you how do you how should the output of this layer change? Okay, by adjusting the weights in the direction of the thing on the right side of the equality sign, you're going to change the output of the layer into the direction of that green part. Now, in backpropagation, the green part basically tells you how should the output of this layer change in order to make the losses happy as possible. Now, we don't have that anymore. Here, we simply change the output of the layer into the into the direction of a random transformation of the of the change we would like to have in the output. Now, okay, that's the, the first thing is we understand what's different. And we understand what the green quantity means. Green quantity means how should the output of our layer change? Okay, second thing. If you look at the last layer of a neural network that that logits layer, right, what does it actually do? Let's say we have that's a three dimensional last layer, which means you have three classes, right? If your last layer is three dimensional, you have three classes, each axis represents one class because you encode the classes as one hot vectors. So this might be C, the class label equals zero, this might be C equals one, this might be C equals two. If you have something that you forward propagate through your neural network, and let's say it comes out to be like this, what would you classify that as? Now you classify that as the whatever class has the the biggest inner product with that vector, which would be the C equals zero class right here. And what is this quantity going to be? How should you update this output in order to make the loss happier? Now that depends on your true label. But let's say your true label is actually the zero label. Now, what you want to do is you want to update that thing into the direction here, right, such that it is more aligned with the axis. So what happens if you pull that back through a random matrix? Now, the thing you have to know about random matrices like this is that they do approximately preserve distances and angles. So technically, if you pull this back, what you're going to induce is another coordinate system in that other space. Now, this can be a higher or lower dimensional space, I frankly, I don't care. But what you're going to induce is a coordinate system. And what do you pull through that B matrix? So this is the bi matrix, you fix it, right? This is really important, you fix it at the beginning of training, it's always the same, it preserves distances and angles approximately, you pull back that quantity, which is the okay, my colors are all screwed, which is the green arrow over here, you pull back this green arrow here. So what does it mean? What so the output right here, the output vector that came from the lower layers, right? That's the forward propagated that through your network. So maybe in this layer, it actually pointed here, we don't know. But let's say it pointed here. If we pull back the green thing, it might point here. Okay, now, this is, since it's a random matrix, we don't know, we know that the angle is approximately preserved, okay, but you know, the end the lengths are approximately preserved with relative to each other. But it doesn't really tell you too much. So why is this useful? And to see why it's useful, you need to consider other inputs, we don't just input this one vector, we input a whole bunch of data. Now let's consider two other vectors. So first, I want to consider this this blue vector right here. Now, the blue vector is also going to have a label of zero. So what does the blue vectors update look like the blue vector is going to be pulled into this direction. And I also want to consider this red vector right here, the red vector is of class one. So what does the red vectors update going to look like, like this, right? And if I consider now the red and the blue vector in this space, right, let's just draw them at random, like so, okay, what I do know, actually, that's that's for consistent. Let's draw the blue somewhere here, and the red somewhere here. What I do know is that the angles and distances are preserved. So what is the green thing going to look like the update for the blue vector is going to be something like this. And the update for the red vector is going to maybe be something like this, you know, away from from those. So what is happening in that lower space, you'll notice that the two vectors that are supposed to be in the same class, this and this, they are going to be pulled together. Now the direction they're pulled in, that's determined by this random matrix. But we know they're going to be pulled together because they are pulled together in this space in the final space. Okay, and they're going to be pulled apart from the red vector, okay, because that red vector is going to be pulled towards a different class in the in the last space. And since the distances and angles are approximately preserved, it's going to be pulled away from these in this space. So what this induces, in my opinion, is some sort of it induces this coordinate system where if you make the last layer axis aligned because you want to classify it, it kind of clusters things that belong in the same class in these previous weight spaces, right? And because and if you do this layer by layer, so if you do this in layer k, and then you make the job easier for any layer k plus one that's in between here, right? Because they now the things in the same class are already together pretty okay. Now you map it through a weight and the non linearity they might, you know, intertwine a bit again, but there's there more together than they would be otherwise. So you make the job for the next layer easier, which means that the next layer can also can even better cluster things. And what you'll end up with in this last layer is the is a basically a class or next to last layer is basically a clustering, where everything that's supposed to be in the same class is together and far apart from each other. And since the last layer is the classification layer, it's going to have a really easy job separating those classes and performing good classification. So that's what I think is happening in this algorithm. So even though the layers don't know how to change to help the last layer, by the fact that these random matrices induce a clustering together, you know, by back propagating these updates here, it helps the last layer, make it makes its job really easy. And, you know, that's all the classifier needs. And I want to I want to show again, this is my opinion, this is not anything of value. It's just my hypothesis of why something like this could work. I want to show you in this paper that I've shown you before right here, they do actually do these experiments with DFA. And they show that you can see top row shows feature obtained with back propagation, bottom row shows features obtained with DFA. I think these are input and features. I'm not sure where exactly they are in the network. But you can see that this clustering clearly emerges. So oh, yeah, here, from left to right input images first hidden layer, second hidden layer, third hidden layer. So you can see that the clustering from layer to layer in backprop, and also in DFA is better and better. So the reason why backprop is good, maybe it's just that because it also really induces clusterings like this, I don't know, maybe backprop does even does something on top of that. Because I mean, backprop has all the properties of this and more, right. But still, this this is congruent with my hypothesis of what's happening. So what do they do with it, they take this algorithm, and they apply it to these architectures. Now, let's, for example, look at one of them, this neural view synthesis with neural radiance fields. So neural radiance fields is a type of model to do this task of where you get a bunch of views of an object in 3d, or, you know, a bunch of views around an object, and you're supposed to render a new view. And you can see that the DFA parameter or the DFA updated nerve neural radiance field model is pretty close to the backpropagation updated one, you can see it's a bit more blurry, but it it works, right. And I think the this paper is really trying to show that look, this works, it doesn't work, you know, extremely well, but it works. And it works on a level that hasn't been seen before. So here, if you consider these results higher is better on the synthetic data set here, even you see that if you have the same model with backprop, it performs better than with DFA. But the DFA for that model performs better than these other baseline models that have themselves been trained with backpropagation. So it's definitely in the direction of being competitive. And that's the same thing they show with all of these experiments. So they apply this to graph networks, they apply this to transformers. And as I said, it's not there yet you see that. So in the transformers, they have these settings where in macro, they just use it DFA for the individual blocks and micro, they use it for each layer, and already told you that you still in the attention mechanism, you still have to use backprop within the attention mechanism. But it is much more of a plausible algorithm than the backpropagation through the entire network. And they show that if they appropriately tweak the hyper parameters, they do get into the direction of something that's performant, at least with this macro strategy. Now, this is nowhere close to this is nowhere close to what the to what the backpropagation algorithm achieves. But it's sort of it's sort of an indication that if the community could work as much on this as it has worked on backpropagation, then probably will make a lot of like we could we could push this to a place where it does perform on par with backprop or very close to it. So I do invite you to go and look at the experiments, they have a lot of lot of details on how they did it. And exactly how you have to change the architectures to make DFA work and the hyper parameters and so on. So that's really cool. And they have some more outputs right here of the view synthesis and so on. Yeah, if you are interested in that thing, I again, I don't want to disrespect it. It's just I don't think there is much point in me going over it. It's the results are always sort of the same that DFA it. It's not there yet, but it's a good direction. Yeah, I hope this was informative. Let me know if you disagree about my assessment of DFA I could be completely wrong or you know, I have Yeah, or this could be like well known to people already. So yeah, see you next time.
[{"start": 0.0, "end": 5.8, "text": " Hi there. Today we'll look at Direct Feedback Alignment Scales to Modern Deep Learning Tasks"}, {"start": 5.8, "end": 13.14, "text": " and Architectures by Giulia Loney, Jacopo Poli, Francois Boniface and Florian Crisakala."}, {"start": 13.14, "end": 19.400000000000002, "text": " So this paper on a high level, it replaces the backpropagation algorithm in deep learning"}, {"start": 19.400000000000002, "end": 24.64, "text": " architectures with this algorithm called direct feedback alignment, which is more biologically"}, {"start": 24.64, "end": 30.44, "text": " plausible. The algorithm has been around for a while, but it hasn't yet been shown to be"}, {"start": 30.44, "end": 37.32, "text": " applicable to really modern big deep learning architectures and then perform on par with"}, {"start": 37.32, "end": 43.120000000000005, "text": " backprop on modern deep learning tasks. This paper, as I understand it, is the first one"}, {"start": 43.120000000000005, "end": 48.8, "text": " to demonstrate that it can do that. So this is very much an engineering paper, an applied"}, {"start": 48.8, "end": 57.64, "text": " paper, and we're going to mostly go into direct feedback alignment as such. And I don't think"}, {"start": 57.64, "end": 63.959999999999994, "text": " we're going to go too much into what the actual empirical findings are, because they even"}, {"start": 63.959999999999994, "end": 68.32, "text": " though they're impressive, and it's a good piece of engineering, I think they can be"}, {"start": 68.32, "end": 74.44, "text": " summarized pretty much by it, it works not yet on par with backpropagation, but into"}, {"start": 74.44, "end": 81.58, "text": " a promising direction. Alright, as always, if you like content like this, consider sharing"}, {"start": 81.58, "end": 88.0, "text": " it out and leaving a like and tell me in the comments what you like, of course, subscribe"}, {"start": 88.0, "end": 94.75999999999999, "text": " if you aren't yet that that is, you know, essential. Otherwise, how are we going to"}, {"start": 94.75999999999999, "end": 100.75999999999999, "text": " hear from me in the future? Okay, let's dive in. They say despite being the workhorse of"}, {"start": 100.76, "end": 105.84, "text": " deep learning, the backpropagation algorithm is no panacea. It enforces sequential layer"}, {"start": 105.84, "end": 111.4, "text": " updates thus preventing efficient parallelization of the training process. Furthermore, its"}, {"start": 111.4, "end": 117.60000000000001, "text": " biological plausibility is being challenged. Alternative schemes have been devised yet"}, {"start": 117.60000000000001, "end": 123.28, "text": " under the constraints of synaptic asymmetry. None have scaled to modern deep learning tasks"}, {"start": 123.28, "end": 129.08, "text": " and architectures. Here we challenge this perspective and study the applicability of"}, {"start": 129.08, "end": 135.72000000000003, "text": " direct feedback alignment to neural view synthesis, recommender systems, geometric learning and"}, {"start": 135.72000000000003, "end": 142.72000000000003, "text": " natural language processing. In contrast with previous studies, limited to computer vision"}, {"start": 142.72000000000003, "end": 146.8, "text": " tasks, our findings show that it successfully trains a large range of state of the art deep"}, {"start": 146.8, "end": 153.26000000000002, "text": " learning architectures with performance close to fine tuned backpropagation. At variance"}, {"start": 153.26000000000002, "end": 158.8, "text": " with common beliefs, our work supports that challenging tasks can be tackled in the absence"}, {"start": 158.8, "end": 166.58, "text": " of weight transport. So there's a lot to unpack in this particular abstract right here. So"}, {"start": 166.58, "end": 172.24, "text": " first of all, what's the problem with backpropagation? Backpropagation, they have they have two"}, {"start": 172.24, "end": 178.0, "text": " quarrels right here. First of all, it's preventing efficient parallelization of the training"}, {"start": 178.0, "end": 186.88000000000002, "text": " process. So what does that mean? So in backpropagation, I'm pretty sure you all know, it's basic backpropagation,"}, {"start": 186.88, "end": 190.56, "text": " but you have an input to a neural network. And the neural network has a bunch of layers."}, {"start": 190.56, "end": 196.0, "text": " So the input will travel layer by layer. And at the end, you'll get some output and your"}, {"start": 196.0, "end": 201.44, "text": " output y hat, let's call it here what the neural network thinks the let's say it's a"}, {"start": 201.44, "end": 207.4, "text": " classifier thinks that the class of this particular x should be now in the data set, you have"}, {"start": 207.4, "end": 214.18, "text": " your true label, and then you compare that to your output label, and you can compute"}, {"start": 214.18, "end": 220.4, "text": " a loss function. Now, the whole question of the backpropagation algorithm is how do I"}, {"start": 220.4, "end": 226.64000000000001, "text": " need to change my layers of the neural network in order to make the loss as small as possible."}, {"start": 226.64000000000001, "end": 230.64000000000001, "text": " And for that, you can use backpropagation, that means you can take that loss and you"}, {"start": 230.64000000000001, "end": 238.12, "text": " can backpropagate it down the layers in order to update each layer individually. So the"}, {"start": 238.12, "end": 242.96, "text": " first problem they have here with the backpropagation algorithm, and it's not, I mean, it's kind"}, {"start": 242.96, "end": 248.78, "text": " of a secondary problem, but it is that is sequential. So in order to update this layer"}, {"start": 248.78, "end": 254.08, "text": " right here, you need to have already back propagated to this layer, and then you need"}, {"start": 254.08, "end": 258.88, "text": " to back propagate further to this and to this layer. So it's a sequential task, you need"}, {"start": 258.88, "end": 265.56, "text": " to back propagate down the layers again, whereas what is more plausible, but what would be"}, {"start": 265.56, "end": 271.16, "text": " more efficient if if we could somehow update all the layers in parallel, but this is a"}, {"start": 271.16, "end": 278.0, "text": " minor quarrel. The bigger one is that backpropagation isn't biologically plausible. We know that"}, {"start": 278.0, "end": 284.92, "text": " in real neurons, you have your your dendrites, your inputs, and you have your axon, and the"}, {"start": 284.92, "end": 291.76000000000005, "text": " signal only travels in one direction, we don't know of a feedback mechanism in true neurons"}, {"start": 291.76000000000005, "end": 297.58000000000004, "text": " in the brain that would allow for information sort of to flow in the opposite direction,"}, {"start": 297.58, "end": 302.03999999999996, "text": " there is there is information flowing the opposite direction, but it's it's, I guess,"}, {"start": 302.03999999999996, "end": 310.08, "text": " I think it's too slow. And it's so it's not really, it can't be, there's no analogous"}, {"start": 310.08, "end": 316.44, "text": " way of backpropagation, there's no nothing in the brain that would take the role of the"}, {"start": 316.44, "end": 323.84, "text": " backpropagation algorithm. Specifically, if each layer is characterized by a weight matrix,"}, {"start": 323.84, "end": 332.73999999999995, "text": " right here, what backpropagation does is it uses the transpose of that weight matrix to"}, {"start": 332.73999999999995, "end": 340.2, "text": " back propagate. So these, these arrows to the front, right here, they use the weight"}, {"start": 340.2, "end": 346.35999999999996, "text": " matrices, and these arrows to the back, they use the transposes of the weight matrices."}, {"start": 346.35999999999996, "end": 353.05999999999995, "text": " So the transposes of the weight matrices, sort of relay the information of what needs"}, {"start": 353.06, "end": 358.48, "text": " to change, that would be the loss, what needs to change to make the loss as small as possible,"}, {"start": 358.48, "end": 365.36, "text": " they relay this information down to the other layers. And we don't know of any biological"}, {"start": 365.36, "end": 371.32, "text": " analog, analogy to this mechanism right here, this transpose, it acts as sort of a layer"}, {"start": 371.32, "end": 379.24, "text": " inverse. And that is called weight transport. So weight transport means that you can you"}, {"start": 379.24, "end": 385.52, "text": " can do something like the transpose of the weights basically, to carry to bring information"}, {"start": 385.52, "end": 392.74, "text": " from the next layer back to this layer. And in biology, we don't have this. And in direct"}, {"start": 392.74, "end": 397.16, "text": " feedback alignment, we don't have this either. So direct feedback alignment, the next thing"}, {"start": 397.16, "end": 404.22, "text": " here in this abstract is the algorithm that they are going to apply here, direct feedback"}, {"start": 404.22, "end": 409.6, "text": " alignment, and we'll go into what it is, but it is more biologically plausible, in that"}, {"start": 409.6, "end": 416.28000000000003, "text": " what it does is it takes the loss somehow, and it distributes it globally to all of these"}, {"start": 416.28000000000003, "end": 424.64000000000004, "text": " layers like this. And it does so without requiring these transposes and also without requiring"}, {"start": 424.64000000000004, "end": 433.96000000000004, "text": " these sequential steps. So both of their proposed problems here would be solved by this. They"}, {"start": 433.96, "end": 442.44, "text": " say they say that in contrast with previous studies limited to computer vision tasks."}, {"start": 442.44, "end": 450.84, "text": " So what people have tried to do is they have tried to apply this DFA algorithm to computer"}, {"start": 450.84, "end": 456.58, "text": " vision tasks. But in computer vision, most architectures are CNNs. And as I understand"}, {"start": 456.58, "end": 463.84, "text": " it, as far as I understand it, DFA can only right now be applied to linear layers. So"}, {"start": 463.84, "end": 471.15999999999997, "text": " something that is w x plus b, and then a non linearity. It cannot even though you can write"}, {"start": 471.15999999999997, "end": 478.32, "text": " to CNN as like a linear layer with constraints. As I read this paper, I think to interpret"}, {"start": 478.32, "end": 484.79999999999995, "text": " that you can only apply DFA to fully connected layers or things that look kind of like fully"}, {"start": 484.8, "end": 488.56, "text": " connected layers. So what they're going to do in their experiments is they're going to"}, {"start": 488.56, "end": 495.22, "text": " take these big architectures like transformers and replace parts of them with the parts that"}, {"start": 495.22, "end": 501.24, "text": " act as fully connected layers with with DFA updates. So well, they're not going to replace"}, {"start": 501.24, "end": 506.04, "text": " the layers, but they're going to replace the back propagation part of it with DFA updates."}, {"start": 506.04, "end": 511.44, "text": " It remains to say that they still use back propagation at some places where they can't"}, {"start": 511.44, "end": 517.84, "text": " replace the updates with DFA. And that means where the layer isn't, you know, a fully connected"}, {"start": 517.84, "end": 522.16, "text": " layer or I guess it's too big, they somehow have to make it work. So often they will not"}, {"start": 522.16, "end": 528.64, "text": " update, for example, the embedding layers, and things like this. Okay, so what they're"}, {"start": 528.64, "end": 533.88, "text": " saying is they go away from computer vision tasks. Because if you go to computer vision,"}, {"start": 533.88, "end": 540.76, "text": " and CNNs rule that world, right, you can only do four feet forward layers, fully connected"}, {"start": 540.76, "end": 548.24, "text": " layers, you're going to lose already. And so, yeah, it's kind of an unfair fight in"}, {"start": 548.24, "end": 554.4, "text": " that in that sense. But even in absence of that, they say we apply this to neural view"}, {"start": 554.4, "end": 560.22, "text": " synthesis recommender systems, geometric learning and natural language processing. So these"}, {"start": 560.22, "end": 564.6, "text": " are quite diverse tasks. And they're going to be quite diverse architectures that they're"}, {"start": 564.6, "end": 569.72, "text": " applying it to, for example, in geometric learning, I believe they do graph neural networks."}, {"start": 569.72, "end": 576.32, "text": " And there, there, they replace the, the usually in graph neural networks, there are fully"}, {"start": 576.32, "end": 582.28, "text": " connected layers that connect the two the vertices and the edges together and compute"}, {"start": 582.28, "end": 589.0, "text": " properties of them. So that's a pretty good point for using DFA, right? Because what you're"}, {"start": 589.0, "end": 594.0400000000001, "text": " looking for is state of the art tasks and architectures that still employ fully connected"}, {"start": 594.04, "end": 602.92, "text": " layers because there your algorithm can shine. Okay, so that's it. And they're basically"}, {"start": 602.92, "end": 608.1999999999999, "text": " going to show that this is performance is close to fine tuned back propagation. Right."}, {"start": 608.1999999999999, "end": 616.12, "text": " So what is DFA? What is this direct feedback alignment? And for that, I actually want to"}, {"start": 616.12, "end": 623.48, "text": " jump papers right here and go to this other paper that describes DFA in a bit in a bit,"}, {"start": 623.48, "end": 628.5600000000001, "text": " not more detail, but in a graphic fashion. So this paper right here, direct feedback"}, {"start": 628.5600000000001, "end": 637.96, "text": " alignment provides learning in deep neural networks by RL Nocklund, sorry, Nocklund shows"}, {"start": 637.96, "end": 642.44, "text": " some theoretical properties about DFA. Now, I don't want to go into the theory right here"}, {"start": 642.44, "end": 649.5600000000001, "text": " or in the math, but I mainly like this paper for this particular graphic right here. So"}, {"start": 649.56, "end": 653.92, "text": " in the back propagation algorithm, as you can see, you forward propagate using these"}, {"start": 653.92, "end": 660.16, "text": " weight matrices, and then you back propagate using the transposes of the weight matrices."}, {"start": 660.16, "end": 665.78, "text": " Now one step after that is this thing right here. It's called feedback alignment. It's"}, {"start": 665.78, "end": 671.68, "text": " not the same thing as direct feedback alignment. In feedback alignment, you simply say, Well,"}, {"start": 671.68, "end": 677.0799999999999, "text": " I won't back prop using these transposes because I can't because that's not biologically possible."}, {"start": 677.08, "end": 684.9200000000001, "text": " What I'll do is I'll use other matrices. And these other matrices are going to be random"}, {"start": 684.9200000000001, "end": 690.5600000000001, "text": " matrices. And by random matrices, we really mean a matrix that is of you know, the correct"}, {"start": 690.5600000000001, "end": 697.98, "text": " shape, the same shape as this W transpose. But each entry is going to be sampled from"}, {"start": 697.98, "end": 704.96, "text": " a like a random Gaussian, right? Now, I don't mean like the distribution of Gaussians, but"}, {"start": 704.96, "end": 711.64, "text": " you fix this matrix once at the beginning of training by sampling from Gaussian, and"}, {"start": 711.64, "end": 716.48, "text": " then you leave it there. And that's going to be the matrix that you use for relaying"}, {"start": 716.48, "end": 722.48, "text": " the signal back through the layers. Now, you might protest and say, wait, that's not going"}, {"start": 722.48, "end": 728.52, "text": " to work. Because specifically, this thing right here, it you know that you need to know"}, {"start": 728.52, "end": 733.84, "text": " the weights here to know what you need to change in the lower layers, you need to somehow"}, {"start": 733.84, "end": 738.88, "text": " have that information in there, how are you going to know what to change? And that's a"}, {"start": 738.88, "end": 746.4, "text": " valid question. And I will give my opinion of why this works. Okay. In a second in two"}, {"start": 746.4, "end": 753.5600000000001, "text": " seconds. First, this is feedback alignment. So simply use random matrices to back propagate,"}, {"start": 753.5600000000001, "end": 758.52, "text": " so to say. And then you have direct feedback alignment and direct feedback alignment goes"}, {"start": 758.52, "end": 763.84, "text": " a step further. Because in feedback alignment, you still do this in a sequential manner."}, {"start": 763.84, "end": 770.76, "text": " Direct feedback alignment simply takes whatever the top change should be the change to the"}, {"start": 770.76, "end": 776.8, "text": " top layer. So how do I need to change the top layer, and it back propagates that in"}, {"start": 776.8, "end": 783.96, "text": " a this global fashion to all the layers directly using random matrices, okay. And then this"}, {"start": 783.96, "end": 789.52, "text": " IFA we're not going to look at today, because that's not relevant for this other paper."}, {"start": 789.52, "end": 798.9200000000001, "text": " But I hope you can sort of see the overview here. So let's go back. Scroll, scroll, scroll,"}, {"start": 798.9200000000001, "end": 805.24, "text": " scroll, scroll, scroll, scroll. Okay, so here is the mathematical formulation of all of"}, {"start": 805.24, "end": 810.76, "text": " this. And it pays to look at it to understand what's going on. So they characterize a neural"}, {"start": 810.76, "end": 815.92, "text": " network right here as having n layers. Each neural network is the following each neural"}, {"start": 815.92, "end": 822.24, "text": " each layer takes whatever is the output of the last layer, multiplies it by a weight"}, {"start": 822.24, "end": 830.68, "text": " matrix. And that's going to be your a quantity, you put a through a non linearity to obtain"}, {"start": 830.68, "end": 836.96, "text": " the next layers input. Okay, so the H is the output of this layer, and the input of the"}, {"start": 836.96, "end": 845.4000000000001, "text": " next layer. At the very end, your last output is going to be your estimation of the labels."}, {"start": 845.4000000000001, "end": 852.64, "text": " So your last non linearity is probably going to be something like a, a softmax or something"}, {"start": 852.64, "end": 861.9200000000001, "text": " like this. Okay. So how can we how can we have this as a concept in our heads? If you"}, {"start": 861.92, "end": 867.64, "text": " have the neural network right here, what you want to do is you want to forward prop always"}, {"start": 867.64, "end": 875.92, "text": " using your weight matrix w, and then your non linearity of that particular layer. And"}, {"start": 875.92, "end": 883.0, "text": " then the last in the last layer, you get your y hat, as we saw before. Now the question"}, {"start": 883.0, "end": 892.44, "text": " is, how can we adjust? How can we adjust this w right here to make y hat more into the direction"}, {"start": 892.44, "end": 900.32, "text": " of y. And here it's in here, it's useful to think of the last layer as a vector output."}, {"start": 900.32, "end": 907.32, "text": " Like usually we think of the loss function. But in all of these algorithms, they always"}, {"start": 907.32, "end": 913.5600000000001, "text": " start with the derivative of the loss function with respect to the last layer output, so"}, {"start": 913.5600000000001, "end": 922.2800000000001, "text": " a y, and a y is here right before the non linearity. If you remember, this was f of"}, {"start": 922.2800000000001, "end": 930.22, "text": " a y. And this here, I guess, is the softmax. So if this is a classifier, the a y here,"}, {"start": 930.22, "end": 936.7600000000001, "text": " those are the lockets. And that's the output of your last layer. So it, instead of having"}, {"start": 936.76, "end": 948.48, "text": " y and y hat, right, sorry, y hat right here, it pays to maybe think of the output as a"}, {"start": 948.48, "end": 955.3199999999999, "text": " vector, and the desired output as another vector. And the desired output is of course"}, {"start": 955.3199999999999, "end": 963.04, "text": " going to be one hot vector in the case of in the case of a classification. But it, you"}, {"start": 963.04, "end": 970.76, "text": " know, if you think of it like this, then you will recognize, okay, I need to change if"}, {"start": 970.76, "end": 976.5999999999999, "text": " this is my estimated output, and I want to achieve this output, I need to change it into"}, {"start": 976.5999999999999, "end": 983.38, "text": " this direction, right to get more into the same direction as the output I want. The entire"}, {"start": 983.38, "end": 990.0, "text": " question now becomes how do I tell the lower layers about this change right here? This"}, {"start": 990.0, "end": 997.12, "text": " is the change that I want to make in the lower layers? How do I get the lower layers such"}, {"start": 997.12, "end": 1004.36, "text": " that they provide me with that signal with with the green signal instead of the red signal?"}, {"start": 1004.36, "end": 1010.4, "text": " So I need to propagate this blue difference. In the back propagation algorithm, you can"}, {"start": 1010.4, "end": 1017.48, "text": " simply ask the system, right? So we've built entire frameworks on being able to back propagate"}, {"start": 1017.48, "end": 1024.56, "text": " TensorFlow, pytorch, jacks, whatever. Because with back propagation, we can simply ask the"}, {"start": 1024.56, "end": 1031.08, "text": " system this question. So here is how should I change the weights of my layer to make the"}, {"start": 1031.08, "end": 1036.84, "text": " loss smaller? You can just ask that you can say, what's the gradient of the loss with"}, {"start": 1036.84, "end": 1044.0, "text": " respect to the to my weights, and the negative sign here is because you want to make the"}, {"start": 1044.0, "end": 1050.76, "text": " loss smaller. Okay, and that is going to be a straightforward calculation. How does that"}, {"start": 1050.76, "end": 1061.68, "text": " calculation go? It's going to involve this right here is the last layer's output. This"}, {"start": 1061.68, "end": 1071.4, "text": " right here, as you can see, over here is going to be this is going to be whatever comes back"}, {"start": 1071.4, "end": 1076.64, "text": " from the back propagation. So in back propagation, you always have to think of, if you want to"}, {"start": 1076.64, "end": 1081.76, "text": " update these weights, you need two quantities, you need whatever comes from the bottom or"}, {"start": 1081.76, "end": 1087.48, "text": " came from the bottom during the forward pass, and whatever comes from the top during the"}, {"start": 1087.48, "end": 1097.8400000000001, "text": " backward pass. And this quantity here is going to be the one that came from the top. And"}, {"start": 1097.84, "end": 1103.3999999999999, "text": " it's basically how you need to change the next layer in order to make the loss happier."}, {"start": 1103.3999999999999, "end": 1109.08, "text": " And by using this right here, you pull it back to this layer. So how do I need to change"}, {"start": 1109.08, "end": 1114.6799999999998, "text": " this layer? And here you see that dreaded transpose of that weight matrix. This is what"}, {"start": 1114.6799999999998, "end": 1120.6599999999999, "text": " we can't do in biology. But this is what back propagation does. So it pulls back how you"}, {"start": 1120.6599999999999, "end": 1126.4399999999998, "text": " need to change the next layer, it pulls it back to this layer. So this quantity right"}, {"start": 1126.44, "end": 1133.3200000000002, "text": " here is basically how do I need to change the output of this particular layer in order"}, {"start": 1133.3200000000002, "end": 1140.3200000000002, "text": " to make the loss happier. And then you multiply it by the signal that comes from the bottom."}, {"start": 1140.3200000000002, "end": 1146.5800000000002, "text": " And that will give you how you need to change your weights. Okay. So the green part is how"}, {"start": 1146.5800000000002, "end": 1151.8400000000001, "text": " does the output of the layer need to change and the multiplied by the blue part, it's"}, {"start": 1151.84, "end": 1156.8, "text": " how do the weights need to change. And of course, the non linearity is in there as well."}, {"start": 1156.8, "end": 1162.28, "text": " But let's, let's just leave the non linearity away because it's really not important for"}, {"start": 1162.28, "end": 1172.6799999999998, "text": " this particular thing. So this is what backprop does. What does DFA do? DFA here, again asks,"}, {"start": 1172.6799999999998, "end": 1180.04, "text": " how should I change the weights of layer i and DFA says, Well, first, you need to compute"}, {"start": 1180.04, "end": 1186.36, "text": " this thing right here. This is you see the derivative of the loss with respect to a y"}, {"start": 1186.36, "end": 1192.84, "text": " now a y is the output of the last layer. These are in in our case, for example, your log"}, {"start": 1192.84, "end": 1199.72, "text": " it's okay, note that this is still a gradient. So it's not like we can't differentiate anymore,"}, {"start": 1199.72, "end": 1206.52, "text": " we simply can't do back propagation from layer to layer. Okay, so this is the quantity. How"}, {"start": 1206.52, "end": 1213.84, "text": " do we need to change the last layer's output? And we're going to take that and simply feed"}, {"start": 1213.84, "end": 1220.72, "text": " it through this random matrix, and then multiply again, let's leave this away, multiply it"}, {"start": 1220.72, "end": 1227.94, "text": " by the by this thing right here. So if I get my colors correct, like this, again, you have"}, {"start": 1227.94, "end": 1233.6399999999999, "text": " your neural network, you want to update these weights, the green is what comes from the"}, {"start": 1233.64, "end": 1238.8000000000002, "text": " top. Now it doesn't come from the next layer, but the green actually comes from all the"}, {"start": 1238.8000000000002, "end": 1245.96, "text": " way at the end. Sorry, you can't see that I still have to get used to that new frame"}, {"start": 1245.96, "end": 1253.48, "text": " of view. So the green comes all the way from the end, and the blue comes from down here."}, {"start": 1253.48, "end": 1261.2800000000002, "text": " Okay, so this is weird, right? Because especially because this is just modulated by a random"}, {"start": 1261.28, "end": 1269.48, "text": " matrix. So how can this possibly work? That's the question. And I, you know, I had some"}, {"start": 1269.48, "end": 1273.56, "text": " thoughts, but I haven't read too much about it. So I might be completely wrong. Or this"}, {"start": 1273.56, "end": 1279.44, "text": " might be completely known in the community. I have no idea. I'll just give my opinion"}, {"start": 1279.44, "end": 1286.72, "text": " right here. So first of all, you have to see if to compare this to backprop. So what's"}, {"start": 1286.72, "end": 1292.4, "text": " actually changing is this green part right here, right? We agree that this is the thing"}, {"start": 1292.4, "end": 1297.8, "text": " that's changing. And what do we say, does the green part mean, the green part basically"}, {"start": 1297.8, "end": 1306.68, "text": " tells you how do you how should the output of this layer change? Okay, by adjusting the"}, {"start": 1306.68, "end": 1310.52, "text": " weights in the direction of the thing on the right side of the equality sign, you're going"}, {"start": 1310.52, "end": 1317.4, "text": " to change the output of the layer into the direction of that green part. Now, in backpropagation,"}, {"start": 1317.4, "end": 1323.48, "text": " the green part basically tells you how should the output of this layer change in order to"}, {"start": 1323.48, "end": 1330.52, "text": " make the losses happy as possible. Now, we don't have that anymore. Here, we simply change"}, {"start": 1330.52, "end": 1338.92, "text": " the output of the layer into the into the direction of a random transformation of the"}, {"start": 1338.92, "end": 1344.6000000000001, "text": " of the change we would like to have in the output. Now, okay, that's the, the first thing"}, {"start": 1344.6000000000001, "end": 1349.6000000000001, "text": " is we understand what's different. And we understand what the green quantity means."}, {"start": 1349.6000000000001, "end": 1356.64, "text": " Green quantity means how should the output of our layer change? Okay, second thing. If"}, {"start": 1356.64, "end": 1362.52, "text": " you look at the last layer of a neural network that that logits layer, right, what does it"}, {"start": 1362.52, "end": 1367.68, "text": " actually do? Let's say we have that's a three dimensional last layer, which means you have"}, {"start": 1367.68, "end": 1373.8400000000001, "text": " three classes, right? If your last layer is three dimensional, you have three classes,"}, {"start": 1373.8400000000001, "end": 1379.88, "text": " each axis represents one class because you encode the classes as one hot vectors. So"}, {"start": 1379.88, "end": 1386.68, "text": " this might be C, the class label equals zero, this might be C equals one, this might be"}, {"start": 1386.68, "end": 1394.1200000000001, "text": " C equals two. If you have something that you forward propagate through your neural network,"}, {"start": 1394.12, "end": 1401.1999999999998, "text": " and let's say it comes out to be like this, what would you classify that as? Now you classify"}, {"start": 1401.1999999999998, "end": 1410.7199999999998, "text": " that as the whatever class has the the biggest inner product with that vector, which would"}, {"start": 1410.7199999999998, "end": 1418.08, "text": " be the C equals zero class right here. And what is this quantity going to be? How should"}, {"start": 1418.08, "end": 1424.08, "text": " you update this output in order to make the loss happier? Now that depends on your true"}, {"start": 1424.08, "end": 1430.36, "text": " label. But let's say your true label is actually the zero label. Now, what you want to do is"}, {"start": 1430.36, "end": 1436.4199999999998, "text": " you want to update that thing into the direction here, right, such that it is more aligned"}, {"start": 1436.4199999999998, "end": 1444.0, "text": " with the axis. So what happens if you pull that back through a random matrix? Now, the"}, {"start": 1444.0, "end": 1449.36, "text": " thing you have to know about random matrices like this is that they do approximately preserve"}, {"start": 1449.36, "end": 1457.84, "text": " distances and angles. So technically, if you pull this back, what you're going to induce"}, {"start": 1457.84, "end": 1462.84, "text": " is another coordinate system in that other space. Now, this can be a higher or lower"}, {"start": 1462.84, "end": 1470.88, "text": " dimensional space, I frankly, I don't care. But what you're going to induce is a coordinate"}, {"start": 1470.88, "end": 1478.48, "text": " system. And what do you pull through that B matrix? So this is the bi matrix, you fix"}, {"start": 1478.48, "end": 1482.2, "text": " it, right? This is really important, you fix it at the beginning of training, it's always"}, {"start": 1482.2, "end": 1489.6000000000001, "text": " the same, it preserves distances and angles approximately, you pull back that quantity,"}, {"start": 1489.6000000000001, "end": 1495.2, "text": " which is the okay, my colors are all screwed, which is the green arrow over here, you pull"}, {"start": 1495.2, "end": 1505.38, "text": " back this green arrow here. So what does it mean? What so the output right here, the output"}, {"start": 1505.38, "end": 1510.24, "text": " vector that came from the lower layers, right? That's the forward propagated that through"}, {"start": 1510.24, "end": 1515.76, "text": " your network. So maybe in this layer, it actually pointed here, we don't know. But let's say"}, {"start": 1515.76, "end": 1525.0, "text": " it pointed here. If we pull back the green thing, it might point here. Okay, now, this"}, {"start": 1525.0, "end": 1530.04, "text": " is, since it's a random matrix, we don't know, we know that the angle is approximately preserved,"}, {"start": 1530.04, "end": 1534.6, "text": " okay, but you know, the end the lengths are approximately preserved with relative to each"}, {"start": 1534.6, "end": 1544.54, "text": " other. But it doesn't really tell you too much. So why is this useful? And to see why"}, {"start": 1544.54, "end": 1552.24, "text": " it's useful, you need to consider other inputs, we don't just input this one vector, we input"}, {"start": 1552.24, "end": 1558.48, "text": " a whole bunch of data. Now let's consider two other vectors. So first, I want to consider"}, {"start": 1558.48, "end": 1565.42, "text": " this this blue vector right here. Now, the blue vector is also going to have a label"}, {"start": 1565.42, "end": 1572.28, "text": " of zero. So what does the blue vectors update look like the blue vector is going to be pulled"}, {"start": 1572.28, "end": 1579.42, "text": " into this direction. And I also want to consider this red vector right here, the red vector"}, {"start": 1579.42, "end": 1586.88, "text": " is of class one. So what does the red vectors update going to look like, like this, right?"}, {"start": 1586.88, "end": 1594.18, "text": " And if I consider now the red and the blue vector in this space, right, let's just draw"}, {"start": 1594.18, "end": 1603.24, "text": " them at random, like so, okay, what I do know, actually, that's that's for consistent. Let's"}, {"start": 1603.24, "end": 1609.72, "text": " draw the blue somewhere here, and the red somewhere here. What I do know is that the"}, {"start": 1609.72, "end": 1614.44, "text": " angles and distances are preserved. So what is the green thing going to look like the"}, {"start": 1614.44, "end": 1619.0, "text": " update for the blue vector is going to be something like this. And the update for the"}, {"start": 1619.0, "end": 1626.74, "text": " red vector is going to maybe be something like this, you know, away from from those."}, {"start": 1626.74, "end": 1632.08, "text": " So what is happening in that lower space, you'll notice that the two vectors that are"}, {"start": 1632.08, "end": 1639.36, "text": " supposed to be in the same class, this and this, they are going to be pulled together."}, {"start": 1639.36, "end": 1645.9199999999998, "text": " Now the direction they're pulled in, that's determined by this random matrix. But we know"}, {"start": 1645.9199999999998, "end": 1650.86, "text": " they're going to be pulled together because they are pulled together in this space in"}, {"start": 1650.86, "end": 1660.28, "text": " the final space. Okay, and they're going to be pulled apart from the red vector, okay,"}, {"start": 1660.28, "end": 1665.16, "text": " because that red vector is going to be pulled towards a different class in the in the last"}, {"start": 1665.16, "end": 1670.04, "text": " space. And since the distances and angles are approximately preserved, it's going to"}, {"start": 1670.04, "end": 1678.1, "text": " be pulled away from these in this space. So what this induces, in my opinion, is some"}, {"start": 1678.1, "end": 1687.8799999999999, "text": " sort of it induces this coordinate system where if you make the last layer axis aligned"}, {"start": 1687.88, "end": 1694.2, "text": " because you want to classify it, it kind of clusters things that belong in the same class"}, {"start": 1694.2, "end": 1701.5600000000002, "text": " in these previous weight spaces, right? And because and if you do this layer by layer,"}, {"start": 1701.5600000000002, "end": 1710.0600000000002, "text": " so if you do this in layer k, and then you make the job easier for any layer k plus one"}, {"start": 1710.0600000000002, "end": 1714.88, "text": " that's in between here, right? Because they now the things in the same class are already"}, {"start": 1714.88, "end": 1719.92, "text": " together pretty okay. Now you map it through a weight and the non linearity they might,"}, {"start": 1719.92, "end": 1726.5600000000002, "text": " you know, intertwine a bit again, but there's there more together than they would be otherwise."}, {"start": 1726.5600000000002, "end": 1733.44, "text": " So you make the job for the next layer easier, which means that the next layer can also can"}, {"start": 1733.44, "end": 1741.68, "text": " even better cluster things. And what you'll end up with in this last layer is the is a"}, {"start": 1741.68, "end": 1747.16, "text": " basically a class or next to last layer is basically a clustering, where everything that's"}, {"start": 1747.16, "end": 1753.16, "text": " supposed to be in the same class is together and far apart from each other. And since the"}, {"start": 1753.16, "end": 1759.72, "text": " last layer is the classification layer, it's going to have a really easy job separating"}, {"start": 1759.72, "end": 1766.48, "text": " those classes and performing good classification. So that's what I think is happening in this"}, {"start": 1766.48, "end": 1773.28, "text": " algorithm. So even though the layers don't know how to change to help the last layer,"}, {"start": 1773.28, "end": 1780.72, "text": " by the fact that these random matrices induce a clustering together, you know, by back propagating"}, {"start": 1780.72, "end": 1788.96, "text": " these updates here, it helps the last layer, make it makes its job really easy. And, you"}, {"start": 1788.96, "end": 1794.08, "text": " know, that's all the classifier needs. And I want to I want to show again, this is my"}, {"start": 1794.08, "end": 1801.4399999999998, "text": " opinion, this is not anything of value. It's just my hypothesis of why something like this"}, {"start": 1801.4399999999998, "end": 1805.96, "text": " could work. I want to show you in this paper that I've shown you before right here, they"}, {"start": 1805.96, "end": 1814.06, "text": " do actually do these experiments with DFA. And they show that you can see top row shows"}, {"start": 1814.06, "end": 1820.12, "text": " feature obtained with back propagation, bottom row shows features obtained with DFA. I think"}, {"start": 1820.12, "end": 1826.8799999999999, "text": " these are input and features. I'm not sure where exactly they are in the network. But"}, {"start": 1826.8799999999999, "end": 1834.4399999999998, "text": " you can see that this clustering clearly emerges. So oh, yeah, here, from left to right input"}, {"start": 1834.4399999999998, "end": 1839.12, "text": " images first hidden layer, second hidden layer, third hidden layer. So you can see that the"}, {"start": 1839.12, "end": 1847.2399999999998, "text": " clustering from layer to layer in backprop, and also in DFA is better and better. So the"}, {"start": 1847.24, "end": 1853.72, "text": " reason why backprop is good, maybe it's just that because it also really induces clusterings"}, {"start": 1853.72, "end": 1858.84, "text": " like this, I don't know, maybe backprop does even does something on top of that. Because"}, {"start": 1858.84, "end": 1864.96, "text": " I mean, backprop has all the properties of this and more, right. But still, this this"}, {"start": 1864.96, "end": 1873.36, "text": " is congruent with my hypothesis of what's happening. So what do they do with it, they"}, {"start": 1873.36, "end": 1881.1599999999999, "text": " take this algorithm, and they apply it to these architectures. Now, let's, for example,"}, {"start": 1881.1599999999999, "end": 1888.1999999999998, "text": " look at one of them, this neural view synthesis with neural radiance fields. So neural radiance"}, {"start": 1888.1999999999998, "end": 1895.36, "text": " fields is a type of model to do this task of where you get a bunch of views of an object"}, {"start": 1895.36, "end": 1901.4799999999998, "text": " in 3d, or, you know, a bunch of views around an object, and you're supposed to render a"}, {"start": 1901.48, "end": 1911.56, "text": " new view. And you can see that the DFA parameter or the DFA updated nerve neural radiance field"}, {"start": 1911.56, "end": 1919.32, "text": " model is pretty close to the backpropagation updated one, you can see it's a bit more blurry,"}, {"start": 1919.32, "end": 1924.64, "text": " but it it works, right. And I think the this paper is really trying to show that look,"}, {"start": 1924.64, "end": 1933.0800000000002, "text": " this works, it doesn't work, you know, extremely well, but it works. And it works on a level"}, {"start": 1933.0800000000002, "end": 1937.92, "text": " that hasn't been seen before. So here, if you consider these results higher is better"}, {"start": 1937.92, "end": 1943.5200000000002, "text": " on the synthetic data set here, even you see that if you have the same model with backprop,"}, {"start": 1943.5200000000002, "end": 1951.2, "text": " it performs better than with DFA. But the DFA for that model performs better than these"}, {"start": 1951.2, "end": 1957.0, "text": " other baseline models that have themselves been trained with backpropagation. So it's"}, {"start": 1957.0, "end": 1965.96, "text": " definitely in the direction of being competitive. And that's the same thing they show with all"}, {"start": 1965.96, "end": 1971.0, "text": " of these experiments. So they apply this to graph networks, they apply this to transformers."}, {"start": 1971.0, "end": 1976.76, "text": " And as I said, it's not there yet you see that. So in the transformers, they have these"}, {"start": 1976.76, "end": 1982.2, "text": " settings where in macro, they just use it DFA for the individual blocks and micro, they"}, {"start": 1982.2, "end": 1987.32, "text": " use it for each layer, and already told you that you still in the attention mechanism,"}, {"start": 1987.32, "end": 1992.76, "text": " you still have to use backprop within the attention mechanism. But it is much more of"}, {"start": 1992.76, "end": 2000.08, "text": " a plausible algorithm than the backpropagation through the entire network. And they show"}, {"start": 2000.08, "end": 2006.6399999999999, "text": " that if they appropriately tweak the hyper parameters, they do get into the direction"}, {"start": 2006.6399999999999, "end": 2011.52, "text": " of something that's performant, at least with this macro strategy. Now, this is nowhere"}, {"start": 2011.52, "end": 2020.1, "text": " close to this is nowhere close to what the to what the backpropagation algorithm achieves."}, {"start": 2020.1, "end": 2026.96, "text": " But it's sort of it's sort of an indication that if the community could work as much on"}, {"start": 2026.96, "end": 2033.28, "text": " this as it has worked on backpropagation, then probably will make a lot of like we could"}, {"start": 2033.28, "end": 2039.8400000000001, "text": " we could push this to a place where it does perform on par with backprop or very close"}, {"start": 2039.8400000000001, "end": 2046.32, "text": " to it. So I do invite you to go and look at the experiments, they have a lot of lot of"}, {"start": 2046.32, "end": 2053.32, "text": " details on how they did it. And exactly how you have to change the architectures to make"}, {"start": 2053.32, "end": 2058.36, "text": " DFA work and the hyper parameters and so on. So that's really cool. And they have some"}, {"start": 2058.36, "end": 2065.2000000000003, "text": " more outputs right here of the view synthesis and so on. Yeah, if you are interested in"}, {"start": 2065.2000000000003, "end": 2069.6400000000003, "text": " that thing, I again, I don't want to disrespect it. It's just I don't think there is much"}, {"start": 2069.6400000000003, "end": 2076.1000000000004, "text": " point in me going over it. It's the results are always sort of the same that DFA it. It's"}, {"start": 2076.1, "end": 2083.72, "text": " not there yet, but it's a good direction. Yeah, I hope this was informative. Let me know"}, {"start": 2083.72, "end": 2090.4, "text": " if you disagree about my assessment of DFA I could be completely wrong or you know, I"}, {"start": 2090.4, "end": 2107.6800000000003, "text": " have Yeah, or this could be like well known to people already. So yeah, see you next time."}]
Yannic Kilchner
https://www.youtube.com/watch?v=cuyM63ugsxI
On the Measure of Intelligence by François Chollet - Part 3: The Math (Paper Explained)
In this part, we go over the formal definition of the measure of intelligence. In order to do this, we have to frame and quantify the notions of generalization difficulty, priors, and experience in terms of algorithmic complexity. OUTLINE: 0:00 - Intro & Recap 2:50 - Concept Schema 10:00 - Algorithmic Complexity 13:00 - Definitions 15:25 - Generalization Difficulty 18:55 - Developer Aware Generalization Difficulty 22:40 - Priors 25:10 - Experience 30:50 - The Measure Of Intelligence 38:00 - An Ideal Intelligence Benchmark 42:30 - Conclusion Paper: https://arxiv.org/abs/1911.01547 Part 1: https://youtu.be/3_qGrmD6iQY Part 2: https://youtu.be/THcuTJbeD34 Abstract: To make deliberate progress towards more intelligent and more human-like artificial systems, we need to be following an appropriate feedback signal: we need to be able to define and evaluate intelligence in a way that enables comparisons between two systems, as well as comparisons with humans. Over the past hundred years, there has been an abundance of attempts to define and measure intelligence, across both the fields of psychology and AI. We summarize and critically assess these definitions and evaluation approaches, while making apparent the two historical conceptions of intelligence that have implicitly guided them. We note that in practice, the contemporary AI community still gravitates towards benchmarking intelligence by comparing the skill exhibited by AIs and humans at specific tasks such as board games and video games. We argue that solely measuring skill at any given task falls short of measuring intelligence, because skill is heavily modulated by prior knowledge and experience: unlimited priors or unlimited training data allow experimenters to "buy" arbitrary levels of skills for a system, in a way that masks the system's own generalization power. We then articulate a new formal definition of intelligence based on Algorithmic Information Theory, describing intelligence as skill-acquisition efficiency and highlighting the concepts of scope, generalization difficulty, priors, and experience. Using this definition, we propose a set of guidelines for what a general AI benchmark should look like. Finally, we present a benchmark closely following these guidelines, the Abstraction and Reasoning Corpus (ARC), built upon an explicit set of priors designed to be as close as possible to innate human priors. We argue that ARC can be used to measure a human-like form of general fluid intelligence and that it enables fair general intelligence comparisons between AI systems and humans. Authors: François Chollet Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hello and welcome to the third part on On the Measure of Intelligence by Francois Chollet. Now, this is a multi-part series. If you haven't seen the first two parts, I recommend to watch at least one of them. They're somewhat overlapping. But we've basically gone over the history of intelligence measurement and the foundations of what a measurement for intelligence for an AI system should look like. And today we're going to get into the formal definition of the intelligence that Chollet proposes right here. So this sentence here pretty much sums up what kind of what we're interested in. The intelligence of a system is a measure of its skill acquisition efficiency over a scope of tasks with respect to priors, experience and generalization difficulty. So these are the things that we've established so far, basically. The intelligence of a system, that's the thing we want to measure, right, is a measure of its skill acquisition efficiency. So how fast does it acquire new skills? Important here is that we are measuring it over a scope of tasks. So it's not arbitrary skills. It is a scope that we define. And this is going to be mostly the the human scope, the tasks, the scope of tasks that humans can solve and are sort of different at. And what we need to factor in our priors, which is what is already built in to a system, because that doesn't count as intelligence that's already built in. If your ability to solve a problem is already built into you, you don't have to use intelligence to solve the problem. Second, experience. If you have had lots and lots and lots of experience at the particular task you're asked to solve, you don't have to use intelligence. You can simply rely on your experience. And the third is generalization difficulty. And that's a property of the task. So if the task is very difficult to generalize. So if it's very difficult, if the task itself is very difficult, then achieving a good score at it should count as having higher intelligence if all other things are equal. So this is going to be the basis. And today we're going to watch Shirley define these things into a basically into a number that can give us the intelligence of any system with respect to these things. So that's the program for today. If you like content like this, share it out and tell all your friends and leave a like so that YouTube knows that you do like it. OK, so the conceptualization of the entire system is like this. There is a task and we're going to consider a series of tasks, of course. But if we just look at one task in our scope, there is the task and the task outputs these situations. OK, which in a machine learning term, these are like your training examples. And on the other side, there is the intelligent system. OK, now the intelligent system in a pure machine learning side, you would factor this as the task gives the intelligent system a something like a training sample or in reinforcement learning, it would be something like an observation. And the intelligent system, you know, gives something back like a response. Here we have a kind of a in between step. The intelligent system doesn't actually give back the response to the situation. The intelligent system generates a skill program. So the intelligent system will generate a program that can map the situation to a response. And that skill program should be able to run on its own. OK, so in the classic machine learning sense, if we look at supervised learning, for example, the intelligent system would be the would be like a ResNet, ResNet plus SGD. OK, that is an intelligent system. And if it is output to is it is able to generate a skill program. So during training, what happens during training? During training, the intelligent system is able to intervene in the skill program at each step. So the situation comes in and then the skill program does something. But the intelligent system can at any point, it can kind of intervene and update the skill program and generate a new skill program for the next step. Right. So there's a situation the skill program gives a response and the task gives feedback in form of a score. In machine learning terms, this would be your training sample. Your training sample comes in, your neural network gives a response, which are the logits of the classes. Right. Then the task gives a score to that, which in the supervised learning case is the label or the loss function as a feedback to the intelligent system. And the intelligent system using SGD would update the skill program for the next step. OK, so at each step, the intelligent system can update the skill program. That's why the intelligent system in this case is the architecture of the neural network and the procedure to update the weights, not the weights themselves, but the procedure to update the weights. And the skill program here, those would be the actual weights of the neural network or like the instantiation of the ResNet with these particular weights. OK, now at test time, we sever this connection right here. So this this is now severed at test time. At some point, the training is done. The task says, OK, now training is done. And then the intelligent system will produce one last skill program. And then this connection is cut and the skill program must by itself answer to these situations. It cannot like the intelligent system cannot intervene anymore. And in this loop here, it situation response, situation response. This goes over for a number of steps and all the scores during that time are counted and tallied up. And at the end, you know, the higher the score, the better. So the intelligent system must at this end step produce a skill program that by itself can achieve a high score. OK, so there's always this training phase first and then there is the test phase. Now the training phase, the situations that we get in a training phase, they are called a curriculum in this in this world. In our world, this would be something like a training data set. But this this is curriculum. It's slightly more intricate. But just the notion here makes sense, right? The intelligent system produces the skill program. OK, so there's a lot of formalisms right here, like, OK, the task has like a situation generator and that maps the task state to a situation. So the task can have a state and the skill program can have a state and the intelligent system can have a state. And I don't like this is all a bit too formal. You don't really need to understand it. Except if Francois Chollet is watching this, I think I have found I'm not sure if it's a mistake, but you say the intelligent system here consists of three objects. So it generates the skill program according to its internal state. OK, and it generates the skill program. And when it learns, when it learns, it updates the internal scale internal state according to. Let me if I can find it. Right here. A self update function. So this is how the intelligent system can update itself, so its own state. So it takes the internal state of the intelligent system and outputs another internal state. And this is the you know where I said the internal the intelligent system at each training step, it can observe what happens and basically react accordingly. So it takes the situation, the response and the feedback and its own internal state as an input. Now, what do we have here? It takes the situation, which would be in our case, the training sample, the response or the logits that the neural network has produced, the feedback, which is the loss and its internal state. OK, now what I argue is basically that it should also get the internal state of the skill program as an input right here, because the skill program can have an internal state. All of this, like the response can be a stochastic procedure of the skill program. And I guess it's not necessary because you can sort of infer it, but I think the framework would be more complete if the internal state of the skill program at that time were part of the intelligent system update procedure. Just you don't. OK, this is not relevant. This is just me bickering. Cool. Let's actually jump all of this. This is boring. This is very boring. OK, blah, blah, blah, blah, blah. Lots of definitions. All right. Quantifying, generalization, difficulty, experience and priors using algorithmic information theory. So these things that at the beginning we said that we want to define intelligence with respect to, we are now going to quantify using algorithmic information theory. Algorithmic information theory in this case right here that we're using, it's not very complicated. The main quantity is this H, the algorithmic complexity. The H of S is the length of the shortest description of the string in a fixed universal language. So it's the length of the shortest program that outputs the string when running on a fixed universal Turing machine. So basically, if you have this string S right here, S is a bit string, the shortest program that can compute S or, you know. So in the worst case, that's the string itself. But if the string is like 01010101 all the way, you can just say 01 times 50. And that would be like the shortest program to produce that. It is an information theoretic concept here. But in essence, you can just think of it as a measure of how long is the program that I would need to write to output a given, to produce a given output. So that's the algorithmic complexity. And then the second quantity right here is the relative algorithmic complexity, which is almost the same thing. It's how long is the program that I have to write, so the shortest, we're always talking about how long is the shortest program that I have to write that produces S1, but is allowed to take S2 as an input. So it can always ignore S2. That's always a possibility. So if S1 is like a super easy string, you can just output that. But if S1, let's say S2, here is 01001. And S1 is 01001, 01001. So it's just twice that. So you could sort of output that string here, you could write a program that just outputs this, or you could write a program that just says 2 times S2. Okay, so the length of this is not part of the program, the program is just 2 times S2, because it's allowed to take S2 as an input. Okay, so this is the algorithmic, the relative algorithmic complexity is how complex is the program to get from S2 to S1. So you can almost already see how that will relate now to generalization. Okay, so a few quantities that we need to consider are a task called T here, then Sol T theta is the shortest of all possible solutions of T. So task T has a solution of threshold theta, which the threshold theta is just, this is like the minimum score we need to achieve in a task. We consider tasks according to thresholds, like, you know, you need to get a score of 9000 in Pong or so. So the shortest of all programs that will optimize, that will solve the task to a threshold theta, which is the shortest scale program that achieves at least theta during evaluation. And the other quantity is this train Sol opt TC. This has a lot of quantity right here, you can see the task, we want to be optimal, but with respect to a curriculum. Okay, the curriculum is the training data. So this quantity is the shortest optimal training time solution given a curriculum. So it's the shortest scale program that achieves optimal training time performance over the situation in the curriculum. So this right here is if we could, if we had an oracle that told us here is how to solve the task in general, like the task of determining cats from dogs in images. This would be the program that does it. Okay. You know, overall, over the entirety of the task, all cats and dog images there are. That's the solution. Now this quantity right here means sort of the one neural network that is best at disturb determining cats from dogs in this particular training data set, this curriculum C. Okay, so this is the one neural network that is hyper optimized in this particular training data set. And now we assess the generalization difficulty. So the generalization difficulty is going to be a measure of how hard is it to in a particular task to generalize to the whole task from the curriculum C. And that's going to be the relative algorithmic complexity to go from this quantity to this quantity, both quantities we've just explained. So it basically means if, if I had the perfect solution on the training data set, how much how much more complex is it to get from that to the perfect solution on the entire T of data, or you can also guess on the test data set. So if, if this is really easy, so if the training data set already perfectly captures all of the data there is that this quantity is zero, like the out the program. I don't need to write a program, I already have the solution. Right. And you can see here we divide by the age of Sol T. But however, if the training data has no information whatsoever about about the about the solution to the general task, or if I just so horribly overfit on the training data such that it doesn't help me at all for the general task, then this quantity is zero. So this quantity is in zero one with with, sorry, the quantity is one, of course, yes, because the shortest this thing up here will be equal to just H of Sol T, because this doesn't help me in that case. And then this ratio will be one. So generalization difficulty of one basically means that the training data solution doesn't help me at all. This this particular training curriculum is useless because I'll just overfit so horribly that I will not learn anything about the task or I can't learn anything at all. And generalization difficulty of zero. Oh, that's yeah. No. Yes. Generalization difficulty of zero basically means that all of the solution is already contained in the training solution. And I require no work to get to the to the test set solution. Okay. This is I mean, I do this train test set. This is all a bit more general as it is written here, but I think it's a good a good way to think about it. Okay, so the point here he makes is that is that so. Yeah, he makes this example right here where he has these two data points where X minus point seven five has a label false and X point one five has a label true and the shortest possible solution will not help you to generalize to the to the other things. So the nearest neighbor program would be better prepared for future uncertainty, but would take significantly more space to write down. So there's there's a trade off there is direct trade off to how much you optimize on the training data and how much generalization capability you have. Okay, so the next quantity we want to assess is developer aware generalization difficulty because so far we've only considered generalization difficulty with respect to the task itself and to the to the curriculum. But what you could do is you could simply, you know, you producing this intelligent system, you could simply build in the solution to the entire task into your intelligent system. That means it could completely ignore the training data and still perform pretty well on this thing, even though, even though the training data itself the algorithmic complexity. It tells you nothing about about this so the generalization difficulty would be very high in the measure up here. But so you would think wow, this intelligent system solves this task really well, but it's because you've baked the solution to the task into the system, and it just ignores the training data. So the developer aware generalization difficulty is going to capture that and basically punish you for building the solution, the final solution directly into the task so this is the intelligent system right here at time zero. This is basically whatever you pre build into the intelligent system. This is it hasn't interacted with the training data yet. This is simply the state at the very beginning. So this is all the priors you build in. If you build a ResNet, you know it has certain you know it has convolutional filters and so on. That's a certain prior on the translational invariance if you build a an alpha go system that certainly has the rules of go built in to the system and it has this Monte Carlo tree search which biases it towards a certain kind of learning and so on. So all of this is captured in this quantity right here. This basically means that how if I am given the optimal training solution as before, and also the initial state of the learning system. How much more work is it to get to the solution of the task. And here you can clearly see if I have already built the solution into the system. So if I'm building a tic tac toe learning system, I call it the learning system, but I like build in the optimal strategy from the beginning into my system and it just ignores the training data. Then this thing here would be low because it takes me, it takes me a lot of work to own we only have the training data to get to the solution. But it takes me very little work if I also have the initial state of the system because the solution would be encoded into the initial state already, right. So any prior you put in there will be captured by this. Okay. So, otherwise it's the same, the same metric. Zero means it's very easy to generalize to the entire solution. One means it's even like it's given the training data solution and the system you give me that it is very hard for that system. Now consider here this quantity actually depends on the system you put in. All right. Then we need two more things, which are priors and experience. So this was the difficulty. This was how difficult is the task as such if for a given system and a curriculum. Now, what we want, we want to characterize priors and experience now priors are pretty easy. What are, what is a prior, a prior we can capture by simply looking at the difference between how complex is the solution minus how complex is the solution if I'm given the initial state. This is almost the same as before, but it now only considers what you built into the system, right. There is no training data anymore. It simply says, if I have, you know, if you give me your, the source code of your learning system, can I, if I can already read out the solution, then this quantity right here will be zero. There is zero complexity to get from your initial state of the learning system to the solution of the task and therefore this entire quantity would be one. That means the prior, all the information is in the prior. However, if your learning system is a very general learning system, like it's a, it's like a standard reinforcement learning algorithm with almost no assumption about the data, then this quantity right here would be very low. Sorry, it would be very high, of course, because the initial system doesn't tell you too much. So it's still a lot of work. If I gave you the source code, it's like, well, this is very general. This doesn't tell me anything about the task and it would require a lot of work to get the solution of the task and therefore the quantity up here would be very low and therefore this would be close to zero. So that means there are no priors in this intelligent system for that given task. OK, and the quantity is always how to reach the threshold. The solution is always with respect to a threshold in scale. So you must reach like this many points. OK, the important thing that Chollet notes here is that the priors capture not the amount of information in the program, in the intelligent system, but the amount of relevant information for that task. You can make a super duper complex intelligent system. The only thing that matters for this quantity is the amount of information that's relevant to get to the solution of the task T. The last thing we need to capture is experience. Now, experience basically means how much during this learning phase. Now we just talked about at the outset, like the state at time zero for the priors. Now you remember we interact with the task for a number of time in this training phase, right? And the question is, of course, if we are given a longer training phase, it is easier to generalize generally. Right? More training data makes it makes our life easier, makes it easier to generalize. And the intelligence is inverse proportional to that. So a system that had all else being equal, that has less training data, but is performing as well on a task as a system that had more training data, that system that had less training data, we consider to be a more intelligent system because it can generalize more efficiently. So we need to quantify experience and experience now in the same kind of in the same train of thought is going to be the difference between two quantities. So the first quantity is this. So here we consider at each time step T. OK, so at each time step T, we have the intelligent system. And we have this thing here called data. Now, data is everything that the intelligent system gets at that point in time. So the intelligent system is here at time step T, and then it outputs the skill program and that skill program gets a situation and gives a response. And this gives a feedback and all of this data that's called data. OK, it's basically you can think of it as one additional training example. You're at time step T and you're given one additional training example. The experience is going to quantify how much information is in that one additional example. And then we're going to sum this up over time down here, which basically means over the entire course of training, which is this curriculum C, how much information did you get out of the training data at each step? That's going to be your experience over the course of training, which again, this is the sum over the experience that you got at each step. And the experience at each step is simply the following two things. So we're going to assess is how difficult is it at time T? So you've learned for T steps, how difficult is it to go from that to the solution? So if you might have had some training data, right, and you score a certain you score a certain score, like 80 percent on the on the test set. So that's basically how difficult it is. It's like you still make 20 percent of error. That's your difficulty. And then you get one more training sample, this data here. Now, you can ask again, if I know everything I'm knowing my intelligence system, but I also get one more training data point. Can I? How easy is it now to arrive at the solution of the task? And now you can say, oh, with this training data point, I now can correct some of my mistakes and I only make like 18 percent of error. OK, so the difference here would be like two percent. So that's going to be your experience is going to be worth of two percent of errors. OK, now the important thing here is that it is it is different if we we could have just written here minus H of, you know, Sol theta T, given the intelligent system at time step T plus one. Right, because the intelligent system at times that people as one has had that data point at time step T and incorporated it. But that's not that's not the same thing here. We in in this step right here, when we say how difficult is it? We assume that, you know, God or Vapnik himself tells us how like the optimal way to use that information. OK, whereas this thing here, it's not a given that the intelligent system will use that information in the most optimal way. So this is basically the difference between how difficult is it to get from the intelligent system to the solution and how difficult is it to get from the intelligent system and the data point at time T if you could make optimal use of that data point to the solution. All right. So this this is going to be an assessment of how much experience you've had in the in the sense of had you been able to incorporate the experience properly at each time step. Because yeah, because otherwise, you know, you you couldn't compare the experience if two systems had had the same experience in the same task, it should mean they had had the same, you know, data points in the same order or in in a simplistic sense. All right. So this is all we need. Intelligence. Boom. This is it. So there's a lot of stuff here. Okay, intelligence of an intelligent system with respect to a scope. And there are two definitions right here. One is for optimal skill at each task, and one is for threshold of skill. Now we're going to focus on the threshold as we said, we at each task we require something like you must achieve 8000 points, and we're going to consider the shortest programs that will get to at least 8000 points. Now, there's a bit of confusion in the notation here as this, I'm pretty sure this quantity right here, you know, should be called something different because it's you know, it's the T is here. And then there's this here, this refers to this, and this shouldn't be out of here, this should be meaning something like thresh. I'm pretty sure this is just a name, like here, the name opt. So, um, yeah. So in any case, the intelligence is of an intelligent system with respect to a scope of tasks. Okay. And the first thing we do is we're going to average over the tasks in the scope. So we consider all the different tasks, and each task has a weight associated with it. This, this is the threshold and skill that we want. And this is sort of a mapping, this is a conversion rate, because this might be, you know, 9000 points at Pong. And another task might be, you need to achieve point two, and that's really good at point two is really good. So this W for each task is simply going to map it to a like a uniform coordinate space of, of, of points of skill level of that particular task. Okay, so we're going to average over tasks. Now you can, I guess, disregard this, this is not super, this is just scaling. We're going to average over tasks. Now in each task, we're going to consider all curriculums that get you to this threshold. So all curriculums that get you to the threshold T for theta T for task T, which means sort of means all the possible permutations of training data sets for that task, right? It's more general than this, but we yeah, we want to assess all the, all the different ones. And as you can see here, there's P of C. So this is an expectation, this is the probability of that particular curriculum. This is, this is the expectation over data right here. This is the expectation over the training data distribution, okay, in the classical machine learning sense. So we're going to take the average across all tasks over the expectation under the training data distribution. So we're good so far. And usually right here, we would put something like the empirical risk, right? The minimum, minimum loss, min loss function, min theta loss function over my, over my C, over my training data set, okay, but not in this case. Because we now want to consider the priors and the experience and discount that from the difficulty. And that's what's written here. So this is the developer aware generalization difficulty. This here is the amount of information that's already contained in the priors. And this here is the amount of information that's contained in the experience in that curriculum. As you can see here, the experience is in that curriculum. So basically, a system is more intelligent if the task is harder for that given system and that given curriculum, okay? So that makes intelligence up. A system is more intelligent if it gets to a certain threshold with lower priors, okay? If the priors are low, this whole quantity is high. And the system is also more intelligent if it gets to the threshold with less experience, okay? So if the experience here is lower, it is counts as more intelligent. All right. In this in this quantity, and this is written all in the text here, it has some properties in that it for example, it down values actors that in the same curriculum, like in the same training data, they if if an actor learns faster, like it learns earlier to reach the threshold, it would assign more intelligence to that actor and so on. It's kind of sometimes it's hidden over the it's hidden in the definitions. For example, these curricula are not all the same as the curricular specifically curricula that you need to reach this certain threshold. So it's not always doesn't always sum up to one with this probability here. That's why it's not exactly an expectation. Let's call it an expectation in quotation marks. But in the general sense, that's it. So insist the intelligence of a system is over a scope of tasks. The the expectation in quotation marks under the training distribution of the generalization difficulty accounted but accounted for discount, we discount the prior knowledge of the system and the experience that the system has had. Okay. And that's it. It says, P plus E prior experience represents the total exposure of the system to information about the problem, including the information it starts with at the beginning of training. Okay, so if this is high, then the system is not very intelligent or is not if a system that has more of this but generalizes to the same level as another system is considered less intelligent than the other system because it has had more exposure to information about the problem. It makes a lot of sense, right? So schematically, the contribution of each task is the expectation over skill times generalization divided by priors plus experience. That's kind of in words, what we looked at. So it gives over a number of key observations. And at last, he goes over consequences, or basically a recommendation for what a benchmark should look like if we regard it in this light. Now, of course, these complexities and so on, they're not exactly computable. Right. So it's like how much exactly the shortest the length of the shortest program is is not exactly computable, but it can inform our notion of how we should test intelligence. Okay, so what to expect of an ideal intelligence benchmark. First of all, it should describe its scope of application its own predictiveness with regard to the scope. So that means the validity, it should be replicable, it should be reproducible. It should measure broad abilities and developer aware generalization. Sorry, it should. It should set out to measure broad abilities and developer aware generalization. Okay, so that means it should not be solely measuring skill or potential. It should not feature in its evaluation set any tasks that are known in advance, either to the test taking system itself, or to the developers of the system. And that, of course, refers directly to the developer aware generalization. And it should seek to quantify the generalization difficulty it measures, or at least provide qualitative guidelines with regards to its generalization difficulty. It should at least be made clear whether the benchmark seeks to measure local generalization, broad generalization, or extreme generalization. So we've seen this in part one. Taking into account generalization difficulty minimizes the possibility that a given benchmark could be hacked by solvers that take undesired shortcuts that bypass broad abilities. It says it should control for the amount of experience leveraged by test taking systems during training. It should not be possible to buy performance on the benchmark by sampling unlimited training data. So this this already rules out sort of any, let's say image recognition or NLP benchmarks because there we can always just feed in more data, the more unlabeled data from the internet or even labeled data. Like if there's a benchmark that, you know, is on computer vision, I can just pay more humans to label more data and then I will be better at that benchmark. The benchmark should avoid tasks for which new data can be generated at will. It should be in effect a game for which it is not possible to practice in advance of the evaluation session. That's going to be hard, right? It should be it should explicitly and exhaustively describe the set of priors it assumes. Any task is going to involve priors. But in many tasks used for evaluation today, priors stay implicit and the existence of implicit hidden priors may often give an unfair advantage to either humans or machines. So this is, for example, if the test is like a speed test. A lot of times machines are going to be way faster than humans because the hidden assumption in a speed test is that kind of your nerve conductivity is the same across all test takers. And the last one, it should work for both humans and machines fairly by only assessing the same priors as possessed by humans. And he refers to core knowledge, which we saw in the last part, and only requiring a human sized amount of practice time or training data. So this means if we want to compare humans and machines, machines can often incorporate way more data than humans. So the tasks in the benchmark should only like the amount of data should be such that a human could process that data. Now, of course, that that sort of also means that any task where basically you collect data during your life is all also sort of ruled out a bit. So that means the AI benchmark task can't be like cook a pan of spaghetti or something like this. Yeah. And in the end, he says these recommendations for general AI evaluation wouldn't be complete without a concrete effort to implement them. In part three, we present our initial attempt, which is going to be the ARK dataset and the ARK Kaggle challenge. But that's a story for next time. I hope you enjoy this and at least got some bits of it. It's very abstract. This measure of intelligence, of course, it can never be computed exactly. But the fact that someone is trying to formalize and it's not the first time this has been trying to formalize. But this I feel it's quite understandable and makes sort of sense. And I'm interested to see if people come up with actual approximations to this quantity that you could actually compute sort of. All right. That was it. Thank you for watching and bye bye. See you next time.
[{"start": 0.0, "end": 7.0, "text": " Hello and welcome to the third part on On the Measure of Intelligence by Francois Chollet."}, {"start": 7.0, "end": 14.0, "text": " Now, this is a multi-part series. If you haven't seen the first two parts, I recommend to watch at least one of them."}, {"start": 14.0, "end": 21.0, "text": " They're somewhat overlapping. But we've basically gone over the history of intelligence measurement"}, {"start": 21.0, "end": 28.0, "text": " and the foundations of what a measurement for intelligence for an AI system should look like."}, {"start": 28.0, "end": 36.0, "text": " And today we're going to get into the formal definition of the intelligence that Chollet proposes right here."}, {"start": 36.0, "end": 43.0, "text": " So this sentence here pretty much sums up what kind of what we're interested in."}, {"start": 43.0, "end": 55.0, "text": " The intelligence of a system is a measure of its skill acquisition efficiency over a scope of tasks with respect to priors, experience and generalization difficulty."}, {"start": 55.0, "end": 60.0, "text": " So these are the things that we've established so far, basically."}, {"start": 60.0, "end": 67.0, "text": " The intelligence of a system, that's the thing we want to measure, right, is a measure of its skill acquisition efficiency."}, {"start": 67.0, "end": 74.0, "text": " So how fast does it acquire new skills? Important here is that we are measuring it over a scope of tasks."}, {"start": 74.0, "end": 78.0, "text": " So it's not arbitrary skills. It is a scope that we define."}, {"start": 78.0, "end": 89.0, "text": " And this is going to be mostly the the human scope, the tasks, the scope of tasks that humans can solve and are sort of different at."}, {"start": 89.0, "end": 101.0, "text": " And what we need to factor in our priors, which is what is already built in to a system, because that doesn't count as intelligence that's already built in."}, {"start": 101.0, "end": 108.0, "text": " If your ability to solve a problem is already built into you, you don't have to use intelligence to solve the problem."}, {"start": 108.0, "end": 117.0, "text": " Second, experience. If you have had lots and lots and lots of experience at the particular task you're asked to solve, you don't have to use intelligence."}, {"start": 117.0, "end": 122.0, "text": " You can simply rely on your experience. And the third is generalization difficulty."}, {"start": 122.0, "end": 128.0, "text": " And that's a property of the task. So if the task is very difficult to generalize."}, {"start": 128.0, "end": 141.0, "text": " So if it's very difficult, if the task itself is very difficult, then achieving a good score at it should count as having higher intelligence if all other things are equal."}, {"start": 141.0, "end": 157.0, "text": " So this is going to be the basis. And today we're going to watch Shirley define these things into a basically into a number that can give us the intelligence of any system with respect to these things."}, {"start": 157.0, "end": 169.0, "text": " So that's the program for today. If you like content like this, share it out and tell all your friends and leave a like so that YouTube knows that you do like it."}, {"start": 169.0, "end": 174.0, "text": " OK, so the conceptualization of the entire system is like this."}, {"start": 174.0, "end": 179.0, "text": " There is a task and we're going to consider a series of tasks, of course."}, {"start": 179.0, "end": 188.0, "text": " But if we just look at one task in our scope, there is the task and the task outputs these situations."}, {"start": 188.0, "end": 193.0, "text": " OK, which in a machine learning term, these are like your training examples."}, {"start": 193.0, "end": 196.0, "text": " And on the other side, there is the intelligent system."}, {"start": 196.0, "end": 210.0, "text": " OK, now the intelligent system in a pure machine learning side, you would factor this as the task gives the intelligent system a something like a training sample or in reinforcement learning, it would be something like an observation."}, {"start": 210.0, "end": 214.0, "text": " And the intelligent system, you know, gives something back like a response."}, {"start": 214.0, "end": 218.0, "text": " Here we have a kind of a in between step."}, {"start": 218.0, "end": 226.0, "text": " The intelligent system doesn't actually give back the response to the situation. The intelligent system generates a skill program."}, {"start": 226.0, "end": 233.0, "text": " So the intelligent system will generate a program that can map the situation to a response."}, {"start": 233.0, "end": 238.0, "text": " And that skill program should be able to run on its own."}, {"start": 238.0, "end": 255.0, "text": " OK, so in the classic machine learning sense, if we look at supervised learning, for example, the intelligent system would be the would be like a ResNet, ResNet plus SGD."}, {"start": 255.0, "end": 258.0, "text": " OK, that is an intelligent system."}, {"start": 258.0, "end": 268.0, "text": " And if it is output to is it is able to generate a skill program."}, {"start": 268.0, "end": 270.0, "text": " So during training, what happens during training?"}, {"start": 270.0, "end": 277.0, "text": " During training, the intelligent system is able to intervene in the skill program at each step."}, {"start": 277.0, "end": 282.0, "text": " So the situation comes in and then the skill program does something."}, {"start": 282.0, "end": 291.0, "text": " But the intelligent system can at any point, it can kind of intervene and update the skill program and generate a new skill program for the next step."}, {"start": 291.0, "end": 300.0, "text": " Right. So there's a situation the skill program gives a response and the task gives feedback in form of a score."}, {"start": 300.0, "end": 304.0, "text": " In machine learning terms, this would be your training sample."}, {"start": 304.0, "end": 310.0, "text": " Your training sample comes in, your neural network gives a response, which are the logits of the classes."}, {"start": 310.0, "end": 322.0, "text": " Right. Then the task gives a score to that, which in the supervised learning case is the label or the loss function as a feedback to the intelligent system."}, {"start": 322.0, "end": 329.0, "text": " And the intelligent system using SGD would update the skill program for the next step."}, {"start": 329.0, "end": 332.0, "text": " OK, so at each step, the intelligent system can update the skill program."}, {"start": 332.0, "end": 344.0, "text": " That's why the intelligent system in this case is the architecture of the neural network and the procedure to update the weights, not the weights themselves, but the procedure to update the weights."}, {"start": 344.0, "end": 356.0, "text": " And the skill program here, those would be the actual weights of the neural network or like the instantiation of the ResNet with these particular weights."}, {"start": 356.0, "end": 360.0, "text": " OK, now at test time, we sever this connection right here."}, {"start": 360.0, "end": 365.0, "text": " So this this is now severed at test time. At some point, the training is done."}, {"start": 365.0, "end": 372.0, "text": " The task says, OK, now training is done. And then the intelligent system will produce one last skill program."}, {"start": 372.0, "end": 380.0, "text": " And then this connection is cut and the skill program must by itself answer to these situations."}, {"start": 380.0, "end": 384.0, "text": " It cannot like the intelligent system cannot intervene anymore."}, {"start": 384.0, "end": 390.0, "text": " And in this loop here, it situation response, situation response."}, {"start": 390.0, "end": 397.0, "text": " This goes over for a number of steps and all the scores during that time are counted and tallied up."}, {"start": 397.0, "end": 401.0, "text": " And at the end, you know, the higher the score, the better."}, {"start": 401.0, "end": 409.0, "text": " So the intelligent system must at this end step produce a skill program that by itself can achieve a high score."}, {"start": 409.0, "end": 415.0, "text": " OK, so there's always this training phase first and then there is the test phase."}, {"start": 415.0, "end": 426.0, "text": " Now the training phase, the situations that we get in a training phase, they are called a curriculum in this in this world."}, {"start": 426.0, "end": 431.0, "text": " In our world, this would be something like a training data set."}, {"start": 431.0, "end": 435.0, "text": " But this this is curriculum. It's slightly more intricate."}, {"start": 435.0, "end": 442.0, "text": " But just the notion here makes sense, right? The intelligent system produces the skill program."}, {"start": 442.0, "end": 455.0, "text": " OK, so there's a lot of formalisms right here, like, OK, the task has like a situation generator and that maps the task state to a situation."}, {"start": 455.0, "end": 460.0, "text": " So the task can have a state and the skill program can have a state and the intelligent system can have a state."}, {"start": 460.0, "end": 467.0, "text": " And I don't like this is all a bit too formal. You don't really need to understand it."}, {"start": 467.0, "end": 480.0, "text": " Except if Francois Chollet is watching this, I think I have found I'm not sure if it's a mistake, but you say the intelligent system here consists of three objects."}, {"start": 480.0, "end": 485.0, "text": " So it generates the skill program according to its internal state."}, {"start": 485.0, "end": 494.0, "text": " OK, and it generates the skill program. And when it learns, when it learns, it updates the internal scale internal state according to."}, {"start": 494.0, "end": 503.0, "text": " Let me if I can find it. Right here. A self update function."}, {"start": 503.0, "end": 508.0, "text": " So this is how the intelligent system can update itself, so its own state."}, {"start": 508.0, "end": 514.0, "text": " So it takes the internal state of the intelligent system and outputs another internal state."}, {"start": 514.0, "end": 523.0, "text": " And this is the you know where I said the internal the intelligent system at each training step, it can observe what happens and basically react accordingly."}, {"start": 523.0, "end": 530.0, "text": " So it takes the situation, the response and the feedback and its own internal state as an input."}, {"start": 530.0, "end": 541.0, "text": " Now, what do we have here? It takes the situation, which would be in our case, the training sample, the response or the logits that the neural network has produced,"}, {"start": 541.0, "end": 545.0, "text": " the feedback, which is the loss and its internal state."}, {"start": 545.0, "end": 558.0, "text": " OK, now what I argue is basically that it should also get the internal state of the skill program as an input right here, because the skill program can have an internal state."}, {"start": 558.0, "end": 562.0, "text": " All of this, like the response can be a stochastic procedure of the skill program."}, {"start": 562.0, "end": 579.0, "text": " And I guess it's not necessary because you can sort of infer it, but I think the framework would be more complete if the internal state of the skill program at that time were part of the intelligent system update procedure."}, {"start": 579.0, "end": 586.0, "text": " Just you don't. OK, this is not relevant. This is just me bickering."}, {"start": 586.0, "end": 599.0, "text": " Cool. Let's actually jump all of this. This is boring. This is very boring. OK, blah, blah, blah, blah, blah. Lots of definitions."}, {"start": 599.0, "end": 605.0, "text": " All right. Quantifying, generalization, difficulty, experience and priors using algorithmic information theory."}, {"start": 605.0, "end": 617.0, "text": " So these things that at the beginning we said that we want to define intelligence with respect to, we are now going to quantify using algorithmic information theory."}, {"start": 617.0, "end": 622.0, "text": " Algorithmic information theory in this case right here that we're using, it's not very complicated."}, {"start": 622.0, "end": 638.0, "text": " The main quantity is this H, the algorithmic complexity. The H of S is the length of the shortest description of the string in a fixed universal language."}, {"start": 638.0, "end": 645.0, "text": " So it's the length of the shortest program that outputs the string when running on a fixed universal Turing machine."}, {"start": 645.0, "end": 656.0, "text": " So basically, if you have this string S right here, S is a bit string, the shortest program that can compute S or, you know."}, {"start": 656.0, "end": 666.0, "text": " So in the worst case, that's the string itself. But if the string is like 01010101 all the way, you can just say 01 times 50."}, {"start": 666.0, "end": 673.0, "text": " And that would be like the shortest program to produce that. It is an information theoretic concept here."}, {"start": 673.0, "end": 685.0, "text": " But in essence, you can just think of it as a measure of how long is the program that I would need to write to output a given, to produce a given output."}, {"start": 685.0, "end": 695.0, "text": " So that's the algorithmic complexity. And then the second quantity right here is the relative algorithmic complexity, which is almost the same thing."}, {"start": 695.0, "end": 712.0, "text": " It's how long is the program that I have to write, so the shortest, we're always talking about how long is the shortest program that I have to write that produces S1, but is allowed to take S2 as an input."}, {"start": 712.0, "end": 730.0, "text": " So it can always ignore S2. That's always a possibility. So if S1 is like a super easy string, you can just output that. But if S1, let's say S2, here is 01001."}, {"start": 730.0, "end": 752.0, "text": " And S1 is 01001, 01001. So it's just twice that. So you could sort of output that string here, you could write a program that just outputs this, or you could write a program that just says 2 times S2."}, {"start": 752.0, "end": 764.0, "text": " Okay, so the length of this is not part of the program, the program is just 2 times S2, because it's allowed to take S2 as an input."}, {"start": 764.0, "end": 783.0, "text": " Okay, so this is the algorithmic, the relative algorithmic complexity is how complex is the program to get from S2 to S1. So you can almost already see how that will relate now to generalization."}, {"start": 783.0, "end": 795.0, "text": " Okay, so a few quantities that we need to consider are a task called T here, then Sol T theta is the shortest of all possible solutions of T."}, {"start": 795.0, "end": 804.0, "text": " So task T has a solution of threshold theta, which the threshold theta is just, this is like the minimum score we need to achieve in a task."}, {"start": 804.0, "end": 816.0, "text": " We consider tasks according to thresholds, like, you know, you need to get a score of 9000 in Pong or so."}, {"start": 816.0, "end": 836.0, "text": " So the shortest of all programs that will optimize, that will solve the task to a threshold theta, which is the shortest scale program that achieves at least theta during evaluation."}, {"start": 836.0, "end": 851.0, "text": " And the other quantity is this train Sol opt TC. This has a lot of quantity right here, you can see the task, we want to be optimal, but with respect to a curriculum."}, {"start": 851.0, "end": 860.0, "text": " Okay, the curriculum is the training data. So this quantity is the shortest optimal training time solution given a curriculum."}, {"start": 860.0, "end": 867.0, "text": " So it's the shortest scale program that achieves optimal training time performance over the situation in the curriculum."}, {"start": 867.0, "end": 886.0, "text": " So this right here is if we could, if we had an oracle that told us here is how to solve the task in general, like the task of determining cats from dogs in images."}, {"start": 886.0, "end": 900.0, "text": " This would be the program that does it. Okay. You know, overall, over the entirety of the task, all cats and dog images there are. That's the solution."}, {"start": 900.0, "end": 916.0, "text": " Now this quantity right here means sort of the one neural network that is best at disturb determining cats from dogs in this particular training data set, this curriculum C."}, {"start": 916.0, "end": 923.0, "text": " Okay, so this is the one neural network that is hyper optimized in this particular training data set."}, {"start": 923.0, "end": 940.0, "text": " And now we assess the generalization difficulty. So the generalization difficulty is going to be a measure of how hard is it to in a particular task to generalize to the whole task from the curriculum C."}, {"start": 940.0, "end": 948.0, "text": " And that's going to be the relative algorithmic complexity to go from this quantity to this quantity, both quantities we've just explained."}, {"start": 948.0, "end": 968.0, "text": " So it basically means if, if I had the perfect solution on the training data set, how much how much more complex is it to get from that to the perfect solution on the entire T of data, or you can also guess on the test data set."}, {"start": 968.0, "end": 984.0, "text": " So if, if this is really easy, so if the training data set already perfectly captures all of the data there is that this quantity is zero, like the out the program."}, {"start": 984.0, "end": 992.0, "text": " I don't need to write a program, I already have the solution. Right. And you can see here we divide by the age of Sol T."}, {"start": 992.0, "end": 1012.0, "text": " But however, if the training data has no information whatsoever about about the about the solution to the general task, or if I just so horribly overfit on the training data such that it doesn't help me at all for the general task, then this quantity is zero."}, {"start": 1012.0, "end": 1032.0, "text": " So this quantity is in zero one with with, sorry, the quantity is one, of course, yes, because the shortest this thing up here will be equal to just H of Sol T, because this doesn't help me in that case."}, {"start": 1032.0, "end": 1044.0, "text": " And then this ratio will be one. So generalization difficulty of one basically means that the training data solution doesn't help me at all."}, {"start": 1044.0, "end": 1056.0, "text": " This this particular training curriculum is useless because I'll just overfit so horribly that I will not learn anything about the task or I can't learn anything at all."}, {"start": 1056.0, "end": 1070.0, "text": " And generalization difficulty of zero. Oh, that's yeah. No. Yes. Generalization difficulty of zero basically means that all of the solution is already contained in the training solution."}, {"start": 1070.0, "end": 1077.0, "text": " And I require no work to get to the to the test set solution. Okay."}, {"start": 1077.0, "end": 1087.0, "text": " This is I mean, I do this train test set. This is all a bit more general as it is written here, but I think it's a good a good way to think about it."}, {"start": 1087.0, "end": 1097.0, "text": " Okay, so the point here he makes is that is that so."}, {"start": 1097.0, "end": 1117.0, "text": " Yeah, he makes this example right here where he has these two data points where X minus point seven five has a label false and X point one five has a label true and the shortest possible solution will not help you to generalize to the to the other things."}, {"start": 1117.0, "end": 1127.0, "text": " So the nearest neighbor program would be better prepared for future uncertainty, but would take significantly more space to write down."}, {"start": 1127.0, "end": 1139.0, "text": " So there's there's a trade off there is direct trade off to how much you optimize on the training data and how much generalization capability you have."}, {"start": 1139.0, "end": 1153.0, "text": " Okay, so the next quantity we want to assess is developer aware generalization difficulty because so far we've only considered generalization difficulty with respect to the task itself and to the to the curriculum."}, {"start": 1153.0, "end": 1164.0, "text": " But what you could do is you could simply, you know, you producing this intelligent system, you could simply build in the solution to the entire task into your intelligent system."}, {"start": 1164.0, "end": 1176.0, "text": " That means it could completely ignore the training data and still perform pretty well on this thing, even though, even though the training data itself the algorithmic complexity."}, {"start": 1176.0, "end": 1185.0, "text": " It tells you nothing about about this so the generalization difficulty would be very high in the measure up here."}, {"start": 1185.0, "end": 1199.0, "text": " But so you would think wow, this intelligent system solves this task really well, but it's because you've baked the solution to the task into the system, and it just ignores the training data."}, {"start": 1199.0, "end": 1214.0, "text": " So the developer aware generalization difficulty is going to capture that and basically punish you for building the solution, the final solution directly into the task so this is the intelligent system right here at time zero."}, {"start": 1214.0, "end": 1223.0, "text": " This is basically whatever you pre build into the intelligent system. This is it hasn't interacted with the training data yet."}, {"start": 1223.0, "end": 1228.0, "text": " This is simply the state at the very beginning. So this is all the priors you build in."}, {"start": 1228.0, "end": 1234.0, "text": " If you build a ResNet, you know it has certain you know it has convolutional filters and so on."}, {"start": 1234.0, "end": 1251.0, "text": " That's a certain prior on the translational invariance if you build a an alpha go system that certainly has the rules of go built in to the system and it has this Monte Carlo tree search which biases it towards a certain kind of learning and so on."}, {"start": 1251.0, "end": 1255.0, "text": " So all of this is captured in this quantity right here."}, {"start": 1255.0, "end": 1269.0, "text": " This basically means that how if I am given the optimal training solution as before, and also the initial state of the learning system."}, {"start": 1269.0, "end": 1279.0, "text": " How much more work is it to get to the solution of the task. And here you can clearly see if I have already built the solution into the system."}, {"start": 1279.0, "end": 1295.0, "text": " So if I'm building a tic tac toe learning system, I call it the learning system, but I like build in the optimal strategy from the beginning into my system and it just ignores the training data."}, {"start": 1295.0, "end": 1306.0, "text": " Then this thing here would be low because it takes me, it takes me a lot of work to own we only have the training data to get to the solution."}, {"start": 1306.0, "end": 1317.0, "text": " But it takes me very little work if I also have the initial state of the system because the solution would be encoded into the initial state already, right."}, {"start": 1317.0, "end": 1325.0, "text": " So any prior you put in there will be captured by this. Okay. So, otherwise it's the same, the same metric."}, {"start": 1325.0, "end": 1339.0, "text": " Zero means it's very easy to generalize to the entire solution. One means it's even like it's given the training data solution and the system you give me that it is very hard for that system."}, {"start": 1339.0, "end": 1347.0, "text": " Now consider here this quantity actually depends on the system you put in. All right."}, {"start": 1347.0, "end": 1361.0, "text": " Then we need two more things, which are priors and experience. So this was the difficulty. This was how difficult is the task as such if for a given system and a curriculum."}, {"start": 1361.0, "end": 1369.0, "text": " Now, what we want, we want to characterize priors and experience now priors are pretty easy."}, {"start": 1369.0, "end": 1384.0, "text": " What are, what is a prior, a prior we can capture by simply looking at the difference between how complex is the solution minus how complex is the solution if I'm given the initial state."}, {"start": 1384.0, "end": 1392.0, "text": " This is almost the same as before, but it now only considers what you built into the system, right. There is no training data anymore."}, {"start": 1392.0, "end": 1408.0, "text": " It simply says, if I have, you know, if you give me your, the source code of your learning system, can I, if I can already read out the solution, then this quantity right here will be zero."}, {"start": 1408.0, "end": 1424.0, "text": " There is zero complexity to get from your initial state of the learning system to the solution of the task and therefore this entire quantity would be one. That means the prior, all the information is in the prior."}, {"start": 1424.0, "end": 1441.0, "text": " However, if your learning system is a very general learning system, like it's a, it's like a standard reinforcement learning algorithm with almost no assumption about the data, then this quantity right here would be very low."}, {"start": 1441.0, "end": 1454.0, "text": " Sorry, it would be very high, of course, because the initial system doesn't tell you too much. So it's still a lot of work. If I gave you the source code, it's like, well, this is very general."}, {"start": 1454.0, "end": 1466.0, "text": " This doesn't tell me anything about the task and it would require a lot of work to get the solution of the task and therefore the quantity up here would be very low and therefore this would be close to zero."}, {"start": 1466.0, "end": 1474.0, "text": " So that means there are no priors in this intelligent system for that given task."}, {"start": 1474.0, "end": 1485.0, "text": " OK, and the quantity is always how to reach the threshold. The solution is always with respect to a threshold in scale. So you must reach like this many points."}, {"start": 1485.0, "end": 1501.0, "text": " OK, the important thing that Chollet notes here is that the priors capture not the amount of information in the program, in the intelligent system, but the amount of relevant information for that task."}, {"start": 1501.0, "end": 1515.0, "text": " You can make a super duper complex intelligent system. The only thing that matters for this quantity is the amount of information that's relevant to get to the solution of the task T."}, {"start": 1515.0, "end": 1531.0, "text": " The last thing we need to capture is experience. Now, experience basically means how much during this learning phase. Now we just talked about at the outset, like the state at time zero for the priors."}, {"start": 1531.0, "end": 1541.0, "text": " Now you remember we interact with the task for a number of time in this training phase, right?"}, {"start": 1541.0, "end": 1550.0, "text": " And the question is, of course, if we are given a longer training phase, it is easier to generalize generally."}, {"start": 1550.0, "end": 1560.0, "text": " Right? More training data makes it makes our life easier, makes it easier to generalize. And the intelligence is inverse proportional to that."}, {"start": 1560.0, "end": 1578.0, "text": " So a system that had all else being equal, that has less training data, but is performing as well on a task as a system that had more training data, that system that had less training data, we consider to be a more intelligent system because it can generalize more efficiently."}, {"start": 1578.0, "end": 1589.0, "text": " So we need to quantify experience and experience now in the same kind of in the same train of thought is going to be the difference between two quantities."}, {"start": 1589.0, "end": 1602.0, "text": " So the first quantity is this. So here we consider at each time step T. OK, so at each time step T, we have the intelligent system."}, {"start": 1602.0, "end": 1612.0, "text": " And we have this thing here called data. Now, data is everything that the intelligent system gets at that point in time."}, {"start": 1612.0, "end": 1622.0, "text": " So the intelligent system is here at time step T, and then it outputs the skill program and that skill program gets a situation and gives a response."}, {"start": 1622.0, "end": 1627.0, "text": " And this gives a feedback and all of this data that's called data."}, {"start": 1627.0, "end": 1633.0, "text": " OK, it's basically you can think of it as one additional training example."}, {"start": 1633.0, "end": 1646.0, "text": " You're at time step T and you're given one additional training example. The experience is going to quantify how much information is in that one additional example."}, {"start": 1646.0, "end": 1656.0, "text": " And then we're going to sum this up over time down here, which basically means over the entire course of training, which is this curriculum C,"}, {"start": 1656.0, "end": 1663.0, "text": " how much information did you get out of the training data at each step?"}, {"start": 1663.0, "end": 1672.0, "text": " That's going to be your experience over the course of training, which again, this is the sum over the experience that you got at each step."}, {"start": 1672.0, "end": 1676.0, "text": " And the experience at each step is simply the following two things."}, {"start": 1676.0, "end": 1681.0, "text": " So we're going to assess is how difficult is it at time T?"}, {"start": 1681.0, "end": 1688.0, "text": " So you've learned for T steps, how difficult is it to go from that to the solution?"}, {"start": 1688.0, "end": 1699.0, "text": " So if you might have had some training data, right, and you score a certain you score a certain score, like 80 percent on the on the test set."}, {"start": 1699.0, "end": 1704.0, "text": " So that's basically how difficult it is."}, {"start": 1704.0, "end": 1707.0, "text": " It's like you still make 20 percent of error."}, {"start": 1707.0, "end": 1709.0, "text": " That's your difficulty."}, {"start": 1709.0, "end": 1712.0, "text": " And then you get one more training sample, this data here."}, {"start": 1712.0, "end": 1722.0, "text": " Now, you can ask again, if I know everything I'm knowing my intelligence system, but I also get one more training data point."}, {"start": 1722.0, "end": 1729.0, "text": " Can I? How easy is it now to arrive at the solution of the task?"}, {"start": 1729.0, "end": 1737.0, "text": " And now you can say, oh, with this training data point, I now can correct some of my mistakes and I only make like 18 percent of error."}, {"start": 1737.0, "end": 1740.0, "text": " OK, so the difference here would be like two percent."}, {"start": 1740.0, "end": 1746.0, "text": " So that's going to be your experience is going to be worth of two percent of errors."}, {"start": 1746.0, "end": 1762.0, "text": " OK, now the important thing here is that it is it is different if we we could have just written here minus H of, you know, Sol theta T, given the intelligent system at time step T plus one."}, {"start": 1762.0, "end": 1770.0, "text": " Right, because the intelligent system at times that people as one has had that data point at time step T and incorporated it."}, {"start": 1770.0, "end": 1774.0, "text": " But that's not that's not the same thing here."}, {"start": 1774.0, "end": 1779.0, "text": " We in in this step right here, when we say how difficult is it?"}, {"start": 1779.0, "end": 1790.0, "text": " We assume that, you know, God or Vapnik himself tells us how like the optimal way to use that information."}, {"start": 1790.0, "end": 1799.0, "text": " OK, whereas this thing here, it's not a given that the intelligent system will use that information in the most optimal way."}, {"start": 1799.0, "end": 1817.0, "text": " So this is basically the difference between how difficult is it to get from the intelligent system to the solution and how difficult is it to get from the intelligent system and the data point at time T if you could make optimal use of that data point to the solution."}, {"start": 1817.0, "end": 1833.0, "text": " All right. So this this is going to be an assessment of how much experience you've had in the in the sense of had you been able to incorporate the experience properly at each time step."}, {"start": 1833.0, "end": 1851.0, "text": " Because yeah, because otherwise, you know, you you couldn't compare the experience if two systems had had the same experience in the same task, it should mean they had had the same, you know, data points in the same order or in in a simplistic sense."}, {"start": 1851.0, "end": 1854.0, "text": " All right. So this is all we need. Intelligence."}, {"start": 1854.0, "end": 1858.0, "text": " Boom. This is it. So there's a lot of stuff here."}, {"start": 1858.0, "end": 1868.0, "text": " Okay, intelligence of an intelligent system with respect to a scope. And there are two definitions right here."}, {"start": 1868.0, "end": 1874.0, "text": " One is for optimal skill at each task, and one is for threshold of skill."}, {"start": 1874.0, "end": 1889.0, "text": " Now we're going to focus on the threshold as we said, we at each task we require something like you must achieve 8000 points, and we're going to consider the shortest programs that will get to at least 8000 points."}, {"start": 1889.0, "end": 1906.0, "text": " Now, there's a bit of confusion in the notation here as this, I'm pretty sure this quantity right here, you know, should be called something different because it's you know, it's the T is here. And then there's this here, this refers to this, and this shouldn't be out of here, this should be meaning something like thresh."}, {"start": 1906.0, "end": 1914.0, "text": " I'm pretty sure this is just a name, like here, the name opt. So, um, yeah."}, {"start": 1914.0, "end": 1930.0, "text": " So in any case, the intelligence is of an intelligent system with respect to a scope of tasks. Okay. And the first thing we do is we're going to average over the tasks in the scope."}, {"start": 1930.0, "end": 1945.0, "text": " So we consider all the different tasks, and each task has a weight associated with it. This, this is the threshold and skill that we want. And this is sort of a mapping, this is a conversion rate, because this might be, you know, 9000 points at Pong."}, {"start": 1945.0, "end": 1966.0, "text": " And another task might be, you need to achieve point two, and that's really good at point two is really good. So this W for each task is simply going to map it to a like a uniform coordinate space of, of, of points of skill level of that particular task."}, {"start": 1966.0, "end": 1987.0, "text": " Okay, so we're going to average over tasks. Now you can, I guess, disregard this, this is not super, this is just scaling. We're going to average over tasks. Now in each task, we're going to consider all curriculums that get you to this threshold."}, {"start": 1987.0, "end": 2001.0, "text": " So all curriculums that get you to the threshold T for theta T for task T, which means sort of means all the possible permutations of training data sets for that task, right?"}, {"start": 2001.0, "end": 2008.0, "text": " It's more general than this, but we yeah, we want to assess all the, all the different ones."}, {"start": 2008.0, "end": 2020.0, "text": " And as you can see here, there's P of C. So this is an expectation, this is the probability of that particular curriculum. This is, this is the expectation over data right here."}, {"start": 2020.0, "end": 2027.0, "text": " This is the expectation over the training data distribution, okay, in the classical machine learning sense."}, {"start": 2027.0, "end": 2044.0, "text": " So we're going to take the average across all tasks over the expectation under the training data distribution. So we're good so far. And usually right here, we would put something like the empirical risk, right?"}, {"start": 2044.0, "end": 2059.0, "text": " The minimum, minimum loss, min loss function, min theta loss function over my, over my C, over my training data set, okay, but not in this case."}, {"start": 2059.0, "end": 2069.0, "text": " Because we now want to consider the priors and the experience and discount that from the difficulty. And that's what's written here."}, {"start": 2069.0, "end": 2080.0, "text": " So this is the developer aware generalization difficulty. This here is the amount of information that's already contained in the priors."}, {"start": 2080.0, "end": 2086.0, "text": " And this here is the amount of information that's contained in the experience in that curriculum."}, {"start": 2086.0, "end": 2100.0, "text": " As you can see here, the experience is in that curriculum. So basically, a system is more intelligent if the task is harder for that given system and that given curriculum, okay?"}, {"start": 2100.0, "end": 2110.0, "text": " So that makes intelligence up. A system is more intelligent if it gets to a certain threshold with lower priors, okay?"}, {"start": 2110.0, "end": 2124.0, "text": " If the priors are low, this whole quantity is high. And the system is also more intelligent if it gets to the threshold with less experience, okay?"}, {"start": 2124.0, "end": 2132.0, "text": " So if the experience here is lower, it is counts as more intelligent. All right."}, {"start": 2132.0, "end": 2146.0, "text": " In this in this quantity, and this is written all in the text here, it has some properties in that it for example, it down values actors that in the same curriculum, like in the same training data,"}, {"start": 2146.0, "end": 2155.0, "text": " they if if an actor learns faster, like it learns earlier to reach the threshold, it would assign more intelligence to that actor and so on."}, {"start": 2155.0, "end": 2169.0, "text": " It's kind of sometimes it's hidden over the it's hidden in the definitions. For example, these curricula are not all the same as the curricular specifically curricula that you need to reach this certain threshold."}, {"start": 2169.0, "end": 2180.0, "text": " So it's not always doesn't always sum up to one with this probability here. That's why it's not exactly an expectation. Let's call it an expectation in quotation marks."}, {"start": 2180.0, "end": 2190.0, "text": " But in the general sense, that's it. So insist the intelligence of a system is over a scope of tasks."}, {"start": 2190.0, "end": 2211.0, "text": " The the expectation in quotation marks under the training distribution of the generalization difficulty accounted but accounted for discount, we discount the prior knowledge of the system and the experience that the system has had. Okay."}, {"start": 2211.0, "end": 2214.0, "text": " And that's it."}, {"start": 2214.0, "end": 2228.0, "text": " It says, P plus E prior experience represents the total exposure of the system to information about the problem, including the information it starts with at the beginning of training."}, {"start": 2228.0, "end": 2251.0, "text": " Okay, so if this is high, then the system is not very intelligent or is not if a system that has more of this but generalizes to the same level as another system is considered less intelligent than the other system because it has had more exposure to information about the problem."}, {"start": 2251.0, "end": 2255.0, "text": " It makes a lot of sense, right?"}, {"start": 2255.0, "end": 2270.0, "text": " So schematically, the contribution of each task is the expectation over skill times generalization divided by priors plus experience. That's kind of in words, what we looked at."}, {"start": 2270.0, "end": 2286.0, "text": " So it gives over a number of key observations. And at last, he goes over consequences, or basically a recommendation for what a benchmark should look like if we regard it in this light."}, {"start": 2286.0, "end": 2305.0, "text": " Now, of course, these complexities and so on, they're not exactly computable. Right. So it's like how much exactly the shortest the length of the shortest program is is not exactly computable, but it can inform our notion of how we should test intelligence."}, {"start": 2305.0, "end": 2309.0, "text": " Okay, so what to expect of an ideal intelligence benchmark."}, {"start": 2309.0, "end": 2322.0, "text": " First of all, it should describe its scope of application its own predictiveness with regard to the scope. So that means the validity, it should be replicable, it should be reproducible."}, {"start": 2322.0, "end": 2328.0, "text": " It should measure broad abilities and developer aware generalization. Sorry, it should."}, {"start": 2328.0, "end": 2333.0, "text": " It should set out to measure broad abilities and developer aware generalization."}, {"start": 2333.0, "end": 2339.0, "text": " Okay, so that means it should not be solely measuring skill or potential."}, {"start": 2339.0, "end": 2350.0, "text": " It should not feature in its evaluation set any tasks that are known in advance, either to the test taking system itself, or to the developers of the system."}, {"start": 2350.0, "end": 2356.0, "text": " And that, of course, refers directly to the developer aware generalization."}, {"start": 2356.0, "end": 2367.0, "text": " And it should seek to quantify the generalization difficulty it measures, or at least provide qualitative guidelines with regards to its generalization difficulty."}, {"start": 2367.0, "end": 2377.0, "text": " It should at least be made clear whether the benchmark seeks to measure local generalization, broad generalization, or extreme generalization."}, {"start": 2377.0, "end": 2381.0, "text": " So we've seen this in part one."}, {"start": 2381.0, "end": 2395.0, "text": " Taking into account generalization difficulty minimizes the possibility that a given benchmark could be hacked by solvers that take undesired shortcuts that bypass broad abilities."}, {"start": 2395.0, "end": 2402.0, "text": " It says it should control for the amount of experience leveraged by test taking systems during training."}, {"start": 2402.0, "end": 2408.0, "text": " It should not be possible to buy performance on the benchmark by sampling unlimited training data."}, {"start": 2408.0, "end": 2422.0, "text": " So this this already rules out sort of any, let's say image recognition or NLP benchmarks because there we can always just feed in more data, the more unlabeled data from the internet or even labeled data."}, {"start": 2422.0, "end": 2434.0, "text": " Like if there's a benchmark that, you know, is on computer vision, I can just pay more humans to label more data and then I will be better at that benchmark."}, {"start": 2434.0, "end": 2438.0, "text": " The benchmark should avoid tasks for which new data can be generated at will."}, {"start": 2438.0, "end": 2445.0, "text": " It should be in effect a game for which it is not possible to practice in advance of the evaluation session."}, {"start": 2445.0, "end": 2447.0, "text": " That's going to be hard, right?"}, {"start": 2447.0, "end": 2453.0, "text": " It should be it should explicitly and exhaustively describe the set of priors it assumes."}, {"start": 2453.0, "end": 2456.0, "text": " Any task is going to involve priors."}, {"start": 2456.0, "end": 2468.0, "text": " But in many tasks used for evaluation today, priors stay implicit and the existence of implicit hidden priors may often give an unfair advantage to either humans or machines."}, {"start": 2468.0, "end": 2472.0, "text": " So this is, for example, if the test is like a speed test."}, {"start": 2472.0, "end": 2484.0, "text": " A lot of times machines are going to be way faster than humans because the hidden assumption in a speed test is that kind of your nerve conductivity is the same across all test takers."}, {"start": 2484.0, "end": 2494.0, "text": " And the last one, it should work for both humans and machines fairly by only assessing the same priors as possessed by humans."}, {"start": 2494.0, "end": 2503.0, "text": " And he refers to core knowledge, which we saw in the last part, and only requiring a human sized amount of practice time or training data."}, {"start": 2503.0, "end": 2509.0, "text": " So this means if we want to compare humans and machines, machines can often incorporate way more data than humans."}, {"start": 2509.0, "end": 2520.0, "text": " So the tasks in the benchmark should only like the amount of data should be such that a human could process that data."}, {"start": 2520.0, "end": 2532.0, "text": " Now, of course, that that sort of also means that any task where basically you collect data during your life is all also sort of ruled out a bit."}, {"start": 2532.0, "end": 2540.0, "text": " So that means the AI benchmark task can't be like cook a pan of spaghetti or something like this."}, {"start": 2540.0, "end": 2550.0, "text": " Yeah. And in the end, he says these recommendations for general AI evaluation wouldn't be complete without a concrete effort to implement them."}, {"start": 2550.0, "end": 2559.0, "text": " In part three, we present our initial attempt, which is going to be the ARK dataset and the ARK Kaggle challenge."}, {"start": 2559.0, "end": 2567.0, "text": " But that's a story for next time. I hope you enjoy this and at least got some bits of it."}, {"start": 2567.0, "end": 2572.0, "text": " It's very abstract. This measure of intelligence, of course, it can never be computed exactly."}, {"start": 2572.0, "end": 2578.0, "text": " But the fact that someone is trying to formalize and it's not the first time this has been trying to formalize."}, {"start": 2578.0, "end": 2597.0, "text": " But this I feel it's quite understandable and makes sort of sense. And I'm interested to see if people come up with actual approximations to this quantity that you could actually compute sort of."}, {"start": 2597.0, "end": 2609.0, "text": " All right. That was it. Thank you for watching and bye bye. See you next time."}]
Yannic Kilchner
https://www.youtube.com/watch?v=LMb5tvW-UoQ
Discovering Symbolic Models from Deep Learning with Inductive Biases (Paper Explained)
Neural networks are very good at predicting systems' numerical outputs, but not very good at deriving the discrete symbolic equations that govern many physical systems. This paper combines Graph Networks with symbolic regression and shows that the strong inductive biases of these models can be used to derive accurate symbolic equations from observation data. OUTLINE: 0:00 - Intro & Outline 1:10 - Problem Statement 4:25 - Symbolic Regression 6:40 - Graph Neural Networks 12:05 - Inductive Biases for Physics 15:15 - How Graph Networks compute outputs 23:10 - Loss Backpropagation 24:30 - Graph Network Recap 26:10 - Analogies of GN to Newtonian Mechanics 28:40 - From Graph Network to Equation 33:50 - L1 Regularization of Edge Messages 40:10 - Newtonian Dynamics Example 43:10 - Cosmology Example 44:45 - Conclusions & Appendix Paper: https://arxiv.org/abs/2006.11287 Code: https://github.com/MilesCranmer/symbolic_deep_learning Abstract: We develop a general approach to distill symbolic representations of a learned deep model by introducing strong inductive biases. We focus on Graph Neural Networks (GNNs). The technique works as follows: we first encourage sparse latent representations when we train a GNN in a supervised setting, then we apply symbolic regression to components of the learned model to extract explicit physical relations. We find the correct known equations, including force laws and Hamiltonians, can be extracted from the neural network. We then apply our method to a non-trivial cosmology example-a detailed dark matter simulation-and discover a new analytic formula which can predict the concentration of dark matter from the mass distribution of nearby cosmic structures. The symbolic expressions extracted from the GNN using our technique also generalized to out-of-distribution data better than the GNN itself. Our approach offers alternative directions for interpreting neural networks and discovering novel physical principles from the representations they learn. Authors: Miles Cranmer, Alvaro Sanchez-Gonzalez, Peter Battaglia, Rui Xu, Kyle Cranmer, David Spergel, Shirley Ho Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we're looking at discovering symbolic models from deep learning with inductive biases by Miles Cranmer, Alvaro Sanchez Gonzalez, Peter Battaglia, Rui Xu, Kyle Cranmer, David Spergel and Shirley Ho. So this paper on a high level, it uses graph neural networks to fit a data set of observations of a physical system. And then it uses symbolic regression in order to parse out equations, symbolic equations from the graph neural network. And the symbolic equations that will are found such they describe the physical system. And they do find they do recover some known equations, and they do find a new one in the field of cosmology. So we'll go through how they do it, what these two steps are, and why this might work better than previous approaches. So yeah, join me. If you like content like this, as always, feel free to share it. Subscribe if you haven't, if you want more content like this, and tell me what you think in the comments. Alright, so they claim, we develop a general approach to distill symbolic representation of a learned deep model by introducing strong inductive biases. And this, it doesn't really, it doesn't really say a whole lot. But I think the the abstract doesn't say a whole lot. So let me give you an example. If you have three different, let's say planets, or stars, right, this is a, this three, three body problem is a unsolved problem, I think still. So if you have these three stars, and you just let the simulation run, they have gravity, they attract each other, right, so they are going to move around somehow. So this one's going to move here, this one's going to move like this, this one's going to move like this, and then it turns around, and this one turns around, and so on. So there is a fairly complex motions in already three different things that are somehow in a physical system together. This is a bigger problem than just stars. So you have these systems, for example, when these are atoms, and there is like an electromagnetic force between them or the strong force. There can be these can be things where springs are attached to them, and so on. So our goal is to derive equations that govern this behavior, right? In the case of gravity, we know that these objects sort of pull on each other with the with the force proportional to something like the mass of the first times the mass of the second divided by the radius that they are apart squared. Something like this times like this gravitational constant. That's we know the equation that governs these interactions, we don't know the symbolic solution to the whole problem, but we know the equation that governs the interaction, right? Now, imagine if we didn't know the equation, what do we have to do? Well, what did Newton do? Ultimately, he sat down and just came up with an equation that seemed okay to him, and then found out that the equation actually does predict very accurately the how the things move. So we're going to try to replicate that process in a in an AI system, the process of coming up with an equation that governs this behavior. So what we have is a data set, as I said, we let this stuff run. So we let it run for one time step, and then this is here, maybe this is here, and this is here, okay. And then we let it run for the next time step, this goes here, this goes here, this goes here, and so on. So that will give us basically it will give us frame by frame, how the system evolves frame by frame. And that will give us a data set. So this right here, if we let it run, and maybe we restarted a couple of times with different initializations, we let it run, we get a data set. So now we have a data set, right? So our goal is to be to take that data set and come up with an equation like m one m two divided by r squared, that governs this behavior. Now previous approaches have resorted to symbolic regression, I think they they call this. And that is basically, it's pretty simple. Namely, what you do is you simply provide the system with a bunch of options, you tell it, I have a list, and the list can include the mass of the first, it can include the mass of the second and can include the x and the y position of the things it can include the delta x and delta y, which basically means the speed of the objects, it can include any constant a and b that you want, it can include the symbols plus minus division, multiplication, square, maybe exponential function, and so on. So you give it a bunch of options of what it could potentially use in an equation. And then you simply let it make equations, and you see how well these equations describe the data set. And the way you do that is, you can do it naively by just searching and trying out, or you can be a little bit smarter about it and use like evolutionary methods. So you start with like some equations like this, you're gonna just okay, I'm gonna x plus delta x minus a squared, okay, you see how that how that describes the data set, you'll find not very well. And then you go on and you say, okay, maybe I'll make a like a small mutation, I mutate this to a minus and so on. And if you do this with an entire population, as is common in these evolutionary methods, you'll end up with something better at the end. Now this works until a point. So whenever the the space of things to explore, like this one here gets larger, and it doesn't have to be super large to already exhaust the capabilities of these methods. So these methods are very limited in the space they can search, and have proven not really effective so far for this type of problem. This paper right here goes a different route. It uses graph neural networks in order to describe the data set. So in between this step of collecting a data set and making the equation, it fits another step. So it says in between here, we fit another step and that other step is going to be we have a graph neural network and you don't know yet you don't have to know yet what that exactly is. But it's like a type of neural network, and we're going to have that neural network learn the data set. Now as you know from neural networks, they can't do symbolic regression, they can't give you an equation, they can simply predict numbers. So what the network will do is it will simply predict like the motions or the accelerations, whatever you're interested in, it will predict those things as numbers, not as equations, as just you can plug in this situation right here, and it will tell you how the things will move. Okay, neural networks are pretty good at that. And once you have a graph neural network that can describe the system in a numeric fashion, then you parse out the equations from this graph neural network. And we're going to go over why that is going to be much, much easier than parsing out the equations directly from the physical system. It's going to be because you engineer the graph neural network in a way that makes it very congruent with physical reality, that makes it very adapt to parse out equations like this, that makes the job of this evolutionary method much easier. All right, so that's the that's basically the two step process here. First step is to numerically regress a neural network to describe the system. And then second step is going to be from that neural network parse out the equations. So we have to talk about graph neural networks. So here you see the entire process as they describe it. So they have this data set right here of observations of these physical systems, right? This is like, it's like, you know, any data set that you have in machine learning. They predicted the dynamics, which means in a numeric fashion, with a graph neural network. And then from the graph neural network, they extract the symbolic equation, as you can see, right here. And this here is going to be the equation that they figure out that was previously unknown. They even said unknown dark matter over density equation. Cool. So we have to talk about graph neural networks. We haven't really done this on this channel so far. And I'm not the like a big expert on graph neural networks. But in they come in all shapes and forms. In this particular paper, they use what they call a type of interaction network that's called a graph network. So graph network is something different than graph neural network. I think graph network is a type of graph neural network. And specifically here, they use a network that so a graph neural network has these things called vertices, and then it has edges and edges connect vertices like in a graph. Now we're going to build this graph neural network such that the number of vertices is exactly equal to the number of particles in our system. So in this paper, they consider systems with, I believe, four or eight particles. That's already a lot for if you want to derive equations and things. But of course, the physical world is made of many more particles. In any case, they consider four, let's say four particles right here. So what they're going to do, they're going to build a graph neural network that has four vertices, one for each of the particles. And in a graph neural network, every vertex can have properties. So the properties of each vertex here are going to be the properties of that particle. That means the x coordinate, for example, the y coordinate, and we're going to let's say we're in two dimensions, right? It's a two dimensional problem, the x coordinate, the y coordinate, the delta x, the delta y, the mass, the I don't know, what else? What else can we put here? There's a lot of stuff that we can put here the charge, right? So all of these things are properties of the vertex. Then the other component of a graph are of course, the edges. So the edges connect each two of all of the so each edge connects two vertices like this. And then this particular type of graph network, we're going to consider graphs where all the particles are connected to all the other particles like this. So it's not like a sparse it's not a sparse graph, except I think in the cosmology example here you can see that always there is a node that's connected to all its neighbors. But in the Newtonian dynamics graph networks, you can see right here, everything is connected to every thing like this. Okay. And why, why does that represent a physical system really well? So the reason is going to be the following. What we're going to try to do is we're going to try to say that in physical systems, if I want to, for example, consider this node up here, and consider how it is pulled by gravity by the other nodes, it's going to be pulled in this direction a little bit because of this particle right here, it's going to be pulled in this direction a little bit because of that one, and in this direction because of that one. Now note that these three things are independent. So if I want to describe the total force of gravity, I can do so as a sum over i equals one to one, two, three, of the force that the particle i pulls. So if this is this is j right here, how i pulls on j, right, this is an independent sum across all of the all of the neighbors of that particle. Now you might say, wait a minute, that's it's not independent. Because it's it's being, you know, it's not being strictly pulled in this direction is also pulled in this direction. Yes, but the with independent, we mean that the force, this force right here is only dependent on this particle. And the force diagonally is only dependent on that particle, there is no part of the particle up here that modulates this force right here, right. So you can calculate the total force as an independent sum across the individual forces. And that's the simplification here. And that's a part they claim, why so current approaches that directly try to go about finding an equation using evolutionary methods from the data set itself, don't really work because the space is just too high of equations. But this right here, this is a massive constraint. And it's lucky, first of all, that physical systems, they say, most physical systems actually obey that constraint, most physical systems can be described as an independent sum over contributions of interactions between just two things, right. So we simply can sum over interactions between two things. And that's, and that's way simpler than considering everything at once. And second of all, it's lucky because these graph networks describe exactly this. So each edge in the graph network is coincidentally connecting two things, right, and not more. So the edges, they don't know about each other. No edge knows about the other edge, they only consider whatever particles are at their respective ends. And that is exactly the same as this physical constraint on the physical system. And that's why the graph networks are so adapted or are so useful in describing these systems. So how does a graph network like this do anything basically. So for that, you have to consider the task. If we want to describe a system like this, a task in that if you frame it in a machine learning way, could be, I'm going to give you these particles right here. Okay, here, it's five, five particles, I'm going to give you for each one, I'm going to give you all its features, like the x, the y, the speed currently, and the mass. And you're going to tell me what the acceleration is in the next frame. Okay. So like this, like this, like this. Okay, considering all you know, all the interactions between the particles, just tell me, where does it go in the very next timeframe? That that sounds like a machine learning problem, right? And the graph neural network can be made to predict this. So what we want is for each vertex here, an output of a number or a vector, the acceleration. So we want to compute an output for each vertex, how do we do this? In a graph neural network, there are three or in this particular type, there are three steps, we said each vertex, and we're just going to do it for one vertex, let's say the one on the bottom right. Let's say each vertex has these properties like these x, y, and so on. So first, what we do is we go over the edges. So for each edge in parallel and independent from each other, let's consider this edge right here, what we'll do is we take the nodes that are attached to it. And we combine their features, and we combine them. So x, y, this also has x, y. So we want to combine these two, we want to compute the edge right here. Now, in a physical system, what does the edge represent? The edge represents the force between the two particles, right? And that's a fairly complex equation. It's not like we can just add the features or something like this. So the edge here already needs to compute some sort of nonlinear, complicated function. And we know how to compute nonlinear complicated functions with neural networks. We're in deep learning right here. So the edge here is going to compute what's called this edge function. And this edge function takes in two vertices, v1 and v2 right here, if this is maybe this is v2, this is v1. It takes in the features, these features of the two vertices, and it will compute a so called edge message. I think they call this ek for the edge k. It will compute an edge message. And this is supposed to represent the force that pulls between these two particles. And we're going to approximate this function right here using a neural network. Since we don't know the equation yet, right, we assume we don't know the gravitational equation, but we can learn it right because we have data. So we take this and we simply make it into a neural network. So the features go in here both we can you know, concatenate them. And then out comes this edge message. Now this edge message here is simply going to be a vector, a numerical vector, describing some intermediate hidden state, right, that is going to describe the force. But for now, it's just describing intermediate hidden state. So we do this for each edge. So each edge is going to be maybe this is e1, this is e2, e3, e4, each edge in parallel is going to aggregate information of its endpoints into that edge. And then that's step one. So step one, compute the edge messages. Step two is going to be to compute the vertex messages or the vertex outputs. So we said we're not actually interested in the edges, we're interested that each vertex ends up with an acceleration with an output. So how are we going to do this? So consider again our graph. If we want to compute the output for this node right here, what we'll do is we'll simply aggregate all of the edges, all of the edge messages that connect to that vertex. So we've computed previously the edge messages by integrating the information from all of the attached endpoints. Now we're going to go backwards and distribute the information from the edges back to the vertices that are attached. And you can see already by this two-step process, it's kind of a message passing process if you've ever studied graphical models. This means that in the two-step process, this vertex here aggregates information from the other vertices via these edges. So in this case, this vertex here is going to take in all the edge messages right here, and it is going to aggregate all these edge messages in a function that computes the acceleration. So that our estimate of the acceleration is going to be a function, let's call that new, of the edges that are attached to it. So e1, e2, and e3. And here is where we're going to make our next physical assumption, namely the one we said before, that the way that these edges, the way that they influence the vertex is going to be in a form of an independent sum. So the simplification means that this function should somehow be not of the edges, but of the sum of the edges, right, sum of ei. Okay, so this sum here, this is the simplification that we make to make it in accordance with the physical system. With this graph network, we could do any sort of complicated thing right here, right? We could put a transformer on these things and like compute 12 layers of interaction effects between these edges. We're not going to do that. We're simply going to sum them up and then come up and then, you know, run those through a function. So we'll sum them up. And of course, this function right here is still going to be a complex function because just because you sum up the forces, you don't have the acceleration yet. So you know, as you know, that force is mass times acceleration, that means acceleration is equal to force divided by mass. So this here is going to be this sum over the edges, I guess, yes. So you still need to divide it by force. And technically, you still can do much more complicated things right here. We still, we only say that the edges should only come in in form of a sum. So of course, we're going to say that this function right here, since it can be any complicated function of its input, it should also be a neural network. So we're going to take that sum of the edge messages, and we're going to put that into a second neural network. And then out comes our estimate of the acceleration. And now that we can use together from the data set, we know the true acceleration, right? Since we have a data set, we have the observations and the labels, the labels are the true accelerations of that system that we observed. And we can compute a loss function right here. And if you followed so far, everything we've done so far is differentiable. So from this loss function that compares the output of the neural network for that vertex to the true acceleration that we observed in the data set, we can back propagate through this neural network that computes the vertex function, we can back prop through the sum here to the edge messages. And we can back prop through the edge messages to that neural network that computed the edge messages from those features. So everything is differentiable. By having that loss at the end, we can train this neural network end to end to from the observation right here, predict the numerical acceleration of the system right here. Okay. So this was a fairly lengthy way. But it's important that you kind of understand what's happening. So you build the graph network according to the physical system. In the graph network, there are two kinds of things. First, there are deterministic things like we're always going to aggregate in a sum. And then there are things that you learn. Namely, there are two neural networks, the first one computes the edge messages from the features of the vertices, and the second one computes the output of each vertex, according to the to the sum of the edge messages that are attached to that vertex. Now you can say, wait a minute, there are more than just two neural networks, like each edge here has a neural network technically, right, this edge has a neural network, this edge has a neural network, and each vertex has a neural network. But in this case, these neural networks are shared. So the neural network that computes the edge message for that edge is the same as the neural network that computes the edge message for any of the edges. You can think of it like weight sharing, or you can think that it is actually the same neural network, it's equivalent, right. And the same for the vertices, there's only one neural network that in the same fashion computes the output for each vertex. Of course, the incoming edge messages are going to be different. And that's why you have different outputs. But the neural network itself is the same. Okay, so we have a system that can describe this data set of physical observations really well. It's this graph neural network. Right, so we train this end to end. And here's a little bit of a of an analogy where they say, this, this is how you can and now like analogize the neural network with a physical system. So, what are the analogies here, the nodes in the graph network correspond to the particles in Newtonian mechanics, pairs of nodes correspond to two interacting particles, the edge model is the force between two particles, then the pooling operation, which is the summing up of the edge messages, right that we found so important as a simplification. This is the sum into the net force that is really given in the physical system. So independent sum of so sorry, sum of independent forces without interaction effects, then concatenate with node, I guess this I left this out. But whenever you compute, whenever you compute the vertex properties, right here, I guess, what you want to do is not only input the edge messages, but you know, each vertex has these features that we said, and these could also be fairly important. It's like, you technically have that information in the edge messages, because it started out from these, but you can also just input that again into this neural network together with the edge properties. And that will just make its job a bit easier since for example, right here, we have to divide by the mass in this function. And it's just easier if you provide that mass as a as the property. So that's a little detail I left out before. So that you concatenate the edge mess, the aggregated edge messages with the node, then you compute the node model, which in this case is the computation is simply the you take this sum right here, and you divide it by the mass. And then optionally, you can update the nodes, which is compute the next time step, which we don't do right here, because we simply want to output the acceleration, I guess, I mean, it should be equivalent to output the next time step and then compare, compare with the data set what the next time step was. In any case, you have to have some kind of loss function. And here you can see all the black squares right here are going to be neural networks. So now, we have learned a graph network that can describe a system, how do we make this into an equation. And again, here, our, our physical reality comes in that these of the like the independence assumptions of these realities comes in, because in physics, you know, the, the acceleration here is going to be a function of the sum and so on, what we need to do is we don't need to develop an equation for the entire system, right? What we need to do is simply we need to develop an equation for each vertex. So each vertex, we need to have an equation acceleration equals something, and that something should include some of the edges, and then the edges again should be something, right? So we've technically, as we had two neural networks, we technically need two symbolic equations, one that represents that first neural network that computes the edge functions, and one that represents that second neural network that aggregates the sum of the edge functions or that computes the output from the sum of the edge functions. And that, you know, it's an exact correspondence. So what we need to do is we need to take that first neural network up here, and do symbolic regression on that, and the second neural network, do symbolic regression on that. So what does it mean to do symbolic regression, it basically means that we want to find the symbolic equation that describes the neural network the best, right? And we do that in the exact same fashion as we started right here. So we give it a bunch of these options, and then we let the system describe the neural network as best as possible. The way we do that, again, is we try out equations, and if they just if they get a low error, right, we so we let the neural network run on the data set, and we let this run on the data set, if it outputs the same thing, it describes the neural network well, and we can iterate that until we find a good equation. So the difference here is that we don't need to find an equation that covers the whole system, we just need to find two equations, one governing the edge model, and one governing the vertex model. And that's way, way easier than the whole system. And by finding those two equations, we and our given our physical assumptions, we can now find the equation to the whole system by simply composing them. Alright, so that's the entire system. I believe I've told you the entire paper right here, without actually going into into the paper, let's just skim the paper a bit to see that they actually tell us the same thing. So yeah, so they graph networks, they say are ideal candidate for our approach due to their inductive biases shared by many physics problems, a their equivalent under particle permutations, B, they are differentiable end to end and can be trained efficiently using gradient descent. And C, they make use of three separate and interpretable internal functions, the edge, the node and the global model. Now the global model here isn't really used in the cases we're going to look at. So it's just going to be two different neural networks, which are targets for the symbolic regression graph networks can also be embedded with additional symmetries as in 2324. But we don't implement these, okay, and then they say symbolic regression. So they use this Eureka package to perform symbolic regressions and fit compact closed form analytical expressions to these neural networks. Eureka works by using a genetic algorithm to combine algebraic expression stochastically. The technique is analogous to natural selection, where the fitness of each expression is defined in terms of simplicity and accuracy. The operations considered in the fitting process are plus minus times dot dot dot dot if as well as real constants. Alright, so if we look at the examples, they have three different examples. First of all, they have Newtonian dynamics, which is, for example, this gravitational force we looked at. They have Hamiltonian dynamics, which describes the same systems, but in a different way in terms of the Hamiltonian. And I don't want to go into this too much, because I think that the Newtonian dynamics already demonstrate really well what the system can do. And then they have dark matter halos for cosmology, which is a problem where you have universe simulators and you try to predict where the dark matter is, depending on where other dark matter is. And they actually that's where they find a new unknown equation. Okay, here is the system in a nutshell. Now there is this is the path that you know, you have the data set. You learn a graph network, and then you get out an equation, right. But in between there is now you can put even more constraints to make the network really learn a physical equation. So we said you're going to compute these edge functions right here. And the output of the edge functions is going to be this edge message, which is just going to be a vector of some sort. And that vector can be pretty large, you know, this is a hidden dimension that you can choose as an implementer, all you need to make sure is that the output of the vertex is the same dimension as you know what your output should be everything internal, you can choose. Now, we know that, for example, in a 2d system, the the actual informational content of that edge message should be two dimensional, right? If this really describes the force in two dimensions, it, it should be two dimensional. There's really no reason why it should have a higher dimension since all the relevant information can be described in two dimensions. So one thing you can do is you can simply say, all right, I will choose the hidden dimension to be two. And therefore, I will force my neural network to just use two dimensions. This however, they noticed doesn't work super well, I think it works, but not that well, they call this the bottleneck model. And the reason why it doesn't work super well is that if you have like this constraint of neural networks, they don't turn to, they don't tend to learn very well. And that's what they hypothesize in the paper as well, they don't tend to really come, you know, be good friends with the fact that they only have two floating point numbers to learn anything. And this is probably more a property of the optimization procedure than the problem itself. It's property of, you know, us training graph neural networks with SGD. So what they do instead is they put an L1 penalty on these edge messages. So they say we apply L1 regularization. And what that will do is that will induce sparsity in whatever you apply it to. So L1 regularization simply means that you constrain, so the edge message, if you take the absolute value in each entry, and the sum of that, that should be small. So you can just add this to the loss function. And that will induce sparsity in these edge messages. And so now the network still has these whatever 100 latent dimensions, but it is encouraged to use as few as possible. That means it can use a lot during the beginning when it's really benefits from the lot of dimensions when it learns the system. But then as it gets better and better, it might shift a lot of the information into very, very few dimensions. Okay, so once we do, if we do that, we can then run a check, right? If it is really the case that this graph network has learned the physical dynamics of the system, then the top, we can simply look at the top two dimensions, and we start by largest standard deviation. So whichever two dimensions are the least sparse, right, have the largest standard deviation, we can look at those two and we say, well, even though we didn't constrain the model, those two should describe our force pretty well. And since in Newtonian dynamics, we know what the force is. So this is, we know what the force is, we can simply check whether or not that holds, we can check whether we can read out the force from these two components. And here, it's made such that you, you can't guarantee that the force is, you know, this force right here is actually. So there are many ways to state a physical equation, because there are many symmetries in physics. And we cannot really make the neural network describe the equation exactly as humans would, because there are infinite amount of equivalent formulations. But they're, in this case, they're all covered by rotations of each other. And that means in these graphs, if you have these message elements right here, and the linear combination of forces right here, a linear relationship means basically that the information is there, whereas a nonlinear relationship would mean that these numbers don't really encode the force as is. And here, you can pretty clearly see that the linear relationship is given. And that means that these first two dimensions right here, really encode the force in the way that we know the equation is. So that's when we know the equation, right? When we know the equation, we can simply say, okay, does this fit? And when we don't know the equation, we can use this symbolic regression. And what turns out is exactly this thing right here. Now, you might object that this isn't really that force right here. But as I said, there are many, many symmetries. So for example, this, this R hat right here, I believe, and this is I've, I'm not a big physics person. This R hat, I think this is the vector of the delta x delta y, right? So delta x delta y is in this R hat. So we already see that delta x and delta y here, this already looks like some sort of, this already looks okay. No, actually, if we go down, it gets even clearer. So here they have the outputs of that. Yes. All right. So in this first case, this is the same example right here. So they say, you in this spring example, so this is a system where the particles are connected by springs, and we do L1 regularization, what we expect is this equation, this is we know that this equation holds in this spring system. And what the neural network combined with the symbolic regression gives us is this equation. So right here, you can see there's this delta vector, and it's a product. It's an inner product, a dot product with this a, which is a numerical constants. And you can see that there is this form of product with numerical constants. What you can also see, so for example, here, the delta y here is 1.36 and 1.37. That's, you know, the same number, and here, it's 0.6, 0.6. Okay. So here you see, for example, r minus 1, and here it's something like this minus something divided by r. Doesn't seem the same, but again, due to the symmetries, you can, if you take this and you simply divide everything by r, you'll end up with this vector right here, a times delta x delta y times 1 over r, no, times 1 minus 1 over r plus b. Right. And now you can see it already looks very much similar. And it's only off by like, it's only a transformation away from what you want. So that's why I said you can describe these equations in many different sort of equivalent ways. We can't ask the neural network to really figure out, you know, the exact one we want. As long as it figures out a one that is equivalent, we're happy. And we're, I guess we're pretty happy here. So also, in this case, right here, you can see that it correctly predicts this relationship that it should be divided by r to the third power. And there is a delta x delta y delta z, if you simply consider, so delta z here, I guess, is simply a factor of zero. And it even has this discontinuous problem where the force breaks after a certain while, it can even parse out this if condition right here. So that's, that's fairly cool, right? But it to me that that is pretty, pretty cool result that you can actually parse out these equations with just these graph networks, and then the symbolic regression. So they do the same thing for this cosmology example, where they have these simulators of the universe, and they let them run. And these kind of distribute this dark matter. And I guess your task is, if I give you a bunch of these points right here, tell me where the other dark matter is something like, I don't understand this, but in essence, it is the same kind of problem, right? You want to figure out the dark matter properties from the surrounding dark matter or properties of other things. And again, here, you can see pretty well that this is the equation they get out. So the equation they get out is going to be a sum right here, over. So here, the output for node i is going to be a sum over all the other nodes j. And then some function of that sum. So this right here is the equation that came out of our edge model of our edge neural network. And this here, that includes this one, it was the equation that came out of our vertex model. As, you know, the same here in this spring law, this came out of our edge model, this came out of our vertex model. Again, this rests on the fact that physical systems can actually be described often as these sums of independent interactions. And that's why all of this works. So they do give very, very detailed instructions on how they did everything. I think the most unclear things in this paper are the physics things that are assumed sort of that you know, I don't I didn't. Yeah, but other than that, it's pretty straightforward. Their appendix is also pretty detailed in how they do all the representations and so on. They have different formulations other than this l one regularization. As I said, they have bottleneck, they have like a KL formulation, they really describe how the graph neural network works here, and so on. So all in all, I enjoyed reading this paper, here is a bunch of examples of these particle systems. And yeah, and here is a bunch of examples of where you'd have a linear relationship that where you can say, Oh, look, this really describes that force, or a nonlinear relationship where you can make the claim this doesn't really describe the force. Well, because it's not linear relationship indicates that what the network found is a rotation of what you really want. And that's good, because it's equivalent, not nonlinear basically means that you can't really it doesn't really describe what you want really well. Yeah, and I'm going to leave you with that, I absolutely invite you to check out the code and the video they made about it. And I'll see you next time. Bye bye.
[{"start": 0.0, "end": 5.32, "text": " Hi there, today we're looking at discovering symbolic models from deep learning with inductive"}, {"start": 5.32, "end": 12.0, "text": " biases by Miles Cranmer, Alvaro Sanchez Gonzalez, Peter Battaglia, Rui Xu, Kyle Cranmer, David"}, {"start": 12.0, "end": 14.52, "text": " Spergel and Shirley Ho."}, {"start": 14.52, "end": 21.64, "text": " So this paper on a high level, it uses graph neural networks to fit a data set of observations"}, {"start": 21.64, "end": 23.78, "text": " of a physical system."}, {"start": 23.78, "end": 30.700000000000003, "text": " And then it uses symbolic regression in order to parse out equations, symbolic equations"}, {"start": 30.700000000000003, "end": 32.68, "text": " from the graph neural network."}, {"start": 32.68, "end": 39.120000000000005, "text": " And the symbolic equations that will are found such they describe the physical system."}, {"start": 39.120000000000005, "end": 45.72, "text": " And they do find they do recover some known equations, and they do find a new one in the"}, {"start": 45.72, "end": 48.34, "text": " field of cosmology."}, {"start": 48.34, "end": 54.88, "text": " So we'll go through how they do it, what these two steps are, and why this might work better"}, {"start": 54.88, "end": 56.78, "text": " than previous approaches."}, {"start": 56.78, "end": 59.440000000000005, "text": " So yeah, join me."}, {"start": 59.440000000000005, "end": 63.92, "text": " If you like content like this, as always, feel free to share it."}, {"start": 63.92, "end": 68.84, "text": " Subscribe if you haven't, if you want more content like this, and tell me what you think"}, {"start": 68.84, "end": 70.64, "text": " in the comments."}, {"start": 70.64, "end": 78.48, "text": " Alright, so they claim, we develop a general approach to distill symbolic representation"}, {"start": 78.48, "end": 82.42, "text": " of a learned deep model by introducing strong inductive biases."}, {"start": 82.42, "end": 87.12, "text": " And this, it doesn't really, it doesn't really say a whole lot."}, {"start": 87.12, "end": 90.82, "text": " But I think the the abstract doesn't say a whole lot."}, {"start": 90.82, "end": 93.14, "text": " So let me give you an example."}, {"start": 93.14, "end": 100.52, "text": " If you have three different, let's say planets, or stars, right, this is a, this three, three"}, {"start": 100.52, "end": 105.47999999999999, "text": " body problem is a unsolved problem, I think still."}, {"start": 105.47999999999999, "end": 110.84, "text": " So if you have these three stars, and you just let the simulation run, they have gravity,"}, {"start": 110.84, "end": 114.46, "text": " they attract each other, right, so they are going to move around somehow."}, {"start": 114.46, "end": 117.67999999999999, "text": " So this one's going to move here, this one's going to move like this, this one's going"}, {"start": 117.67999999999999, "end": 122.24, "text": " to move like this, and then it turns around, and this one turns around, and so on."}, {"start": 122.24, "end": 129.64, "text": " So there is a fairly complex motions in already three different things that are somehow in"}, {"start": 129.64, "end": 132.01999999999998, "text": " a physical system together."}, {"start": 132.01999999999998, "end": 134.72, "text": " This is a bigger problem than just stars."}, {"start": 134.72, "end": 140.48, "text": " So you have these systems, for example, when these are atoms, and there is like an electromagnetic"}, {"start": 140.48, "end": 144.0, "text": " force between them or the strong force."}, {"start": 144.0, "end": 148.5, "text": " There can be these can be things where springs are attached to them, and so on."}, {"start": 148.5, "end": 154.7, "text": " So our goal is to derive equations that govern this behavior, right?"}, {"start": 154.7, "end": 161.16, "text": " In the case of gravity, we know that these objects sort of pull on each other with the"}, {"start": 161.16, "end": 166.07999999999998, "text": " with the force proportional to something like the mass of the first times the mass of the"}, {"start": 166.07999999999998, "end": 172.38, "text": " second divided by the radius that they are apart squared."}, {"start": 172.38, "end": 175.98, "text": " Something like this times like this gravitational constant."}, {"start": 175.98, "end": 181.04, "text": " That's we know the equation that governs these interactions, we don't know the symbolic solution"}, {"start": 181.04, "end": 186.51999999999998, "text": " to the whole problem, but we know the equation that governs the interaction, right?"}, {"start": 186.51999999999998, "end": 189.95999999999998, "text": " Now, imagine if we didn't know the equation, what do we have to do?"}, {"start": 189.95999999999998, "end": 191.76, "text": " Well, what did Newton do?"}, {"start": 191.76, "end": 199.28, "text": " Ultimately, he sat down and just came up with an equation that seemed okay to him, and then"}, {"start": 199.28, "end": 206.48, "text": " found out that the equation actually does predict very accurately the how the things"}, {"start": 206.48, "end": 207.92, "text": " move."}, {"start": 207.92, "end": 214.07999999999998, "text": " So we're going to try to replicate that process in a in an AI system, the process of coming"}, {"start": 214.07999999999998, "end": 217.5, "text": " up with an equation that governs this behavior."}, {"start": 217.5, "end": 221.6, "text": " So what we have is a data set, as I said, we let this stuff run."}, {"start": 221.6, "end": 225.72, "text": " So we let it run for one time step, and then this is here, maybe this is here, and this"}, {"start": 225.72, "end": 227.33999999999997, "text": " is here, okay."}, {"start": 227.33999999999997, "end": 231.88, "text": " And then we let it run for the next time step, this goes here, this goes here, this goes"}, {"start": 231.88, "end": 233.6, "text": " here, and so on."}, {"start": 233.6, "end": 240.51999999999998, "text": " So that will give us basically it will give us frame by frame, how the system evolves"}, {"start": 240.51999999999998, "end": 242.6, "text": " frame by frame."}, {"start": 242.6, "end": 244.72, "text": " And that will give us a data set."}, {"start": 244.72, "end": 249.64, "text": " So this right here, if we let it run, and maybe we restarted a couple of times with"}, {"start": 249.64, "end": 253.78, "text": " different initializations, we let it run, we get a data set."}, {"start": 253.78, "end": 255.88, "text": " So now we have a data set, right?"}, {"start": 255.88, "end": 262.28, "text": " So our goal is to be to take that data set and come up with an equation like m one m"}, {"start": 262.28, "end": 268.0, "text": " two divided by r squared, that governs this behavior."}, {"start": 268.0, "end": 274.59999999999997, "text": " Now previous approaches have resorted to symbolic regression, I think they they call this."}, {"start": 274.59999999999997, "end": 277.28, "text": " And that is basically, it's pretty simple."}, {"start": 277.28, "end": 283.15999999999997, "text": " Namely, what you do is you simply provide the system with a bunch of options, you tell"}, {"start": 283.15999999999997, "end": 287.9, "text": " it, I have a list, and the list can include the mass of the first, it can include the"}, {"start": 287.9, "end": 294.08, "text": " mass of the second and can include the x and the y position of the things it can include"}, {"start": 294.08, "end": 302.32, "text": " the delta x and delta y, which basically means the speed of the objects, it can include any"}, {"start": 302.32, "end": 312.52, "text": " constant a and b that you want, it can include the symbols plus minus division, multiplication,"}, {"start": 312.52, "end": 317.2, "text": " square, maybe exponential function, and so on."}, {"start": 317.2, "end": 323.08, "text": " So you give it a bunch of options of what it could potentially use in an equation."}, {"start": 323.08, "end": 329.28, "text": " And then you simply let it make equations, and you see how well these equations describe"}, {"start": 329.28, "end": 331.09999999999997, "text": " the data set."}, {"start": 331.09999999999997, "end": 335.59999999999997, "text": " And the way you do that is, you can do it naively by just searching and trying out,"}, {"start": 335.59999999999997, "end": 339.52, "text": " or you can be a little bit smarter about it and use like evolutionary methods."}, {"start": 339.52, "end": 345.4, "text": " So you start with like some equations like this, you're gonna just okay, I'm gonna x"}, {"start": 345.4, "end": 353.52, "text": " plus delta x minus a squared, okay, you see how that how that describes the data set,"}, {"start": 353.52, "end": 355.08, "text": " you'll find not very well."}, {"start": 355.08, "end": 360.28, "text": " And then you go on and you say, okay, maybe I'll make a like a small mutation, I mutate"}, {"start": 360.28, "end": 362.2, "text": " this to a minus and so on."}, {"start": 362.2, "end": 369.56, "text": " And if you do this with an entire population, as is common in these evolutionary methods,"}, {"start": 369.56, "end": 373.28, "text": " you'll end up with something better at the end."}, {"start": 373.28, "end": 377.11999999999995, "text": " Now this works until a point."}, {"start": 377.11999999999995, "end": 383.0, "text": " So whenever the the space of things to explore, like this one here gets larger, and it doesn't"}, {"start": 383.0, "end": 389.15999999999997, "text": " have to be super large to already exhaust the capabilities of these methods."}, {"start": 389.15999999999997, "end": 394.53999999999996, "text": " So these methods are very limited in the space they can search, and have proven not really"}, {"start": 394.53999999999996, "end": 399.09999999999997, "text": " effective so far for this type of problem."}, {"start": 399.09999999999997, "end": 402.47999999999996, "text": " This paper right here goes a different route."}, {"start": 402.48, "end": 407.84000000000003, "text": " It uses graph neural networks in order to describe the data set."}, {"start": 407.84000000000003, "end": 414.8, "text": " So in between this step of collecting a data set and making the equation, it fits another"}, {"start": 414.8, "end": 416.06, "text": " step."}, {"start": 416.06, "end": 422.14000000000004, "text": " So it says in between here, we fit another step and that other step is going to be we"}, {"start": 422.14000000000004, "end": 427.52000000000004, "text": " have a graph neural network and you don't know yet you don't have to know yet what that"}, {"start": 427.52000000000004, "end": 428.56, "text": " exactly is."}, {"start": 428.56, "end": 435.16, "text": " But it's like a type of neural network, and we're going to have that neural network learn"}, {"start": 435.16, "end": 436.68, "text": " the data set."}, {"start": 436.68, "end": 441.64, "text": " Now as you know from neural networks, they can't do symbolic regression, they can't give"}, {"start": 441.64, "end": 445.36, "text": " you an equation, they can simply predict numbers."}, {"start": 445.36, "end": 453.08, "text": " So what the network will do is it will simply predict like the motions or the accelerations,"}, {"start": 453.08, "end": 458.4, "text": " whatever you're interested in, it will predict those things as numbers, not as equations,"}, {"start": 458.4, "end": 463.96, "text": " as just you can plug in this situation right here, and it will tell you how the things"}, {"start": 463.96, "end": 464.96, "text": " will move."}, {"start": 464.96, "end": 469.0, "text": " Okay, neural networks are pretty good at that."}, {"start": 469.0, "end": 474.97999999999996, "text": " And once you have a graph neural network that can describe the system in a numeric fashion,"}, {"start": 474.97999999999996, "end": 480.2, "text": " then you parse out the equations from this graph neural network."}, {"start": 480.2, "end": 485.2, "text": " And we're going to go over why that is going to be much, much easier than parsing out the"}, {"start": 485.2, "end": 488.09999999999997, "text": " equations directly from the physical system."}, {"start": 488.1, "end": 493.56, "text": " It's going to be because you engineer the graph neural network in a way that makes it"}, {"start": 493.56, "end": 501.28000000000003, "text": " very congruent with physical reality, that makes it very adapt to parse out equations"}, {"start": 501.28000000000003, "end": 505.36, "text": " like this, that makes the job of this evolutionary method much easier."}, {"start": 505.36, "end": 510.3, "text": " All right, so that's the that's basically the two step process here."}, {"start": 510.3, "end": 515.6, "text": " First step is to numerically regress a neural network to describe the system."}, {"start": 515.6, "end": 521.52, "text": " And then second step is going to be from that neural network parse out the equations."}, {"start": 521.52, "end": 524.5400000000001, "text": " So we have to talk about graph neural networks."}, {"start": 524.5400000000001, "end": 528.96, "text": " So here you see the entire process as they describe it."}, {"start": 528.96, "end": 535.24, "text": " So they have this data set right here of observations of these physical systems, right?"}, {"start": 535.24, "end": 540.02, "text": " This is like, it's like, you know, any data set that you have in machine learning."}, {"start": 540.02, "end": 547.16, "text": " They predicted the dynamics, which means in a numeric fashion, with a graph neural network."}, {"start": 547.16, "end": 551.96, "text": " And then from the graph neural network, they extract the symbolic equation, as you can"}, {"start": 551.96, "end": 554.56, "text": " see, right here."}, {"start": 554.56, "end": 562.64, "text": " And this here is going to be the equation that they figure out that was previously unknown."}, {"start": 562.64, "end": 566.24, "text": " They even said unknown dark matter over density equation."}, {"start": 566.24, "end": 567.52, "text": " Cool."}, {"start": 567.52, "end": 570.0799999999999, "text": " So we have to talk about graph neural networks."}, {"start": 570.0799999999999, "end": 572.54, "text": " We haven't really done this on this channel so far."}, {"start": 572.54, "end": 575.9, "text": " And I'm not the like a big expert on graph neural networks."}, {"start": 575.9, "end": 579.26, "text": " But in they come in all shapes and forms."}, {"start": 579.26, "end": 584.42, "text": " In this particular paper, they use what they call a type of interaction network that's"}, {"start": 584.42, "end": 585.92, "text": " called a graph network."}, {"start": 585.92, "end": 590.1999999999999, "text": " So graph network is something different than graph neural network."}, {"start": 590.1999999999999, "end": 593.84, "text": " I think graph network is a type of graph neural network."}, {"start": 593.84, "end": 601.4, "text": " And specifically here, they use a network that so a graph neural network has these things"}, {"start": 601.4, "end": 607.52, "text": " called vertices, and then it has edges and edges connect vertices like in a graph."}, {"start": 607.52, "end": 613.2800000000001, "text": " Now we're going to build this graph neural network such that the number of vertices is"}, {"start": 613.2800000000001, "end": 617.12, "text": " exactly equal to the number of particles in our system."}, {"start": 617.12, "end": 623.12, "text": " So in this paper, they consider systems with, I believe, four or eight particles."}, {"start": 623.12, "end": 627.6, "text": " That's already a lot for if you want to derive equations and things."}, {"start": 627.6, "end": 632.94, "text": " But of course, the physical world is made of many more particles."}, {"start": 632.94, "end": 637.1, "text": " In any case, they consider four, let's say four particles right here."}, {"start": 637.1, "end": 640.72, "text": " So what they're going to do, they're going to build a graph neural network that has four"}, {"start": 640.72, "end": 645.12, "text": " vertices, one for each of the particles."}, {"start": 645.12, "end": 650.52, "text": " And in a graph neural network, every vertex can have properties."}, {"start": 650.52, "end": 655.8, "text": " So the properties of each vertex here are going to be the properties of that particle."}, {"start": 655.8, "end": 660.42, "text": " That means the x coordinate, for example, the y coordinate, and we're going to let's"}, {"start": 660.42, "end": 663.24, "text": " say we're in two dimensions, right?"}, {"start": 663.24, "end": 668.8, "text": " It's a two dimensional problem, the x coordinate, the y coordinate, the delta x, the delta y,"}, {"start": 668.8, "end": 672.06, "text": " the mass, the I don't know, what else?"}, {"start": 672.06, "end": 673.4399999999999, "text": " What else can we put here?"}, {"start": 673.4399999999999, "end": 676.68, "text": " There's a lot of stuff that we can put here the charge, right?"}, {"start": 676.68, "end": 681.12, "text": " So all of these things are properties of the vertex."}, {"start": 681.12, "end": 684.52, "text": " Then the other component of a graph are of course, the edges."}, {"start": 684.52, "end": 692.3, "text": " So the edges connect each two of all of the so each edge connects two vertices like this."}, {"start": 692.3, "end": 698.4, "text": " And then this particular type of graph network, we're going to consider graphs where all the"}, {"start": 698.4, "end": 701.8599999999999, "text": " particles are connected to all the other particles like this."}, {"start": 701.86, "end": 709.14, "text": " So it's not like a sparse it's not a sparse graph, except I think in the cosmology example"}, {"start": 709.14, "end": 715.24, "text": " here you can see that always there is a node that's connected to all its neighbors."}, {"start": 715.24, "end": 720.48, "text": " But in the Newtonian dynamics graph networks, you can see right here, everything is connected"}, {"start": 720.48, "end": 725.24, "text": " to every thing like this."}, {"start": 725.24, "end": 727.24, "text": " Okay."}, {"start": 727.24, "end": 732.96, "text": " And why, why does that represent a physical system really well?"}, {"start": 732.96, "end": 737.88, "text": " So the reason is going to be the following."}, {"start": 737.88, "end": 743.6, "text": " What we're going to try to do is we're going to try to say that in physical systems, if"}, {"start": 743.6, "end": 750.28, "text": " I want to, for example, consider this node up here, and consider how it is pulled by"}, {"start": 750.28, "end": 756.58, "text": " gravity by the other nodes, it's going to be pulled in this direction a little bit because"}, {"start": 756.58, "end": 760.6800000000001, "text": " of this particle right here, it's going to be pulled in this direction a little bit because"}, {"start": 760.6800000000001, "end": 764.44, "text": " of that one, and in this direction because of that one."}, {"start": 764.44, "end": 768.32, "text": " Now note that these three things are independent."}, {"start": 768.32, "end": 775.24, "text": " So if I want to describe the total force of gravity, I can do so as a sum over i equals"}, {"start": 775.24, "end": 783.2, "text": " one to one, two, three, of the force that the particle i pulls."}, {"start": 783.2, "end": 789.72, "text": " So if this is this is j right here, how i pulls on j, right, this is an independent"}, {"start": 789.72, "end": 795.48, "text": " sum across all of the all of the neighbors of that particle."}, {"start": 795.48, "end": 799.58, "text": " Now you might say, wait a minute, that's it's not independent."}, {"start": 799.58, "end": 802.84, "text": " Because it's it's being, you know, it's not being strictly pulled in this direction is"}, {"start": 802.84, "end": 804.6800000000001, "text": " also pulled in this direction."}, {"start": 804.68, "end": 814.16, "text": " Yes, but the with independent, we mean that the force, this force right here is only dependent"}, {"start": 814.16, "end": 815.8399999999999, "text": " on this particle."}, {"start": 815.8399999999999, "end": 820.9599999999999, "text": " And the force diagonally is only dependent on that particle, there is no part of the"}, {"start": 820.9599999999999, "end": 826.0, "text": " particle up here that modulates this force right here, right."}, {"start": 826.0, "end": 833.18, "text": " So you can calculate the total force as an independent sum across the individual forces."}, {"start": 833.18, "end": 835.2399999999999, "text": " And that's the simplification here."}, {"start": 835.2399999999999, "end": 841.5999999999999, "text": " And that's a part they claim, why so current approaches that directly try to go about finding"}, {"start": 841.5999999999999, "end": 848.3599999999999, "text": " an equation using evolutionary methods from the data set itself, don't really work because"}, {"start": 848.3599999999999, "end": 851.1999999999999, "text": " the space is just too high of equations."}, {"start": 851.1999999999999, "end": 856.28, "text": " But this right here, this is a massive constraint."}, {"start": 856.28, "end": 861.64, "text": " And it's lucky, first of all, that physical systems, they say, most physical systems actually"}, {"start": 861.64, "end": 867.08, "text": " obey that constraint, most physical systems can be described as an independent sum over"}, {"start": 867.08, "end": 872.64, "text": " contributions of interactions between just two things, right."}, {"start": 872.64, "end": 878.26, "text": " So we simply can sum over interactions between two things."}, {"start": 878.26, "end": 883.16, "text": " And that's, and that's way simpler than considering everything at once."}, {"start": 883.16, "end": 888.92, "text": " And second of all, it's lucky because these graph networks describe exactly this."}, {"start": 888.92, "end": 896.12, "text": " So each edge in the graph network is coincidentally connecting two things, right, and not more."}, {"start": 896.12, "end": 898.7199999999999, "text": " So the edges, they don't know about each other."}, {"start": 898.7199999999999, "end": 904.88, "text": " No edge knows about the other edge, they only consider whatever particles are at their respective"}, {"start": 904.88, "end": 906.5999999999999, "text": " ends."}, {"start": 906.5999999999999, "end": 911.12, "text": " And that is exactly the same as this physical constraint on the physical system."}, {"start": 911.12, "end": 918.66, "text": " And that's why the graph networks are so adapted or are so useful in describing these systems."}, {"start": 918.66, "end": 923.52, "text": " So how does a graph network like this do anything basically."}, {"start": 923.52, "end": 926.3199999999999, "text": " So for that, you have to consider the task."}, {"start": 926.3199999999999, "end": 933.4, "text": " If we want to describe a system like this, a task in that if you frame it in a machine"}, {"start": 933.4, "end": 941.36, "text": " learning way, could be, I'm going to give you these particles right here."}, {"start": 941.36, "end": 945.4, "text": " Okay, here, it's five, five particles, I'm going to give you for each one, I'm going"}, {"start": 945.4, "end": 952.28, "text": " to give you all its features, like the x, the y, the speed currently, and the mass."}, {"start": 952.28, "end": 958.12, "text": " And you're going to tell me what the acceleration is in the next frame."}, {"start": 958.12, "end": 959.12, "text": " Okay."}, {"start": 959.12, "end": 962.0, "text": " So like this, like this, like this."}, {"start": 962.0, "end": 967.5, "text": " Okay, considering all you know, all the interactions between the particles, just tell me, where"}, {"start": 967.5, "end": 970.68, "text": " does it go in the very next timeframe?"}, {"start": 970.68, "end": 973.56, "text": " That that sounds like a machine learning problem, right?"}, {"start": 973.56, "end": 977.0799999999999, "text": " And the graph neural network can be made to predict this."}, {"start": 977.0799999999999, "end": 984.9, "text": " So what we want is for each vertex here, an output of a number or a vector, the acceleration."}, {"start": 984.9, "end": 988.56, "text": " So we want to compute an output for each vertex, how do we do this?"}, {"start": 988.56, "end": 992.68, "text": " In a graph neural network, there are three or in this particular type, there are three"}, {"start": 992.68, "end": 999.16, "text": " steps, we said each vertex, and we're just going to do it for one vertex, let's say the"}, {"start": 999.16, "end": 1002.3199999999999, "text": " one on the bottom right."}, {"start": 1002.32, "end": 1008.24, "text": " Let's say each vertex has these properties like these x, y, and so on."}, {"start": 1008.24, "end": 1012.96, "text": " So first, what we do is we go over the edges."}, {"start": 1012.96, "end": 1017.7600000000001, "text": " So for each edge in parallel and independent from each other, let's consider this edge"}, {"start": 1017.7600000000001, "end": 1025.8600000000001, "text": " right here, what we'll do is we take the nodes that are attached to it."}, {"start": 1025.8600000000001, "end": 1031.04, "text": " And we combine their features, and we combine them."}, {"start": 1031.04, "end": 1033.04, "text": " So x, y, this also has x, y."}, {"start": 1033.04, "end": 1040.48, "text": " So we want to combine these two, we want to compute the edge right here."}, {"start": 1040.48, "end": 1043.8799999999999, "text": " Now, in a physical system, what does the edge represent?"}, {"start": 1043.8799999999999, "end": 1048.8, "text": " The edge represents the force between the two particles, right?"}, {"start": 1048.8, "end": 1051.76, "text": " And that's a fairly complex equation."}, {"start": 1051.76, "end": 1055.26, "text": " It's not like we can just add the features or something like this."}, {"start": 1055.26, "end": 1063.3799999999999, "text": " So the edge here already needs to compute some sort of nonlinear, complicated function."}, {"start": 1063.3799999999999, "end": 1067.96, "text": " And we know how to compute nonlinear complicated functions with neural networks."}, {"start": 1067.96, "end": 1069.48, "text": " We're in deep learning right here."}, {"start": 1069.48, "end": 1076.26, "text": " So the edge here is going to compute what's called this edge function."}, {"start": 1076.26, "end": 1081.5, "text": " And this edge function takes in two vertices, v1 and v2 right here, if this is maybe this"}, {"start": 1081.5, "end": 1083.8, "text": " is v2, this is v1."}, {"start": 1083.8, "end": 1089.1399999999999, "text": " It takes in the features, these features of the two vertices, and it will compute a so"}, {"start": 1089.1399999999999, "end": 1091.04, "text": " called edge message."}, {"start": 1091.04, "end": 1095.12, "text": " I think they call this ek for the edge k."}, {"start": 1095.12, "end": 1096.54, "text": " It will compute an edge message."}, {"start": 1096.54, "end": 1102.28, "text": " And this is supposed to represent the force that pulls between these two particles."}, {"start": 1102.28, "end": 1106.84, "text": " And we're going to approximate this function right here using a neural network."}, {"start": 1106.84, "end": 1111.9199999999998, "text": " Since we don't know the equation yet, right, we assume we don't know the gravitational"}, {"start": 1111.92, "end": 1116.72, "text": " equation, but we can learn it right because we have data."}, {"start": 1116.72, "end": 1121.18, "text": " So we take this and we simply make it into a neural network."}, {"start": 1121.18, "end": 1125.14, "text": " So the features go in here both we can you know, concatenate them."}, {"start": 1125.14, "end": 1127.3600000000001, "text": " And then out comes this edge message."}, {"start": 1127.3600000000001, "end": 1133.6000000000001, "text": " Now this edge message here is simply going to be a vector, a numerical vector, describing"}, {"start": 1133.6000000000001, "end": 1138.64, "text": " some intermediate hidden state, right, that is going to describe the force."}, {"start": 1138.64, "end": 1142.24, "text": " But for now, it's just describing intermediate hidden state."}, {"start": 1142.24, "end": 1143.92, "text": " So we do this for each edge."}, {"start": 1143.92, "end": 1151.0, "text": " So each edge is going to be maybe this is e1, this is e2, e3, e4, each edge in parallel"}, {"start": 1151.0, "end": 1156.5400000000002, "text": " is going to aggregate information of its endpoints into that edge."}, {"start": 1156.5400000000002, "end": 1158.88, "text": " And then that's step one."}, {"start": 1158.88, "end": 1161.5200000000002, "text": " So step one, compute the edge messages."}, {"start": 1161.52, "end": 1170.44, "text": " Step two is going to be to compute the vertex messages or the vertex outputs."}, {"start": 1170.44, "end": 1175.12, "text": " So we said we're not actually interested in the edges, we're interested that each vertex"}, {"start": 1175.12, "end": 1178.68, "text": " ends up with an acceleration with an output."}, {"start": 1178.68, "end": 1180.02, "text": " So how are we going to do this?"}, {"start": 1180.02, "end": 1183.04, "text": " So consider again our graph."}, {"start": 1183.04, "end": 1189.06, "text": " If we want to compute the output for this node right here, what we'll do is we'll simply"}, {"start": 1189.06, "end": 1196.24, "text": " aggregate all of the edges, all of the edge messages that connect to that vertex."}, {"start": 1196.24, "end": 1203.0, "text": " So we've computed previously the edge messages by integrating the information from all of"}, {"start": 1203.0, "end": 1205.84, "text": " the attached endpoints."}, {"start": 1205.84, "end": 1212.8, "text": " Now we're going to go backwards and distribute the information from the edges back to the"}, {"start": 1212.8, "end": 1214.6799999999998, "text": " vertices that are attached."}, {"start": 1214.68, "end": 1219.76, "text": " And you can see already by this two-step process, it's kind of a message passing process if"}, {"start": 1219.76, "end": 1226.48, "text": " you've ever studied graphical models."}, {"start": 1226.48, "end": 1231.8400000000001, "text": " This means that in the two-step process, this vertex here aggregates information from the"}, {"start": 1231.8400000000001, "end": 1235.42, "text": " other vertices via these edges."}, {"start": 1235.42, "end": 1243.46, "text": " So in this case, this vertex here is going to take in all the edge messages right here,"}, {"start": 1243.46, "end": 1250.6000000000001, "text": " and it is going to aggregate all these edge messages in a function that computes the acceleration."}, {"start": 1250.6000000000001, "end": 1258.88, "text": " So that our estimate of the acceleration is going to be a function, let's call that new,"}, {"start": 1258.88, "end": 1261.4, "text": " of the edges that are attached to it."}, {"start": 1261.4, "end": 1265.1200000000001, "text": " So e1, e2, and e3."}, {"start": 1265.1200000000001, "end": 1270.92, "text": " And here is where we're going to make our next physical assumption, namely the one we"}, {"start": 1270.92, "end": 1278.6000000000001, "text": " said before, that the way that these edges, the way that they influence the vertex is"}, {"start": 1278.6000000000001, "end": 1282.3200000000002, "text": " going to be in a form of an independent sum."}, {"start": 1282.3200000000002, "end": 1292.3200000000002, "text": " So the simplification means that this function should somehow be not of the edges, but of"}, {"start": 1292.3200000000002, "end": 1297.72, "text": " the sum of the edges, right, sum of ei."}, {"start": 1297.72, "end": 1305.88, "text": " Okay, so this sum here, this is the simplification that we make to make it in accordance with"}, {"start": 1305.88, "end": 1307.72, "text": " the physical system."}, {"start": 1307.72, "end": 1312.18, "text": " With this graph network, we could do any sort of complicated thing right here, right?"}, {"start": 1312.18, "end": 1317.68, "text": " We could put a transformer on these things and like compute 12 layers of interaction"}, {"start": 1317.68, "end": 1319.74, "text": " effects between these edges."}, {"start": 1319.74, "end": 1320.74, "text": " We're not going to do that."}, {"start": 1320.74, "end": 1327.16, "text": " We're simply going to sum them up and then come up and then, you know, run those through"}, {"start": 1327.16, "end": 1328.16, "text": " a function."}, {"start": 1328.16, "end": 1329.3600000000001, "text": " So we'll sum them up."}, {"start": 1329.3600000000001, "end": 1334.28, "text": " And of course, this function right here is still going to be a complex function because"}, {"start": 1334.28, "end": 1341.3200000000002, "text": " just because you sum up the forces, you don't have the acceleration yet."}, {"start": 1341.3200000000002, "end": 1347.92, "text": " So you know, as you know, that force is mass times acceleration, that means acceleration"}, {"start": 1347.92, "end": 1350.88, "text": " is equal to force divided by mass."}, {"start": 1350.88, "end": 1357.3000000000002, "text": " So this here is going to be this sum over the edges, I guess, yes."}, {"start": 1357.3000000000002, "end": 1359.0, "text": " So you still need to divide it by force."}, {"start": 1359.0, "end": 1362.44, "text": " And technically, you still can do much more complicated things right here."}, {"start": 1362.44, "end": 1368.5800000000002, "text": " We still, we only say that the edges should only come in in form of a sum."}, {"start": 1368.5800000000002, "end": 1376.68, "text": " So of course, we're going to say that this function right here, since it can be any complicated"}, {"start": 1376.68, "end": 1380.0600000000002, "text": " function of its input, it should also be a neural network."}, {"start": 1380.06, "end": 1384.1399999999999, "text": " So we're going to take that sum of the edge messages, and we're going to put that into"}, {"start": 1384.1399999999999, "end": 1386.26, "text": " a second neural network."}, {"start": 1386.26, "end": 1390.6599999999999, "text": " And then out comes our estimate of the acceleration."}, {"start": 1390.6599999999999, "end": 1398.32, "text": " And now that we can use together from the data set, we know the true acceleration, right?"}, {"start": 1398.32, "end": 1405.9199999999998, "text": " Since we have a data set, we have the observations and the labels, the labels are the true accelerations"}, {"start": 1405.9199999999998, "end": 1409.1599999999999, "text": " of that system that we observed."}, {"start": 1409.16, "end": 1413.72, "text": " And we can compute a loss function right here."}, {"start": 1413.72, "end": 1419.1200000000001, "text": " And if you followed so far, everything we've done so far is differentiable."}, {"start": 1419.1200000000001, "end": 1425.64, "text": " So from this loss function that compares the output of the neural network for that vertex"}, {"start": 1425.64, "end": 1431.8000000000002, "text": " to the true acceleration that we observed in the data set, we can back propagate through"}, {"start": 1431.8000000000002, "end": 1438.02, "text": " this neural network that computes the vertex function, we can back prop through the sum"}, {"start": 1438.02, "end": 1440.96, "text": " here to the edge messages."}, {"start": 1440.96, "end": 1446.08, "text": " And we can back prop through the edge messages to that neural network that computed the edge"}, {"start": 1446.08, "end": 1447.8, "text": " messages from those features."}, {"start": 1447.8, "end": 1449.94, "text": " So everything is differentiable."}, {"start": 1449.94, "end": 1456.56, "text": " By having that loss at the end, we can train this neural network end to end to from the"}, {"start": 1456.56, "end": 1465.8, "text": " observation right here, predict the numerical acceleration of the system right here."}, {"start": 1465.8, "end": 1466.8, "text": " Okay."}, {"start": 1466.8, "end": 1469.32, "text": " So this was a fairly lengthy way."}, {"start": 1469.32, "end": 1473.78, "text": " But it's important that you kind of understand what's happening."}, {"start": 1473.78, "end": 1477.78, "text": " So you build the graph network according to the physical system."}, {"start": 1477.78, "end": 1480.6599999999999, "text": " In the graph network, there are two kinds of things."}, {"start": 1480.6599999999999, "end": 1486.08, "text": " First, there are deterministic things like we're always going to aggregate in a sum."}, {"start": 1486.08, "end": 1488.04, "text": " And then there are things that you learn."}, {"start": 1488.04, "end": 1493.36, "text": " Namely, there are two neural networks, the first one computes the edge messages from"}, {"start": 1493.36, "end": 1500.12, "text": " the features of the vertices, and the second one computes the output of each vertex, according"}, {"start": 1500.12, "end": 1506.6, "text": " to the to the sum of the edge messages that are attached to that vertex."}, {"start": 1506.6, "end": 1511.0, "text": " Now you can say, wait a minute, there are more than just two neural networks, like each"}, {"start": 1511.0, "end": 1515.9599999999998, "text": " edge here has a neural network technically, right, this edge has a neural network, this"}, {"start": 1515.9599999999998, "end": 1519.32, "text": " edge has a neural network, and each vertex has a neural network."}, {"start": 1519.32, "end": 1522.52, "text": " But in this case, these neural networks are shared."}, {"start": 1522.52, "end": 1527.6399999999999, "text": " So the neural network that computes the edge message for that edge is the same as the neural"}, {"start": 1527.6399999999999, "end": 1531.5, "text": " network that computes the edge message for any of the edges."}, {"start": 1531.5, "end": 1535.72, "text": " You can think of it like weight sharing, or you can think that it is actually the same"}, {"start": 1535.72, "end": 1538.12, "text": " neural network, it's equivalent, right."}, {"start": 1538.12, "end": 1543.12, "text": " And the same for the vertices, there's only one neural network that in the same fashion"}, {"start": 1543.12, "end": 1546.78, "text": " computes the output for each vertex."}, {"start": 1546.78, "end": 1549.76, "text": " Of course, the incoming edge messages are going to be different."}, {"start": 1549.76, "end": 1551.66, "text": " And that's why you have different outputs."}, {"start": 1551.66, "end": 1556.52, "text": " But the neural network itself is the same."}, {"start": 1556.52, "end": 1565.5600000000002, "text": " Okay, so we have a system that can describe this data set of physical observations really"}, {"start": 1565.5600000000002, "end": 1566.5600000000002, "text": " well."}, {"start": 1566.5600000000002, "end": 1567.5600000000002, "text": " It's this graph neural network."}, {"start": 1567.5600000000002, "end": 1570.48, "text": " Right, so we train this end to end."}, {"start": 1570.48, "end": 1576.38, "text": " And here's a little bit of a of an analogy where they say, this, this is how you can"}, {"start": 1576.38, "end": 1581.7600000000002, "text": " and now like analogize the neural network with a physical system."}, {"start": 1581.7600000000002, "end": 1588.0800000000002, "text": " So, what are the analogies here, the nodes in the graph network correspond to the particles"}, {"start": 1588.0800000000002, "end": 1595.94, "text": " in Newtonian mechanics, pairs of nodes correspond to two interacting particles, the edge model"}, {"start": 1595.94, "end": 1603.24, "text": " is the force between two particles, then the pooling operation, which is the summing up"}, {"start": 1603.24, "end": 1608.56, "text": " of the edge messages, right that we found so important as a simplification."}, {"start": 1608.56, "end": 1614.04, "text": " This is the sum into the net force that is really given in the physical system."}, {"start": 1614.04, "end": 1624.18, "text": " So independent sum of so sorry, sum of independent forces without interaction effects, then concatenate"}, {"start": 1624.18, "end": 1626.56, "text": " with node, I guess this I left this out."}, {"start": 1626.56, "end": 1637.22, "text": " But whenever you compute, whenever you compute the vertex properties, right here, I guess,"}, {"start": 1637.22, "end": 1641.94, "text": " what you want to do is not only input the edge messages, but you know, each vertex has"}, {"start": 1641.94, "end": 1646.44, "text": " these features that we said, and these could also be fairly important."}, {"start": 1646.44, "end": 1652.02, "text": " It's like, you technically have that information in the edge messages, because it started out"}, {"start": 1652.02, "end": 1658.36, "text": " from these, but you can also just input that again into this neural network together with"}, {"start": 1658.36, "end": 1660.94, "text": " the edge properties."}, {"start": 1660.94, "end": 1664.72, "text": " And that will just make its job a bit easier since for example, right here, we have to"}, {"start": 1664.72, "end": 1667.7, "text": " divide by the mass in this function."}, {"start": 1667.7, "end": 1672.62, "text": " And it's just easier if you provide that mass as a as the property."}, {"start": 1672.62, "end": 1675.92, "text": " So that's a little detail I left out before."}, {"start": 1675.92, "end": 1681.42, "text": " So that you concatenate the edge mess, the aggregated edge messages with the node, then"}, {"start": 1681.42, "end": 1687.74, "text": " you compute the node model, which in this case is the computation is simply the you"}, {"start": 1687.74, "end": 1693.5600000000002, "text": " take this sum right here, and you divide it by the mass."}, {"start": 1693.5600000000002, "end": 1698.02, "text": " And then optionally, you can update the nodes, which is compute the next time step, which"}, {"start": 1698.02, "end": 1705.28, "text": " we don't do right here, because we simply want to output the acceleration, I guess,"}, {"start": 1705.28, "end": 1711.14, "text": " I mean, it should be equivalent to output the next time step and then compare, compare"}, {"start": 1711.14, "end": 1714.3600000000001, "text": " with the data set what the next time step was."}, {"start": 1714.3600000000001, "end": 1717.26, "text": " In any case, you have to have some kind of loss function."}, {"start": 1717.26, "end": 1723.4, "text": " And here you can see all the black squares right here are going to be neural networks."}, {"start": 1723.4, "end": 1730.96, "text": " So now, we have learned a graph network that can describe a system, how do we make this"}, {"start": 1730.96, "end": 1732.64, "text": " into an equation."}, {"start": 1732.64, "end": 1740.3400000000001, "text": " And again, here, our, our physical reality comes in that these of the like the independence"}, {"start": 1740.34, "end": 1747.52, "text": " assumptions of these realities comes in, because in physics, you know, the, the acceleration"}, {"start": 1747.52, "end": 1752.34, "text": " here is going to be a function of the sum and so on, what we need to do is we don't"}, {"start": 1752.34, "end": 1757.1399999999999, "text": " need to develop an equation for the entire system, right?"}, {"start": 1757.1399999999999, "end": 1762.12, "text": " What we need to do is simply we need to develop an equation for each vertex."}, {"start": 1762.12, "end": 1769.48, "text": " So each vertex, we need to have an equation acceleration equals something, and that something"}, {"start": 1769.48, "end": 1778.74, "text": " should include some of the edges, and then the edges again should be something, right?"}, {"start": 1778.74, "end": 1784.28, "text": " So we've technically, as we had two neural networks, we technically need two symbolic"}, {"start": 1784.28, "end": 1789.48, "text": " equations, one that represents that first neural network that computes the edge functions,"}, {"start": 1789.48, "end": 1795.56, "text": " and one that represents that second neural network that aggregates the sum of the edge"}, {"start": 1795.56, "end": 1800.6, "text": " functions or that computes the output from the sum of the edge functions."}, {"start": 1800.6, "end": 1803.26, "text": " And that, you know, it's an exact correspondence."}, {"start": 1803.26, "end": 1809.76, "text": " So what we need to do is we need to take that first neural network up here, and do symbolic"}, {"start": 1809.76, "end": 1816.22, "text": " regression on that, and the second neural network, do symbolic regression on that."}, {"start": 1816.22, "end": 1822.94, "text": " So what does it mean to do symbolic regression, it basically means that we want to find the"}, {"start": 1822.94, "end": 1828.8600000000001, "text": " symbolic equation that describes the neural network the best, right?"}, {"start": 1828.8600000000001, "end": 1832.7, "text": " And we do that in the exact same fashion as we started right here."}, {"start": 1832.7, "end": 1838.42, "text": " So we give it a bunch of these options, and then we let the system describe the neural"}, {"start": 1838.42, "end": 1841.26, "text": " network as best as possible."}, {"start": 1841.26, "end": 1847.78, "text": " The way we do that, again, is we try out equations, and if they just if they get a low error,"}, {"start": 1847.78, "end": 1851.8400000000001, "text": " right, we so we let the neural network run on the data set, and we let this run on the"}, {"start": 1851.84, "end": 1856.5, "text": " data set, if it outputs the same thing, it describes the neural network well, and we"}, {"start": 1856.5, "end": 1859.48, "text": " can iterate that until we find a good equation."}, {"start": 1859.48, "end": 1863.8799999999999, "text": " So the difference here is that we don't need to find an equation that covers the whole"}, {"start": 1863.8799999999999, "end": 1870.06, "text": " system, we just need to find two equations, one governing the edge model, and one governing"}, {"start": 1870.06, "end": 1871.24, "text": " the vertex model."}, {"start": 1871.24, "end": 1875.3799999999999, "text": " And that's way, way easier than the whole system."}, {"start": 1875.38, "end": 1881.8600000000001, "text": " And by finding those two equations, we and our given our physical assumptions, we can"}, {"start": 1881.8600000000001, "end": 1887.18, "text": " now find the equation to the whole system by simply composing them."}, {"start": 1887.18, "end": 1890.18, "text": " Alright, so that's the entire system."}, {"start": 1890.18, "end": 1897.5, "text": " I believe I've told you the entire paper right here, without actually going into into the"}, {"start": 1897.5, "end": 1904.42, "text": " paper, let's just skim the paper a bit to see that they actually tell us the same thing."}, {"start": 1904.42, "end": 1912.76, "text": " So yeah, so they graph networks, they say are ideal candidate for our approach due to"}, {"start": 1912.76, "end": 1918.48, "text": " their inductive biases shared by many physics problems, a their equivalent under particle"}, {"start": 1918.48, "end": 1923.22, "text": " permutations, B, they are differentiable end to end and can be trained efficiently using"}, {"start": 1923.22, "end": 1924.68, "text": " gradient descent."}, {"start": 1924.68, "end": 1930.28, "text": " And C, they make use of three separate and interpretable internal functions, the edge,"}, {"start": 1930.28, "end": 1932.46, "text": " the node and the global model."}, {"start": 1932.46, "end": 1937.42, "text": " Now the global model here isn't really used in the cases we're going to look at."}, {"start": 1937.42, "end": 1943.26, "text": " So it's just going to be two different neural networks, which are targets for the symbolic"}, {"start": 1943.26, "end": 1949.46, "text": " regression graph networks can also be embedded with additional symmetries as in 2324."}, {"start": 1949.46, "end": 1954.04, "text": " But we don't implement these, okay, and then they say symbolic regression."}, {"start": 1954.04, "end": 1958.8600000000001, "text": " So they use this Eureka package to perform symbolic regressions and fit compact closed"}, {"start": 1958.86, "end": 1963.78, "text": " form analytical expressions to these neural networks."}, {"start": 1963.78, "end": 1969.3999999999999, "text": " Eureka works by using a genetic algorithm to combine algebraic expression stochastically."}, {"start": 1969.3999999999999, "end": 1974.08, "text": " The technique is analogous to natural selection, where the fitness of each expression is defined"}, {"start": 1974.08, "end": 1976.4599999999998, "text": " in terms of simplicity and accuracy."}, {"start": 1976.4599999999998, "end": 1981.34, "text": " The operations considered in the fitting process are plus minus times dot dot dot dot if as"}, {"start": 1981.34, "end": 1983.9399999999998, "text": " well as real constants."}, {"start": 1983.94, "end": 1992.0, "text": " Alright, so if we look at the examples, they have three different examples."}, {"start": 1992.0, "end": 1997.42, "text": " First of all, they have Newtonian dynamics, which is, for example, this gravitational"}, {"start": 1997.42, "end": 1999.3, "text": " force we looked at."}, {"start": 1999.3, "end": 2005.2, "text": " They have Hamiltonian dynamics, which describes the same systems, but in a different way in"}, {"start": 2005.2, "end": 2006.72, "text": " terms of the Hamiltonian."}, {"start": 2006.72, "end": 2012.2, "text": " And I don't want to go into this too much, because I think that the Newtonian dynamics"}, {"start": 2012.2, "end": 2015.94, "text": " already demonstrate really well what the system can do."}, {"start": 2015.94, "end": 2022.54, "text": " And then they have dark matter halos for cosmology, which is a problem where you have universe"}, {"start": 2022.54, "end": 2027.74, "text": " simulators and you try to predict where the dark matter is, depending on where other dark"}, {"start": 2027.74, "end": 2029.3600000000001, "text": " matter is."}, {"start": 2029.3600000000001, "end": 2032.82, "text": " And they actually that's where they find a new unknown equation."}, {"start": 2032.82, "end": 2037.1000000000001, "text": " Okay, here is the system in a nutshell."}, {"start": 2037.1000000000001, "end": 2042.18, "text": " Now there is this is the path that you know, you have the data set."}, {"start": 2042.18, "end": 2047.5800000000002, "text": " You learn a graph network, and then you get out an equation, right."}, {"start": 2047.5800000000002, "end": 2055.0, "text": " But in between there is now you can put even more constraints to make the network really"}, {"start": 2055.0, "end": 2057.26, "text": " learn a physical equation."}, {"start": 2057.26, "end": 2062.38, "text": " So we said you're going to compute these edge functions right here."}, {"start": 2062.38, "end": 2068.06, "text": " And the output of the edge functions is going to be this edge message, which is just going"}, {"start": 2068.06, "end": 2071.26, "text": " to be a vector of some sort."}, {"start": 2071.26, "end": 2075.46, "text": " And that vector can be pretty large, you know, this is a hidden dimension that you can choose"}, {"start": 2075.46, "end": 2080.38, "text": " as an implementer, all you need to make sure is that the output of the vertex is the same"}, {"start": 2080.38, "end": 2086.46, "text": " dimension as you know what your output should be everything internal, you can choose."}, {"start": 2086.46, "end": 2095.98, "text": " Now, we know that, for example, in a 2d system, the the actual informational content of that"}, {"start": 2095.98, "end": 2098.7400000000002, "text": " edge message should be two dimensional, right?"}, {"start": 2098.74, "end": 2106.8599999999997, "text": " If this really describes the force in two dimensions, it, it should be two dimensional."}, {"start": 2106.8599999999997, "end": 2111.4599999999996, "text": " There's really no reason why it should have a higher dimension since all the relevant"}, {"start": 2111.4599999999996, "end": 2114.3799999999997, "text": " information can be described in two dimensions."}, {"start": 2114.3799999999997, "end": 2119.8999999999996, "text": " So one thing you can do is you can simply say, all right, I will choose the hidden dimension"}, {"start": 2119.8999999999996, "end": 2121.4599999999996, "text": " to be two."}, {"start": 2121.4599999999996, "end": 2127.9799999999996, "text": " And therefore, I will force my neural network to just use two dimensions."}, {"start": 2127.98, "end": 2133.3, "text": " This however, they noticed doesn't work super well, I think it works, but not that well,"}, {"start": 2133.3, "end": 2135.82, "text": " they call this the bottleneck model."}, {"start": 2135.82, "end": 2141.3, "text": " And the reason why it doesn't work super well is that if you have like this constraint of"}, {"start": 2141.3, "end": 2147.5, "text": " neural networks, they don't turn to, they don't tend to learn very well."}, {"start": 2147.5, "end": 2152.18, "text": " And that's what they hypothesize in the paper as well, they don't tend to really come, you"}, {"start": 2152.18, "end": 2157.7, "text": " know, be good friends with the fact that they only have two floating point numbers to learn"}, {"start": 2157.7, "end": 2159.02, "text": " anything."}, {"start": 2159.02, "end": 2164.5, "text": " And this is probably more a property of the optimization procedure than the problem itself."}, {"start": 2164.5, "end": 2169.9399999999996, "text": " It's property of, you know, us training graph neural networks with SGD."}, {"start": 2169.9399999999996, "end": 2177.24, "text": " So what they do instead is they put an L1 penalty on these edge messages."}, {"start": 2177.24, "end": 2180.22, "text": " So they say we apply L1 regularization."}, {"start": 2180.22, "end": 2185.0, "text": " And what that will do is that will induce sparsity in whatever you apply it to."}, {"start": 2185.0, "end": 2191.22, "text": " So L1 regularization simply means that you constrain, so the edge message, if you take"}, {"start": 2191.22, "end": 2196.34, "text": " the absolute value in each entry, and the sum of that, that should be small."}, {"start": 2196.34, "end": 2198.82, "text": " So you can just add this to the loss function."}, {"start": 2198.82, "end": 2203.34, "text": " And that will induce sparsity in these edge messages."}, {"start": 2203.34, "end": 2209.9, "text": " And so now the network still has these whatever 100 latent dimensions, but it is encouraged"}, {"start": 2209.9, "end": 2212.78, "text": " to use as few as possible."}, {"start": 2212.78, "end": 2218.7400000000002, "text": " That means it can use a lot during the beginning when it's really benefits from the lot of"}, {"start": 2218.7400000000002, "end": 2221.1800000000003, "text": " dimensions when it learns the system."}, {"start": 2221.1800000000003, "end": 2227.78, "text": " But then as it gets better and better, it might shift a lot of the information into"}, {"start": 2227.78, "end": 2230.5800000000004, "text": " very, very few dimensions."}, {"start": 2230.5800000000004, "end": 2237.1600000000003, "text": " Okay, so once we do, if we do that, we can then run a check, right?"}, {"start": 2237.1600000000003, "end": 2242.7400000000002, "text": " If it is really the case that this graph network has learned the physical dynamics of the"}, {"start": 2242.74, "end": 2250.7799999999997, "text": " system, then the top, we can simply look at the top two dimensions, and we start by largest"}, {"start": 2250.7799999999997, "end": 2252.4199999999996, "text": " standard deviation."}, {"start": 2252.4199999999996, "end": 2259.02, "text": " So whichever two dimensions are the least sparse, right, have the largest standard deviation,"}, {"start": 2259.02, "end": 2263.2599999999998, "text": " we can look at those two and we say, well, even though we didn't constrain the model,"}, {"start": 2263.2599999999998, "end": 2267.68, "text": " those two should describe our force pretty well."}, {"start": 2267.68, "end": 2270.8199999999997, "text": " And since in Newtonian dynamics, we know what the force is."}, {"start": 2270.82, "end": 2276.5, "text": " So this is, we know what the force is, we can simply check whether or not that holds,"}, {"start": 2276.5, "end": 2282.4, "text": " we can check whether we can read out the force from these two components."}, {"start": 2282.4, "end": 2290.3, "text": " And here, it's made such that you, you can't guarantee that the force is, you know, this"}, {"start": 2290.3, "end": 2293.98, "text": " force right here is actually."}, {"start": 2293.98, "end": 2299.1000000000004, "text": " So there are many ways to state a physical equation, because there are many symmetries"}, {"start": 2299.1, "end": 2300.8199999999997, "text": " in physics."}, {"start": 2300.8199999999997, "end": 2306.7799999999997, "text": " And we cannot really make the neural network describe the equation exactly as humans would,"}, {"start": 2306.7799999999997, "end": 2310.7999999999997, "text": " because there are infinite amount of equivalent formulations."}, {"start": 2310.7999999999997, "end": 2314.9, "text": " But they're, in this case, they're all covered by rotations of each other."}, {"start": 2314.9, "end": 2321.8199999999997, "text": " And that means in these graphs, if you have these message elements right here, and the"}, {"start": 2321.8199999999997, "end": 2327.86, "text": " linear combination of forces right here, a linear relationship means basically that the"}, {"start": 2327.86, "end": 2332.7000000000003, "text": " information is there, whereas a nonlinear relationship would mean that these numbers"}, {"start": 2332.7000000000003, "end": 2335.28, "text": " don't really encode the force as is."}, {"start": 2335.28, "end": 2339.54, "text": " And here, you can pretty clearly see that the linear relationship is given."}, {"start": 2339.54, "end": 2346.58, "text": " And that means that these first two dimensions right here, really encode the force in the"}, {"start": 2346.58, "end": 2350.86, "text": " way that we know the equation is."}, {"start": 2350.86, "end": 2352.94, "text": " So that's when we know the equation, right?"}, {"start": 2352.94, "end": 2356.7400000000002, "text": " When we know the equation, we can simply say, okay, does this fit?"}, {"start": 2356.74, "end": 2361.0, "text": " And when we don't know the equation, we can use this symbolic regression."}, {"start": 2361.0, "end": 2366.18, "text": " And what turns out is exactly this thing right here."}, {"start": 2366.18, "end": 2373.7, "text": " Now, you might object that this isn't really that force right here."}, {"start": 2373.7, "end": 2376.74, "text": " But as I said, there are many, many symmetries."}, {"start": 2376.74, "end": 2385.4599999999996, "text": " So for example, this, this R hat right here, I believe, and this is I've, I'm not a big"}, {"start": 2385.46, "end": 2387.7400000000002, "text": " physics person."}, {"start": 2387.7400000000002, "end": 2392.98, "text": " This R hat, I think this is the vector of the delta x delta y, right?"}, {"start": 2392.98, "end": 2395.92, "text": " So delta x delta y is in this R hat."}, {"start": 2395.92, "end": 2404.1, "text": " So we already see that delta x and delta y here, this already looks like some sort of,"}, {"start": 2404.1, "end": 2405.9, "text": " this already looks okay."}, {"start": 2405.9, "end": 2410.98, "text": " No, actually, if we go down, it gets even clearer."}, {"start": 2410.98, "end": 2414.5, "text": " So here they have the outputs of that."}, {"start": 2414.5, "end": 2415.5, "text": " Yes."}, {"start": 2415.5, "end": 2420.1, "text": " All right."}, {"start": 2420.1, "end": 2424.04, "text": " So in this first case, this is the same example right here."}, {"start": 2424.04, "end": 2429.46, "text": " So they say, you in this spring example, so this is a system where the particles are connected"}, {"start": 2429.46, "end": 2434.94, "text": " by springs, and we do L1 regularization, what we expect is this equation, this is we know"}, {"start": 2434.94, "end": 2438.06, "text": " that this equation holds in this spring system."}, {"start": 2438.06, "end": 2443.96, "text": " And what the neural network combined with the symbolic regression gives us is this equation."}, {"start": 2443.96, "end": 2449.8, "text": " So right here, you can see there's this delta vector, and it's a product."}, {"start": 2449.8, "end": 2455.26, "text": " It's an inner product, a dot product with this a, which is a numerical constants."}, {"start": 2455.26, "end": 2462.56, "text": " And you can see that there is this form of product with numerical constants."}, {"start": 2462.56, "end": 2468.7, "text": " What you can also see, so for example, here, the delta y here is 1.36 and 1.37."}, {"start": 2468.7, "end": 2472.66, "text": " That's, you know, the same number, and here, it's 0.6, 0.6."}, {"start": 2472.66, "end": 2473.66, "text": " Okay."}, {"start": 2473.66, "end": 2480.2599999999998, "text": " So here you see, for example, r minus 1, and here it's something like this minus something"}, {"start": 2480.2599999999998, "end": 2481.54, "text": " divided by r."}, {"start": 2481.54, "end": 2490.8999999999996, "text": " Doesn't seem the same, but again, due to the symmetries, you can, if you take this and"}, {"start": 2490.8999999999996, "end": 2496.54, "text": " you simply divide everything by r, you'll end up with this vector right here, a times"}, {"start": 2496.54, "end": 2509.94, "text": " delta x delta y times 1 over r, no, times 1 minus 1 over r plus b."}, {"start": 2509.94, "end": 2510.94, "text": " Right."}, {"start": 2510.94, "end": 2516.12, "text": " And now you can see it already looks very much similar."}, {"start": 2516.12, "end": 2521.3, "text": " And it's only off by like, it's only a transformation away from what you want."}, {"start": 2521.3, "end": 2526.06, "text": " So that's why I said you can describe these equations in many different sort of equivalent"}, {"start": 2526.06, "end": 2527.06, "text": " ways."}, {"start": 2527.06, "end": 2532.52, "text": " We can't ask the neural network to really figure out, you know, the exact one we want."}, {"start": 2532.52, "end": 2537.34, "text": " As long as it figures out a one that is equivalent, we're happy."}, {"start": 2537.34, "end": 2541.14, "text": " And we're, I guess we're pretty happy here."}, {"start": 2541.14, "end": 2547.7999999999997, "text": " So also, in this case, right here, you can see that it correctly predicts this relationship"}, {"start": 2547.7999999999997, "end": 2553.5, "text": " that it should be divided by r to the third power."}, {"start": 2553.5, "end": 2560.78, "text": " And there is a delta x delta y delta z, if you simply consider, so delta z here, I guess,"}, {"start": 2560.78, "end": 2566.06, "text": " is simply a factor of zero."}, {"start": 2566.06, "end": 2572.48, "text": " And it even has this discontinuous problem where the force breaks after a certain while,"}, {"start": 2572.48, "end": 2577.22, "text": " it can even parse out this if condition right here."}, {"start": 2577.22, "end": 2580.5, "text": " So that's, that's fairly cool, right?"}, {"start": 2580.5, "end": 2585.98, "text": " But it to me that that is pretty, pretty cool result that you can actually parse out these"}, {"start": 2585.98, "end": 2591.54, "text": " equations with just these graph networks, and then the symbolic regression."}, {"start": 2591.54, "end": 2598.4, "text": " So they do the same thing for this cosmology example, where they have these simulators"}, {"start": 2598.4, "end": 2602.5, "text": " of the universe, and they let them run."}, {"start": 2602.5, "end": 2605.46, "text": " And these kind of distribute this dark matter."}, {"start": 2605.46, "end": 2611.78, "text": " And I guess your task is, if I give you a bunch of these points right here, tell me"}, {"start": 2611.78, "end": 2617.54, "text": " where the other dark matter is something like, I don't understand this, but in essence, it"}, {"start": 2617.54, "end": 2619.94, "text": " is the same kind of problem, right?"}, {"start": 2619.94, "end": 2626.58, "text": " You want to figure out the dark matter properties from the surrounding dark matter or properties"}, {"start": 2626.58, "end": 2628.06, "text": " of other things."}, {"start": 2628.06, "end": 2633.86, "text": " And again, here, you can see pretty well that this is the equation they get out."}, {"start": 2633.86, "end": 2638.6800000000003, "text": " So the equation they get out is going to be a sum right here, over."}, {"start": 2638.6800000000003, "end": 2648.06, "text": " So here, the output for node i is going to be a sum over all the other nodes j."}, {"start": 2648.06, "end": 2651.6400000000003, "text": " And then some function of that sum."}, {"start": 2651.6400000000003, "end": 2658.38, "text": " So this right here is the equation that came out of our edge model of our edge neural network."}, {"start": 2658.38, "end": 2664.6600000000003, "text": " And this here, that includes this one, it was the equation that came out of our vertex"}, {"start": 2664.6600000000003, "end": 2665.6600000000003, "text": " model."}, {"start": 2665.6600000000003, "end": 2670.34, "text": " As, you know, the same here in this spring law, this came out of our edge model, this"}, {"start": 2670.34, "end": 2672.86, "text": " came out of our vertex model."}, {"start": 2672.86, "end": 2679.5, "text": " Again, this rests on the fact that physical systems can actually be described often as"}, {"start": 2679.5, "end": 2682.1, "text": " these sums of independent interactions."}, {"start": 2682.1, "end": 2684.58, "text": " And that's why all of this works."}, {"start": 2684.58, "end": 2689.9, "text": " So they do give very, very detailed instructions on how they did everything."}, {"start": 2689.9, "end": 2695.6, "text": " I think the most unclear things in this paper are the physics things that are assumed sort"}, {"start": 2695.6, "end": 2699.5, "text": " of that you know, I don't I didn't."}, {"start": 2699.5, "end": 2703.16, "text": " Yeah, but other than that, it's pretty straightforward."}, {"start": 2703.16, "end": 2707.9, "text": " Their appendix is also pretty detailed in how they do all the representations and so"}, {"start": 2707.9, "end": 2708.9, "text": " on."}, {"start": 2708.9, "end": 2711.6, "text": " They have different formulations other than this l one regularization."}, {"start": 2711.6, "end": 2716.3399999999997, "text": " As I said, they have bottleneck, they have like a KL formulation, they really describe"}, {"start": 2716.3399999999997, "end": 2719.8199999999997, "text": " how the graph neural network works here, and so on."}, {"start": 2719.8199999999997, "end": 2724.72, "text": " So all in all, I enjoyed reading this paper, here is a bunch of examples of these particle"}, {"start": 2724.72, "end": 2726.3399999999997, "text": " systems."}, {"start": 2726.3399999999997, "end": 2733.66, "text": " And yeah, and here is a bunch of examples of where you'd have a linear relationship"}, {"start": 2733.66, "end": 2739.8399999999997, "text": " that where you can say, Oh, look, this really describes that force, or a nonlinear relationship"}, {"start": 2739.84, "end": 2743.9, "text": " where you can make the claim this doesn't really describe the force."}, {"start": 2743.9, "end": 2749.0, "text": " Well, because it's not linear relationship indicates that what the network found is a"}, {"start": 2749.0, "end": 2751.58, "text": " rotation of what you really want."}, {"start": 2751.58, "end": 2756.1400000000003, "text": " And that's good, because it's equivalent, not nonlinear basically means that you can't"}, {"start": 2756.1400000000003, "end": 2761.02, "text": " really it doesn't really describe what you want really well."}, {"start": 2761.02, "end": 2766.9, "text": " Yeah, and I'm going to leave you with that, I absolutely invite you to check out the code"}, {"start": 2766.9, "end": 2771.5, "text": " and the video they made about it. And I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=Uumd2zOOz60
How I Read a Paper: Facebook's DETR (Video Tutorial)
I retrace my first reading of Facebook AI's DETR paper and explain my process of understanding it. OUTLINE: 0:00 - Introduction 1:25 - Title 4:10 - Authors 5:55 - Affiliation 7:40 - Abstract 13:50 - Pictures 20:30 - Introduction 22:00 - Related Work 24:00 - Model 30:00 - Experiments 41:50 - Conclusions & Abstract 42:40 - Final Remarks Original Video about DETR: https://youtu.be/T35ba_VXkMY Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, people. So a lot of you have asked me how I read papers. And honestly, I don't think there is any super special method to it. But you know, I thought because people have asked me to make a video on it, so I'll make a video on it. And I'll try to share my method of reading papers. And hopefully, this is going to be somewhat of a mini series or a series where I every now and then discuss how I read one of the papers that I make videos about. And I'll try to select them such that different things are highlighted. Now, I've selected this one right here for really for no particular reason, other than I sort of remembered it. And I'm going to try to go with you through how I read this, and how I encountered this and kind of try to honestly share what I thought at the first time when I read it. And I hope this helps some of you. If it does help you, and if you like content like this, of course, feel free to share this out and subscribe. If you haven't seen my original video on this paper, it might be worth to go watch it, I'll link it. And with that, let's dive in. So again, this might be not really something new, but I'll just go through it. Okay. So first thing I do is, of course, read the title. So the title has three parts, end to end object detection with transformers. So what I noticed that I do myself is I like, through reading a paper, it's like read the paper with an open mind, I don't do that, I almost immediately form an opinion and a hypothesis of what's going on. Like, so I see transformers. So I know what transformers are, if you don't, I've made a video of my lots of videos on transformers, attention is all you need is the base paper for that. So I know what a transformer is, okay. And I know that transformers are usually in NLP are usually used in NLP, though, there are things like, you know, other things with transformers, but it's usually an NLP model. Then I read object detection. And I know object detection is a computer vision task. So immediately, this here is sort of a, a difference. And I immediately try to assess what's the new idea in this paper. And in this case, it might be okay, it might be applying transformers to object detection. But then I also see end to end. And the only reason to put that in a title is because that's the novelty because usually in deep learning, we're sort of used to systems being end to end. And even if they aren't, if most systems aren't end to end, a lot of people don't is like end to end image classification on ImageNet, like thanks. So I was guessing that the reason they put in ends to end into the title was because that's actually something that's special about the model. So now I have like two competing hypotheses of why this paper matters, first of all, because it does it with transformers. And second, because it does it end to end. And the, of course, the truth here is that the combination of end to end transformers, all of that is what makes this model. And I already form like a hypothesis of whether I like this or not, like I have to be I have to be honest, I have very quick judgment of papers of whether I like them or not. And then I sort of catch myself each time. And I still try to so there for most papers actually that I have sort of a negative opinion at the beginning where I will negative. There are papers where I think like, there is no way this is going to, you know, work or something like this. I'm actually positively convinced throughout the paper. So for most for most papers where I that I read, I'm trying to find the positive things in there. But I do form an opinion pretty quickly, usually. Alright, so the second thing, this part right here, I like I don't even see this is like advertisements on on like Twitter, I like you just, I have always had issues with author names, like people will come to me and be like, Oh, have you seen the new vinyls paper? And I have no clue. And then when they say like, Oh, that's where they use this character level model to do that. And I'm like, Oh, that paper. So I like, do not care who the authors are of a paper. Like I don't, I can't remember the papers by their author names. I've gotten better at it, I have to say, but I've always had trouble with this. Now, that's not to say that a name doesn't pop out to me. Like, if this would be like, like Yoshua Bengio or some someone, like really famous, then of course, that would catch my eye. And, but I also know that, you know, Yoshua Bengio's paper, Yoshua Bengio's lab is huge. So just because a big name is on the paper doesn't mean that the paper is going to be of any good or bad quality. Sometimes the authors give you an indication of what kind of research is there. Like if you see Jeff Klune or Ken Kenneth O. Stanley, you know that there's, there's going to be this certain type of, of, you know, learning to explore and, and, and kind of a bit more out of the box thinking in their papers, which I really like, but it doesn't immediately give you a clue. Maybe if you go by first authors, it's much more indicative if you have already read some of their papers, but most often I just ignore authors and go on. The affiliation sometimes matters in in that it's a bit of a vicious cycle. If there's a big name affiliation, like Facebook AI, Google AI, and so on. These papers, also they get more exposure in like the press and so on. So whenever Google published the paper, all of these all these all these pop sign magazines like The Verge and this and Life Hacker and Hacker News and whatnot, they like like write a blurb about it. So often they get much more scrutinized for these papers, they get much more, they get much more the public attention, but they also get much more scrutiny, which in turn means that there is a bit more pressure on them to do good experiments. So that biases me like a little bit into the direction of believing their experimental evidence more. Now, usually, this is also backed up by the fact that I am actually convinced by their experiments, usually. So these, these big name papers, often I find myself even without or disregarding the affiliation to be convinced more than of like regular papers. My most often issue with papers is that I don't believe the experiments. And I make no difference. Like even if it's Facebook, I still my prior is the experiments are crap, and I don't believe them. And they have to convince me of the opposite. But some like, I can't say that it doesn't affect me that it's like a big name affiliation. Okay, so then the second thing is I sometimes I see the paper on archive, and I skim the abstract. Sometimes the abstract is informative and sometimes not. So here is like blah, blah, blah, a new method that views object detection as a direct set prediction problem. And I'm like, Oh, yeah, okay. So streamlines the detection effectively removing the need for many hand design components like non maximum suppression, yada, yada, yada. The main ingredients called detection transformer, a set based global loss that forces unique prediction via bipartite matching, and the transformer encoder decoder architecture. So they make it clear here why it matters. And that's, that's what I what I want to get at is sort of what's the new thing in this paper, most papers are even though they're all very long and have lots of math and so on. They often have like one or maybe two new core things that they really tell you sometimes zero. But a lot of times it's like one thing that they really do. And you, you sort of have to, but they're trying to cloak it often because they need to make their research as impactful as possible, right? But you need to sort of figure out what it is they're doing here, they make it fairly easy for us in that they say, Okay, okay. They remove the need for many hand design components like non maximum suppression, which tells me that they're building something that's easier than what came before them. And that already tells me it, it's not necessarily going to be better, their argument is more that it's going to be easier, right? There are sort of two kinds of experimental results, the ones where you try to beat what came before you. And the ones where you're trying to say, look, our thing works just as well as this other thing while being more advantageous in some other metric. So I would place this already in the sort of second category. And then they say, what are the actual ingredients? It's a set based global loss that forces unique predictions via bipartite matching. Now I at this point, I know what these terms mean. But at this point, I actually don't have to know what the terms mean. What I need to recognize is that I simply have to go later and figure out what that is, and a transformer based encoder decoder architecture. Okay. So there are two things right here that I remember I need to pay attention to later, there's this loss, which seems to be special. And there is the transformer architecture, which seem which they say, okay, that that's the model basically consists of those two things. And then they have a short description of what it does. Given a fixed small set of learned object queries, that your reasons about the relations of the objects and the global image context to directly output the final set of predicted in parallel, that almost tells me nothing. Yeah, okay, the model reasons, maybe this in parallel is something but the model is conceptually simple and does not require specialized library. Unlike many other modern detectors, this sort of repeats, this enforces my hypothesis that they're going with the Hey, this is a much easier way of doing things approach. debtor demonstrates accuracy and runtime performance on par with well established that further confirms my hypothesis that this is on par, right, the runtime performance on par with the current state of the art. And at the end, they say, moreover, debtor can easily be generalized to proceed to produce panoptic segmentation in a unified manner. We show that it significantly outperforms competitive baselines, training code and preterm models are available. Okay. Now this last part, when I first read it, it's like, okay, can easily be generalized to produce this panoptic segmentation. This is I didn't know yet whether this is like a central claim of their paper that it can do this segmentation or whether this is like an added benefit to their paper, because you can read it in both ways. And I'm just ready to find this out in the paper. Now after I've read the abstract and sort of already formed the hypothesis of what's going on. So here I already in my mind, I already sort of have a model of how would I do that? Right? How would I how would I do that? And then what would I do? So right now, what I might be thinking is if I have a transformer over images that directly outputs the predictions in parallel, I'm imagining like an image, and the image somehow needs to go into a transformer. So maybe there's like an encoder, like a CNN encoder that gives me image features. And then it's it's so maybe you sample this down this image. This is just me hypothesizing what could be going on, right? And then I might be unrolling that right this image into a vector of these lower pixels. And then so in my mind, what I would do is I would do something like BERT span prediction. So I would have BERT right here. And I so for I would input the sequence right here. And then to detect an object, I would sort of think that maybe the BERT, you know, BERT has an output that is the same length as the input, right? So it's it's very good at sequence tagging and things like this. So maybe how it detects an object is going to be that it's sort of like tags the tags the center location in the pixel of an object right here, or it tags somehow the corners of the of the bounding box. But then I don't know how this is going to be in parallel. Maybe BERT outputs like a score for each location, and then it's going to be like I don't know how this is going to be in parallel, maybe BERT outputs like a score for each location, and then you do some kind of matching right here. So this is my initial hypothesis of what's going on. And then I scroll through. And honestly, the first thing I do is I go and find the pictures. And no, no different in all, like since since your first book you read, that's what you do, I go and find the pictures because usually if someone proposes anything new that they're going to try to make a picture of it. Luckily, I don't do like super theoretical, what not your Bayesian generalization bounds and I don't know. So most often papers I read have some sort of picture. And that's very helpful to me. I know I know I know. But yeah, so I find this picture. And here I see okay, you have image, you have CNN, okay, gives you set of image features are so far so good, then transformer encoder decoder, then set of box predictions. So all of them come out here. And already read they're in parallel. And then bipartite matching loss. So here, they I can see they color these in different ways. And these color appear to match with these colors right here, right in the green here. And these they they also this is a very good graphic, right from this, I can already read that these here go to the no object. A lot of times, the graphics aren't very good. So this this is what I'm not saying in every paper, you can learn by looking at the graphics, like sometimes the graphics are terrible. And you're like, what's going on here? I like I don't, this this makes no sense. This happens a lot in this paper right here. This happens to be very, very good explanatory graphics. So I'll take advantage of that. And I do the same thing in the other papers, right. But then later, when it doesn't match what I read in the text, I'll have to, you know, update my belief and so on. But here, I see that these go to no object. And this goes to no object. So I don't know yet that this is the test set. At the point where I read this, I was sort of confused by this. But I recognized that each of these boxes right here is going to be either resulting in a bounding box or in the no object prediction. So from that, I could conclude that these things here are maybe some sort of a fixed set, right. But I still thought that, you know, these that this would actually be the output of these image features. So that in this case, you'd have like six set of image features. And then you'd have like BERT here. Even though that's not an encoder decoder, I still, this was still my running hypothesis that somehow you'd map these image features to these boxes right here. So, and I didn't know what to what to make of this, this thing right here. So then I went through some more and look for more pictures. And they're not sometimes I also kind of glance at the formulas. But okay, when I ever I see this, this is just, I mean, this is kind of useless, like, okay, cool, you minimize the loss, thanks. This, okay, didn't really pay attention to that, ah, new picture, cool. So this picture is much more informative than the other picture. I believe with the other picture, they were trying to showcase this loss, how they do the matching. And even though I could read a lot from that picture, I did not get that part. And therefore, I felt when I saw this, and I just glanced at it, I'm like, wait, what's what's different than up here? It seems like the same. But okay, let's look at this. So again, we see, okay, you have set of image features that comes out of the CNN. So that conforms with my belief. But then this here goes into a transformer encoder. And this comes out. So immediately, I see, oh, this is not the same as these boxes here, right? That was my hypothesis that these things here would be the colored boxes. So I I say, okay, obviously, that's not what happens. This thing here seems to be sort of the encoded image information, then that's somehow fed into here. And that then there are these object query things, and they seem to correspond to this. So I'm a bit more confused right now. What I can see is that these then will result in these in these boxes. Okay. So being confused by that, I look for more pictures. So I go look for more pictures. This here seems to be like a visualization, a lot of these papers have some sort of ablation experiments or so and so on. This I just find really cool picture for now. I don't know yet what it means this, I don't know yet what it means. And I go down, skip all of this. And then back here in the appendix, I find this here, which I immediately mapped to the previous where this is the encoder. And this is a decoder. And I've already read the attention is all you need paper. And at that point, it clicked in means like, ah, this is not a BERT transformer. This is one of these transformers that has an encoder in the decoder, even though they told me like 50 billion times already, I was too stupid until this point. So now I know, okay, okay, I see what's going on. So the image goes through here. And then this goes as a side input, like as an attention from the decoder to the encoder, like I know in NLP, right. So in NLP, this here would be a source sequence, like maybe if you do translation, and this here would be a target sequence. So now, whenever I see a transformer like this, and it outputs something at this, I, I look at it as okay, this here is sort of the input that goes as like a side input over here. And usually, here you have the target sequence, but that's not the case right here, right? You have these, these object queries. So this is how far I get from the pictures. Now, I go up. So I have a sort of I have questions now. I have questions. And that's when I start reading the paper. Only now do I start reading the paper after I've looked through all the images, formed the hypothesis, and sort of have questions on how this works. And we'll go a bit faster from now on, to just not bore you with all the things. So the introduction is often very important, even though it's called introduction. And maybe, you know, if you read a book, like, if there's like introduction or prologue or something like this, it's often kind of pointless. introduction in these research papers is one of the most important points, because all of these papers, they try, basically all of them try to convince a reviewer to accept them. And in order to do that, they will set up their main points and their main story immediately in the introduction. So what you'll usually have is a problem statement, which is here, like why what's what's wrong right now. And then you have like a story of how their paper addresses the issue. Okay, and that's, that's here. We streamline the training pipeline by viewing object prediction, yada yada yada. This is often formulates in words what the paper is about, and what contribution the paper makes, right? This is like a, this is like a longer abstract, the abstract is often very, very cryptic, very dense. This here is often much more informative of what the paper does. So for understanding the paper and a high level, the introduction is the best place. But given that I've already looked at the images and so on, I don't actually draw many new much new information from this thing. Then there's related work. And honestly, I, I skip it, like, unless I'm the actual reviewer of a paper, like when I'm the reviewer of a paper, I read the related work. But often related work is just like you, first of all, you cite a bunch of your friends, and then you cite the mandatory papers, and then you cite every single person that you think could be a reviewer because, or you've actually been rejected from a conference with a reviewer claiming that you're you haven't compared or you haven't cited that or that paper, you can pretty much be sure that that's the if if it's not a glaring omission, if it's like a niche paper, and you haven't cited it, then you're like, okay, I'm gonna cite it just because the next conference, you could be my reviewer again. So I'm not gonna quote, I'm not I'm not sure that these related work sections, they're necessary. Like if someone wants to write their thesis, and they go and read this paper, and they want references. Oftentimes, this is a good place, but a lot of it is just blah, blah, blah, blah, blah. Okay, I know, I know, disagree with me if you want. Oh, yeah, to maybe to reading quality. So I tend to at this point, I tend to not skim. So at first I skim. But at this point, I tend to read every sentence, and read it closely and understand it. And when I realized like I'm tired or something, I don't just skim the paper, I've tried to skim papers, and it doesn't doesn't work, try to read every sentence, understand every sentence. And okay, if you don't understand it, don't stop reading because of that. But try to not skim and be like, oh, yeah, yeah, okay, I gotta go to go to go to go to that's not helpful. Except related work skip completely cool. Then a lot of times in this paper now is the model. And this is the section I'm actually interested in, right. So I read very, very closely here. And then I find out what their, their loss is all about. And again, I stress read these things and understand them, right? Sometimes it's hard. But if you're if you're confused, that means you either they've done a bad job, or they made a mistake, or that you haven't understood something. If you can't understand the sentence, try to read on maybe it's clarified later, and then you know, go back. But again, do not do not, like just start a lot of times, when I read paper previously, like I wouldn't understand something quite well yet. And then I would be like, Oh, yeah, yeah, yeah. And then I noticed that I start skipping and skimming more and more, because that would, you know, pop up again and again, and I wouldn't understand it again and again. And then at the end, I would just be kind of glancing at the paper. And I don't want to do that right here. So I want to read every sentence and understand it. Okay, so here, then I find out about the loss. And then I if I don't know something here, then I'll go and look it up on maybe on Wikipedia, or something like this. Now, I don't need to actually, I don't need to understand every single part of it, right? That's maybe I should correct myself. So for example, this bounding box loss here, they talk about the second part of the maximum cost of Hungarian false law is this box loss that scores bounding boxes. Unlike many detectors that do box prediction with some initial the yada yada yada, they say the most commonly used l one loss will have different scales for a small. So here, they basically talk about how they mix the losses, they say overall, our box loss is that defined as this and this. Now, I haven't, I don't know what these losses are, I just assume there's some bounding box losses. So when I it's not true, when I say understand everything, understand the things that are integral to the story of the paper, right? How exactly they compute bounding box losses at this point, I don't care, I just assume that there's some loss that I can back propagate, right? I, what is important is that they do this Hungarian matching thing, right? As soon as I get that, I'm like, ah, that was this, you know, this, this thing, no, this thing up here. This thing, this with the matching thing. Now I get it, now I know, ah, there are always the same amount of boxes here. And there are always the same amount of labels here. And all we need to do is somehow match them. And I immediately think, why is that relevant? Oh, because when something is already matched to an object, some other thing cannot be matched to the same object. And that's how we, you know, prevent the fact that all the things predict the same thing, right? And so that immediately becomes clear. And as I said, there is usually like one or two ideas in a paper, I don't assume or I don't care what their exact loss function is, because I've sort of gotten the idea up here of what the loss is about. All right, so I hope that's clear. Very closely read the things and understand the things that are necessary for the story. If you find if you think something's not necessary for the story, and then later end up not understanding that maybe come back and, you know, read it again. In any case, I would, I would rather, I would rather skip something and assume it's not necessary, if I think so, and then come back, then trying to understand every everything. But the things I do read, I try to understand thoroughly. Okay. Then there's the architecture, okay. And that again, I read closely and get backbone, okay, transformer encoder, okay. And now I understand much more closely decoder, okay. And here I get now finally, I get what this is about decodes and objects in parallel, yada, yada, yada. These input embeddings are learned positional encodings that we refer to as object queries. And similarly, to the encoder, we add them to the input at each attention layer. So now they name I've already seen these object queries here. And the only word I actually need from this sentence are learned. The fact that they're positional encodings, I just kind of ignore. As soon as they say learned, I know, aha, these things here are learned, they have actually they're always the same for each of the images. They're just overall learned. Okay, so now I feel I understand the entire model. And yeah, so they then they say auxiliary decoding losses. And this sometimes you have to pay attention to like, axil auxiliary things, because those are the the things that here they say explicitly, we found helpful to use auxiliary losses. Sometimes they they won't say why they did it, they'll just say, our loss consists of three things. And, you know, if you look at the three things, only one of the things is really a part of their story so far. And that you should immediately conclude that they've put in the other things, because they tried it and it didn't work. Right. So you can also kind of get an estimate of the brittleness and so on of the system in that you see how many unnecessary things are there or how many things are not straightforward, how many things are the easiest thing that you would do when you would go about and do what they did. Okay. So then you this concludes this model or method. Usually this section is called like method or model or something like this. And you go to experiments. Now the main question I have so far, or I have, maybe I have some more questions about the model itself that I haven't been able to pick up from this section, which is not the case here. But I simply keep those questions in mind and see whether they are resolved later. Right. So I keep an awareness of what I don't understand. But from here on, my main issue is, are they demonstrating that their that their story works? Right. So they're here, they're, they're proposing a loss and a model. And in my mind, they now need to convince me that that works. And that's, that's, it's not as easy as simply to show me some numbers that they are good at some benchmark, they need to show me that they get those numbers because of what they claim. So here they claim, well, okay, they propose a new, they propose a new architecture. So what they need to convince me of is that the architecture itself makes sense, right. But in other papers, when, when you propose, like, and when you say like, oh, we, for example, in an LSTM, when you build in an attention mechanism, and you claim, oh, we, you know, the attention mechanism can look back at the source sequence in one step, then you need to convince me that that actually happens, right. So you need to not only do you need to perform well, you need to convince me that you perform well, because of what you claim your model does. Right. So and that's often difficult. And I specifically look out in the experiments for usually the question is like, where are they trying to bullshit me? Right? Where are they trying to? Are or are they trying to bullshit me? Are they trying to cover up the fact that something doesn't work? Now, all the experiments are always in the best light possible, of course, and you have to keep that in mind. But a lot of times you can also already see from the experiments that, okay, are they doing something weird? Are they not showing me some obvious experiment? Or, and that's a lot of times, because is there an easier explanation for why they get the results that they get, other than their explanation, right? And it is it is their job to convince you that their explanation is the correct one for these numbers. And especially if there is an easier one that they haven't excluded. And then I don't believe the experiments if that's the case, right? If there is an easier explanation for the effect, I'm, I'm very skeptical. But some papers have an easier job here than other papers. So in this paper, they basically show results on a on a on a task. And since their paper is about, hey, our pipeline is just easier than other pipelines, what they first of all need to do is they just need to like match the numbers of other pipelines. And here I see that, okay, in these results, often you have maybe a table or something. Here you see like this, their model, other models, and their model is the best model in a lot of cases. Now, if the best thing is, of course, if their model throughout is the best, the worst thing is if it's like scattered, like this, even if their model is the best, but in every single benchmark, a different configuration of their model is the best. That's, that's sort of a bad sign unless they can explicitly explain why that is. And it's also not that good of a sign if these things are spread out like this, like sometimes the baseline is good, sometimes their model is better, and so on. So pay attention to that. Now in this paper, it doesn't matter so much, that's actually fine, because what they're trying to show is that their model is on par and way easier. And they've already made the case in what way it is easier, it's easier in terms of architecture. If they were to say it's much faster, then after that, I would expect, you know, an experiment in speed while these numbers are matched. But since they say it's easier, I've already seen the architecture, I'm convinced of that. Now that they show, okay, our numbers match, or actually, I'm surprised they even outperform a lot of times, then I'm quite happy with these experiments. So also, look for differences between numbers and the spread of numbers. Now, it's not easy to say what if like point one is a big or a small difference that depends on the task. But if you know, pay attention to these things, pay attention to the fact that these results are noisy. And oftentimes, there is a lot more hyper parameter tuning going into the model of the paper than into the baseline model. So I do want to make your look your stuff look as good as possible. And here is a little bit where the institutional credibility of someone like Facebook comes in in that I tend to believe their results a bit more than other results, not mega, but a bit more. Yeah, also look at patterns that they don't point out in the text. So if there is like a pattern, if you see like an interaction between the number of parameters and the score or something like this, just try to be on the lookout of that and see if you can spot something that you think or think about whether that makes sense or not in what your hypothesis would be. So here we go on and okay, then they go into ablations and a lot of a lot of these papers do ablations. And I generally appreciate that. So here they visualize that the attention mechanism in their model actually refers to different instances, right encoder self attention for a set of reference points, the encoder is able to separate individual instances. And you can see that pretty clearly right here, where and even here with the overlapping cows. And this is the sort of experiment that I would expect that actually convinces me that their architecture does what it says that it does, right. And something like this, where you see like totally overlapping things with the attention of the individual things visualized. So telling me like, especially this one right here, the the foot of the back elephant actually being focused by the attention of the bounding box of the back elephant. That's the sort of experiment that convinces me that their claims like that their numbers really come from what they claim it comes from. Okay, so at the end of the experimental section, you should always ask yourself, have they really convinced me that their story is true, right, that the improvement or when whenever they get an improvement or whatever they get, what is, is due to the story that they want to sell me? Or could there be like an easier explanation? Or does something not fit is like, are there are the experiments different than from what you would expect here? Okay, so these are these are my main questions. Are they are they convincing me of their story? It's not? Do they have state of the art numbers? I don't care. I don't care. Even though, like sometimes. So there is a bit of a catch, I, I don't care about state of the art numbers. Now, let's say you have a table like this, and you have a computer vision model. And one of the models is like on the C for 10 data set. Now, if your baseline model has like a 91 92% accuracy on C for 10, when I know the state of the art is 96, I don't care, right? I know like I've done C for 10 I know with like, I don't know, five, six layers, CNN, you can reach these 91 92 93% accuracy. And to get to the 96 97, you'd actually be like in the region of a wide resnet and whatnot. So I, I know that even though you're a few points behind state of the art, I know, you know, this, this is valid still, so I don't care. But if you were to be like at 80% accuracy on C for 10, then I then I get a bit like, hmm, I like it's pretty easy to get to 90% plus with like a standard CNN. So there, I immediately start to wonder why is there an explanation? Now, this could be like a theoretical paper that says, Oh, we investigate MLPs. And that's why we only get that number. So that's, that would be fine. But if something is out of the ordinary, like this, then I pay attention, but never because something isn't like the latest and greatest state of the art. That's just dumb. Okay. And also, if only evaluate what the paper claims it does, right, if the paper says, we want to show that we are on par with current models, then don't be mad if the paper doesn't outperform these models, they didn't claim that, right? So yeah. So after these ablations, I'm actually pretty happy right here with the results. And this right here, when I saw this, I didn't, I didn't expect that. But I read the experiment description that these are these different learned object queries and what they do. And that gave me an increased understanding of how these object queries actually work, right? So at that point, I still had like a vague, I knew that these are learned. But reading this and sort of looking at it, studying it a bit, I was like, Oh, okay, then I understood even better what they are. So again, when I say understand everything in the method section, you can still have questions. And but you just have to keep it in mind for later. And then here I go on. And there's this detr for panoptic segmentation. And they here they propose like a new model. So I first look at it and I'm like, okay, they propose a new model, they can do stuff like this. Now this is not object detection. And again, I'm not sure is this like a is this like a an add on to the method? Or is was was this up here just an intermediate step to this? And honestly, after reading that I still wasn't sure. It seems like something in between. Of course, the paper is also a bit longer than other papers. It just, it seems it's too long for just being a side note. But it's too short for being its own thing. So that was just a bit weird. And I treated it as just like a oh, we can also do this with our model. But I didn't pay like too much attention to that. Okay. So at the end, I you know, look at conclusions. Now the conclusions of a paper are much, much often, they are not nearly as informative as the introduction. The conclusions, they all often tend to be very generic and kind of hedging a bit against criticisms, saying what would be up for future work, which is again, hedging against criticism. Because you simply say, Well, we didn't do this. That's future work. Yeah. So again, I read it, but I don't really pay attention to it. And then I gloss over the abstract, I just would kind of scroll through the abstract, if there's something that catches my eye, I would look at it. And if not, then not. And then I basically go to the start. And whenever I didn't understand something, I go back, I look at it again. And I try to think are all my questions answered? And have they sufficiently convinced me that their story is the thing that really has the effect right here. And then, if I now were to make a video of this, I've often found it useful to just put the paper away for a while. And it's, I usually get the best results when I read the paper the day before and then make a video the day after. Or if not, I'll just, you know, put it away, do something else, do some email responding programming, going outside, eating lunch, just some kind of a break between first read or between first couple of reads. And just, I don't even think about the paper, I just kind of, it's just in the subconscious, it kind of brews, right. And I happen to think about the paper every now and then, but I don't make a conscious effort to be like, Oh, how am I going to explain this and so on. But I just found the worst videos are the ones where I immediately make the video after reading a paper. And I've just discovered that if I kind of take a break, and then I look at it again, right, I look, I don't read it fully again, but I, if I have, if I have the feeling I've understood it, I don't read it fully again. But I just kind of look at it and go again through the story. And I think that's even if you, you know, want to, if you want to talk about a paper in a reading group or tell, you know, explain it to your friends or whatnot. This is often very useful, just put it away for a while, let it mellow. And I find that helps a lot. Okay, that was my process of reading this particular paper. Now we, again, this, this is a high quality paper. So it's, I find it's a pretty easy read, in that I simply need to understand what they did. And I'm pretty happy with their experiments. I, maybe next time I can find an experiment or a paper where I'm initially more skeptical and not as happy with what I find. But yeah, let me know if you enjoyed this or if you would like to see any other explanation. I don't exactly know if this is what you expected from a video like this. So let me know. Maybe I've misunderstood you completely, or it's way too long, way too detailed, or way too undetailed. Yeah, leave me a comment and I'll see you next time. Bye bye.
[{"start": 0.0, "end": 8.32, "text": " Hi there, people. So a lot of you have asked me how I read papers. And honestly, I don't think"}, {"start": 8.32, "end": 14.68, "text": " there is any super special method to it. But you know, I thought because people have asked me to"}, {"start": 14.68, "end": 21.72, "text": " make a video on it, so I'll make a video on it. And I'll try to share my method of reading papers."}, {"start": 21.72, "end": 28.48, "text": " And hopefully, this is going to be somewhat of a mini series or a series where I every now and"}, {"start": 28.48, "end": 34.52, "text": " then discuss how I read one of the papers that I make videos about. And I'll try to select them"}, {"start": 34.52, "end": 40.8, "text": " such that different things are highlighted. Now, I've selected this one right here for really for"}, {"start": 40.8, "end": 47.68, "text": " no particular reason, other than I sort of remembered it. And I'm going to try to go with"}, {"start": 47.68, "end": 55.519999999999996, "text": " you through how I read this, and how I encountered this and kind of try to honestly share what I"}, {"start": 55.52, "end": 63.120000000000005, "text": " thought at the first time when I read it. And I hope this helps some of you. If it does help you,"}, {"start": 63.120000000000005, "end": 68.92, "text": " and if you like content like this, of course, feel free to share this out and subscribe. If"}, {"start": 68.92, "end": 76.08, "text": " you haven't seen my original video on this paper, it might be worth to go watch it, I'll link it."}, {"start": 76.08, "end": 85.36, "text": " And with that, let's dive in. So again, this might be not really something new, but I'll just go"}, {"start": 85.36, "end": 91.92, "text": " through it. Okay. So first thing I do is, of course, read the title. So the title has three"}, {"start": 91.92, "end": 98.03999999999999, "text": " parts, end to end object detection with transformers. So what I noticed that I do myself"}, {"start": 98.03999999999999, "end": 105.0, "text": " is I like, through reading a paper, it's like read the paper with an open mind, I don't do that, I"}, {"start": 105.0, "end": 111.4, "text": " almost immediately form an opinion and a hypothesis of what's going on. Like, so I see"}, {"start": 111.4, "end": 116.16000000000001, "text": " transformers. So I know what transformers are, if you don't, I've made a video of my lots of videos"}, {"start": 116.16000000000001, "end": 121.76, "text": " on transformers, attention is all you need is the base paper for that. So I know what a transformer"}, {"start": 121.76, "end": 129.0, "text": " is, okay. And I know that transformers are usually in NLP are usually used in NLP, though, there are"}, {"start": 129.0, "end": 137.24, "text": " things like, you know, other things with transformers, but it's usually an NLP model. Then I read object"}, {"start": 137.24, "end": 143.08, "text": " detection. And I know object detection is a computer vision task. So immediately, this here is"}, {"start": 143.12, "end": 149.96, "text": " sort of a, a difference. And I immediately try to assess what's the new idea in this paper. And in"}, {"start": 149.96, "end": 155.64000000000001, "text": " this case, it might be okay, it might be applying transformers to object detection. But then I also"}, {"start": 155.64000000000001, "end": 162.0, "text": " see end to end. And the only reason to put that in a title is because that's the novelty because"}, {"start": 162.0, "end": 168.28, "text": " usually in deep learning, we're sort of used to systems being end to end. And even if they aren't,"}, {"start": 168.4, "end": 174.32, "text": " if most systems aren't end to end, a lot of people don't is like end to end image classification on"}, {"start": 174.32, "end": 182.44, "text": " ImageNet, like thanks. So I was guessing that the reason they put in ends to end into the title was"}, {"start": 182.44, "end": 188.28, "text": " because that's actually something that's special about the model. So now I have like two competing"}, {"start": 188.28, "end": 193.76, "text": " hypotheses of why this paper matters, first of all, because it does it with transformers. And"}, {"start": 193.76, "end": 200.0, "text": " second, because it does it end to end. And the, of course, the truth here is that the combination of"}, {"start": 200.88, "end": 208.16, "text": " end to end transformers, all of that is what makes this model. And I already form like a hypothesis"}, {"start": 208.16, "end": 214.32, "text": " of whether I like this or not, like I have to be I have to be honest, I have very quick judgment of"}, {"start": 214.32, "end": 221.92, "text": " papers of whether I like them or not. And then I sort of catch myself each time. And I still try to"}, {"start": 222.23999999999998, "end": 227.95999999999998, "text": " so there for most papers actually that I have sort of a negative opinion at the beginning where I"}, {"start": 228.32, "end": 234.79999999999998, "text": " will negative. There are papers where I think like, there is no way this is going to, you know, work"}, {"start": 234.79999999999998, "end": 242.16, "text": " or something like this. I'm actually positively convinced throughout the paper. So for most for"}, {"start": 242.16, "end": 249.64, "text": " most papers where I that I read, I'm trying to find the positive things in there. But I do form an"}, {"start": 249.64, "end": 256.2, "text": " opinion pretty quickly, usually. Alright, so the second thing, this part right here, I like I don't"}, {"start": 256.2, "end": 264.0, "text": " even see this is like advertisements on on like Twitter, I like you just, I have always had issues"}, {"start": 264.0, "end": 270.4, "text": " with author names, like people will come to me and be like, Oh, have you seen the new vinyls paper?"}, {"start": 270.4, "end": 275.64, "text": " And I have no clue. And then when they say like, Oh, that's where they use this character level"}, {"start": 275.64, "end": 282.15999999999997, "text": " model to do that. And I'm like, Oh, that paper. So I like, do not care who the authors are of a"}, {"start": 282.15999999999997, "end": 287.84, "text": " paper. Like I don't, I can't remember the papers by their author names. I've gotten better at it,"}, {"start": 287.88, "end": 293.35999999999996, "text": " I have to say, but I've always had trouble with this. Now, that's not to say that a name doesn't"}, {"start": 293.36, "end": 300.96000000000004, "text": " pop out to me. Like, if this would be like, like Yoshua Bengio or some someone, like really famous,"}, {"start": 300.96000000000004, "end": 306.40000000000003, "text": " then of course, that would catch my eye. And, but I also know that, you know, Yoshua Bengio's"}, {"start": 306.40000000000003, "end": 313.04, "text": " paper, Yoshua Bengio's lab is huge. So just because a big name is on the paper doesn't mean"}, {"start": 313.24, "end": 318.84000000000003, "text": " that the paper is going to be of any good or bad quality. Sometimes the authors give you an"}, {"start": 318.84, "end": 326.44, "text": " indication of what kind of research is there. Like if you see Jeff Klune or Ken Kenneth O. Stanley,"}, {"start": 327.08, "end": 332.52, "text": " you know that there's, there's going to be this certain type of, of, you know, learning to"}, {"start": 332.52, "end": 339.47999999999996, "text": " explore and, and, and kind of a bit more out of the box thinking in their papers, which I really"}, {"start": 339.47999999999996, "end": 346.35999999999996, "text": " like, but it doesn't immediately give you a clue. Maybe if you go by first authors, it's much more"}, {"start": 346.36, "end": 353.56, "text": " indicative if you have already read some of their papers, but most often I just ignore authors and"}, {"start": 353.64, "end": 361.72, "text": " go on. The affiliation sometimes matters in in that it's a bit of a vicious cycle. If there's a"}, {"start": 361.72, "end": 369.24, "text": " big name affiliation, like Facebook AI, Google AI, and so on. These papers, also they get more"}, {"start": 369.24, "end": 374.6, "text": " exposure in like the press and so on. So whenever Google published the paper, all of these all these"}, {"start": 374.6, "end": 381.56, "text": " all these pop sign magazines like The Verge and this and Life Hacker and Hacker News and whatnot,"}, {"start": 381.56, "end": 389.16, "text": " they like like write a blurb about it. So often they get much more scrutinized for these papers,"}, {"start": 389.16, "end": 395.08000000000004, "text": " they get much more, they get much more the public attention, but they also get much more scrutiny,"}, {"start": 395.08000000000004, "end": 402.84000000000003, "text": " which in turn means that there is a bit more pressure on them to do good experiments. So that"}, {"start": 402.84, "end": 409.71999999999997, "text": " biases me like a little bit into the direction of believing their experimental evidence more. Now,"}, {"start": 409.71999999999997, "end": 416.2, "text": " usually, this is also backed up by the fact that I am actually convinced by their experiments,"}, {"start": 416.28, "end": 424.03999999999996, "text": " usually. So these, these big name papers, often I find myself even without or disregarding the"}, {"start": 424.03999999999996, "end": 431.64, "text": " affiliation to be convinced more than of like regular papers. My most often issue with papers is"}, {"start": 431.64, "end": 437.88, "text": " that I don't believe the experiments. And I make no difference. Like even if it's Facebook, I still"}, {"start": 438.03999999999996, "end": 444.44, "text": " my prior is the experiments are crap, and I don't believe them. And they have to convince me of the"}, {"start": 444.44, "end": 451.08, "text": " opposite. But some like, I can't say that it doesn't affect me that it's like a big name"}, {"start": 451.08, "end": 459.15999999999997, "text": " affiliation. Okay, so then the second thing is I sometimes I see the paper on archive, and I skim"}, {"start": 459.16, "end": 467.08000000000004, "text": " the abstract. Sometimes the abstract is informative and sometimes not. So here is like blah, blah,"}, {"start": 467.08000000000004, "end": 471.96000000000004, "text": " blah, a new method that views object detection as a direct set prediction problem. And I'm like, Oh,"}, {"start": 471.96000000000004, "end": 477.40000000000003, "text": " yeah, okay. So streamlines the detection effectively removing the need for many hand"}, {"start": 477.40000000000003, "end": 482.76000000000005, "text": " design components like non maximum suppression, yada, yada, yada. The main ingredients called"}, {"start": 482.76, "end": 489.56, "text": " detection transformer, a set based global loss that forces unique prediction via bipartite matching,"}, {"start": 489.56, "end": 495.15999999999997, "text": " and the transformer encoder decoder architecture. So they make it clear here why it matters. And"}, {"start": 495.15999999999997, "end": 499.96, "text": " that's, that's what I what I want to get at is sort of what's the new thing in this paper, most"}, {"start": 499.96, "end": 507.64, "text": " papers are even though they're all very long and have lots of math and so on. They often have like"}, {"start": 507.64, "end": 517.24, "text": " one or maybe two new core things that they really tell you sometimes zero. But a lot of times it's"}, {"start": 517.24, "end": 523.72, "text": " like one thing that they really do. And you, you sort of have to, but they're trying to cloak it"}, {"start": 523.72, "end": 530.1999999999999, "text": " often because they need to make their research as impactful as possible, right? But you need to sort"}, {"start": 530.1999999999999, "end": 536.68, "text": " of figure out what it is they're doing here, they make it fairly easy for us in that they say, Okay,"}, {"start": 536.68, "end": 542.28, "text": " okay. They remove the need for many hand design components like non maximum suppression, which"}, {"start": 542.28, "end": 547.2399999999999, "text": " tells me that they're building something that's easier than what came before them. And that"}, {"start": 547.2399999999999, "end": 553.0, "text": " already tells me it, it's not necessarily going to be better, their argument is more that it's"}, {"start": 553.0, "end": 560.04, "text": " going to be easier, right? There are sort of two kinds of experimental results, the ones where you"}, {"start": 560.04, "end": 565.4, "text": " try to beat what came before you. And the ones where you're trying to say, look, our thing works"}, {"start": 565.4, "end": 571.48, "text": " just as well as this other thing while being more advantageous in some other metric. So I would"}, {"start": 571.48, "end": 578.04, "text": " place this already in the sort of second category. And then they say, what are the actual ingredients?"}, {"start": 578.04, "end": 585.16, "text": " It's a set based global loss that forces unique predictions via bipartite matching. Now I at this"}, {"start": 585.16, "end": 589.0, "text": " point, I know what these terms mean. But at this point, I actually don't have to know what the"}, {"start": 589.0, "end": 596.36, "text": " terms mean. What I need to recognize is that I simply have to go later and figure out what that"}, {"start": 596.36, "end": 604.36, "text": " is, and a transformer based encoder decoder architecture. Okay. So there are two things"}, {"start": 604.36, "end": 609.64, "text": " right here that I remember I need to pay attention to later, there's this loss, which seems to be"}, {"start": 609.64, "end": 616.68, "text": " special. And there is the transformer architecture, which seem which they say, okay, that that's the"}, {"start": 616.68, "end": 622.92, "text": " model basically consists of those two things. And then they have a short description of what it does."}, {"start": 622.92, "end": 629.4799999999999, "text": " Given a fixed small set of learned object queries, that your reasons about the relations of the"}, {"start": 629.4799999999999, "end": 634.76, "text": " objects and the global image context to directly output the final set of predicted in parallel,"}, {"start": 634.76, "end": 641.8, "text": " that almost tells me nothing. Yeah, okay, the model reasons, maybe this in parallel is something but"}, {"start": 641.8, "end": 646.5999999999999, "text": " the model is conceptually simple and does not require specialized library. Unlike many other"}, {"start": 646.5999999999999, "end": 651.24, "text": " modern detectors, this sort of repeats, this enforces my hypothesis that they're going with"}, {"start": 651.24, "end": 658.12, "text": " the Hey, this is a much easier way of doing things approach. debtor demonstrates accuracy and runtime"}, {"start": 658.12, "end": 665.24, "text": " performance on par with well established that further confirms my hypothesis that this is on"}, {"start": 665.24, "end": 671.88, "text": " par, right, the runtime performance on par with the current state of the art. And at the end,"}, {"start": 671.88, "end": 676.76, "text": " they say, moreover, debtor can easily be generalized to proceed to produce panoptic"}, {"start": 676.76, "end": 683.24, "text": " segmentation in a unified manner. We show that it significantly outperforms competitive baselines,"}, {"start": 683.24, "end": 688.28, "text": " training code and preterm models are available. Okay. Now this last part, when I first read it,"}, {"start": 688.28, "end": 693.0, "text": " it's like, okay, can easily be generalized to produce this panoptic segmentation."}, {"start": 693.0, "end": 698.6, "text": " This is I didn't know yet whether this is like a central claim of their paper that it can do this"}, {"start": 698.6, "end": 703.8, "text": " segmentation or whether this is like an added benefit to their paper, because you can read it"}, {"start": 703.8, "end": 710.76, "text": " in both ways. And I'm just ready to find this out in the paper. Now after I've read the abstract"}, {"start": 710.76, "end": 715.72, "text": " and sort of already formed the hypothesis of what's going on. So here I already in my mind,"}, {"start": 715.72, "end": 723.08, "text": " I already sort of have a model of how would I do that? Right? How would I how would I do that?"}, {"start": 723.08, "end": 730.44, "text": " And then what would I do? So right now, what I might be thinking is if I have a transformer"}, {"start": 730.44, "end": 741.4, "text": " over images that directly outputs the predictions in parallel, I'm imagining like an image, and the"}, {"start": 741.4, "end": 747.0799999999999, "text": " image somehow needs to go into a transformer. So maybe there's like an encoder, like a CNN encoder"}, {"start": 747.0799999999999, "end": 756.04, "text": " that gives me image features. And then it's it's so maybe you sample this down this image. This is"}, {"start": 756.04, "end": 761.64, "text": " just me hypothesizing what could be going on, right? And then I might be unrolling that right"}, {"start": 761.64, "end": 768.76, "text": " this image into a vector of these lower pixels. And then so in my mind, what I would do is I would"}, {"start": 768.76, "end": 776.4399999999999, "text": " do something like BERT span prediction. So I would have BERT right here. And I so for I would input"}, {"start": 776.4399999999999, "end": 784.12, "text": " the sequence right here. And then to detect an object, I would sort of think that maybe the BERT,"}, {"start": 784.12, "end": 790.6, "text": " you know, BERT has an output that is the same length as the input, right? So it's it's very good"}, {"start": 790.6, "end": 797.96, "text": " at sequence tagging and things like this. So maybe how it detects an object is going to be that it's"}, {"start": 797.96, "end": 804.0400000000001, "text": " sort of like tags the tags the center location in the pixel of an object right here, or it tags"}, {"start": 804.0400000000001, "end": 809.0, "text": " somehow the corners of the of the bounding box. But then I don't know how this is going to be in"}, {"start": 809.0, "end": 814.6, "text": " parallel. Maybe BERT outputs like a score for each location, and then it's going to be like"}, {"start": 814.6, "end": 820.6800000000001, "text": " I don't know how this is going to be in parallel, maybe BERT outputs like a score for each location,"}, {"start": 820.6800000000001, "end": 827.16, "text": " and then you do some kind of matching right here. So this is my initial hypothesis of what's going"}, {"start": 827.16, "end": 834.44, "text": " on. And then I scroll through. And honestly, the first thing I do is I go and find the pictures."}, {"start": 834.44, "end": 840.12, "text": " And no, no different in all, like since since your first book you read, that's what you do,"}, {"start": 840.12, "end": 845.24, "text": " I go and find the pictures because usually if someone proposes anything new that they're going"}, {"start": 845.24, "end": 852.68, "text": " to try to make a picture of it. Luckily, I don't do like super theoretical, what not your Bayesian"}, {"start": 852.68, "end": 859.96, "text": " generalization bounds and I don't know. So most often papers I read have some sort of picture."}, {"start": 859.96, "end": 868.76, "text": " And that's very helpful to me. I know I know I know. But yeah, so I find this picture. And here"}, {"start": 868.76, "end": 876.92, "text": " I see okay, you have image, you have CNN, okay, gives you set of image features are so far so good,"}, {"start": 876.92, "end": 882.76, "text": " then transformer encoder decoder, then set of box predictions. So all of them come out here. And"}, {"start": 882.76, "end": 888.84, "text": " already read they're in parallel. And then bipartite matching loss. So here, they I can see"}, {"start": 888.84, "end": 894.84, "text": " they color these in different ways. And these color appear to match with these colors right here,"}, {"start": 894.84, "end": 900.0400000000001, "text": " right in the green here. And these they they also this is a very good graphic, right from this,"}, {"start": 900.0400000000001, "end": 906.12, "text": " I can already read that these here go to the no object. A lot of times, the graphics aren't very"}, {"start": 906.12, "end": 911.88, "text": " good. So this this is what I'm not saying in every paper, you can learn by looking at the graphics,"}, {"start": 911.88, "end": 917.96, "text": " like sometimes the graphics are terrible. And you're like, what's going on here? I like I don't,"}, {"start": 917.96, "end": 923.08, "text": " this this makes no sense. This happens a lot in this paper right here. This happens to be very,"}, {"start": 923.08, "end": 930.12, "text": " very good explanatory graphics. So I'll take advantage of that. And I do the same thing in"}, {"start": 930.12, "end": 935.8000000000001, "text": " the other papers, right. But then later, when it doesn't match what I read in the text, I'll have"}, {"start": 935.8000000000001, "end": 943.4000000000001, "text": " to, you know, update my belief and so on. But here, I see that these go to no object. And this"}, {"start": 943.4000000000001, "end": 950.44, "text": " goes to no object. So I don't know yet that this is the test set. At the point where I read this,"}, {"start": 950.44, "end": 958.7600000000001, "text": " I was sort of confused by this. But I recognized that each of these boxes right here is going to"}, {"start": 958.7600000000001, "end": 966.0400000000001, "text": " be either resulting in a bounding box or in the no object prediction. So from that, I could conclude"}, {"start": 966.0400000000001, "end": 973.8000000000001, "text": " that these things here are maybe some sort of a fixed set, right. But I still thought that,"}, {"start": 973.8000000000001, "end": 978.6, "text": " you know, these that this would actually be the output of these image features. So that"}, {"start": 978.6, "end": 983.72, "text": " in this case, you'd have like six set of image features. And then you'd have like BERT here."}, {"start": 985.24, "end": 990.6, "text": " Even though that's not an encoder decoder, I still, this was still my running hypothesis that"}, {"start": 990.6, "end": 997.88, "text": " somehow you'd map these image features to these boxes right here. So, and I didn't know what to"}, {"start": 997.88, "end": 1005.8000000000001, "text": " what to make of this, this thing right here. So then I went through some more and look for more"}, {"start": 1005.8, "end": 1011.56, "text": " pictures. And they're not sometimes I also kind of glance at the formulas. But okay, when I ever"}, {"start": 1011.56, "end": 1016.3599999999999, "text": " I see this, this is just, I mean, this is kind of useless, like, okay, cool, you minimize the loss,"}, {"start": 1016.3599999999999, "end": 1024.44, "text": " thanks. This, okay, didn't really pay attention to that, ah, new picture, cool. So this picture"}, {"start": 1024.44, "end": 1030.44, "text": " is much more informative than the other picture. I believe with the other picture, they were trying"}, {"start": 1030.44, "end": 1037.24, "text": " to showcase this loss, how they do the matching. And even though I could read a lot from that"}, {"start": 1037.24, "end": 1043.72, "text": " picture, I did not get that part. And therefore, I felt when I saw this, and I just glanced at it,"}, {"start": 1043.72, "end": 1048.3600000000001, "text": " I'm like, wait, what's what's different than up here? It seems like the same. But okay,"}, {"start": 1049.16, "end": 1054.1200000000001, "text": " let's look at this. So again, we see, okay, you have set of image features that comes out of the"}, {"start": 1054.12, "end": 1061.8, "text": " CNN. So that conforms with my belief. But then this here goes into a transformer encoder. And"}, {"start": 1062.76, "end": 1070.1999999999998, "text": " this comes out. So immediately, I see, oh, this is not the same as these boxes here, right? That"}, {"start": 1070.1999999999998, "end": 1079.08, "text": " was my hypothesis that these things here would be the colored boxes. So I I say, okay, obviously,"}, {"start": 1079.08, "end": 1086.04, "text": " that's not what happens. This thing here seems to be sort of the encoded image information,"}, {"start": 1087.08, "end": 1094.76, "text": " then that's somehow fed into here. And that then there are these object query things, and they"}, {"start": 1094.76, "end": 1103.0, "text": " seem to correspond to this. So I'm a bit more confused right now. What I can see is that these"}, {"start": 1103.0, "end": 1112.36, "text": " then will result in these in these boxes. Okay. So being confused by that, I look for more pictures."}, {"start": 1113.56, "end": 1119.16, "text": " So I go look for more pictures. This here seems to be like a visualization, a lot of these papers"}, {"start": 1119.16, "end": 1125.32, "text": " have some sort of ablation experiments or so and so on. This I just find really cool picture for"}, {"start": 1125.32, "end": 1130.52, "text": " now. I don't know yet what it means this, I don't know yet what it means. And I go down,"}, {"start": 1130.52, "end": 1140.44, "text": " skip all of this. And then back here in the appendix, I find this here, which I immediately"}, {"start": 1140.44, "end": 1144.68, "text": " mapped to the previous where this is the encoder. And this is a decoder. And I've already read the"}, {"start": 1144.68, "end": 1148.2, "text": " attention is all you need paper. And at that point, it clicked in means like, ah, this is"}, {"start": 1148.2, "end": 1152.84, "text": " not a BERT transformer. This is one of these transformers that has an encoder in the decoder,"}, {"start": 1152.84, "end": 1157.96, "text": " even though they told me like 50 billion times already, I was too stupid until this point. So"}, {"start": 1157.96, "end": 1164.76, "text": " now I know, okay, okay, I see what's going on. So the image goes through here. And then this goes as"}, {"start": 1164.76, "end": 1172.52, "text": " a side input, like as an attention from the decoder to the encoder, like I know in NLP, right. So in"}, {"start": 1172.52, "end": 1178.28, "text": " NLP, this here would be a source sequence, like maybe if you do translation, and this here would"}, {"start": 1178.28, "end": 1184.92, "text": " be a target sequence. So now, whenever I see a transformer like this, and it outputs something"}, {"start": 1184.92, "end": 1194.6000000000001, "text": " at this, I, I look at it as okay, this here is sort of the input that goes as like a side input"}, {"start": 1194.6000000000001, "end": 1201.5600000000002, "text": " over here. And usually, here you have the target sequence, but that's not the case right here,"}, {"start": 1201.5600000000002, "end": 1209.24, "text": " right? You have these, these object queries. So this is how far I get from the pictures. Now,"}, {"start": 1209.24, "end": 1215.8, "text": " I go up. So I have a sort of I have questions now. I have questions. And that's when I start reading"}, {"start": 1215.8, "end": 1220.44, "text": " the paper. Only now do I start reading the paper after I've looked through all the images, formed"}, {"start": 1220.44, "end": 1227.24, "text": " the hypothesis, and sort of have questions on how this works. And we'll go a bit faster from now on,"}, {"start": 1227.24, "end": 1234.1200000000001, "text": " to just not bore you with all the things. So the introduction is often very important, even though"}, {"start": 1234.12, "end": 1239.32, "text": " it's called introduction. And maybe, you know, if you read a book, like, if there's like introduction"}, {"start": 1239.32, "end": 1245.9599999999998, "text": " or prologue or something like this, it's often kind of pointless. introduction in these research"}, {"start": 1245.9599999999998, "end": 1253.2399999999998, "text": " papers is one of the most important points, because all of these papers, they try, basically all of"}, {"start": 1253.2399999999998, "end": 1259.4799999999998, "text": " them try to convince a reviewer to accept them. And in order to do that, they will set up their"}, {"start": 1259.48, "end": 1265.0, "text": " main points and their main story immediately in the introduction. So what you'll usually have"}, {"start": 1265.72, "end": 1272.52, "text": " is a problem statement, which is here, like why what's what's wrong right now. And then you have"}, {"start": 1272.52, "end": 1279.24, "text": " like a story of how their paper addresses the issue. Okay, and that's, that's here."}, {"start": 1282.1200000000001, "end": 1287.48, "text": " We streamline the training pipeline by viewing object prediction, yada yada yada. This is often"}, {"start": 1287.48, "end": 1294.6, "text": " formulates in words what the paper is about, and what contribution the paper makes, right? This is"}, {"start": 1294.6, "end": 1300.52, "text": " like a, this is like a longer abstract, the abstract is often very, very cryptic, very dense."}, {"start": 1300.52, "end": 1307.16, "text": " This here is often much more informative of what the paper does. So for understanding the paper and"}, {"start": 1307.16, "end": 1314.68, "text": " a high level, the introduction is the best place. But given that I've already looked at the images"}, {"start": 1314.68, "end": 1322.68, "text": " and so on, I don't actually draw many new much new information from this thing. Then there's"}, {"start": 1322.68, "end": 1329.48, "text": " related work. And honestly, I, I skip it, like, unless I'm the actual reviewer of a paper, like"}, {"start": 1329.48, "end": 1335.0800000000002, "text": " when I'm the reviewer of a paper, I read the related work. But often related work is just like"}, {"start": 1335.0800000000002, "end": 1339.96, "text": " you, first of all, you cite a bunch of your friends, and then you cite the mandatory papers,"}, {"start": 1339.96, "end": 1346.3600000000001, "text": " and then you cite every single person that you think could be a reviewer because, or you've"}, {"start": 1346.3600000000001, "end": 1350.76, "text": " actually been rejected from a conference with a reviewer claiming that you're you haven't compared"}, {"start": 1350.76, "end": 1356.28, "text": " or you haven't cited that or that paper, you can pretty much be sure that that's the if if it's"}, {"start": 1356.28, "end": 1362.28, "text": " not a glaring omission, if it's like a niche paper, and you haven't cited it, then you're like, okay,"}, {"start": 1362.28, "end": 1369.32, "text": " I'm gonna cite it just because the next conference, you could be my reviewer again. So I'm not gonna"}, {"start": 1369.32, "end": 1376.12, "text": " quote, I'm not I'm not sure that these related work sections, they're necessary. Like if someone"}, {"start": 1376.12, "end": 1381.32, "text": " wants to write their thesis, and they go and read this paper, and they want references."}, {"start": 1381.8799999999999, "end": 1386.6, "text": " Oftentimes, this is a good place, but a lot of it is just blah, blah, blah, blah, blah."}, {"start": 1388.2, "end": 1395.24, "text": " Okay, I know, I know, disagree with me if you want. Oh, yeah, to maybe to reading quality. So I"}, {"start": 1395.24, "end": 1403.24, "text": " tend to at this point, I tend to not skim. So at first I skim. But at this point, I tend to read"}, {"start": 1403.24, "end": 1410.1200000000001, "text": " every sentence, and read it closely and understand it. And when I realized like I'm tired or"}, {"start": 1410.1200000000001, "end": 1416.92, "text": " something, I don't just skim the paper, I've tried to skim papers, and it doesn't doesn't work, try"}, {"start": 1416.92, "end": 1422.52, "text": " to read every sentence, understand every sentence. And okay, if you don't understand it, don't stop"}, {"start": 1422.52, "end": 1428.68, "text": " reading because of that. But try to not skim and be like, oh, yeah, yeah, okay, I gotta go to go"}, {"start": 1428.68, "end": 1438.92, "text": " to go to go to that's not helpful. Except related work skip completely cool. Then a lot of times in"}, {"start": 1438.92, "end": 1445.0, "text": " this paper now is the model. And this is the section I'm actually interested in, right. So I"}, {"start": 1445.0, "end": 1452.6, "text": " read very, very closely here. And then I find out what their, their loss is all about. And again,"}, {"start": 1452.6, "end": 1463.16, "text": " I stress read these things and understand them, right? Sometimes it's hard. But if you're if"}, {"start": 1463.16, "end": 1469.16, "text": " you're confused, that means you either they've done a bad job, or they made a mistake, or that"}, {"start": 1469.16, "end": 1474.52, "text": " you haven't understood something. If you can't understand the sentence, try to read on maybe"}, {"start": 1474.52, "end": 1482.28, "text": " it's clarified later, and then you know, go back. But again, do not do not, like just start a lot of"}, {"start": 1482.28, "end": 1489.0, "text": " times, when I read paper previously, like I wouldn't understand something quite well yet. And"}, {"start": 1489.0, "end": 1494.68, "text": " then I would be like, Oh, yeah, yeah, yeah. And then I noticed that I start skipping and skimming"}, {"start": 1494.68, "end": 1499.6399999999999, "text": " more and more, because that would, you know, pop up again and again, and I wouldn't understand it"}, {"start": 1499.64, "end": 1505.16, "text": " again and again. And then at the end, I would just be kind of glancing at the paper. And I don't want"}, {"start": 1505.16, "end": 1510.5200000000002, "text": " to do that right here. So I want to read every sentence and understand it. Okay, so here, then I"}, {"start": 1510.5200000000002, "end": 1519.48, "text": " find out about the loss. And then I if I don't know something here, then I'll go and look it up"}, {"start": 1519.48, "end": 1524.92, "text": " on maybe on Wikipedia, or something like this. Now, I don't need to actually, I don't need to"}, {"start": 1524.92, "end": 1531.0800000000002, "text": " understand every single part of it, right? That's maybe I should correct myself. So for example,"}, {"start": 1531.0800000000002, "end": 1537.4, "text": " this bounding box loss here, they talk about the second part of the maximum cost of Hungarian"}, {"start": 1537.4, "end": 1542.6000000000001, "text": " false law is this box loss that scores bounding boxes. Unlike many detectors that do box prediction"}, {"start": 1542.6000000000001, "end": 1547.8000000000002, "text": " with some initial the yada yada yada, they say the most commonly used l one loss will have different"}, {"start": 1547.8000000000002, "end": 1553.3200000000002, "text": " scales for a small. So here, they basically talk about how they mix the losses, they say overall,"}, {"start": 1553.32, "end": 1560.2, "text": " our box loss is that defined as this and this. Now, I haven't, I don't know what these losses are,"}, {"start": 1560.2, "end": 1565.24, "text": " I just assume there's some bounding box losses. So when I it's not true, when I say understand"}, {"start": 1565.24, "end": 1572.6799999999998, "text": " everything, understand the things that are integral to the story of the paper, right? How"}, {"start": 1572.6799999999998, "end": 1578.12, "text": " exactly they compute bounding box losses at this point, I don't care, I just assume that there's"}, {"start": 1578.12, "end": 1585.8, "text": " some loss that I can back propagate, right? I, what is important is that they do this Hungarian"}, {"start": 1585.8, "end": 1590.52, "text": " matching thing, right? As soon as I get that, I'm like, ah, that was this, you know, this,"}, {"start": 1591.8799999999999, "end": 1598.76, "text": " this thing, no, this thing up here. This thing, this with the matching thing. Now I get it,"}, {"start": 1598.76, "end": 1604.76, "text": " now I know, ah, there are always the same amount of boxes here. And there are always the same"}, {"start": 1604.76, "end": 1610.84, "text": " amount of labels here. And all we need to do is somehow match them. And I immediately think,"}, {"start": 1610.84, "end": 1616.6, "text": " why is that relevant? Oh, because when something is already matched to an object, some other thing"}, {"start": 1616.6, "end": 1622.36, "text": " cannot be matched to the same object. And that's how we, you know, prevent the fact that all the"}, {"start": 1622.36, "end": 1629.48, "text": " things predict the same thing, right? And so that immediately becomes clear. And as I said, there is"}, {"start": 1629.48, "end": 1636.6, "text": " usually like one or two ideas in a paper, I don't assume or I don't care what their exact loss"}, {"start": 1636.6, "end": 1643.64, "text": " function is, because I've sort of gotten the idea up here of what the loss is about. All right,"}, {"start": 1643.64, "end": 1649.96, "text": " so I hope that's clear. Very closely read the things and understand the things that are"}, {"start": 1649.96, "end": 1656.28, "text": " necessary for the story. If you find if you think something's not necessary for the story,"}, {"start": 1656.28, "end": 1660.68, "text": " and then later end up not understanding that maybe come back and, you know, read it again."}, {"start": 1661.24, "end": 1668.6, "text": " In any case, I would, I would rather, I would rather skip something and assume it's not necessary,"}, {"start": 1668.6, "end": 1676.12, "text": " if I think so, and then come back, then trying to understand every everything. But the things I do"}, {"start": 1676.12, "end": 1685.3999999999999, "text": " read, I try to understand thoroughly. Okay. Then there's the architecture, okay. And that again,"}, {"start": 1685.4, "end": 1692.6000000000001, "text": " I read closely and get backbone, okay, transformer encoder, okay. And now I understand much more"}, {"start": 1692.6000000000001, "end": 1700.6000000000001, "text": " closely decoder, okay. And here I get now finally, I get what this is about decodes and objects in"}, {"start": 1700.6000000000001, "end": 1708.2, "text": " parallel, yada, yada, yada. These input embeddings are learned positional encodings that we refer to"}, {"start": 1708.2, "end": 1713.48, "text": " as object queries. And similarly, to the encoder, we add them to the input at each attention layer."}, {"start": 1713.48, "end": 1719.64, "text": " So now they name I've already seen these object queries here. And the only word I actually need"}, {"start": 1719.64, "end": 1725.24, "text": " from this sentence are learned. The fact that they're positional encodings, I just kind of"}, {"start": 1725.24, "end": 1732.52, "text": " ignore. As soon as they say learned, I know, aha, these things here are learned, they have actually"}, {"start": 1732.52, "end": 1738.76, "text": " they're always the same for each of the images. They're just overall learned. Okay, so now I feel"}, {"start": 1738.76, "end": 1749.0, "text": " I understand the entire model. And yeah, so they then they say auxiliary decoding losses. And this"}, {"start": 1749.0, "end": 1755.8799999999999, "text": " sometimes you have to pay attention to like, axil auxiliary things, because those are the"}, {"start": 1755.8799999999999, "end": 1762.6, "text": " the things that here they say explicitly, we found helpful to use auxiliary losses. Sometimes"}, {"start": 1762.6, "end": 1769.8799999999999, "text": " they they won't say why they did it, they'll just say, our loss consists of three things. And, you"}, {"start": 1769.8799999999999, "end": 1774.1999999999998, "text": " know, if you look at the three things, only one of the things is really a part of their story so"}, {"start": 1774.1999999999998, "end": 1780.12, "text": " far. And that you should immediately conclude that they've put in the other things, because they"}, {"start": 1780.12, "end": 1785.6399999999999, "text": " tried it and it didn't work. Right. So you can also kind of get an estimate of the brittleness"}, {"start": 1785.6399999999999, "end": 1791.9599999999998, "text": " and so on of the system in that you see how many unnecessary things are there or how many things"}, {"start": 1791.96, "end": 1798.1200000000001, "text": " are not straightforward, how many things are the easiest thing that you would do when you would go"}, {"start": 1798.1200000000001, "end": 1805.96, "text": " about and do what they did. Okay. So then you this concludes this model or method. Usually this"}, {"start": 1805.96, "end": 1811.56, "text": " section is called like method or model or something like this. And you go to experiments. Now the"}, {"start": 1811.96, "end": 1818.6000000000001, "text": " main question I have so far, or I have, maybe I have some more questions about the model itself"}, {"start": 1818.6, "end": 1825.56, "text": " that I haven't been able to pick up from this section, which is not the case here. But I simply"}, {"start": 1825.56, "end": 1833.3999999999999, "text": " keep those questions in mind and see whether they are resolved later. Right. So I keep an awareness"}, {"start": 1833.3999999999999, "end": 1841.48, "text": " of what I don't understand. But from here on, my main issue is, are they demonstrating that their"}, {"start": 1841.48, "end": 1848.68, "text": " that their story works? Right. So they're here, they're, they're proposing a loss and a model."}, {"start": 1849.24, "end": 1858.3600000000001, "text": " And in my mind, they now need to convince me that that works. And that's, that's, it's not as easy"}, {"start": 1858.3600000000001, "end": 1864.3600000000001, "text": " as simply to show me some numbers that they are good at some benchmark, they need to show me"}, {"start": 1864.36, "end": 1872.36, "text": " that they get those numbers because of what they claim. So here they claim, well, okay,"}, {"start": 1872.36, "end": 1877.0, "text": " they propose a new, they propose a new architecture. So what they need to convince me"}, {"start": 1877.0, "end": 1884.52, "text": " of is that the architecture itself makes sense, right. But in other papers, when, when you propose,"}, {"start": 1884.52, "end": 1891.32, "text": " like, and when you say like, oh, we, for example, in an LSTM, when you build in an attention"}, {"start": 1891.32, "end": 1897.6399999999999, "text": " mechanism, and you claim, oh, we, you know, the attention mechanism can look back at the source"}, {"start": 1897.6399999999999, "end": 1904.6799999999998, "text": " sequence in one step, then you need to convince me that that actually happens, right. So you need to"}, {"start": 1904.6799999999998, "end": 1911.56, "text": " not only do you need to perform well, you need to convince me that you perform well, because of what"}, {"start": 1911.56, "end": 1919.08, "text": " you claim your model does. Right. So and that's often difficult. And I specifically look out in"}, {"start": 1919.08, "end": 1926.28, "text": " the experiments for usually the question is like, where are they trying to bullshit me? Right? Where"}, {"start": 1926.28, "end": 1933.08, "text": " are they trying to? Are or are they trying to bullshit me? Are they trying to cover up the fact"}, {"start": 1933.08, "end": 1937.8, "text": " that something doesn't work? Now, all the experiments are always in the best light possible,"}, {"start": 1937.8, "end": 1943.56, "text": " of course, and you have to keep that in mind. But a lot of times you can also already see from the"}, {"start": 1943.56, "end": 1951.96, "text": " experiments that, okay, are they doing something weird? Are they not showing me some obvious"}, {"start": 1951.96, "end": 1959.0, "text": " experiment? Or, and that's a lot of times, because is there an easier explanation for why they get"}, {"start": 1959.0, "end": 1965.56, "text": " the results that they get, other than their explanation, right? And it is it is their job"}, {"start": 1965.56, "end": 1972.12, "text": " to convince you that their explanation is the correct one for these numbers. And especially if"}, {"start": 1972.12, "end": 1978.4399999999998, "text": " there is an easier one that they haven't excluded. And then I don't believe the experiments if that's"}, {"start": 1978.4399999999998, "end": 1986.52, "text": " the case, right? If there is an easier explanation for the effect, I'm, I'm very skeptical. But some"}, {"start": 1986.52, "end": 1992.6799999999998, "text": " papers have an easier job here than other papers. So in this paper, they basically show results on"}, {"start": 1992.6799999999998, "end": 2000.4399999999998, "text": " a on a on a task. And since their paper is about, hey, our pipeline is just easier than other"}, {"start": 2000.44, "end": 2005.4, "text": " pipelines, what they first of all need to do is they just need to like match the numbers of other"}, {"start": 2005.4, "end": 2012.2, "text": " pipelines. And here I see that, okay, in these results, often you have maybe a table or something."}, {"start": 2012.2, "end": 2018.44, "text": " Here you see like this, their model, other models, and their model is the best model in a lot of"}, {"start": 2018.44, "end": 2025.88, "text": " cases. Now, if the best thing is, of course, if their model throughout is the best, the worst"}, {"start": 2025.88, "end": 2032.5200000000002, "text": " thing is if it's like scattered, like this, even if their model is the best, but in every single"}, {"start": 2032.5200000000002, "end": 2038.2800000000002, "text": " benchmark, a different configuration of their model is the best. That's, that's sort of a bad"}, {"start": 2038.2800000000002, "end": 2045.3200000000002, "text": " sign unless they can explicitly explain why that is. And it's also not that good of a sign if"}, {"start": 2046.2800000000002, "end": 2052.04, "text": " these things are spread out like this, like sometimes the baseline is good, sometimes their"}, {"start": 2052.04, "end": 2057.48, "text": " model is better, and so on. So pay attention to that. Now in this paper, it doesn't matter so much,"}, {"start": 2057.48, "end": 2064.04, "text": " that's actually fine, because what they're trying to show is that their model is on par and way"}, {"start": 2064.04, "end": 2069.4, "text": " easier. And they've already made the case in what way it is easier, it's easier in terms of"}, {"start": 2069.4, "end": 2074.44, "text": " architecture. If they were to say it's much faster, then after that, I would expect, you know, an"}, {"start": 2074.44, "end": 2082.36, "text": " experiment in speed while these numbers are matched. But since they say it's easier, I've"}, {"start": 2082.36, "end": 2087.96, "text": " already seen the architecture, I'm convinced of that. Now that they show, okay, our numbers match,"}, {"start": 2087.96, "end": 2094.52, "text": " or actually, I'm surprised they even outperform a lot of times, then I'm quite happy with these"}, {"start": 2094.52, "end": 2100.28, "text": " experiments. So also, look for differences between numbers and the spread of numbers. Now,"}, {"start": 2100.28, "end": 2106.28, "text": " it's not easy to say what if like point one is a big or a small difference that depends on the"}, {"start": 2106.28, "end": 2111.6400000000003, "text": " task. But if you know, pay attention to these things, pay attention to the fact that these"}, {"start": 2111.6400000000003, "end": 2117.2400000000002, "text": " results are noisy. And oftentimes, there is a lot more hyper parameter tuning going into"}, {"start": 2117.2400000000002, "end": 2123.1600000000003, "text": " the model of the paper than into the baseline model. So I do want to make your look your stuff"}, {"start": 2123.1600000000003, "end": 2129.5600000000004, "text": " look as good as possible. And here is a little bit where the institutional credibility of someone"}, {"start": 2129.56, "end": 2137.24, "text": " like Facebook comes in in that I tend to believe their results a bit more than other results, not"}, {"start": 2137.88, "end": 2144.7599999999998, "text": " mega, but a bit more. Yeah, also look at patterns that they don't point out in the text. So if there"}, {"start": 2144.7599999999998, "end": 2150.44, "text": " is like a pattern, if you see like an interaction between the number of parameters and the score or"}, {"start": 2150.44, "end": 2158.04, "text": " something like this, just try to be on the lookout of that and see if you can spot something that you"}, {"start": 2158.04, "end": 2167.4, "text": " think or think about whether that makes sense or not in what your hypothesis would be. So here we"}, {"start": 2167.4, "end": 2176.04, "text": " go on and okay, then they go into ablations and a lot of a lot of these papers do ablations. And"}, {"start": 2176.04, "end": 2182.2799999999997, "text": " I generally appreciate that. So here they visualize that the attention mechanism in their model"}, {"start": 2182.28, "end": 2188.76, "text": " actually refers to different instances, right encoder self attention for a set of reference"}, {"start": 2188.76, "end": 2194.0400000000004, "text": " points, the encoder is able to separate individual instances. And you can see that pretty clearly"}, {"start": 2194.6000000000004, "end": 2203.1600000000003, "text": " right here, where and even here with the overlapping cows. And this is the sort of experiment that I"}, {"start": 2203.1600000000003, "end": 2208.92, "text": " would expect that actually convinces me that their architecture does what it says that it does,"}, {"start": 2208.92, "end": 2215.88, "text": " right. And something like this, where you see like totally overlapping things with the attention of"}, {"start": 2215.88, "end": 2222.6800000000003, "text": " the individual things visualized. So telling me like, especially this one right here, the the foot"}, {"start": 2222.6800000000003, "end": 2228.12, "text": " of the back elephant actually being focused by the attention of the bounding box of the back elephant."}, {"start": 2228.84, "end": 2235.2400000000002, "text": " That's the sort of experiment that convinces me that their claims like that their numbers really"}, {"start": 2235.24, "end": 2242.6, "text": " come from what they claim it comes from. Okay, so at the end of the experimental section, you should"}, {"start": 2242.6, "end": 2251.56, "text": " always ask yourself, have they really convinced me that their story is true, right, that the"}, {"start": 2251.56, "end": 2259.0, "text": " improvement or when whenever they get an improvement or whatever they get, what is, is due to the"}, {"start": 2259.0, "end": 2266.2, "text": " story that they want to sell me? Or could there be like an easier explanation? Or does something not"}, {"start": 2266.2, "end": 2271.64, "text": " fit is like, are there are the experiments different than from what you would expect here?"}, {"start": 2273.0, "end": 2278.2, "text": " Okay, so these are these are my main questions. Are they are they convincing me of their story?"}, {"start": 2278.2, "end": 2286.04, "text": " It's not? Do they have state of the art numbers? I don't care. I don't care. Even though, like"}, {"start": 2286.04, "end": 2291.8, "text": " sometimes. So there is a bit of a catch, I, I don't care about state of the art numbers."}, {"start": 2293.0, "end": 2298.92, "text": " Now, let's say you have a table like this, and you have a computer vision model. And one of the"}, {"start": 2298.92, "end": 2307.32, "text": " models is like on the C for 10 data set. Now, if your baseline model has like a 91 92% accuracy on"}, {"start": 2307.32, "end": 2314.6, "text": " C for 10, when I know the state of the art is 96, I don't care, right? I know like I've done C for 10"}, {"start": 2314.6, "end": 2322.7599999999998, "text": " I know with like, I don't know, five, six layers, CNN, you can reach these 91 92 93% accuracy. And"}, {"start": 2322.7599999999998, "end": 2330.2, "text": " to get to the 96 97, you'd actually be like in the region of a wide resnet and whatnot. So I,"}, {"start": 2331.24, "end": 2337.64, "text": " I know that even though you're a few points behind state of the art, I know, you know, this,"}, {"start": 2337.64, "end": 2347.3199999999997, "text": " this is valid still, so I don't care. But if you were to be like at 80% accuracy on C for 10, then"}, {"start": 2347.3199999999997, "end": 2355.4, "text": " I then I get a bit like, hmm, I like it's pretty easy to get to 90% plus with like a standard CNN."}, {"start": 2356.3599999999997, "end": 2362.2799999999997, "text": " So there, I immediately start to wonder why is there an explanation? Now, this could be like a"}, {"start": 2362.28, "end": 2369.5600000000004, "text": " theoretical paper that says, Oh, we investigate MLPs. And that's why we only get that number. So"}, {"start": 2369.5600000000004, "end": 2376.0400000000004, "text": " that's, that would be fine. But if something is out of the ordinary, like this, then I pay"}, {"start": 2376.0400000000004, "end": 2381.2400000000002, "text": " attention, but never because something isn't like the latest and greatest state of the art. That's"}, {"start": 2381.2400000000002, "end": 2389.48, "text": " just dumb. Okay. And also, if only evaluate what the paper claims it does, right, if the paper says,"}, {"start": 2389.48, "end": 2396.6, "text": " we want to show that we are on par with current models, then don't be mad if the paper doesn't"}, {"start": 2397.48, "end": 2404.52, "text": " outperform these models, they didn't claim that, right? So yeah. So after these ablations,"}, {"start": 2404.52, "end": 2410.12, "text": " I'm actually pretty happy right here with the results. And this right here, when I saw this,"}, {"start": 2411.72, "end": 2418.28, "text": " I didn't, I didn't expect that. But I read the experiment description that these are these"}, {"start": 2418.28, "end": 2424.36, "text": " different learned object queries and what they do. And that gave me an increased understanding of"}, {"start": 2424.36, "end": 2430.2000000000003, "text": " how these object queries actually work, right? So at that point, I still had like a vague, I knew"}, {"start": 2430.2000000000003, "end": 2435.8, "text": " that these are learned. But reading this and sort of looking at it, studying it a bit, I was like,"}, {"start": 2435.8, "end": 2442.92, "text": " Oh, okay, then I understood even better what they are. So again, when I say understand everything"}, {"start": 2442.92, "end": 2449.56, "text": " in the method section, you can still have questions. And but you just have to keep it in"}, {"start": 2449.56, "end": 2457.48, "text": " mind for later. And then here I go on. And there's this detr for panoptic segmentation. And"}, {"start": 2458.36, "end": 2464.04, "text": " they here they propose like a new model. So I first look at it and I'm like, okay, they propose"}, {"start": 2464.04, "end": 2469.8, "text": " a new model, they can do stuff like this. Now this is not object detection. And again, I'm not sure"}, {"start": 2469.8, "end": 2477.1600000000003, "text": " is this like a is this like a an add on to the method? Or is was was this up here just an"}, {"start": 2477.1600000000003, "end": 2484.6000000000004, "text": " intermediate step to this? And honestly, after reading that I still wasn't sure. It seems like"}, {"start": 2484.6000000000004, "end": 2489.8, "text": " something in between. Of course, the paper is also a bit longer than other papers. It just,"}, {"start": 2490.6000000000004, "end": 2497.5600000000004, "text": " it seems it's too long for just being a side note. But it's too short for being its own thing. So"}, {"start": 2497.56, "end": 2503.96, "text": " that was just a bit weird. And I treated it as just like a oh, we can also do this with our model."}, {"start": 2504.7599999999998, "end": 2513.24, "text": " But I didn't pay like too much attention to that. Okay. So at the end, I you know, look at"}, {"start": 2513.24, "end": 2522.6, "text": " conclusions. Now the conclusions of a paper are much, much often, they are not nearly as informative"}, {"start": 2522.6, "end": 2529.0, "text": " as the introduction. The conclusions, they all often tend to be very generic and kind of hedging"}, {"start": 2529.0, "end": 2535.7999999999997, "text": " a bit against criticisms, saying what would be up for future work, which is again, hedging against"}, {"start": 2535.7999999999997, "end": 2544.6, "text": " criticism. Because you simply say, Well, we didn't do this. That's future work. Yeah. So again, I"}, {"start": 2544.6, "end": 2550.8399999999997, "text": " read it, but I don't really pay attention to it. And then I gloss over the abstract, I just would"}, {"start": 2550.84, "end": 2556.84, "text": " kind of scroll through the abstract, if there's something that catches my eye, I would look at it."}, {"start": 2556.84, "end": 2565.0, "text": " And if not, then not. And then I basically go to the start. And whenever I didn't understand"}, {"start": 2565.0, "end": 2571.32, "text": " something, I go back, I look at it again. And I try to think are all my questions answered? And"}, {"start": 2571.32, "end": 2577.88, "text": " have they sufficiently convinced me that their story is the thing that really has the effect"}, {"start": 2577.88, "end": 2585.6400000000003, "text": " right here. And then, if I now were to make a video of this, I've often found it useful to"}, {"start": 2586.44, "end": 2591.7200000000003, "text": " just put the paper away for a while. And it's, I usually get the best results when I read the"}, {"start": 2591.7200000000003, "end": 2598.04, "text": " paper the day before and then make a video the day after. Or if not, I'll just, you know, put it away,"}, {"start": 2598.04, "end": 2604.6, "text": " do something else, do some email responding programming, going outside, eating lunch, just"}, {"start": 2604.6, "end": 2614.2, "text": " some kind of a break between first read or between first couple of reads. And just, I don't even"}, {"start": 2614.2, "end": 2621.88, "text": " think about the paper, I just kind of, it's just in the subconscious, it kind of brews, right. And"}, {"start": 2621.88, "end": 2625.48, "text": " I happen to think about the paper every now and then, but I don't make a conscious effort to be"}, {"start": 2625.48, "end": 2631.56, "text": " like, Oh, how am I going to explain this and so on. But I just found the worst videos are the ones"}, {"start": 2631.56, "end": 2638.7599999999998, "text": " where I immediately make the video after reading a paper. And I've just discovered that if I kind"}, {"start": 2638.7599999999998, "end": 2644.2799999999997, "text": " of take a break, and then I look at it again, right, I look, I don't read it fully again, but I,"}, {"start": 2644.84, "end": 2648.84, "text": " if I have, if I have the feeling I've understood it, I don't read it fully again. But I just kind"}, {"start": 2648.84, "end": 2654.84, "text": " of look at it and go again through the story. And I think that's even if you, you know, want to,"}, {"start": 2655.32, "end": 2659.88, "text": " if you want to talk about a paper in a reading group or tell, you know, explain it to your"}, {"start": 2659.88, "end": 2666.28, "text": " friends or whatnot. This is often very useful, just put it away for a while, let it mellow."}, {"start": 2668.28, "end": 2674.84, "text": " And I find that helps a lot. Okay, that was my process of reading this particular paper."}, {"start": 2675.6400000000003, "end": 2682.36, "text": " Now we, again, this, this is a high quality paper. So it's, I find it's a pretty easy read,"}, {"start": 2682.36, "end": 2688.12, "text": " in that I simply need to understand what they did. And I'm pretty happy with their experiments. I,"}, {"start": 2688.12, "end": 2695.24, "text": " maybe next time I can find an experiment or a paper where I'm initially more skeptical and not"}, {"start": 2695.24, "end": 2702.92, "text": " as happy with what I find. But yeah, let me know if you enjoyed this or if you would like to see"}, {"start": 2702.92, "end": 2708.52, "text": " any other explanation. I don't exactly know if this is what you expected from a video like this."}, {"start": 2709.4, "end": 2716.92, "text": " So let me know. Maybe I've misunderstood you completely, or it's way too long, way too detailed,"}, {"start": 2716.92, "end": 2722.04, "text": " or way too undetailed. Yeah, leave me a comment and I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=qSArFEIoSbo
RepNet: Counting Out Time - Class Agnostic Video Repetition Counting in the Wild (Paper Explained)
Counting repeated actions in a video is one of the easiest tasks for humans, yet remains incredibly hard for machines. RepNet achieves state-of-the-art by creating an information bottleneck in the form of a temporal self-similarity matrix, relating video frames to each other in a way that forces the model to surface the information relevant for counting. Along with that, the authors produce a new dataset for evaluating counting models. OUTLINE: 0:00 - Intro & Overview 2:30 - Problem Statement 5:15 - Output & Loss 6:25 - Per-Frame Embeddings 11:20 - Temporal Self-Similarity Matrix 19:00 - Periodicity Predictor 25:50 - Architecture Recap 27:00 - Synthetic Dataset 30:15 - Countix Dataset 31:10 - Experiments 33:35 - Applications 35:30 - Conclusion & Comments Paper Website: https://sites.google.com/view/repnet Colab: https://colab.research.google.com/github/google-research/google-research/blob/master/repnet/repnet_colab.ipynb Abstract: We present an approach for estimating the period with which an action is repeated in a video. The crux of the approach lies in constraining the period prediction module to use temporal self-similarity as an intermediate representation bottleneck that allows generalization to unseen repetitions in videos in the wild. We train this model, called RepNet, with a synthetic dataset that is generated from a large unlabeled video collection by sampling short clips of varying lengths and repeating them with different periods and counts. This combination of synthetic data and a powerful yet constrained model, allows us to predict periods in a class-agnostic fashion. Our model substantially exceeds the state of the art performance on existing periodicity (PERTUBE) and repetition counting (QUVA) benchmarks. We also collect a new challenging dataset called Countix (~90 times larger than existing datasets) which captures the challenges of repetition counting in real-world videos. Authors: Debidatta Dwibedi, Yusuf Aytar, Jonathan Tompson, Pierre Sermanet, Andrew Zisserman Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, check out these videos on the top. Each one kind of contains a repeating action. So on the left you see someone doing a jumping jacks in a fairly regular pattern. In the middle it gets a bit more difficult because what you see is a tennis ball bouncing and it bounces faster and faster and faster as time goes on. On the right you see that there is a short intro sequence before the repeating action the person shoveling the cement is displayed. So the goal here is to build an AI that can detect that a repeating action is happening. And if it detects so that it can count how often this repeating action is happening. You can already see the difficulties here is not only the recognition itself, but the fact that the repeating actions can be different and can be of different length and cannot always look the same and so on. So this paper uses these self these temporal self similarity matrices that you see at the bottom here to achieve this and we're going to explore how that's happening. So the paper we'll look at is called counting out time class agnostic video repetition counting in the wild by Debida Debida Dwebidi, Yusuf Aytar, Jonathan Thompson, Pierre Sermonet and Andrew Zizerman of Google Research and DeepMind. So as I already said, this paper detects repeating actions and is able to count them and on a high level what they do is they encode the video using convolutional networks. Then they build these temporal self similarity matrices between the frames in order to detect the repetitions and they decode that into the predictions using another neural network. This is all trained end to end and they also make a new data set for this task. So that's the high level if you want to find out how exactly that's done, I invite you to stick around because we'll go into the paper. If you like content like this, don't forget to share it out to leave a like and tell me what you think of the paper in the comments. I do read the comments. So yeah, I'm very happy to read what you all think about it. Okay, so as we already said, they say we present an approach for estimating the period with which an action is repeated in a video. And that's actually understating what the problem is here. The problem is many, many fold. As you can see on the right here, even if you don't get what this self similarity matrix is yet, the outputs that you want are at the bottom. So what you want is first of all, a per frame periodicity prediction. So that means that for each frame, you want to know is there even a repeating action happening or not in that particular frame, you can see here at the beginning at the end of the video, there's no repeating action. And then in the middle, there is a repeating action. So that's the first thing you want to know. The second thing is this per frame period length prediction. So for each frame, that is part of a repeating action, you want to know what is the period length of that repeating action. And that can change throughout the video. So you need it per frame. And once you have it per frame, you can actually count the number of repetitions. So those are two problems already. The third problem that this paper solves is that there is no adequate data set to train a model like this, it seems, for example, this model right here, this q u v a data set, I believe has 100 data points. And these are mostly these are meant for testing. So you would build your system somewhere, and then you would test it on those 100 data points. But they claim not even those are no large and diverse enough for the systems to be evaluated. So they build, we also collect a new challenging data set called countix, which is 90 times larger than existing data sets, which captures the challenges of repetition counting in real world videos. And that actually consists of a train and test split. So you can also train a system using it. Let's dive into the architecture. I think this paper is a very, very, very cool example of even though we're in this deep learning paradigm, where you just throw neural networks at a problem. And it's a very cool example that you can still achieve a lot by smartly constructing this, because we used to achieve a lot by smartly constructing features and so on. In this case, the the goal is achieved by smartly constructing the architecture of the neural network itself to give you back a good performance on the particular task right here. Okay, so if that tablet lets me actually scroll around, let's go to the architecture. So figure two shows the architecture in more detail. So we'll go through it from the beginning to the end. Actually, let's go, let's go to the end. So you know what is supposed to happen. So for each frame in this video, what we'll need is a period length and a periodicity. These are two. So the bottom is a binary variable. And the top is a, it's actually a number, but it is predicted in kind of binned as a classification task doesn't really matter, we need two outputs that we can compare with the labels, right? In this case, the videos are of length 64. So there's 64 frames per video. And for each of those frames, we want a period length. And for each of those frames, we want a periodicity binary prediction. And that, as I said, we compare it with our labels, and then we can calculate a loss. So this is the loss, the losses at the end, comparing these labels, and then everything else is trained using back propagation on that loss. Okay. So now with that in mind, let's go to the beginning. So the video is taken and fed through an encoder in order to produce these per frame embeddings. So we want an embedding for each frame, that means for each of the 64 frames, we want to obtain one vector of length 512. That describes that particular frame in terms that the model can understand. And we do that using an encoder. Now the encoder, it has a bunch of parts to it, it's not just a blob, as you see right here. So the encoder consists of three things. First of all, there's this convolutional feature extractor, which is a resonant 50 architecture is simply a convolution. And you let the convolutional neural network run on each frame independently. This is simply a feature extractor from images, right? Like, you know it from any other image processing task. But of course, here we have a video. So it would be nice if the it would be nice if the frames knew something about the other frames, right? Especially if you think of something like a jumping jack. If you are in this position right here, it, it doesn't tell you everything about that video frame, if you consider the frame before it, and maybe the frame before it is this, and maybe the frame after it is that you can clearly see that the hands or the arms are in an upward motion. So the next step of the encoder tries to integrate that temporal information into the embeddings. And that is achieved via a 3d convolution. So once once we process each frame individually, then we feed it into one layer through a layer of 3d convolution to add local temporal information to the per frame features. So if you don't know what a 3d convolution is, oh, this already drew. So in a 2d convolution, what you want to do is you want to have this filter right here, which is a 2d filter for each of the channels. And you slide it across the image like this, okay. And you can have multiple channels of the input image right here. And you can actually do this multiple times, which corresponds to multiple output channels of the filters. But the actual convolution is happening in two dimensions. So the sliding is across the width and the height of the image. In contrast to that, if you have a 3d convolution, and you have the same input stack of images, and now this, we have to you have to pay attention here, this right, this stack right here is the individual channels of one image. So of one video frame, this stack right here that I'm drawing, these are the video frames stacked. Now each of these stacked video frames can have multiple channels resulting from its 2d convolution, or even just RGB. So I can't really draw in four dimensions. But now we stack the video frames. And now our kernel, our filter will be also in the direction of the video frame. So I don't know if this is really recognizable if I draw it like this. But as you can see, the kernel is not only 2d, but 3d. And now the sliding, so if we have actually more than that, the sliding is not only done into the direction of height and width, but also into the direction of depth, so that each of the frames each of the video frames right here can incorporate information from its immediate neighbors in case of a three by three by three filter or even more neighbors. But here we use a three by three by three filter. Okay, so that's, that's how we obtain these embeddings right here. And at the end, there is a dimension reduction, like a max pooling or something. But ultimately, what you'll end up with is for each of the 64 video frames, you get one vector. And that vector mainly describes that particular video frame, like if you consider the green one here, but also contains information from the video frame before it and from the video frame after it. Okay, so that's sort of and that's, that's the so the temporal convolution is not to detect the periodic actions, because it's just one frame into the future and into the past, it is more like what we said here, in order to give you extra information of what's happening in a particular frame. Because especially for periodicity, it's actually important if the arms are going up or down. Cool. So then comes the heart of the architecture, the heart of the architecture is this temporal self similarity matrix. Now, what does this do? This is relating the frames to each other. And important to note here, this is just a single channel image. So there is no other ones of these for the entire video frame sequence, you have one 64 by 64 matrix, and all the signal has to go through this matrix, right? Everything from here is only through this matrix, there's no residual connections, there's no skip connections. That's all that's your information bottleneck. And by having a bottleneck like this, these, the authors here force the model to basically do a good job at making this temporal self similarity happen if it wants to achieve a low loss. That's what I mean by you can achieve a lot by having a smart architecture. This temporal self similarity matrix is actually not learned, this can be computed deterministically from the embeddings right here. So what you do is you each row here corresponds to one frame. So you take each frame that corresponds to a row, and you calculate simply the the distance to or the similarity with each of the other frames. So this is as you can see, it's 64 by 64. So frame i here is simply compared to each of the other frames j. And it depending on whether that embedding is very similar to the embedding of frame j, this number is going to be high or low. Now there's also a after that you do a softmax across here such that this is going to be like a distribution and not just raw numbers. But that's ultimately not that important. So what you can see is that the diagonal is very prominent. And that makes sense because technically, the diagonal is always one, right? If for example, if you use the inner product as a similarity, the diagonal should always be one. But here we have the softmax, so it's not but ultimately, we can say that any frame should be very similar to its is going to be very similar to itself. So that's why. But then you can see right here, there's a pattern emerging. And that pattern is these diagonal lines in this direction, as you can see. And what what does that mean? They actually have a larger version of this down here. So what does the diagonal pattern mean? It means that so here the diagonal, that's okay, frame i is very similar to frame i. Cool. But the other lines, what do they mean? So if I look at frame i right here, it is also very similar to this frame j. Now this wouldn't be further, you know, frames are similar. But the line means that if I have if I look 10 frames later, I plus 10, that's very similar to j plus 10. And if I now look at i plus 20 frame, that's very similar to j plus 20. So this is the this is here why the the pattern is emerging of a line, because if I go 10 frames into the future, it's similar to the other one 10 frames into the future and so on. And that means the line indicates that this entire sequence starting from i 20 frames into the future is repeated starting from j, actually j is earlier here. So but you get the point. And if I have a bunch of these lines, that means that this sub sequence is repeated again and again and again throughout the video. So each of these lines is basically one repetition of the sequence from the middle here at some other point in the video. And that's pretty fascinating. And that's these these self similarity matrices. That's what they're sort of showing. Now they don't use the inner product here as a self similarity metric, they actually use as you can see right here, they use the negative squared distance, but the effect is the same. So negative squared distance followed by a row wise softmax operation. So you could say, Hi, we're basically done having the self similarity matrix, what we could do, let's let's say we could train it, we don't worry about how to train it, we could simply take each row right here. And we plot the intensities across that row. And that's maybe you know, like something like this, and then there's the diagonals a bit higher. Okay, we could just use a heuristic to detect these bumps here, basically calculate the length, count the bumps and calculate the period length, right that that should be pretty easy with like a simple heuristic. But the authors here, they want more, they want to solve more problems. So what are some of the problems, we already saw some of the problems namely, for example, there is the hammer throw. So the hammer throw starts out slow and gets faster and faster and faster. And you can see this pretty clearly at the lines right here. Namely, if you go through time, so you start off here, and you go through time, you can see that the distance to the next line here is fairly large, but you go through time further, the distance gets shorter, you go through time further, the distance gets even shorter. So these pattern of lines here, that's kind of converging towards that, it indicates that this repeating action gets faster and faster and faster. This is nice to see her at the bouncy ball example, where you can see it starts out pretty slow, but it gets faster and faster. And here, you if you if you have this full thing right here, that basically means all the frames are self similar to each other, which basically means if you stop the video, right, that's if you have 10 frames in a row, the same thing, the ball is just lying on the ground, all of these frames will be self similar. So there's probably no bouncing happening down here, you can see pretty well from the pattern, what happens. And here in this mixing concrete example that we saw at the beginning, you can see that at the beginning at the end, there's this intro and outro sequence. And only in the middle is there a repeating action. And that's indicated by this line pattern is only at the in the middle of the videos only between here and here. So it's, it's gonna be pretty difficult to just have a heuristic that reads out these periodic action periodicity. And in a true deep learning fashion, the the authors here, oh, sorry, maybe you can't see that I've shifted my recording window. So maybe sometimes something's out of frame and you have to yell at me if I do that, please. So I hope you saw this that you have the ever the speeding up here and here, they're visible in the pattern. And then here, you have the beginning sequence, the end sequence that have no repeating pattern, and the repeating pattern only moves in the middle. So the authors want to do this through, of course, a deep learning network, they want to read out the periodicities, not through a heuristic, but using a deep network, you know, respectable, that's at the times we live in. So what do they do? First of all, you have to see right here, everything that happens from here, as I understand it, is per frame. So they simply take a row of this matrix right here, like this red line, and that is independently pulled through to the end. So there is no interaction happening anymore between the individual frame data, the only interaction that happens is a little bit here at the temporal convolutions. But the only real interaction between the frames is happening through the self similarity matrix. And again, this is the information bottleneck that the authors force the information through everything happening from here. Now, that's actually not right, there is this convolution right here. But still, this is the information bottleneck you have to go through. So right here, we process this image using a convolution. So this is an image, right? And we can process it using a convolutional neural network. So what we do is we have a 64 by 64 image in one channel, we simply up sample that not up sample, but we expand the channels to 32 channels. Now, as I said, it's pretty easy to think we can just go to the end here, use a convnet to produce our final 512 by so 512 embeddings we have here, again, 64 by 64, that we then use to predict the final result. But the authors here do something different, they do transformer layers in the middle, but only per frame. So what does it mean? So here, you up sample to 32 channels. And then that means that one of these blocks right here, one of these blocks corresponds to one row in the self similarity matrix, which corresponds to one frame. And from now on, so from now on, I want to say what I said before, from now on, it's all just this one block, they are independent of each other. Okay, so you take this one block, and you feed it through a transformer to achieve at your final embedding of 512. And it's probably best if we read what they say about it. Okay, so if we're given this self similarity matrices, matrix, they consist of row, each row is the per frame self similarity representation, and generates two outputs, the per frame, period length estimation and the per frame binary periodicity classification. Note that both L and P are vectors and their elements are per frame predictions. Okay. The architecture of the period predictor module can be viewed in figure two, note that the predictors share a common architecture and waits until the last classification phase. The shared processing pipeline starts with 32 2d convolutional filters of size three by three, followed by a transformer layer, which uses a multi headed attention with trainable positional embeddings in the form of a 64 length variable that is learned by training. Okay, it's, I guess the transformers learned by training, and the positional embeddings are also learned by training. That's fairly common. We use four heads with 512 dimension in the transformer. By the way, if you don't know what a transformer is, watch the video on attention is all you need. I made one it's very popular. Yeah. So with each head being 128 dimensions in size. After the shared pipeline, we have two classifiers, period length classifier and periodicity classifier, tau. Sorry, this is fine. This is tau. Each of them consists of two fully connected layers of size 512. So I guess the the pipeline here is pretty simple. The question could be why do they use a transformer and not simply another convolutional network. So here they up sample the image as we saw into 32 channels, and then they simply want to take one of these one of these blocks here. And that corresponds a little bit. So we have for one frame, right? What does it mean we have basically, we have 64 by 32 things. So the 64 things, it's this one frames temporal connection to each other frame given that you know, comes from this self similarity matrix. So it kind of relates this frame that we're considering to each of the other frames. And each of this, each of these entries is a 32 size vector. This is sort of a this is you can consider it like a sequence of 64 things 64 embeddings. So to use a transformer here is pretty natural. If you think of this as like a sequence transformation task, I would guess. So the transformer can if there are these peaks right here, like we saw right here, the transformer can make very good sense of that because of course, the attention mechanism from a one peak, it can attend to all the other peaks and can sort of relate the different peaks to each other and then determine the periodicity length whereas with a convolutional network, I guess that's going to be a lot harder because of the sort of invariance built into the convolution. I'm not sure maybe they also it just worked better. But that's how I think about it. It's that for a given frame, you basically have a sequence classification or a set classification task. And the attention mechanism allows you to in one single step connect each peak with each other peak or each information with each other information in this sequence. Alright, so at the end, you have just fully connected layers again, only on a per frame basis. And that will give you the output. And again, you compare this to the label and you back prop through everything, everything here is differentiable. So all of this is trained to achieve minimum possible loss. And because you train everything to achieve minimal possible loss, you make this encoder right here, which is the crucial part because the encoder is must give you good embeddings, which must give you a sensible self similarity matrix, right? You train the encoder to encode things that are relevant for the task. And that's what makes the whole thing work. Okay. So we've gone through the architecture. Now, the problem right here is the the data set. So they also go into how they do inference, they can actually do a bunch of things like play the video at different speeds and then look at what each of the predictions. So if a double speed, it predicts half the period length, then you can be more sure and so on. So that's pretty cool. But they go into another point right here, and that's the data set. So they produce this countix data set. But also, on the other hand, which is something I also find very cool is they produce a synthetic data set. So here they say, we train with synthetic repetitions. And that can be sort of, I didn't know what to think of it at first, I was just like, huh, but then it's pretty cool. So if you have a video with these, these are the frames of the video, right, so the video goes in this temporal direction, what you can do is simply go here, go through these frames, and just repeat these frames and repeat them and repeat them. And at the end, you have these frames, right. And then you have a data set. And if you if you assume that most videos do not naturally contain repeating actions, right, most videos are just videos, they're not videos of something repeating, then you can safely assume that these parts here are non repeating. So and these parts here are repeating, this is one of the labels that you need, right? The problem with synthetic data set is always to have the labels. And also, you know how many there are, because you can simply count the number of times that you go through it, you can even make it faster, slower, and so on. So this synthetic approach is pretty cool. And especially the bottom right here, because this might be kind of hacky. Because each time, each time you jump from the end of one of those arrows to the beginning, right, you have kind of a hack in the in the video, because, you know, it's not continuous. So what you can do, and this is the the bottom here, you can do this reversal technique where you go to the end, and then you play the frames backwards, and then you play the frames forwards again, backwards again, forwards again, and then you go out here. And that gives you one continuous motion, right? If someone if it's simply a video of someone lifting their hand, like it starts out down here, and it goes here, and it goes here. And then if you do this technique, it would go down again, down again, up again, up again, and so on. So that's, you know, I think it's a fairly smart technique, honestly. Now they tried this, and it doesn't work super well. So what they also have to do is they have to do manual camera motion augmentation. So that's camera motion augmentation, it basically means that if you just do a repeating action, like this, it's sort of, I guess, it's too monotonic, it doesn't really cover real videos with repeating actions. So what they do is they kind of simulate a moving camera. And you simulate that much like you would do image augmentation. So you can rotate the camera over time, you can translate it, you can scale it differently. And through if you do that throughout the video, and you change it around how the camera moves, then that appears to work fairly well. So if they now compare this and their data set, they perform pretty well. So in their data set, they take this kinetics data set, and they crowdsource the label and the tasks in the data set, they're pretty diverse, as you can see right here. So you have sports like rope training, mountain climbers, but you have also things like playing ukulele, exercising arms, slicing an onion, and so on. And you can see that the repetition count is fairly diverse as well. So from one or two repetitions per video, it goes to 50 or so. And the period length is also between one and five seconds, though, as you as I already said, you don't have to, you don't have to count on that, because you can always play the video slower or faster and then determine other periodicities. So in their experiment, first of all, they perform pretty well. And they show that if they train on their data set, and on the synthetic data set, they perform better than if they just train on the synthetic, or they just train on their data set. They also show pretty clearly that the addition of this temporal self similarity matrix helps tremendously, you can see right here in each of these boxes is the comparison. And this OBO, I think is the off by one error. So it kind of forgives you if you're off by one count, but otherwise, you get a zero if you're wrong. And you can see that the self similarity matrix helps tremendously. They also compare with some other architectural choices instead of the transformer, I guess, yeah, so I guess they just take it because it performs pretty well. And they do a lot of lot of ablations. But what I particularly appreciate is that they do something like this. So what they do at the end, when once they've trained the architectures, they do a 1d PCA projection of the encoder features over time. Now, the encoder features, they were 512 dimensional, right? This is the thing before it goes into the self similarity matrix. So those we said the encoder is the crucial part here, because it needs to take the video and encode things that make them accessible to calculating the self similarity. Now they do a 1d PCA. So a projection into one dimension of these features. And you can already see at this one dimensional projection that the periodicity here is clearly clearly visible, namely, for example, right here. Every time up here is when the legs are up. And every time down here is when the legs are down right here. So that is very, very impressive. And that kind of that really shows that the model is doing what you claim what you claim that it's doing. Like, I'm almost more interested in experiments like this than in and in these numbers right here, because the numbers could always be because you've just thrown more stuff at it, right? So they go over a bunch of possible applications of their model. So first of all, you can do something like, as we can see, repetition counting from videos, you can do periodicity detection, those were the things that the model is trained to do. But there's also a bunch of things that the model can now implicitly do, namely, something like change inspection, where they say, look, if someone's chopping this pineapple right here, then at the end of each of the repetitions, there is something that changed, namely the number of slices of pineapple, is it red? Is it? I can't. I think it's pineapple. Okay, so the number of slices or pieces right here changes. So in essence, this could be the base for another model estimating whatever changed or training to recognize numbers of pieces and so on. Also, you can detect the speed. So the speed of a repeating action, if you perform something slow or fast, this model can implicitly do it. And this they call cross period retrieval. So if you know when the repetitions are, you know that, okay, maybe the first frame, so always on the upswing right here, these should all be fairly similar visually, right? As with respect to the repeating action. So you can see that even though this, whenever the kid in the swing here is close, it looks fairly different in a purely visual sense in a pixel sense, but it is at the same point in the repeating action. And that's, you know, that's that's pretty cool. So you can technically retrieve related things, even though they visually they don't look similar that much. Yeah, that that's the, the kind of applications here are probably many, many fold. And I also think that so in this measure of intelligence paper by Francois Chollet, he basically claims that this is one of the innate abilities of humans. They can count, you know, they can count things, this is something you're basically born with. And maybe this thing right here will become sort of a staple staple component for many other things that we build AI on, I would not be surprised, but maybe it will just fade into history. I think it's pretty cool project, especially, you know, the the architectural choice here to pull everything through this self similarity matrix. And the, you know, just just looking at this matrix already makes you kind of know that this thing works. All right, this was it from me. Let me know in the comments what you think about the paper, check out the website, the website has a lot of video demo examples of what the they're doing, I think the data set as well. And yeah, I'll see you next time. Bye bye.
[{"start": 0.0, "end": 7.76, "text": " Hi there, check out these videos on the top. Each one kind of contains a repeating action."}, {"start": 7.76, "end": 13.0, "text": " So on the left you see someone doing a jumping jacks in a fairly regular pattern. In the"}, {"start": 13.0, "end": 18.72, "text": " middle it gets a bit more difficult because what you see is a tennis ball bouncing and"}, {"start": 18.72, "end": 24.64, "text": " it bounces faster and faster and faster as time goes on. On the right you see that there"}, {"start": 24.64, "end": 31.36, "text": " is a short intro sequence before the repeating action the person shoveling the cement is"}, {"start": 31.36, "end": 38.8, "text": " displayed. So the goal here is to build an AI that can detect that a repeating action"}, {"start": 38.8, "end": 44.88, "text": " is happening. And if it detects so that it can count how often this repeating action"}, {"start": 44.88, "end": 51.44, "text": " is happening. You can already see the difficulties here is not only the recognition itself, but"}, {"start": 51.44, "end": 56.28, "text": " the fact that the repeating actions can be different and can be of different length and"}, {"start": 56.28, "end": 61.44, "text": " cannot always look the same and so on. So this paper uses these self these temporal"}, {"start": 61.44, "end": 66.72, "text": " self similarity matrices that you see at the bottom here to achieve this and we're going"}, {"start": 66.72, "end": 73.68, "text": " to explore how that's happening. So the paper we'll look at is called counting out time"}, {"start": 73.68, "end": 82.48, "text": " class agnostic video repetition counting in the wild by Debida Debida Dwebidi, Yusuf Aytar,"}, {"start": 82.48, "end": 90.28, "text": " Jonathan Thompson, Pierre Sermonet and Andrew Zizerman of Google Research and DeepMind."}, {"start": 90.28, "end": 96.12, "text": " So as I already said, this paper detects repeating actions and is able to count them and on a"}, {"start": 96.12, "end": 102.80000000000001, "text": " high level what they do is they encode the video using convolutional networks. Then they"}, {"start": 102.8, "end": 108.39999999999999, "text": " build these temporal self similarity matrices between the frames in order to detect the"}, {"start": 108.39999999999999, "end": 115.8, "text": " repetitions and they decode that into the predictions using another neural network."}, {"start": 115.8, "end": 122.52, "text": " This is all trained end to end and they also make a new data set for this task. So that's"}, {"start": 122.52, "end": 126.47999999999999, "text": " the high level if you want to find out how exactly that's done, I invite you to stick"}, {"start": 126.48, "end": 132.84, "text": " around because we'll go into the paper. If you like content like this, don't forget to"}, {"start": 132.84, "end": 138.0, "text": " share it out to leave a like and tell me what you think of the paper in the comments. I"}, {"start": 138.0, "end": 146.06, "text": " do read the comments. So yeah, I'm very happy to read what you all think about it. Okay,"}, {"start": 146.06, "end": 152.64000000000001, "text": " so as we already said, they say we present an approach for estimating the period with"}, {"start": 152.64, "end": 157.39999999999998, "text": " which an action is repeated in a video. And that's actually understating what the problem"}, {"start": 157.39999999999998, "end": 163.73999999999998, "text": " is here. The problem is many, many fold. As you can see on the right here, even if you"}, {"start": 163.73999999999998, "end": 170.11999999999998, "text": " don't get what this self similarity matrix is yet, the outputs that you want are at the"}, {"start": 170.11999999999998, "end": 178.77999999999997, "text": " bottom. So what you want is first of all, a per frame periodicity prediction. So that"}, {"start": 178.78, "end": 184.2, "text": " means that for each frame, you want to know is there even a repeating action happening"}, {"start": 184.2, "end": 188.84, "text": " or not in that particular frame, you can see here at the beginning at the end of the video,"}, {"start": 188.84, "end": 193.48, "text": " there's no repeating action. And then in the middle, there is a repeating action. So that's"}, {"start": 193.48, "end": 199.6, "text": " the first thing you want to know. The second thing is this per frame period length prediction."}, {"start": 199.6, "end": 205.52, "text": " So for each frame, that is part of a repeating action, you want to know what is the period"}, {"start": 205.52, "end": 210.32000000000002, "text": " length of that repeating action. And that can change throughout the video. So you need"}, {"start": 210.32000000000002, "end": 218.22, "text": " it per frame. And once you have it per frame, you can actually count the number of repetitions."}, {"start": 218.22, "end": 223.8, "text": " So those are two problems already. The third problem that this paper solves is that there"}, {"start": 223.8, "end": 229.64000000000001, "text": " is no adequate data set to train a model like this, it seems, for example, this model right"}, {"start": 229.64, "end": 238.04, "text": " here, this q u v a data set, I believe has 100 data points. And these are mostly these"}, {"start": 238.04, "end": 241.85999999999999, "text": " are meant for testing. So you would build your system somewhere, and then you would"}, {"start": 241.85999999999999, "end": 247.82, "text": " test it on those 100 data points. But they claim not even those are no large and diverse"}, {"start": 247.82, "end": 254.32, "text": " enough for the systems to be evaluated. So they build, we also collect a new challenging"}, {"start": 254.32, "end": 260.4, "text": " data set called countix, which is 90 times larger than existing data sets, which captures"}, {"start": 260.4, "end": 265.44, "text": " the challenges of repetition counting in real world videos. And that actually consists of"}, {"start": 265.44, "end": 273.68, "text": " a train and test split. So you can also train a system using it. Let's dive into the architecture."}, {"start": 273.68, "end": 280.74, "text": " I think this paper is a very, very, very cool example of even though we're in this deep"}, {"start": 280.74, "end": 285.88, "text": " learning paradigm, where you just throw neural networks at a problem. And it's a very cool"}, {"start": 285.88, "end": 293.84000000000003, "text": " example that you can still achieve a lot by smartly constructing this, because we used"}, {"start": 293.84000000000003, "end": 300.04, "text": " to achieve a lot by smartly constructing features and so on. In this case, the the goal is achieved"}, {"start": 300.04, "end": 305.32, "text": " by smartly constructing the architecture of the neural network itself to give you back"}, {"start": 305.32, "end": 312.8, "text": " a good performance on the particular task right here. Okay, so if that tablet lets me"}, {"start": 312.8, "end": 318.4, "text": " actually scroll around, let's go to the architecture. So figure two shows the architecture in more"}, {"start": 318.4, "end": 324.28, "text": " detail. So we'll go through it from the beginning to the end. Actually, let's go, let's go to"}, {"start": 324.28, "end": 330.24, "text": " the end. So you know what is supposed to happen. So for each frame in this video, what we'll"}, {"start": 330.24, "end": 336.40000000000003, "text": " need is a period length and a periodicity. These are two. So the bottom is a binary variable."}, {"start": 336.40000000000003, "end": 343.32, "text": " And the top is a, it's actually a number, but it is predicted in kind of binned as a"}, {"start": 343.32, "end": 348.64, "text": " classification task doesn't really matter, we need two outputs that we can compare with"}, {"start": 348.64, "end": 354.72, "text": " the labels, right? In this case, the videos are of length 64. So there's 64 frames per"}, {"start": 354.72, "end": 360.22, "text": " video. And for each of those frames, we want a period length. And for each of those frames,"}, {"start": 360.22, "end": 368.24, "text": " we want a periodicity binary prediction. And that, as I said, we compare it with our labels,"}, {"start": 368.24, "end": 373.48, "text": " and then we can calculate a loss. So this is the loss, the losses at the end, comparing"}, {"start": 373.48, "end": 380.0, "text": " these labels, and then everything else is trained using back propagation on that loss."}, {"start": 380.0, "end": 386.4, "text": " Okay. So now with that in mind, let's go to the beginning. So the video is taken and fed"}, {"start": 386.4, "end": 393.48, "text": " through an encoder in order to produce these per frame embeddings. So we want an embedding"}, {"start": 393.48, "end": 399.06, "text": " for each frame, that means for each of the 64 frames, we want to obtain one vector of"}, {"start": 399.06, "end": 406.4, "text": " length 512. That describes that particular frame in terms that the model can understand."}, {"start": 406.4, "end": 412.76, "text": " And we do that using an encoder. Now the encoder, it has a bunch of parts to it, it's not just"}, {"start": 412.76, "end": 420.08, "text": " a blob, as you see right here. So the encoder consists of three things. First of all, there's"}, {"start": 420.08, "end": 425.79999999999995, "text": " this convolutional feature extractor, which is a resonant 50 architecture is simply a"}, {"start": 425.79999999999995, "end": 432.0, "text": " convolution. And you let the convolutional neural network run on each frame independently."}, {"start": 432.0, "end": 438.88, "text": " This is simply a feature extractor from images, right? Like, you know it from any other image"}, {"start": 438.88, "end": 447.54, "text": " processing task. But of course, here we have a video. So it would be nice if the it would"}, {"start": 447.54, "end": 454.76, "text": " be nice if the frames knew something about the other frames, right? Especially if you"}, {"start": 454.76, "end": 463.48, "text": " think of something like a jumping jack. If you are in this position right here, it, it"}, {"start": 463.48, "end": 468.82, "text": " doesn't tell you everything about that video frame, if you consider the frame before it,"}, {"start": 468.82, "end": 476.18, "text": " and maybe the frame before it is this, and maybe the frame after it is that you can clearly"}, {"start": 476.18, "end": 484.58, "text": " see that the hands or the arms are in an upward motion. So the next step of the encoder tries"}, {"start": 484.58, "end": 490.47999999999996, "text": " to integrate that temporal information into the embeddings. And that is achieved via a"}, {"start": 490.47999999999996, "end": 500.14, "text": " 3d convolution. So once once we process each frame individually, then we feed it into one"}, {"start": 500.14, "end": 506.32, "text": " layer through a layer of 3d convolution to add local temporal information to the per"}, {"start": 506.32, "end": 512.5799999999999, "text": " frame features. So if you don't know what a 3d convolution is, oh, this already drew."}, {"start": 512.58, "end": 518.62, "text": " So in a 2d convolution, what you want to do is you want to have this filter right here,"}, {"start": 518.62, "end": 525.62, "text": " which is a 2d filter for each of the channels. And you slide it across the image like this,"}, {"start": 525.62, "end": 530.98, "text": " okay. And you can have multiple channels of the input image right here. And you can actually"}, {"start": 530.98, "end": 535.74, "text": " do this multiple times, which corresponds to multiple output channels of the filters."}, {"start": 535.74, "end": 540.94, "text": " But the actual convolution is happening in two dimensions. So the sliding is across the"}, {"start": 540.94, "end": 546.7800000000001, "text": " width and the height of the image. In contrast to that, if you have a 3d convolution, and"}, {"start": 546.7800000000001, "end": 553.3000000000001, "text": " you have the same input stack of images, and now this, we have to you have to pay attention"}, {"start": 553.3000000000001, "end": 560.46, "text": " here, this right, this stack right here is the individual channels of one image. So of"}, {"start": 560.46, "end": 568.7800000000001, "text": " one video frame, this stack right here that I'm drawing, these are the video frames stacked."}, {"start": 568.78, "end": 573.26, "text": " Now each of these stacked video frames can have multiple channels resulting from its"}, {"start": 573.26, "end": 580.74, "text": " 2d convolution, or even just RGB. So I can't really draw in four dimensions. But now we"}, {"start": 580.74, "end": 589.02, "text": " stack the video frames. And now our kernel, our filter will be also in the direction of"}, {"start": 589.02, "end": 596.0, "text": " the video frame. So I don't know if this is really recognizable if I draw it like this."}, {"start": 596.0, "end": 602.58, "text": " But as you can see, the kernel is not only 2d, but 3d. And now the sliding, so if we"}, {"start": 602.58, "end": 607.34, "text": " have actually more than that, the sliding is not only done into the direction of height"}, {"start": 607.34, "end": 612.98, "text": " and width, but also into the direction of depth, so that each of the frames each of"}, {"start": 612.98, "end": 618.64, "text": " the video frames right here can incorporate information from its immediate neighbors in"}, {"start": 618.64, "end": 626.26, "text": " case of a three by three by three filter or even more neighbors. But here we use a three"}, {"start": 626.26, "end": 630.42, "text": " by three by three filter. Okay, so that's, that's how we obtain these embeddings right"}, {"start": 630.42, "end": 634.34, "text": " here. And at the end, there is a dimension reduction, like a max pooling or something."}, {"start": 634.34, "end": 639.66, "text": " But ultimately, what you'll end up with is for each of the 64 video frames, you get one"}, {"start": 639.66, "end": 646.62, "text": " vector. And that vector mainly describes that particular video frame, like if you consider"}, {"start": 646.62, "end": 653.26, "text": " the green one here, but also contains information from the video frame before it and from the"}, {"start": 653.26, "end": 660.94, "text": " video frame after it. Okay, so that's sort of and that's, that's the so the temporal"}, {"start": 660.94, "end": 665.18, "text": " convolution is not to detect the periodic actions, because it's just one frame into"}, {"start": 665.18, "end": 670.54, "text": " the future and into the past, it is more like what we said here, in order to give you extra"}, {"start": 670.54, "end": 676.24, "text": " information of what's happening in a particular frame. Because especially for periodicity,"}, {"start": 676.24, "end": 682.54, "text": " it's actually important if the arms are going up or down. Cool. So then comes the heart"}, {"start": 682.54, "end": 688.02, "text": " of the architecture, the heart of the architecture is this temporal self similarity matrix. Now,"}, {"start": 688.02, "end": 695.3, "text": " what does this do? This is relating the frames to each other. And important to note here,"}, {"start": 695.3, "end": 702.34, "text": " this is just a single channel image. So there is no other ones of these for the entire video"}, {"start": 702.34, "end": 710.6600000000001, "text": " frame sequence, you have one 64 by 64 matrix, and all the signal has to go through this"}, {"start": 710.6600000000001, "end": 717.1, "text": " matrix, right? Everything from here is only through this matrix, there's no residual connections,"}, {"start": 717.1, "end": 722.64, "text": " there's no skip connections. That's all that's your information bottleneck. And by having"}, {"start": 722.64, "end": 728.58, "text": " a bottleneck like this, these, the authors here force the model to basically do a good"}, {"start": 728.58, "end": 734.9000000000001, "text": " job at making this temporal self similarity happen if it wants to achieve a low loss."}, {"start": 734.9000000000001, "end": 741.3000000000001, "text": " That's what I mean by you can achieve a lot by having a smart architecture. This temporal"}, {"start": 741.3000000000001, "end": 746.9000000000001, "text": " self similarity matrix is actually not learned, this can be computed deterministically from"}, {"start": 746.9000000000001, "end": 753.82, "text": " the embeddings right here. So what you do is you each row here corresponds to one frame."}, {"start": 753.82, "end": 761.5, "text": " So you take each frame that corresponds to a row, and you calculate simply the the distance"}, {"start": 761.5, "end": 767.7, "text": " to or the similarity with each of the other frames. So this is as you can see, it's 64"}, {"start": 767.7, "end": 776.4200000000001, "text": " by 64. So frame i here is simply compared to each of the other frames j. And it depending"}, {"start": 776.4200000000001, "end": 781.6400000000001, "text": " on whether that embedding is very similar to the embedding of frame j, this number is"}, {"start": 781.64, "end": 789.0, "text": " going to be high or low. Now there's also a after that you do a softmax across here"}, {"start": 789.0, "end": 795.3, "text": " such that this is going to be like a distribution and not just raw numbers. But that's ultimately"}, {"start": 795.3, "end": 800.38, "text": " not that important. So what you can see is that the diagonal is very prominent. And that"}, {"start": 800.38, "end": 807.58, "text": " makes sense because technically, the diagonal is always one, right? If for example, if you"}, {"start": 807.58, "end": 811.24, "text": " use the inner product as a similarity, the diagonal should always be one. But here we"}, {"start": 811.24, "end": 816.2, "text": " have the softmax, so it's not but ultimately, we can say that any frame should be very similar"}, {"start": 816.2, "end": 821.58, "text": " to its is going to be very similar to itself. So that's why. But then you can see right"}, {"start": 821.58, "end": 827.98, "text": " here, there's a pattern emerging. And that pattern is these diagonal lines in this direction,"}, {"start": 827.98, "end": 834.32, "text": " as you can see. And what what does that mean? They actually have a larger version of this"}, {"start": 834.32, "end": 843.2600000000001, "text": " down here. So what does the diagonal pattern mean? It means that so here the diagonal,"}, {"start": 843.2600000000001, "end": 851.5, "text": " that's okay, frame i is very similar to frame i. Cool. But the other lines, what do they"}, {"start": 851.5, "end": 857.22, "text": " mean? So if I look at frame i right here, it is also very similar to this frame j. Now"}, {"start": 857.22, "end": 863.62, "text": " this wouldn't be further, you know, frames are similar. But the line means that if I"}, {"start": 863.62, "end": 872.5, "text": " have if I look 10 frames later, I plus 10, that's very similar to j plus 10. And if I"}, {"start": 872.5, "end": 880.86, "text": " now look at i plus 20 frame, that's very similar to j plus 20. So this is the this is here"}, {"start": 880.86, "end": 886.94, "text": " why the the pattern is emerging of a line, because if I go 10 frames into the future,"}, {"start": 886.94, "end": 893.8800000000001, "text": " it's similar to the other one 10 frames into the future and so on. And that means the line"}, {"start": 893.8800000000001, "end": 900.96, "text": " indicates that this entire sequence starting from i 20 frames into the future is repeated"}, {"start": 900.96, "end": 907.62, "text": " starting from j, actually j is earlier here. So but you get the point. And if I have a"}, {"start": 907.62, "end": 912.7, "text": " bunch of these lines, that means that this sub sequence is repeated again and again and"}, {"start": 912.7, "end": 919.4200000000001, "text": " again throughout the video. So each of these lines is basically one repetition of the sequence"}, {"start": 919.4200000000001, "end": 926.94, "text": " from the middle here at some other point in the video. And that's pretty fascinating."}, {"start": 926.94, "end": 935.0, "text": " And that's these these self similarity matrices. That's what they're sort of showing. Now they"}, {"start": 935.0, "end": 939.94, "text": " don't use the inner product here as a self similarity metric, they actually use as you"}, {"start": 939.94, "end": 945.58, "text": " can see right here, they use the negative squared distance, but the effect is the same."}, {"start": 945.58, "end": 951.94, "text": " So negative squared distance followed by a row wise softmax operation. So you could say,"}, {"start": 951.94, "end": 957.58, "text": " Hi, we're basically done having the self similarity matrix, what we could do, let's let's say"}, {"start": 957.58, "end": 962.08, "text": " we could train it, we don't worry about how to train it, we could simply take each row"}, {"start": 962.08, "end": 968.74, "text": " right here. And we plot the intensities across that row. And that's maybe you know, like"}, {"start": 968.74, "end": 973.38, "text": " something like this, and then there's the diagonals a bit higher. Okay, we could just"}, {"start": 973.38, "end": 979.98, "text": " use a heuristic to detect these bumps here, basically calculate the length, count the"}, {"start": 979.98, "end": 984.6, "text": " bumps and calculate the period length, right that that should be pretty easy with like"}, {"start": 984.6, "end": 991.62, "text": " a simple heuristic. But the authors here, they want more, they want to solve more problems."}, {"start": 991.62, "end": 996.98, "text": " So what are some of the problems, we already saw some of the problems namely, for example,"}, {"start": 996.98, "end": 1002.9, "text": " there is the hammer throw. So the hammer throw starts out slow and gets faster and faster"}, {"start": 1002.9, "end": 1008.5600000000001, "text": " and faster. And you can see this pretty clearly at the lines right here. Namely, if you go"}, {"start": 1008.5600000000001, "end": 1015.62, "text": " through time, so you start off here, and you go through time, you can see that the distance"}, {"start": 1015.62, "end": 1021.7, "text": " to the next line here is fairly large, but you go through time further, the distance"}, {"start": 1021.7, "end": 1027.1000000000001, "text": " gets shorter, you go through time further, the distance gets even shorter. So these pattern"}, {"start": 1027.1000000000001, "end": 1033.54, "text": " of lines here, that's kind of converging towards that, it indicates that this repeating action"}, {"start": 1033.54, "end": 1040.02, "text": " gets faster and faster and faster. This is nice to see her at the bouncy ball example,"}, {"start": 1040.02, "end": 1047.9, "text": " where you can see it starts out pretty slow, but it gets faster and faster. And here, you"}, {"start": 1047.9, "end": 1053.02, "text": " if you if you have this full thing right here, that basically means all the frames are self"}, {"start": 1053.02, "end": 1059.3000000000002, "text": " similar to each other, which basically means if you stop the video, right, that's if you"}, {"start": 1059.3000000000002, "end": 1063.18, "text": " have 10 frames in a row, the same thing, the ball is just lying on the ground, all of these"}, {"start": 1063.18, "end": 1069.68, "text": " frames will be self similar. So there's probably no bouncing happening down here, you can see"}, {"start": 1069.68, "end": 1075.8600000000001, "text": " pretty well from the pattern, what happens. And here in this mixing concrete example that"}, {"start": 1075.86, "end": 1080.82, "text": " we saw at the beginning, you can see that at the beginning at the end, there's this"}, {"start": 1080.82, "end": 1086.4599999999998, "text": " intro and outro sequence. And only in the middle is there a repeating action. And that's"}, {"start": 1086.4599999999998, "end": 1092.6999999999998, "text": " indicated by this line pattern is only at the in the middle of the videos only between"}, {"start": 1092.6999999999998, "end": 1100.6599999999999, "text": " here and here. So it's, it's gonna be pretty difficult to just have a heuristic that reads"}, {"start": 1100.66, "end": 1107.1000000000001, "text": " out these periodic action periodicity. And in a true deep learning fashion, the the authors"}, {"start": 1107.1000000000001, "end": 1112.5, "text": " here, oh, sorry, maybe you can't see that I've shifted my recording window. So maybe"}, {"start": 1112.5, "end": 1118.8600000000001, "text": " sometimes something's out of frame and you have to yell at me if I do that, please. So"}, {"start": 1118.8600000000001, "end": 1125.3000000000002, "text": " I hope you saw this that you have the ever the speeding up here and here, they're visible"}, {"start": 1125.3, "end": 1130.54, "text": " in the pattern. And then here, you have the beginning sequence, the end sequence that"}, {"start": 1130.54, "end": 1134.78, "text": " have no repeating pattern, and the repeating pattern only moves in the middle. So the authors"}, {"start": 1134.78, "end": 1141.3, "text": " want to do this through, of course, a deep learning network, they want to read out the"}, {"start": 1141.3, "end": 1147.34, "text": " periodicities, not through a heuristic, but using a deep network, you know, respectable,"}, {"start": 1147.34, "end": 1154.78, "text": " that's at the times we live in. So what do they do? First of all, you have to see right"}, {"start": 1154.78, "end": 1162.06, "text": " here, everything that happens from here, as I understand it, is per frame. So they simply"}, {"start": 1162.06, "end": 1169.94, "text": " take a row of this matrix right here, like this red line, and that is independently pulled"}, {"start": 1169.94, "end": 1176.8999999999999, "text": " through to the end. So there is no interaction happening anymore between the individual frame"}, {"start": 1176.8999999999999, "end": 1183.1399999999999, "text": " data, the only interaction that happens is a little bit here at the temporal convolutions."}, {"start": 1183.14, "end": 1187.5600000000002, "text": " But the only real interaction between the frames is happening through the self similarity"}, {"start": 1187.5600000000002, "end": 1192.98, "text": " matrix. And again, this is the information bottleneck that the authors force the information"}, {"start": 1192.98, "end": 1200.2, "text": " through everything happening from here. Now, that's actually not right, there is this convolution"}, {"start": 1200.2, "end": 1206.6200000000001, "text": " right here. But still, this is the information bottleneck you have to go through. So right"}, {"start": 1206.62, "end": 1214.6999999999998, "text": " here, we process this image using a convolution. So this is an image, right? And we can process"}, {"start": 1214.6999999999998, "end": 1222.3, "text": " it using a convolutional neural network. So what we do is we have a 64 by 64 image in"}, {"start": 1222.3, "end": 1228.86, "text": " one channel, we simply up sample that not up sample, but we expand the channels to 32"}, {"start": 1228.86, "end": 1233.82, "text": " channels. Now, as I said, it's pretty easy to think we can just go to the end here, use"}, {"start": 1233.82, "end": 1243.5, "text": " a convnet to produce our final 512 by so 512 embeddings we have here, again, 64 by 64,"}, {"start": 1243.5, "end": 1251.08, "text": " that we then use to predict the final result. But the authors here do something different,"}, {"start": 1251.08, "end": 1258.02, "text": " they do transformer layers in the middle, but only per frame. So what does it mean?"}, {"start": 1258.02, "end": 1268.5, "text": " So here, you up sample to 32 channels. And then that means that one of these blocks right"}, {"start": 1268.5, "end": 1275.56, "text": " here, one of these blocks corresponds to one row in the self similarity matrix, which corresponds"}, {"start": 1275.56, "end": 1281.92, "text": " to one frame. And from now on, so from now on, I want to say what I said before, from"}, {"start": 1281.92, "end": 1289.1000000000001, "text": " now on, it's all just this one block, they are independent of each other. Okay, so you"}, {"start": 1289.1000000000001, "end": 1296.7, "text": " take this one block, and you feed it through a transformer to achieve at your final embedding"}, {"start": 1296.7, "end": 1307.5, "text": " of 512. And it's probably best if we read what they say about it. Okay, so if we're"}, {"start": 1307.5, "end": 1315.62, "text": " given this self similarity matrices, matrix, they consist of row, each row is the per frame"}, {"start": 1315.62, "end": 1320.74, "text": " self similarity representation, and generates two outputs, the per frame, period length"}, {"start": 1320.74, "end": 1327.78, "text": " estimation and the per frame binary periodicity classification. Note that both L and P are"}, {"start": 1327.78, "end": 1335.86, "text": " vectors and their elements are per frame predictions. Okay. The architecture of the period predictor"}, {"start": 1335.86, "end": 1340.86, "text": " module can be viewed in figure two, note that the predictors share a common architecture"}, {"start": 1340.86, "end": 1347.78, "text": " and waits until the last classification phase. The shared processing pipeline starts with"}, {"start": 1347.78, "end": 1356.3, "text": " 32 2d convolutional filters of size three by three, followed by a transformer layer,"}, {"start": 1356.3, "end": 1361.86, "text": " which uses a multi headed attention with trainable positional embeddings in the form of a 64"}, {"start": 1361.86, "end": 1368.54, "text": " length variable that is learned by training. Okay, it's, I guess the transformers learned"}, {"start": 1368.54, "end": 1373.8999999999999, "text": " by training, and the positional embeddings are also learned by training. That's fairly"}, {"start": 1373.8999999999999, "end": 1379.74, "text": " common. We use four heads with 512 dimension in the transformer. By the way, if you don't"}, {"start": 1379.74, "end": 1384.74, "text": " know what a transformer is, watch the video on attention is all you need. I made one it's"}, {"start": 1384.74, "end": 1393.1, "text": " very popular. Yeah. So with each head being 128 dimensions in size. After the shared pipeline,"}, {"start": 1393.1, "end": 1400.06, "text": " we have two classifiers, period length classifier and periodicity classifier, tau. Sorry, this"}, {"start": 1400.06, "end": 1404.9, "text": " is fine. This is tau. Each of them consists of two fully connected layers of size 512."}, {"start": 1404.9, "end": 1410.3, "text": " So I guess the the pipeline here is pretty simple. The question could be why do they"}, {"start": 1410.3, "end": 1418.32, "text": " use a transformer and not simply another convolutional network. So here they up sample the image"}, {"start": 1418.32, "end": 1425.8999999999999, "text": " as we saw into 32 channels, and then they simply want to take one of these one of these"}, {"start": 1425.8999999999999, "end": 1432.6599999999999, "text": " blocks here. And that corresponds a little bit. So we have for one frame, right? What"}, {"start": 1432.66, "end": 1443.42, "text": " does it mean we have basically, we have 64 by 32 things. So the 64 things, it's this"}, {"start": 1443.42, "end": 1449.44, "text": " one frames temporal connection to each other frame given that you know, comes from this"}, {"start": 1449.44, "end": 1455.14, "text": " self similarity matrix. So it kind of relates this frame that we're considering to each"}, {"start": 1455.14, "end": 1463.0200000000002, "text": " of the other frames. And each of this, each of these entries is a 32 size vector. This"}, {"start": 1463.0200000000002, "end": 1470.7800000000002, "text": " is sort of a this is you can consider it like a sequence of 64 things 64 embeddings. So"}, {"start": 1470.7800000000002, "end": 1477.0600000000002, "text": " to use a transformer here is pretty natural. If you think of this as like a sequence transformation"}, {"start": 1477.06, "end": 1487.7, "text": " task, I would guess. So the transformer can if there are these peaks right here, like"}, {"start": 1487.7, "end": 1492.54, "text": " we saw right here, the transformer can make very good sense of that because of course,"}, {"start": 1492.54, "end": 1500.3, "text": " the attention mechanism from a one peak, it can attend to all the other peaks and can"}, {"start": 1500.3, "end": 1506.1399999999999, "text": " sort of relate the different peaks to each other and then determine the periodicity length"}, {"start": 1506.14, "end": 1512.8600000000001, "text": " whereas with a convolutional network, I guess that's going to be a lot harder because of"}, {"start": 1512.8600000000001, "end": 1517.66, "text": " the sort of invariance built into the convolution. I'm not sure maybe they also it just worked"}, {"start": 1517.66, "end": 1524.1000000000001, "text": " better. But that's how I think about it. It's that for a given frame, you basically have"}, {"start": 1524.1000000000001, "end": 1530.6200000000001, "text": " a sequence classification or a set classification task. And the attention mechanism allows you"}, {"start": 1530.62, "end": 1539.26, "text": " to in one single step connect each peak with each other peak or each information with each"}, {"start": 1539.26, "end": 1543.8999999999999, "text": " other information in this sequence. Alright, so at the end, you have just fully connected"}, {"start": 1543.8999999999999, "end": 1551.2199999999998, "text": " layers again, only on a per frame basis. And that will give you the output. And again,"}, {"start": 1551.2199999999998, "end": 1555.1, "text": " you compare this to the label and you back prop through everything, everything here is"}, {"start": 1555.1, "end": 1562.1799999999998, "text": " differentiable. So all of this is trained to achieve minimum possible loss. And because"}, {"start": 1562.1799999999998, "end": 1567.6399999999999, "text": " you train everything to achieve minimal possible loss, you make this encoder right here, which"}, {"start": 1567.6399999999999, "end": 1572.8999999999999, "text": " is the crucial part because the encoder is must give you good embeddings, which must"}, {"start": 1572.8999999999999, "end": 1580.3, "text": " give you a sensible self similarity matrix, right? You train the encoder to encode things"}, {"start": 1580.3, "end": 1589.86, "text": " that are relevant for the task. And that's what makes the whole thing work. Okay. So"}, {"start": 1589.86, "end": 1599.58, "text": " we've gone through the architecture. Now, the problem right here is the the data set."}, {"start": 1599.58, "end": 1604.7, "text": " So they also go into how they do inference, they can actually do a bunch of things like"}, {"start": 1604.7, "end": 1609.3, "text": " play the video at different speeds and then look at what each of the predictions. So if"}, {"start": 1609.3, "end": 1614.7, "text": " a double speed, it predicts half the period length, then you can be more sure and so on."}, {"start": 1614.7, "end": 1622.8799999999999, "text": " So that's pretty cool. But they go into another point right here, and that's the data set."}, {"start": 1622.8799999999999, "end": 1629.1399999999999, "text": " So they produce this countix data set. But also, on the other hand, which is something"}, {"start": 1629.1399999999999, "end": 1636.06, "text": " I also find very cool is they produce a synthetic data set. So here they say, we train with"}, {"start": 1636.06, "end": 1645.1799999999998, "text": " synthetic repetitions. And that can be sort of, I didn't know what to think of it at first,"}, {"start": 1645.1799999999998, "end": 1651.3, "text": " I was just like, huh, but then it's pretty cool. So if you have a video with these, these"}, {"start": 1651.3, "end": 1656.46, "text": " are the frames of the video, right, so the video goes in this temporal direction, what"}, {"start": 1656.46, "end": 1663.8, "text": " you can do is simply go here, go through these frames, and just repeat these frames and repeat"}, {"start": 1663.8, "end": 1667.98, "text": " them and repeat them. And at the end, you have these frames, right. And then you have"}, {"start": 1667.98, "end": 1675.3, "text": " a data set. And if you if you assume that most videos do not naturally contain repeating"}, {"start": 1675.3, "end": 1679.46, "text": " actions, right, most videos are just videos, they're not videos of something repeating,"}, {"start": 1679.46, "end": 1686.24, "text": " then you can safely assume that these parts here are non repeating. So and these parts"}, {"start": 1686.24, "end": 1690.62, "text": " here are repeating, this is one of the labels that you need, right? The problem with synthetic"}, {"start": 1690.62, "end": 1698.2199999999998, "text": " data set is always to have the labels. And also, you know how many there are, because"}, {"start": 1698.2199999999998, "end": 1703.58, "text": " you can simply count the number of times that you go through it, you can even make it faster,"}, {"start": 1703.58, "end": 1708.9199999999998, "text": " slower, and so on. So this synthetic approach is pretty cool. And especially the bottom"}, {"start": 1708.9199999999998, "end": 1713.34, "text": " right here, because this might be kind of hacky. Because each time, each time you jump"}, {"start": 1713.34, "end": 1718.3799999999999, "text": " from the end of one of those arrows to the beginning, right, you have kind of a hack"}, {"start": 1718.38, "end": 1725.66, "text": " in the in the video, because, you know, it's not continuous. So what you can do, and this"}, {"start": 1725.66, "end": 1729.98, "text": " is the the bottom here, you can do this reversal technique where you go to the end, and then"}, {"start": 1729.98, "end": 1735.0200000000002, "text": " you play the frames backwards, and then you play the frames forwards again, backwards"}, {"start": 1735.0200000000002, "end": 1740.0600000000002, "text": " again, forwards again, and then you go out here. And that gives you one continuous motion,"}, {"start": 1740.0600000000002, "end": 1745.2600000000002, "text": " right? If someone if it's simply a video of someone lifting their hand, like it starts"}, {"start": 1745.26, "end": 1751.18, "text": " out down here, and it goes here, and it goes here. And then if you do this technique, it"}, {"start": 1751.18, "end": 1760.22, "text": " would go down again, down again, up again, up again, and so on. So that's, you know,"}, {"start": 1760.22, "end": 1766.18, "text": " I think it's a fairly smart technique, honestly. Now they tried this, and it doesn't work super"}, {"start": 1766.18, "end": 1773.9, "text": " well. So what they also have to do is they have to do manual camera motion augmentation."}, {"start": 1773.9, "end": 1779.94, "text": " So that's camera motion augmentation, it basically means that if you just do a repeating action,"}, {"start": 1779.94, "end": 1784.96, "text": " like this, it's sort of, I guess, it's too monotonic, it doesn't really cover real videos"}, {"start": 1784.96, "end": 1793.6200000000001, "text": " with repeating actions. So what they do is they kind of simulate a moving camera. And"}, {"start": 1793.6200000000001, "end": 1799.46, "text": " you simulate that much like you would do image augmentation. So you can rotate the camera"}, {"start": 1799.46, "end": 1805.18, "text": " over time, you can translate it, you can scale it differently. And through if you do that"}, {"start": 1805.18, "end": 1809.94, "text": " throughout the video, and you change it around how the camera moves, then that appears to"}, {"start": 1809.94, "end": 1820.14, "text": " work fairly well. So if they now compare this and their data set, they perform pretty well."}, {"start": 1820.14, "end": 1825.8600000000001, "text": " So in their data set, they take this kinetics data set, and they crowdsource the label and"}, {"start": 1825.86, "end": 1831.4199999999998, "text": " the tasks in the data set, they're pretty diverse, as you can see right here. So you"}, {"start": 1831.4199999999998, "end": 1838.1799999999998, "text": " have sports like rope training, mountain climbers, but you have also things like playing ukulele,"}, {"start": 1838.1799999999998, "end": 1844.1, "text": " exercising arms, slicing an onion, and so on. And you can see that the repetition count"}, {"start": 1844.1, "end": 1849.26, "text": " is fairly diverse as well. So from one or two repetitions per video, it goes to 50"}, {"start": 1849.26, "end": 1855.94, "text": " or so. And the period length is also between one and five seconds, though, as you as I"}, {"start": 1855.94, "end": 1861.1, "text": " already said, you don't have to, you don't have to count on that, because you can always"}, {"start": 1861.1, "end": 1870.18, "text": " play the video slower or faster and then determine other periodicities. So in their experiment,"}, {"start": 1870.18, "end": 1876.42, "text": " first of all, they perform pretty well. And they show that if they train on their data"}, {"start": 1876.42, "end": 1884.78, "text": " set, and on the synthetic data set, they perform better than if they just train on the synthetic,"}, {"start": 1884.78, "end": 1890.7, "text": " or they just train on their data set. They also show pretty clearly that the addition"}, {"start": 1890.7, "end": 1895.7, "text": " of this temporal self similarity matrix helps tremendously, you can see right here in each"}, {"start": 1895.7, "end": 1902.74, "text": " of these boxes is the comparison. And this OBO, I think is the off by one error. So it"}, {"start": 1902.74, "end": 1907.5, "text": " kind of forgives you if you're off by one count, but otherwise, you get a zero if you're"}, {"start": 1907.5, "end": 1913.94, "text": " wrong. And you can see that the self similarity matrix helps tremendously. They also compare"}, {"start": 1913.94, "end": 1919.38, "text": " with some other architectural choices instead of the transformer, I guess, yeah, so I guess"}, {"start": 1919.38, "end": 1927.98, "text": " they just take it because it performs pretty well. And they do a lot of lot of ablations."}, {"start": 1927.98, "end": 1934.02, "text": " But what I particularly appreciate is that they do something like this. So what they"}, {"start": 1934.02, "end": 1939.96, "text": " do at the end, when once they've trained the architectures, they do a 1d PCA projection"}, {"start": 1939.96, "end": 1946.14, "text": " of the encoder features over time. Now, the encoder features, they were 512 dimensional,"}, {"start": 1946.14, "end": 1953.74, "text": " right? This is the thing before it goes into the self similarity matrix. So those we said"}, {"start": 1953.74, "end": 1959.86, "text": " the encoder is the crucial part here, because it needs to take the video and encode things"}, {"start": 1959.86, "end": 1967.24, "text": " that make them accessible to calculating the self similarity. Now they do a 1d PCA. So"}, {"start": 1967.24, "end": 1973.96, "text": " a projection into one dimension of these features. And you can already see at this one dimensional"}, {"start": 1973.96, "end": 1983.2, "text": " projection that the periodicity here is clearly clearly visible, namely, for example, right"}, {"start": 1983.2, "end": 1989.38, "text": " here. Every time up here is when the legs are up. And every time down here is when the"}, {"start": 1989.38, "end": 1997.18, "text": " legs are down right here. So that is very, very impressive. And that kind of that really"}, {"start": 1997.18, "end": 2002.82, "text": " shows that the model is doing what you claim what you claim that it's doing. Like, I'm"}, {"start": 2002.82, "end": 2007.74, "text": " almost more interested in experiments like this than in and in these numbers right here,"}, {"start": 2007.74, "end": 2014.82, "text": " because the numbers could always be because you've just thrown more stuff at it, right?"}, {"start": 2014.82, "end": 2023.32, "text": " So they go over a bunch of possible applications of their model. So first of all, you can do"}, {"start": 2023.32, "end": 2028.82, "text": " something like, as we can see, repetition counting from videos, you can do periodicity"}, {"start": 2028.82, "end": 2033.76, "text": " detection, those were the things that the model is trained to do. But there's also a"}, {"start": 2033.76, "end": 2039.02, "text": " bunch of things that the model can now implicitly do, namely, something like change inspection,"}, {"start": 2039.02, "end": 2044.46, "text": " where they say, look, if someone's chopping this pineapple right here, then at the end"}, {"start": 2044.46, "end": 2050.04, "text": " of each of the repetitions, there is something that changed, namely the number of slices"}, {"start": 2050.04, "end": 2056.08, "text": " of pineapple, is it red? Is it? I can't. I think it's pineapple. Okay, so the number"}, {"start": 2056.08, "end": 2063.74, "text": " of slices or pieces right here changes. So in essence, this could be the base for another"}, {"start": 2063.74, "end": 2071.8999999999996, "text": " model estimating whatever changed or training to recognize numbers of pieces and so on."}, {"start": 2071.8999999999996, "end": 2078.8199999999997, "text": " Also, you can detect the speed. So the speed of a repeating action, if you perform something"}, {"start": 2078.8199999999997, "end": 2087.18, "text": " slow or fast, this model can implicitly do it. And this they call cross period retrieval."}, {"start": 2087.18, "end": 2094.56, "text": " So if you know when the repetitions are, you know that, okay, maybe the first frame, so"}, {"start": 2094.56, "end": 2103.0, "text": " always on the upswing right here, these should all be fairly similar visually, right? As"}, {"start": 2103.0, "end": 2109.7599999999998, "text": " with respect to the repeating action. So you can see that even though this, whenever the"}, {"start": 2109.7599999999998, "end": 2115.98, "text": " kid in the swing here is close, it looks fairly different in a purely visual sense in a pixel"}, {"start": 2115.98, "end": 2121.78, "text": " sense, but it is at the same point in the repeating action. And that's, you know, that's"}, {"start": 2121.78, "end": 2126.58, "text": " that's pretty cool. So you can technically retrieve related things, even though they"}, {"start": 2126.58, "end": 2134.64, "text": " visually they don't look similar that much. Yeah, that that's the, the kind of applications"}, {"start": 2134.64, "end": 2140.76, "text": " here are probably many, many fold. And I also think that so in this measure of intelligence"}, {"start": 2140.76, "end": 2146.5200000000004, "text": " paper by Francois Chollet, he basically claims that this is one of the innate abilities of"}, {"start": 2146.5200000000004, "end": 2151.94, "text": " humans. They can count, you know, they can count things, this is something you're basically"}, {"start": 2151.94, "end": 2160.46, "text": " born with. And maybe this thing right here will become sort of a staple staple component"}, {"start": 2160.46, "end": 2166.6600000000003, "text": " for many other things that we build AI on, I would not be surprised, but maybe it will"}, {"start": 2166.66, "end": 2172.08, "text": " just fade into history. I think it's pretty cool project, especially, you know, the the"}, {"start": 2172.08, "end": 2178.8199999999997, "text": " architectural choice here to pull everything through this self similarity matrix. And the,"}, {"start": 2178.8199999999997, "end": 2184.8999999999996, "text": " you know, just just looking at this matrix already makes you kind of know that this thing"}, {"start": 2184.8999999999996, "end": 2190.62, "text": " works. All right, this was it from me. Let me know in the comments what you think about"}, {"start": 2190.62, "end": 2196.64, "text": " the paper, check out the website, the website has a lot of video demo examples of what the"}, {"start": 2196.64, "end": 2201.48, "text": " they're doing, I think the data set as well. And yeah, I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=n1SXlK5rhR8
[Drama] Yann LeCun against Twitter on Dataset Bias
Yann LeCun points out an instance of dataset bias and proposes a sensible solution. People are not happy about it. Original Tweet: https://twitter.com/ylecun/status/1274782757907030016 ERRATA: - My specific example of the L1 regularizer wrt to Porsches and Ferraris does not actually work in this particular case. What I mean is a general sparsity-inducing regularizer. - When I claim that an L1 regularizer would make the problem worse, this only holds in certain circumstances, for example when the data is Gaussian iid. Thumbnail: https://commons.wikimedia.org/wiki/File:Yann_LeCun_-_2018_(cropped).jpg by Jérémy Barande / Ecole polytechnique Université Paris-Saclay / CC BY-SA 2.0 Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, so you may have seen this already. There's a CVPR paper called Pulse and what it does is it's a method to up sample a pixelated image in a way that makes it look realistic but also that the again down sampled variant matches the original down sampled image. So it's kind of a cycle consistency loss together with a GAN and all in all it's a method to demonstrate how you could do this. Now this has been trained on this face data set among others. There was a user Bomzzy that made this into a colab so people could try it out and tweeted this out. And as you can see it works pretty nicely, gives pretty nice results on this particular data set. But of course people started playing around with it and gave fairly funny results like this or that. That gets more into the horrible category. So you can see these ones I particularly like Trump being made into the little child. So you can see as soon as you get away from the original kind of data set modality, you are going to get these results that are off. And people started to notice that so here you input Barack Obama, and what comes out is a fairly standard Caucasian person. Someone tweeted out saying this image speaks volumes about the dangers of bias in AI. I guess here is where the entire story starts. So Yann LeCun weighs in and says ML systems are biased when data is biased. This face up sampling system makes everyone look white because the network was pre trained on flick face HQ, which mainly contains white people pics. And they train the exact same system on a date set from Senegal, and everyone will look African. So this is pointing out why this happens, namely because the data set is mainly Caucasian people. So the results of up sampling are going to be mainly Caucasian people. And this is like a straightforward explanation of why we're seeing what we're seeing. But of course, this was not okay. And here is where the piling starts. As an interjection, we have to talk about bias in machine learning. Technically, there's a statistical notion of bias, which has a very rigorous definition. And there is the societal definition of bias. And these two things, even though they're the same word, they're totally different. A machine learning system mainly consists of four different parts. There is the data set, the model, the loss function, and the optimization procedure. Statistical bias means whenever the model, the loss or the optimization procedure lead to a situation where the outcome doesn't reflect the distribution of the data that you input. This, for example, is achieved when you regularize your model, which means that you put some prior knowledge onto the model, you introduce bias, and therefore you choose to not accurately represent your data distribution, regularize it to a more biased distribution that in turn has lower variance. We know this as the bias variance trade off, it's actually very simple, right? You have the Ferraris and the Lamborghinis, and you want to make a model that predicts the accident probability. Now, it just so happens that the Ferrari drivers are a bit more reckless, and they do slightly higher accidents. And now I train my logistic regression and it tells me, okay, 60-40. Cool. But now I train my logistic regression with an L1 penalty. And I say, I want my model to be, you know, explainable, so I want it to be sparse. I want the least amount of variables to be contributing to it. What's the model going to say? The model is going to say, Ferrari drivers, bad Lamborghini drivers, good. Societal bias in machine learning is way different. An example for this is when face detection systems work well on Caucasian people, but don't work so well faced with people from other heritages. And these societal biases are in the data set. As Yann LeCun points out here, if you change the data set, you'll change these biases. Notably, the societal biases can only be in the data set. Otherwise, you'd have to argue something like logistic regression itself has a preference for white people or something like this. Now there is a considerable interaction effect between the two. But as Yann LeCun points out, the actual societal bias of the final system is a direct result of the bias in the data set. And he is very correct. If you train that system on a different data set, it will exhibit different biases. Societal bias cannot be in the other parts of the machine learning pipeline, they can serve to exaggerate or mitigate that bias in the data set. But they themselves can only be statistically biased, and not societally biased. But Yann LeCun made the terrible mistake of pinpointing the exact root cause of this problem, and not addressing the, I guess, wider ranging problems in the field, as some people perceive it, and he shouldn't have to write, he pretty clearly says, this is why it happens. We can solve it by swapping the data set, he doesn't say anything about anything else. Namely, he doesn't say that general bias in the field is not a problem. He doesn't say that this doesn't harm anyone. None of that he simply suggests a solution. Jonathan Peck says, Well, yes, that's the point. ML researchers need to be more careful selecting their data so that they don't encode biases like this. And LeCun responds with not so much ML researchers, but ML engineers, the consequences of bias are considerably more dire in a deployed product than in an academic paper, which is also correct. This paper was about the method showing that this method works on this data set. Now Sumit here makes a interesting point, which I agree with saying that today, ML researchers are inadvertently powering product of a lot of non AI companies who ignorantly start with a pre trained Bert or Resnet or YOLO from the internet, probably ignoring the license, read me and so on, which is a valid point, right? There are going to be people that take this and think, Oh, this is a face up sampler. Cool. I can use that without noting that this is simply an example of implementation on an example data set. So you can argue that there might be some responsibility of the researchers right here. That doesn't make young lacan not correct. But I still consider this to be like a fruitful discussion between individuals right here. But now we go on this person saying train it on the whole American population with an L two loss and almost everyone will look white, or train it on the whole American population with an L one loss and more people might look black. Stop pretending that bias does not also come from algorithmic choices. Young lacan never says it doesn't right. Lacan responds now saying, the most efficient way to do it though, is to equalize the frequencies of the categories of samples during training. This forces the network to pay attention to all the relevant features for all the sample categories and training with an L one instead of an L two will not even begin to solve the problem. I would pretty much argue training with an L one loss here would exacerbate the problem because the L two loss is much more sensitive to outliers. Charles Sutton says serious question, why do you feel that it's important to make this point? Are you worried that people are going to start suing CycleGAN? And Lacan says, because people should be aware of this problem and know its cause so they can fix it. How terrible, Jan, how terrible you dare pinpoint the exact cause of the problem so that people can fix it. The correct thing to do is to point out that everything is problematic. So Tim Nguyberu says, Jan, I suggest you watch me and Emily's tutorial or a number of scholars who are expert in this area. You can't just reduce harms to data set bias. For once, listen to us people from marginalized communities and what we tell you, if not now during worldwide protests, not sure when. So again, I feel the argument here is that you can't simply point out that it's the data set bias, you must point out the bigger problems which Jan Lacan does not ever deny. He simply says this particular problem can be solved by switching the data set. Well, Larue says, Jan was in my PhD jury, I'm indebted for him for everything he taught me but this constant dismissal of the harms caused directly or indirectly by the ML community is highly problematic. Where or when have I dismissed the harm caused by the ML community? I'm pointing out the cause of the harm so it can be fixed. You can't fix the harm unless you know what causes it. No, Larue says causes of the biases are numerous only pointing out data set bias deflects the attention away from the other more pervasive ones that make the whole field of bias in ML. Many people try to get your attention about these issues but you kept focus on the data set because the data set is the problem right here. He doesn't dismiss any of the other things he simply says here the data set is the problem. If your problem is that it doesn't work as well for non-Concaisian people, which was never the intent of this the intent of this was to showcase the method. I mean, ImageNet is like 60% dog species. And still, people train on it to showcase their image recognition techniques. No one training on ImageNet makes a claim that they have solved computer vision for all the classes in the world in a fair manner. Timnit Gibru goes on saying I'm sick of this framing tired of it. Many people have tried to explain many scholars listen to us you can't just reduce the harms caused by ML to data set bias. Doesn't do that doesn't do it. So someone asks her, is he engaging in any ways with you? It's appalling to see that he answers to everybody but you yet maybe there is a conversation going on in private and I don't want to jeopardize it. Note that Yann LeCun's tweet has 500 retweets, 1.9k likes and comments as far as you can scroll. To what she responds to with Yep, but I'm used to white men refusing to engage with black and brown women, even on issues of bias that mostly affect us. I mean, he literally has ignored a whole body of work by people from that demographic, hence the statement so not surprised. I mean, in absence of the fact that an argument should be independent of the person making the argument. That is a low blow. Hard Maru says I respectfully disagree with Yann here. As long as progress is benchmarked on biased data, such biases will also be reflected in the inductive biases of ML systems. Advancing ML with bias benchmarks and asking engineers to simply retrain models with unbiased data is not helpful. I don't disagree with you here. I don't think my tweet contradicts your statement, which it doesn't. People are reading into this, because he doesn't conform to the orthodoxy of pointing out that everything and everything is problematic and simply pinpoints a particular problem. He must be thinking all the wrong things. Jeff Dean says this is a clear example here is an illustration that seemingly minor choices in learning algorithms or loss can have significant effects. So bias in ML systems is about much more than just avoid data bias. ML researchers and practitioners must pay attention to these issues. And I think they are and Lacan doesn't say anything against that. He says, as I point out in my comment to this tweet is much more efficient to correct this kind of bias. Note that Yann Lacan actually differentiates between the different kinds of biases by equalizing the frequencies of categories of samples during training, then be hacking the loss function. Correct, because if you hack the loss function, you're trying to counter one kind of bias by another kind of bias. Meredith Whitaker says this is very racist. And even if it recognized non white people, it would be very racist. This is cop tech. It's designed to allow those with power to surveil and control those with less power. Diverse training sets aren't going to fix it, advocating that we should never build these systems. And that's a discussion to be had. But let me break this to you. This isn't going to help the cops. This isn't actually giving you the face of the person that was down pixeled. This is simply going to give you the most likely face associated with that down pixel picture. Given the data set the algorithm was trained on. I don't see this whenever any machine learning algorithm does anything with faces at all people jumping up going like this is cop technology. Well, in line with all the broader impact statement advice, can it also be used to find lost children from very, very bad security camera footage. And if I already mentioned that this doesn't actually give you back the person on the down sampled image, it will give you back the most likely person given the data set. So with that, I want to conclude this section, please stop the witch hunting. Yann LeCun made a completely fine tweet here. And there's no reason why people should pile on him this hard. He doesn't dismiss any of the other problems just because he doesn't mention them. And while we all enjoy a good discussion where people disagree genuinely, it's not helpful to accuse him of things he never said or meant. I mean, where does this all lead? The result of this is going to be that small labs that don't have the resources to collect their own data sets, or check for all the possible biases in their models that are reliant on the data sets that we do have, even if they are biased and flawed, will just be disincentivized from publishing their code, or actually doing research at all. So this as every other additional constraint on research is going to help the large corporations with lots of money. And maybe that's just my opinion, but we should be able to just talk about a problem and the solution to it without always having to make sure that we rabble down all the different things that are and might be wrong according to the canon. And big props to Yann LeCun here for holding his own. 90% of people by now would probably be like, Oh, yes, I'm so sorry. I did not thoughtful comment, blah, blah, blah. Props to you Yann. Keep going. And with that, I conclude this section. Let me know what you think in the comments and I'll see you next time. Bye bye.
[{"start": 0.0, "end": 20.0, "text": " Hi there, so you may have seen this already. There's a CVPR paper called Pulse and what it does is it's a method to up sample a pixelated image in a way that makes it look realistic but also that the again down sampled variant matches the original down sampled image."}, {"start": 20.0, "end": 28.0, "text": " So it's kind of a cycle consistency loss together with a GAN and all in all it's a method to demonstrate how you could do this."}, {"start": 28.0, "end": 41.0, "text": " Now this has been trained on this face data set among others. There was a user Bomzzy that made this into a colab so people could try it out and tweeted this out."}, {"start": 41.0, "end": 59.0, "text": " And as you can see it works pretty nicely, gives pretty nice results on this particular data set. But of course people started playing around with it and gave fairly funny results like this or that. That gets more into the horrible category."}, {"start": 59.0, "end": 78.0, "text": " So you can see these ones I particularly like Trump being made into the little child. So you can see as soon as you get away from the original kind of data set modality, you are going to get these results that are off."}, {"start": 78.0, "end": 94.0, "text": " And people started to notice that so here you input Barack Obama, and what comes out is a fairly standard Caucasian person. Someone tweeted out saying this image speaks volumes about the dangers of bias in AI."}, {"start": 94.0, "end": 113.0, "text": " I guess here is where the entire story starts. So Yann LeCun weighs in and says ML systems are biased when data is biased. This face up sampling system makes everyone look white because the network was pre trained on flick face HQ, which mainly contains white people pics."}, {"start": 113.0, "end": 124.0, "text": " And they train the exact same system on a date set from Senegal, and everyone will look African. So this is pointing out why this happens, namely because the data set is mainly Caucasian people."}, {"start": 124.0, "end": 134.0, "text": " So the results of up sampling are going to be mainly Caucasian people. And this is like a straightforward explanation of why we're seeing what we're seeing."}, {"start": 134.0, "end": 146.0, "text": " But of course, this was not okay. And here is where the piling starts. As an interjection, we have to talk about bias in machine learning. Technically, there's a statistical notion of bias, which has a very rigorous definition."}, {"start": 146.0, "end": 157.0, "text": " And there is the societal definition of bias. And these two things, even though they're the same word, they're totally different. A machine learning system mainly consists of four different parts."}, {"start": 157.0, "end": 175.0, "text": " There is the data set, the model, the loss function, and the optimization procedure. Statistical bias means whenever the model, the loss or the optimization procedure lead to a situation where the outcome doesn't reflect the distribution of the data that you input."}, {"start": 175.0, "end": 193.0, "text": " This, for example, is achieved when you regularize your model, which means that you put some prior knowledge onto the model, you introduce bias, and therefore you choose to not accurately represent your data distribution, regularize it to a more biased distribution that in turn has lower variance."}, {"start": 193.0, "end": 202.0, "text": " We know this as the bias variance trade off, it's actually very simple, right? You have the Ferraris and the Lamborghinis, and you want to make a model that predicts the accident probability."}, {"start": 202.0, "end": 213.0, "text": " Now, it just so happens that the Ferrari drivers are a bit more reckless, and they do slightly higher accidents. And now I train my logistic regression and it tells me, okay, 60-40. Cool."}, {"start": 213.0, "end": 224.0, "text": " But now I train my logistic regression with an L1 penalty. And I say, I want my model to be, you know, explainable, so I want it to be sparse. I want the least amount of variables to be contributing to it."}, {"start": 224.0, "end": 241.0, "text": " What's the model going to say? The model is going to say, Ferrari drivers, bad Lamborghini drivers, good. Societal bias in machine learning is way different. An example for this is when face detection systems work well on Caucasian people, but don't work so well faced with people from other heritages."}, {"start": 241.0, "end": 260.0, "text": " And these societal biases are in the data set. As Yann LeCun points out here, if you change the data set, you'll change these biases. Notably, the societal biases can only be in the data set. Otherwise, you'd have to argue something like logistic regression itself has a preference for white people or something like this."}, {"start": 260.0, "end": 279.0, "text": " Now there is a considerable interaction effect between the two. But as Yann LeCun points out, the actual societal bias of the final system is a direct result of the bias in the data set. And he is very correct. If you train that system on a different data set, it will exhibit different biases."}, {"start": 279.0, "end": 293.0, "text": " Societal bias cannot be in the other parts of the machine learning pipeline, they can serve to exaggerate or mitigate that bias in the data set. But they themselves can only be statistically biased, and not societally biased."}, {"start": 293.0, "end": 311.0, "text": " But Yann LeCun made the terrible mistake of pinpointing the exact root cause of this problem, and not addressing the, I guess, wider ranging problems in the field, as some people perceive it, and he shouldn't have to write, he pretty clearly says, this is why it happens."}, {"start": 311.0, "end": 326.0, "text": " We can solve it by swapping the data set, he doesn't say anything about anything else. Namely, he doesn't say that general bias in the field is not a problem. He doesn't say that this doesn't harm anyone. None of that he simply suggests a solution."}, {"start": 326.0, "end": 347.0, "text": " Jonathan Peck says, Well, yes, that's the point. ML researchers need to be more careful selecting their data so that they don't encode biases like this. And LeCun responds with not so much ML researchers, but ML engineers, the consequences of bias are considerably more dire in a deployed product than in an academic paper, which is also correct."}, {"start": 347.0, "end": 371.0, "text": " This paper was about the method showing that this method works on this data set. Now Sumit here makes a interesting point, which I agree with saying that today, ML researchers are inadvertently powering product of a lot of non AI companies who ignorantly start with a pre trained Bert or Resnet or YOLO from the internet, probably ignoring the license, read me and so on, which is a valid point, right?"}, {"start": 371.0, "end": 388.0, "text": " There are going to be people that take this and think, Oh, this is a face up sampler. Cool. I can use that without noting that this is simply an example of implementation on an example data set. So you can argue that there might be some responsibility of the researchers right here."}, {"start": 388.0, "end": 409.0, "text": " That doesn't make young lacan not correct. But I still consider this to be like a fruitful discussion between individuals right here. But now we go on this person saying train it on the whole American population with an L two loss and almost everyone will look white, or train it on the whole American population with an L one loss and more people might look black."}, {"start": 409.0, "end": 432.0, "text": " Stop pretending that bias does not also come from algorithmic choices. Young lacan never says it doesn't right. Lacan responds now saying, the most efficient way to do it though, is to equalize the frequencies of the categories of samples during training. This forces the network to pay attention to all the relevant features for all the sample categories and training with an L one instead of an L two will not even begin to solve the problem."}, {"start": 432.0, "end": 448.0, "text": " I would pretty much argue training with an L one loss here would exacerbate the problem because the L two loss is much more sensitive to outliers. Charles Sutton says serious question, why do you feel that it's important to make this point? Are you worried that people are going to start suing CycleGAN?"}, {"start": 448.0, "end": 467.0, "text": " And Lacan says, because people should be aware of this problem and know its cause so they can fix it. How terrible, Jan, how terrible you dare pinpoint the exact cause of the problem so that people can fix it. The correct thing to do is to point out that everything is problematic."}, {"start": 467.0, "end": 485.0, "text": " So Tim Nguyberu says, Jan, I suggest you watch me and Emily's tutorial or a number of scholars who are expert in this area. You can't just reduce harms to data set bias. For once, listen to us people from marginalized communities and what we tell you, if not now during worldwide protests, not sure when."}, {"start": 485.0, "end": 502.0, "text": " So again, I feel the argument here is that you can't simply point out that it's the data set bias, you must point out the bigger problems which Jan Lacan does not ever deny. He simply says this particular problem can be solved by switching the data set."}, {"start": 502.0, "end": 518.0, "text": " Well, Larue says, Jan was in my PhD jury, I'm indebted for him for everything he taught me but this constant dismissal of the harms caused directly or indirectly by the ML community is highly problematic. Where or when have I dismissed the harm caused by the ML community?"}, {"start": 518.0, "end": 534.0, "text": " I'm pointing out the cause of the harm so it can be fixed. You can't fix the harm unless you know what causes it. No, Larue says causes of the biases are numerous only pointing out data set bias deflects the attention away from the other more pervasive ones that make the whole field of bias in ML."}, {"start": 534.0, "end": 548.0, "text": " Many people try to get your attention about these issues but you kept focus on the data set because the data set is the problem right here. He doesn't dismiss any of the other things he simply says here the data set is the problem."}, {"start": 548.0, "end": 565.0, "text": " If your problem is that it doesn't work as well for non-Concaisian people, which was never the intent of this the intent of this was to showcase the method. I mean, ImageNet is like 60% dog species. And still, people train on it to showcase their image recognition techniques."}, {"start": 565.0, "end": 582.0, "text": " No one training on ImageNet makes a claim that they have solved computer vision for all the classes in the world in a fair manner. Timnit Gibru goes on saying I'm sick of this framing tired of it. Many people have tried to explain many scholars listen to us you can't just reduce the harms caused by ML to data set bias."}, {"start": 582.0, "end": 585.0, "text": " Doesn't do that doesn't do it."}, {"start": 585.0, "end": 597.0, "text": " So someone asks her, is he engaging in any ways with you? It's appalling to see that he answers to everybody but you yet maybe there is a conversation going on in private and I don't want to jeopardize it."}, {"start": 597.0, "end": 609.0, "text": " Note that Yann LeCun's tweet has 500 retweets, 1.9k likes and comments as far as you can scroll."}, {"start": 609.0, "end": 626.0, "text": " To what she responds to with Yep, but I'm used to white men refusing to engage with black and brown women, even on issues of bias that mostly affect us. I mean, he literally has ignored a whole body of work by people from that demographic, hence the statement so not surprised."}, {"start": 626.0, "end": 634.0, "text": " I mean, in absence of the fact that an argument should be independent of the person making the argument."}, {"start": 634.0, "end": 637.0, "text": " That is a low blow."}, {"start": 637.0, "end": 647.0, "text": " Hard Maru says I respectfully disagree with Yann here. As long as progress is benchmarked on biased data, such biases will also be reflected in the inductive biases of ML systems."}, {"start": 647.0, "end": 656.0, "text": " Advancing ML with bias benchmarks and asking engineers to simply retrain models with unbiased data is not helpful. I don't disagree with you here."}, {"start": 656.0, "end": 670.0, "text": " I don't think my tweet contradicts your statement, which it doesn't. People are reading into this, because he doesn't conform to the orthodoxy of pointing out that everything and everything is problematic and simply pinpoints a particular problem."}, {"start": 670.0, "end": 674.0, "text": " He must be thinking all the wrong things."}, {"start": 674.0, "end": 687.0, "text": " Jeff Dean says this is a clear example here is an illustration that seemingly minor choices in learning algorithms or loss can have significant effects. So bias in ML systems is about much more than just avoid data bias."}, {"start": 687.0, "end": 694.0, "text": " ML researchers and practitioners must pay attention to these issues. And I think they are and Lacan doesn't say anything against that."}, {"start": 694.0, "end": 711.0, "text": " He says, as I point out in my comment to this tweet is much more efficient to correct this kind of bias. Note that Yann Lacan actually differentiates between the different kinds of biases by equalizing the frequencies of categories of samples during training, then be hacking the loss function."}, {"start": 711.0, "end": 718.0, "text": " Correct, because if you hack the loss function, you're trying to counter one kind of bias by another kind of bias."}, {"start": 718.0, "end": 732.0, "text": " Meredith Whitaker says this is very racist. And even if it recognized non white people, it would be very racist. This is cop tech. It's designed to allow those with power to surveil and control those with less power."}, {"start": 732.0, "end": 741.0, "text": " Diverse training sets aren't going to fix it, advocating that we should never build these systems. And that's a discussion to be had. But let me break this to you."}, {"start": 741.0, "end": 753.0, "text": " This isn't going to help the cops. This isn't actually giving you the face of the person that was down pixeled. This is simply going to give you the most likely face associated with that down pixel picture."}, {"start": 753.0, "end": 764.0, "text": " Given the data set the algorithm was trained on. I don't see this whenever any machine learning algorithm does anything with faces at all people jumping up going like this is cop technology."}, {"start": 764.0, "end": 773.0, "text": " Well, in line with all the broader impact statement advice, can it also be used to find lost children from very, very bad security camera footage."}, {"start": 773.0, "end": 785.0, "text": " And if I already mentioned that this doesn't actually give you back the person on the down sampled image, it will give you back the most likely person given the data set."}, {"start": 785.0, "end": 796.0, "text": " So with that, I want to conclude this section, please stop the witch hunting. Yann LeCun made a completely fine tweet here. And there's no reason why people should pile on him this hard."}, {"start": 796.0, "end": 807.0, "text": " He doesn't dismiss any of the other problems just because he doesn't mention them. And while we all enjoy a good discussion where people disagree genuinely, it's not helpful to accuse him of things he never said or meant."}, {"start": 807.0, "end": 828.0, "text": " I mean, where does this all lead? The result of this is going to be that small labs that don't have the resources to collect their own data sets, or check for all the possible biases in their models that are reliant on the data sets that we do have, even if they are biased and flawed, will just be disincentivized from publishing their code, or actually doing research at all."}, {"start": 828.0, "end": 850.0, "text": " So this as every other additional constraint on research is going to help the large corporations with lots of money. And maybe that's just my opinion, but we should be able to just talk about a problem and the solution to it without always having to make sure that we rabble down all the different things that are and might be wrong according to the canon."}, {"start": 850.0, "end": 862.0, "text": " And big props to Yann LeCun here for holding his own. 90% of people by now would probably be like, Oh, yes, I'm so sorry. I did not thoughtful comment, blah, blah, blah. Props to you Yann. Keep going."}, {"start": 862.0, "end": 880.0, "text": " And with that, I conclude this section. Let me know what you think in the comments and I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=Q5g3p9Zwjrk
SIREN: Implicit Neural Representations with Periodic Activation Functions (Paper Explained)
Implicit neural representations are created when a neural network is used to represent a signal as a function. SIRENs are a particular type of INR that can be applied to a variety of signals, such as images, sound, or 3D shapes. This is an interesting departure from regular machine learning and required me to think differently. OUTLINE: 0:00 - Intro & Overview 2:15 - Implicit Neural Representations 9:40 - Representing Images 14:30 - SIRENs 18:05 - Initialization 20:15 - Derivatives of SIRENs 23:05 - Poisson Image Reconstruction 28:20 - Poisson Image Editing 31:35 - Shapes with Signed Distance Functions 45:55 - Paper Website 48:55 - Other Applications 50:45 - Hypernetworks over SIRENs 54:30 - Broader Impact Paper: https://arxiv.org/abs/2006.09661 Website: https://vsitzmann.github.io/siren/ Abstract: Implicitly defined, continuous, differentiable signal representations parameterized by neural networks have emerged as a powerful paradigm, offering many possible benefits over conventional representations. However, current network architectures for such implicit neural representations are incapable of modeling signals with fine detail, and fail to represent a signal's spatial and temporal derivatives, despite the fact that these are essential to many physical signals defined implicitly as the solution to partial differential equations. We propose to leverage periodic activation functions for implicit neural representations and demonstrate that these networks, dubbed sinusoidal representation networks or Sirens, are ideally suited for representing complex natural signals and their derivatives. We analyze Siren activation statistics to propose a principled initialization scheme and demonstrate the representation of images, wavefields, video, sound, and their derivatives. Further, we show how Sirens can be leveraged to solve challenging boundary value problems, such as particular Eikonal equations (yielding signed distance functions), the Poisson equation, and the Helmholtz and wave equations. Lastly, we combine Sirens with hypernetworks to learn priors over the space of Siren functions. Authors: Vincent Sitzmann, Julien N. P. Martel, Alexander W. Bergman, David B. Lindell, Gordon Wetzstein Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there. Today we're looking at implicit neural representations with periodic activation functions by Vincent Sitzman, Julian NP Martel, Alexander W Bergman, David B Landell and Gordon Wetzstein. So this paper is a bit of a special paper. If you're like me coming from like classic machine learning or deep learning, things like this, this paper requires you to think around your notion of what it means to handle data and so on a bit and to think about data points and so on. Essentially what they're doing is they are representing signals such as images or sound or generally waves or point clouds. They're representing these signals as functions mapping, for example, from their coordinates to their values and we'll see what that entails. And they're not the first ones to do this, but they managed to do this very well using these new models called sirens, which are basically neural networks that have sine waves as their nonlinearities instead of like relu's or hyperbolic tangents and so on. So it turns out that if you initialize these very carefully, those can be made to capture these signals very, very well. So that's the kind of high level overview. And we'll go through the paper in a bit of a fashion of someone that is not in this particular literature. So this is not going to be like as in depth or technical as usually because I myself am not super familiar with this kind of literature, with the neural representations and so on. So if you go at this paper from a machine learning perspective, the first, like you're going to be ultimately like super confused at the beginning. So I'm going to try to kind of clear up, retrace my steps of my confusion. Okay, so I love that this paper starts out at we're interested in a class of functions phi that satisfy equations of the form this right here. Like, aren't we all like, we are interested in a class of functions. Okay, I've never, you know, particularly had many dreams about functions like this. But so how can you how can you look at this? So we're interested in the relation between inputs and outputs. This here is the function, as you can see, this maps input to output. Okay. And we're also interested in its derivatives. So here you go first, second, third derivative, and so on. So this function right here is what we're going to call a neural representation or an implicit representation. It's called a neural representation, I guess, if it's a neural network that this function is. So, so far, so good. You've seen this, right? You've seen this could be a data point, and then could map it to a label or something like this. Since we're going to represent images, you already know maybe a GANs, a generative adversarial network, where this here is the latent vector. And then you have a neural network mapping this latent vector to an image, right? So this is going to produce an image. This here is quite similar, but not quite. So in a GAN, I guess this here would count as the the representation, the continuous representation of this picture. However, in this case right here, the function itself is the representation. So in a GAN, what we do, we learn this right here, this function phi, we learn this from data such that if I plug in one particular vector, I get one particular image. And if I plug in another vector, I get another image. And the function always stays the same. Here, it's going to be one function per image. So each image, the function is the image. So how is a function an image? You can simply if I have an image and it's made of pixels, right? So it's made of pixels. Each pixel has an X and a Y coordinate. OK, let's call that X1 and X2, the coordinate of that. And each pixel also has a color value, right, which is three dimensional. So each pixel has a three dimensional RGB color value. So technically, an image is a function from coordinates to pixel values. OK, so if if and if this is my image is represented by a function, then if I input any coordinates like three, four, that function should return. What are the RGB values at that? Maybe it's like zero point five, zero point seven and zero point one. Those are the RGB values at that. OK, so now the goal is to have this right here be a neural network where I have like a multilayer perceptron. And they I think they always use like a five layer MLPs. So really simple neural networks. And you simply input. So here you have two input neurons where this here goes. So one gets the three, one gets the four. Then this travels through the network. And at the end, the network should output three output nodes. And this should be like the point five point seven point one. OK, now again, this network here is they now train this network to map input to output. OK, to map coordinates to values. And this, of course, it is one particular image. So you're going to have one neural network per image that you might reasonably ask, why? Why do we do it like this? Right. Why don't we just save the image as the pixel values? Why do we need like a function mapping the coordinates to the pixels? And that's a valid question, I guess. And the image is just one example of this. But one advantage that you immediately get is that now you have a continuous representation. So now you cannot not only do you know, because if you store an image like this, you only know its value at each of the pixel locations. However, if you store an image like this, you know its value at any continuous in between location. Right. So you can ask the network, what's the pixel value at three point two and four point one? Right. It will give you an answer. And if the network is trained well, it will give you sort of an answer that makes sense. That is, what's the exact color at this sub pixel location right here? Now, so far, so good. Right. So essentially, this boils down to not really a machine learning problem in the classic. But an optimization problem, because all you have to do is you have to make the neural network match all input to all output. There is not really a training and a test set right here. Namely, your data set is going to be all the pixels in the image. So each pixel in the image is going to be one data point because it's one. So each pixel is X, Y, two RGB. OK. And the way they train these networks at the examples of pixels, the way they train it, they simply sample a mini batch of pixels like this one, this one, this one, this one, this one. They use that mini batch to train the network to do one step to train the network. And then they sample another mini batch and so on. You might sample the same pixels multiple times. But ultimately, what you want is sort of a continuous representation of the image that there. This is not a new idea. And this has been around. And they cite a lot of literature where this has been around before. So what their new thing is, is that they say these other representations. So if you use a neural network in a classic sense like this and you do your training with the mini batches like this, what you'll end up with is a bad image. So if you then if you then simply go right once you've trained the network, you can take it and take your network and you can simply output each pixel location. So you say, OK, now I'm going to reproduce this image using my network because if it's trained well, it could certainly give me back the positions at the pixels. So you ask it, what's the zero zero? What's zero one? What's zero two? What's zero at zero three? And you can fill in the picture. And that usually gives you very bad outcomes or so they claim. I mean, I haven't checked it particularly, but you can see right here this is the ground truth. And the here you have a network that is parameterized with ReLU functions like with ReLU nonlinearities. And as you can see, the ReLU network misses a lot of the sort of higher definition things in the image. And so it depends on the architecture that you use, how well you can make a neural network represent those things. Again, you kind of need to forget what you what you know about machine learning in the classic sense, because like I'd still see people who you go like, just use a GAN or something like this. So, yes, a valid point. But we are in the business right now of of solving this particular problem. And as we'll go on to see, it's not just about images, but images are a nice example of a natural signal. So the 10H networks, you also see they I think they fail even harder. They have these artifacts back here even. And this here, it gets better when you do ReLU networks with what is called a positional encoding. So not only do you have your X and your Y coordinates go through a ReLU network, but you also have them go through a positional encoding. And that's very much like in like you would have in a transformer. So if you watch my video about attention is all you need, I explain how the positional encodings work there. But basically what you do is you map these things to cosine and sine waves. So you're going to be like the sine of X times 10 and then the sine wave of X times 100 and so on. So which you'll end up and you do the same for Y. And that ends you up with more features that sort of then the function can use to represent positions way better than just given the X and Y coordinates. If you do that, you kind of recover some of the image. But you see here they also analyze how. So this is the ground truth and this is the gradient of the ground truth, which is basically a Sobel filter. If you know that it's basically an edge detector color gradient thing. And then this here is the second derivative, the Laplacian of the image. And ideally, if your implicit representation models the signal very well, it should also model the derivatives of the signal very well. So now we're kind of connecting it to what we saw at the beginning. Right. These SIREN networks are specifically designed to not only match the signal right here, but also match its derivatives. And if you match maybe in an image, it's not so it's not that important to match the derivatives, even though it is because there are small things. Like you can see right here, the grass isn't as well represented. And here you mostly you get some artifacts that you see here in the in the gradient might not be as important for images in terms of human vision. But for many signals, it's also important to match the derivatives. And here the SIREN, even though it's trained on the image itself, you can see that its derivatives are very much in line with the original signal. So simply by matching the signal, you this architecture manages to also capture the derivatives of the signal and therefore have a more faithful representation. OK, so that was positional. RBF relu's are simply the relu network. And I think somewhere in here there is an RBF kernel. If you young kids don't know what an RBF kernel is, then yeah, no, I guess I guess I don't want to I don't want to dunk on anyone. It's basically you. Oh, how do I explain it? You map it to an infinite dimensional space using Gaussian kernels. Yeah, maybe Wikipedia is better at that than I am. So SIRENs, what what do they do in order to be able to capture a signal very well? What do how does a SIREN different from like an RBF network? And the answer is pretty, pretty, pretty simple. So the architecture of a SIREN network is the end. Does it already stand for network? I'm not sure. Honestly, maybe we'll find out. Yes, it's the Sinusoidal Representation Network. So the end is network. So we don't say SIREN network. We say SIREN. And a SIREN is simply made of what is that? Here, it's a multi layer perceptron, basically. Right. So it is a this here is the network, the network. This is the final layer of the network, which is a linear layer. Before that, you have all these layers just not concatenated, but following each other. So it's a multi layer perceptron, pretty regular. And each of the layers in the multi layer perceptron is made up like this. You have an input, you multiply it by a weight matrix, you add a bias, and then you put it through a sine wave. So the sine wave here is really that's that's the only change from a MLP otherwise. So usually here you have something like a sigmoid or a ReLU function. Now you have a sine wave. And I mean, it's a bit weird, right? Because a ReLU function is like this. So it has this center thing where it kind of switches. But here it's linear and monotonic. And here it's kind of constant. And even a even a sigmoid. So the sigmoid is I don't even remember like this. Yes, I guess. So the sigmoid is like this. So it's kind of constant here, constant here, monotonic, and so on. We're used to monotonic activation functions. Whereas a sine wave is really different. The sine wave, of course, is something like this, right? It's not monotonic at all. Like if you if you want to increase your function value at any point, and you're here and you go up the hill and you do a step that's too large, you end up down the hill again. But it turns out that these networks have some good properties if you want to capture natural signals. And they have some bad properties, namely the fact that they are periodic and go down again. And the reason why they get around the bad properties is because or so they claim they initialize the network in a very particular fashion. Because I think at least I when I when I started in deep learning, I had this idea. So a lot of other people must have had this idea too of like, hey, what if I just replaced a nonlinearity with like my sine function? Could I do something this and then tried it out and it didn't really work. So I scrapped that. Now this here, of course, isn't simply replacing the neural network. It's also using the neural network for something completely different than I would namely it's using the neural network to learn these implicit representations and not like I would to do simply for learning a data set. But still, it seems like you need to initialize them fairly with with very careful consideration. And we'll go on onto that right now. So actually, they just describe it. It's not like a it's not very interesting, but you need to sample the weights uniformly from this uniform distribution where I think, yeah, and they have a proof in the supplementary material where they sort of show why that is. So or not here we propose to draw weights with C equals six such that W is in this uniform distribution right here. Oh, no, it's different. OK. This ensures that the input to each of the sine activation is normal distributed with a standard deviation of one. Since only a few weights have magnitude larger than pi, the frequency throughout the sine network grows only slowly. Finally, we propose to initialize the first layer of the sine network with weights so that the sine function spans multiple periods over negative one to one. We found W zero to equals 30 to work well for all the applications in this work. The proposed initialization scheme yielded fast and robust convergence using the atom optimizer for all experiments in this work. So the initialization here takes a fairly prominent piece in that paper, which tells me maybe that they have spent a lot of time working on this. And this is I mean, if this is the case, this is to their credit, because I guess most people like me would try out something like this and then after a while realize it doesn't work. And to, you know, be so convinced to go and really figure out how do we need to initialize these to make it work. And of course, as you're doing this, there's still like a 99 percent chance that it's not going to work once you've done that is quite respectable. I find it might have been really different. This might have been the first thing they thought about and just worked it out. But yeah. OK, so what what is the deal with all these derivatives? Now, since this network right here has these sine waves in it. Right. So it's a neural network with sine waves as derivatives as nonlinearities. What now? So we have a neural network. What now is the first derivative of that neural network? Right. With respect to its input. So we have an input. Now, what's the first derivative with respect to its input? And the cool thing about this is what's the first derivative of a sine wave? It's, of course, a sine wave that's shifted. So it's a cosine, which is a sine wave that's simply phase shifted. And then the next derivative again is a shifted sine wave and so on. So the derivative of a siren is a siren. And that does not hold for any of these other nonlinearities. So in relu's, it's the derivative of a relu network is like a con. So if I take the derivative of this, it's like a constant zero right here and then a constant one right here. And if I then take the derivative again, it's simply a constant zero function. Right. And all these other nonlinearities, their derivatives are different from themselves. And here, since we want to not only match a signal, but also the signal's derivatives, these property of this siren becoming very, very, very handy. So how do you train a siren? We've already alluded to how you would do that in the kind of idea of matching an image where you simply train the pixel values to the RGB values. But there's more that you can do with the sirens given that they basically given that their derivatives are also sirens. What you can do. So with the image part, we've basically neglected all of this. We simply said, we want to find a relationship between the input x and the output like this. What we can also do is we can say, no, no, no, no, we want to find a relationship between the input and its first derivative and not even have this as part of the let's say of the loss function. And then we can see what comes out. So that's what they do. Oh, can I find it? Can I find it? That's what they do right here. OK, so here you see the ground truth image and this is its gradient and this is its Laplacian. OK, now we've already seen that we can fit the image itself. But what if we just fit the first derivative? So we simply input this thing right here. We input this into the siren. We do the same thing, right? The siren is now it maps x and y to RGB. But our loss function isn't going to be mapping x and y to RGB. Our loss function is going to depend on the gradient of that. So our loss function is going to be something like the gradient of the image. Let's call the image i minus the gradient of that function that maps x of this function right here. OK, because we have these auto differentiation tools right now, we can easily make this into a loss function. So here we are looking for the function whose gradient matches the gradient of the image. Now, again, you can say, why is this? Why can't we just match the image itself? And valid point. But it's not about why can't we just it's about demonstrating the power of these networks. So if you only match the gradients, right, what you'll find is if you then look at the function, right, you still find the function. You don't you don't find the gradient. You still train the function. You still train the weights of the function itself. But the loss function depends on the gradient of that function. If you do that, you'll find that if you then look at the function, again, you can ask the function to produce the image by simply cycling over each of the coordinates. You'll find that look at that just by matching the gradient, you'll match the image itself pretty, pretty well. Right. And that's pretty cool. Now, of course, you're not going to match the RGB values. This is a grayscale image. And, you know, there's a there's kind of a reason for that, because since the gradient loses like constant bias information. So what if you'd match an RGB image, I'm going to guess you're going to have like color, very much color distortions. But and here, what you're going to have in this case is just distortions in luminosity. Like, if you know that if you have a function, if you have the derivative of a function, and you will want to find the function itself, and you integrate, then the solution is always an entire space of functions. Because you will integrate the function, this thing right here. And so with the whatever its input is, and you have to add a constant and you don't know what the constant was in the original function, because when you derive the function, the constant drops away. So similarly here, what we'd expect is that the image that we're getting back will be faithful with respect to like its its borders, right, since we're matching the gradient, and the gradient is basically an edge detector will match the sort of edge information of the picture, which you can clearly see. But what we would expect is some difference in overall luminosity. And I don't even know what how they exactly did this, because they now have to choose a constant to add. Maybe they just chose it in some way, or maybe they just let the network do. But this is, you know, still pretty, pretty impressive. You can see there's some detail missing, but not much. And the same exact same thing you can do for matching the second derivative. So now you match the Laplacian of the image. And remember, in the ReLU networks, they don't even have a Laplacian, it's a constant. So this is something you could never do. And you can see that the outcome image is still pretty good, right? This is now missing the constant luminosity in the first and second derivative, sorry, in the zero and first derivative. And still, the information is the reconstruction is pretty good. Alright, so this demonstrates kind of the power of these networks. Again, we're not having our data set, our entire data set is just this image. So if we fit something, then this thing right here is our entire data set. There's no, there's no big data set. And this is a test sample. Like this is the data set and the test sample at the same, I guess you can consider the Laplacian here the data set, and then the actual image is the test sample, like the label or something like this. So what does that buy you? Here is a thing you can do. If you want to mix two images, what do you do? So if you want to mix this and this, what you could do is linearly interpolate, but that would be not very cool. Because right here, you have a lot of, like, very bright pixels, which probably have like values of one. And here, you'd have the dark pixels, which probably have values like more close to zero. And the if you simply mix them, if you simply add them together and divide by two, then you get kind of get a wash of the two. And similarly, here, you kind of wash out the bear, because you'd have some pixel values here that would come over. And generally not not a good idea to mix images like this. Now, you know, with GANs, we can do this, but we have to have like a training data set and so on. Here, what we'll say is we'll simply say, we'll take the gradient of this, and we'll take the gradient of this, and then we'll add the two gradient maps. Now, what this does is that, as you can see right here on the left is the composite gradients. And what this does is right here in the sky, there is no gradient information in this image because it's just a flat patch of sky. So, and down, maybe down here, there's not that much gradient information, there is a bit right, but not here. So that's where this bear head is. And if you want to mix images, like it can be a good idea to mix their gradients, because generally the information in an image is where the gradients are. So what we would expect the gradient to represent the gradient would carry over this portion, maybe carry over a bit of this portion, it would carry over this portion and this portion. So everything where the signal is not flat. So here you can see the composite gradient. And if we fit, again, we fit our function such that the gradient of the function that we fit matches this mixed gradient right here, then this is the gradient of the function that we match, and this is the actual function. And you can see, pretty, pretty good, right? It basically mixed everywhere where there was gradient. And this is now just reconstructed from this gradient, there is no, I think there is no, at least as I understand it, there is no pixel information carried over from either of those images, they're simply added to this gradient, the gradient is fit. And then the function is asked to output pixel value at each location. And that's that. Okay, so this is just a simple, you know, thing that you can play around with. But they do, they do other more interesting things right here. For example, this representing shapes with signed distance functions. So if you go over the formulation, the actual formulation of their loss function, we haven't actually done this right quite yet. It's here, it's very complicatedly stated. But ultimately, what this means is so a component right here is are these cm, which are constraints. So this loss function operates on these constraints. And the constraints are across a of x, which basically is just x, it's kind of a the anything depending on the input itself, then the output of the function, the gradient of the output of the function, the second derivative, third derivative, and so on. So this, these sirens can fit anything that you can formulate as a set of constraints that relate the input of the function right here to its output or any of its derivatives. And we've already seen that at once we if we fit an image, our only constraint is that these things match right here with the original image that the coordinates are mapped to the RGB values, then when we match the gradients, we don't care about this, we only care about the relation between this, and so on. So the loss function is literally just over the entire signal space, which in our case was was over the entire image, we want these constraints to hold or to be as small as possible, or the constraints are always formulate such that if they are fulfilled, they equal zero. And so the for example, the L2 loss between the RGB values of the true image and the RGB values that you fit the RGB loss, sorry, the L2 loss would be a constraint like this. And of course, the more differentiable you make it, the more the easier this network has at fitting it right. So that's why there's this norm right here. But it's not that complicated. It simply says, whatever you can formulate as a constraint on relating the inputs to the outputs or any of the derivatives of this implicit representation, that is the loss function. Alright, so the in the next interesting thing we can do, as I said, is representing shapes with signed distance functions. So we're going to go slowly. And this is, yeah, it's not that hard. Inspired by recent work on shape representation with differentiable signed distance functions, SDFs, we fit SDFs directly on oriented point clouds, using both ReLU based implicit neural representations and sirens. Okay, so what is an SDF, a signed distance function? That's pretty easy. A signed distance function is simply a distance function with a sign like wow. So, if you have a and it's usually done if you have like a boundary somewhere between things, then of course, any point here has a distance to the boundary. But you if you have a signed distance function, it simply means that each point also has a sign in front of it. And that means all the things on one side of the boundary maybe have a plus and all the things on the other side maybe have a minus. So even though two points could be the same distance from the boundary, one is like plus five away and one is negative five away. And you can do this. This is useful, for example, when you fit point clouds as they do in this example. So when they have point clouds and that's usually in 3D space. But if you have point clouds, you basically have points right here and you know that the points should represent some kind of shape, maybe a wall or so. So they have these room interiors, as you can see right here. So this is a 3D scene, but you only have a point cloud of the 3D scene. And what that means is that maybe you were in this room and you put up a laser scanner right here. Laser scanner. I don't know how a laser scanner looks. And the laser scanner kind of shoots lasers at random locations and always measures the distance. And that's how you end up with a point cloud. So you'll end up with like a point cloud where in 3D space you know where the laser hit something. And the reasonable assumption to make if you have like a dense sampling of this is that you should be able to connect those point clouds in some way to obtain the actual continuous shape of the thing that you measured. And this is what we're going to try to do with these sirens, right? To go from point clouds to shape by training an implicit representation. So we're going to train a neural network that represents this shape right here, basically by mapping coordinates to signed distance values. So whenever we ask the neural network at this location here, what's the signed distance? And it's going to tell us, oh, it's plus five. Or at this location here, what's the signed distance? It's going to tell us, ah, it's zero. So we're going to train a neural network to do that. And hello? Yes? No? OK. So this is a bit more complicated. And since we have these awesome power of these sirens, we can also do two more constraints. So we know, and this goes on, this amounts to solving a particular iconal boundary value problem that constrains the norm of spatial gradients to be one almost everywhere. So this iconal boundary value problem, this is a property of signed distance function that the norm of the gradients with respect to the input is one almost everywhere. Almost everywhere means everywhere, I guess, except at the boundary itself where the distance is zero. Though I could be wrong. Note that ReLU networks are seemingly ideal for representing SDFs as their gradients are locally constant and their second derivatives are zero. Adequate training procedure for working directly with point clouds were described in prior work. We fit a siren to an oriented point cloud using a loss of the form. And now we'll look at the loss. So the first thing you observe in the loss is that it is made of three different integrals. And that simply means they now partition the space right here. They partition it into two different regions, so to say. So maybe go here. No, can I zoom here? So the first region is going to be whatever is on the boundary itself. Right. And that's basically wherever a point, wherever a point hit. Right. Whenever you have a point or on the boundary itself, that's going to be your omega zero is going to be that. And then all the other points right here are going to be part of your omega without the omega zero. So you're going to have different constraints for all of these things right here, for example. And I have to pay attention that I don't say anything wrong. You will have this this constraint of this gradient. My tablet. Maybe I'll start monetizing just so I can get a new tablet. OK, so. No, OK. This condition right here says that the gradient should be one. And that's actually everywhere. Right. So I was wrong that the gradient is only one outside the boundary. Then you can see right here. The last part is all the points that are not on the boundary since our network maps any point in 3D space to assign distance function. So most of these points aren't going to be on the boundary itself, even though in the mini batch where we train, where they train, they sample points on and off the on and off the boundary at the at equal rates just to to have the network train more stably. So this is a condition on all the points off of the boundary. And they say here this function is this exponential function with alpha larger than one. It penalizes off surface points for creating SDF values close to zero. So this is simply a regularizer that says whenever I input coordinates that are far away from the boundary from the surface, then there should be a large sine distance function like it should not be close to zero because it's away from a boundary. OK. And in practice, how are you going to train this is if you have a point cloud, if your coordinates are far away from the next point, then this this is going to be a high. This should be a high value. Otherwise, the network is penalized. So we have this condition right here on the gradients, which we know sign distance function should fulfill. We have this thing right here, which is a regularizer, basically telling points far away from our data that they should have a high distance function. And then we have this last thing right here, which is for all the points on the surface itself. Here's what we'll what we require. First of all, we require their value to be zero or close to zero. Right. This is the loss function. So we want to minimize this. And this is simply the output value. So the sine distance function of points on the surface, you know, the things we actually measure, they should be zero. Because the sine distance function measures how far away from the surface you are. So this is pretty intuitive. But then also this right here, it says that the gradient of the sine distance function and the normal vector of that point should align. And that basically means and this is now I think this is because we have an oriented point cloud or no. Yes. So what we can do is we can kind of connect points next to each other and then calculate the normal vectors of that. Right. And the signed the network, if we ask the network, hey, what do you think about this position right here? The network should tell us, first of all, the sine distance function should be zero because it's on the boundary. Second of all, the norm of the gradient of the sine distance function at that point should be one because that's a property of sine distance function. And third, and that's the thing right now, the gradient of the sine distance function should align with this normal vector. Right. And that's pretty intuitive because you want you want the sine distance function to increase in value. The gradient basically tells you where the highest increase in value of the function is. You want it to increase along the normal direction and not along any other direction. So that's a pretty good, pretty good constraint to have. So you can see right here. I mean, you don't really have to understand exactly about sine distance functions and so on, but these sirens are pretty good at capturing all of these different constraints. And this was a point, you know, on the surface points off the surface. You additionally say, hey, you should have a pretty high value and actually not a zero value, but a pretty high value. So and again, we only fit one particular scene. We only ever fit one scene with an entire network. So the entire neural network, this this this whole structure right here, everything is captured by this neural network that we train on the point cloud. And you can see that if you use a ReLU, what you'll get is super, super wobbly, because if even if you train the ReLU with the same loss function, these constraints on the gradients, they're just not going to work out with the ReLU because the gradients are like constant and discontinuous, right? Whereas the siren can basically fulfill all of these constraints on the different parts, like on the values and on the gradients of the of the loss function. And they have another example right here where they fit this shape. Yeah, so you see all the details are preserved way better where the ReLUs, they'll simply kind of flatten over everything and make it wobbly. All right. So I hope this sort of made sense. And we'll go to the last thing right now. While it is restarting, I wanted to show you the website right here they have for this. It's a pretty cool website to go along with it. And as you can see right here, they have all these samples that they have in the paper, but also in animated format. And as you can see right here, this is the fitting process, the learning process of how you represent these images. So as I said, there, you want to fit these functions to the ground truth, and that happens in steps. So this is very much like you would learn a deep learning functions. I think they use the atom optimizer. It's just that the data set now comes all comes from this one ground truth image. And you can see that the siren network on the right pretty quickly zeros in on the on the image and then gets the details subsequently right. They also represent audio with this and you can watch that they represent video. Compare that to ReLU representations. Then here solving the Poisson equation is where you only fit the gradients or the Laplacian of an image and still get out the good image. That's pretty cool. And here you can see that you can actually play around with these things so you can click on them and look at this look at this learned thing. So on the left, you can see what the siren network learned and scroll down here a bit. And on the right is a ReLU representation of the same thing. So this is the same network with the same objective. It just has ReLUs instead of sine waves as activation functions. So you can see how much of a difference that makes right here. And the middle is a ReLU with the positional encodings. Still not good. The only the only thing right here that you have to think of, if you look at how big these sirens are, how many parameters they have, they're about at the order of magnitude of how many pixels there are in the image. So I'm. Yeah, it's certainly a cool method, but to like this, it's not like you're the implicit representation here is very, very well at generalizing, though it would be very cool to see what happens outside. Right. If you because now you have you can input any x y coordinates. So technically, you could continue the picture to the bottom and just see what the siren thinks should be here at the bottom. So all of these things would be pretty, pretty cool to actually experiment with. And they have the code available to do that. And you can see the fitting process of the Helmholtz equation right here and related projects. Pretty cool website. I definitely invite you to check it out. And let's go back to the paper and we're back and my tablet crashed. And let's continue. So they're now going on to use sirens in order to solve PDEs. And so in physics, often you have these problems where you are given an equation, but the equation doesn't necessarily involve a function itself, but only involves derivatives of that function like or relates derivatives to the function and so on. So one example here is this Helmholtz equation that's given as this, where the I think the the F is a known function, but this is the wave field we want to you want to get, you want to figure out which is unknown. And then this H of M is including, for example, this right here, which is the Laplace operator. So you're given the relation between the function and a Laplace operator of the wave that you want to find out. And your task is to recover the wave. Now, I don't want to go very much into this right here. But what you can do is basically you can measure. You can have a room and you can have measurements of the wave or of its derivatives and so on. And then you kind of calculate backwards from the measurements to what the actual wave was. And these sirens turn out to be very, very good at things like this. And I guess that's in this solving for the wave field things. But essentially, what this amounts to is a numerical solution of these partial differential equations in physics using these sirens. And that's pretty cool. And the last thing they do is and this gets back to a more of the machine learning context, where they say learning a space of implicit functions. So now they go ahead and say, yeah, so we can represent images in terms of these of these functions, right, but each image is basically its own function. So each image is basically an optimization of fitting problem. Can we somehow learn functions of functions? So this goes this comes now back to more of a machine learning context where you say, ah, so I have a network right here that I have a network that gives me the parameters of the siren. So this right here is okay, let's let's go to an example. In this example, what you'll have is you'll have an image like this one, where a few pixels are masked, actually, most of the pixels are masked. And you want to put this into a CNN. And the CNN should output the parameters of the siren network. So the parameters because the siren network, given its parameters, is the image itself. So that's the siren, I said siren network, the siren is the image, if you know its parameters, right. So here, you train a CNN to give you the parameters of the siren. That's almost the same as training a CNN to give you the image directly. But again, we don't want to have the explicit representation of an image, we want to have the implicit representation such that it's continuous, and we can manipulate it and so on. So the CNN is now trained on a data set. So you take C410, and you construct a whole bunch of, of images with only kind of 100 pixels remaining. And then you train a CNN to give you the parameters of the siren that would reconstruct the ground truth, right. And then you can test that on the test image. And you can see right here, the results are pretty good. So these are test samples. These are now, these are now images that were not seen during training of this CNN. And therefore, the outcoming siren also hasn't seen that image, it's the siren is simply parameterized by the CNN. You can see this works pretty well. So if you only have 10 pixels, you already get something out of it, right. And if you have 100 pixel, you already get fairly close to the to the ground truth right here. Now, this is not GAN quality images, of course, but it's pretty impressive to see that an implicit parameterization, an implicit representation of the images can be so powerful, right? Yeah, so this, this is a pretty cool thing. And again, it's better than, it's kind of more back to the machine learning framework that you're used to. There's a train and test data set. And now the only thing is that the output is a function given by its parameters, and not the actual pixel values. Okay, so let's look at the broader impact statement. The proposed siren representation enables accurate representations of natural signals, such as images, audio and video in a deep learning framework. This may be an enabler for downstream tasks involving such signals such as classification for images or speech to text systems for audio. Such applications may be leveraged for both positive and negative ends. Siren may in the future further enable novel approaches to the generation of such signals. This has potential for misuse in impersonating actors without their consent. For an in depth discussion of so called deep fakes, we refer the reader to a recent review article in neural rendering. This has, this has like no perplexity, like, no perplexity at all. Like, is anyone benefited by this? Seriously? Okay. But at least we made the authors think of the consequences of their research. Yeah, so I invite you to check out this paper, maybe with this right now, you can follow a bit better. What happens here, this is a different paradigm of research. It's a cool paradigm. It's away from your usual machine learning framework. And yeah, so I'm excited what happens next in this. I also invite you to check out the websites. They have lots of videos and goodies and so on. And with that, bye bye.
[{"start": 0.0, "end": 14.0, "text": " Hi there. Today we're looking at implicit neural representations with periodic activation functions by Vincent Sitzman, Julian NP Martel, Alexander W Bergman, David B Landell and Gordon Wetzstein."}, {"start": 14.0, "end": 35.0, "text": " So this paper is a bit of a special paper. If you're like me coming from like classic machine learning or deep learning, things like this, this paper requires you to think around your notion of what it means to handle data and so on a bit and to think about data points and so on."}, {"start": 35.0, "end": 45.0, "text": " Essentially what they're doing is they are representing signals such as images or sound or generally waves or point clouds."}, {"start": 45.0, "end": 57.0, "text": " They're representing these signals as functions mapping, for example, from their coordinates to their values and we'll see what that entails."}, {"start": 57.0, "end": 81.0, "text": " And they're not the first ones to do this, but they managed to do this very well using these new models called sirens, which are basically neural networks that have sine waves as their nonlinearities instead of like relu's or hyperbolic tangents and so on."}, {"start": 81.0, "end": 95.0, "text": " So it turns out that if you initialize these very carefully, those can be made to capture these signals very, very well. So that's the kind of high level overview."}, {"start": 95.0, "end": 118.0, "text": " And we'll go through the paper in a bit of a fashion of someone that is not in this particular literature. So this is not going to be like as in depth or technical as usually because I myself am not super familiar with this kind of literature, with the neural representations and so on."}, {"start": 118.0, "end": 127.0, "text": " So if you go at this paper from a machine learning perspective, the first, like you're going to be ultimately like super confused at the beginning."}, {"start": 127.0, "end": 135.0, "text": " So I'm going to try to kind of clear up, retrace my steps of my confusion."}, {"start": 135.0, "end": 151.0, "text": " Okay, so I love that this paper starts out at we're interested in a class of functions phi that satisfy equations of the form this right here. Like, aren't we all like, we are interested in a class of functions."}, {"start": 151.0, "end": 169.0, "text": " Okay, I've never, you know, particularly had many dreams about functions like this. But so how can you how can you look at this? So we're interested in the relation between inputs and outputs."}, {"start": 169.0, "end": 174.0, "text": " This here is the function, as you can see, this maps input to output. Okay."}, {"start": 174.0, "end": 183.0, "text": " And we're also interested in its derivatives. So here you go first, second, third derivative, and so on."}, {"start": 183.0, "end": 191.0, "text": " So this function right here is what we're going to call a neural representation or an implicit representation."}, {"start": 191.0, "end": 197.0, "text": " It's called a neural representation, I guess, if it's a neural network that this function is."}, {"start": 197.0, "end": 207.0, "text": " So, so far, so good. You've seen this, right? You've seen this could be a data point, and then could map it to a label or something like this."}, {"start": 207.0, "end": 217.0, "text": " Since we're going to represent images, you already know maybe a GANs, a generative adversarial network, where this here is the latent vector."}, {"start": 217.0, "end": 226.0, "text": " And then you have a neural network mapping this latent vector to an image, right? So this is going to produce an image."}, {"start": 226.0, "end": 239.0, "text": " This here is quite similar, but not quite. So in a GAN, I guess this here would count as the the representation, the continuous representation of this picture."}, {"start": 239.0, "end": 245.0, "text": " However, in this case right here, the function itself is the representation."}, {"start": 245.0, "end": 257.0, "text": " So in a GAN, what we do, we learn this right here, this function phi, we learn this from data such that if I plug in one particular vector, I get one particular image."}, {"start": 257.0, "end": 266.0, "text": " And if I plug in another vector, I get another image. And the function always stays the same. Here, it's going to be one function per image."}, {"start": 266.0, "end": 271.0, "text": " So each image, the function is the image. So how is a function an image?"}, {"start": 271.0, "end": 279.0, "text": " You can simply if I have an image and it's made of pixels, right? So it's made of pixels."}, {"start": 279.0, "end": 288.0, "text": " Each pixel has an X and a Y coordinate. OK, let's call that X1 and X2, the coordinate of that."}, {"start": 288.0, "end": 294.0, "text": " And each pixel also has a color value, right, which is three dimensional."}, {"start": 294.0, "end": 299.0, "text": " So each pixel has a three dimensional RGB color value."}, {"start": 299.0, "end": 306.0, "text": " So technically, an image is a function from coordinates to pixel values."}, {"start": 306.0, "end": 319.0, "text": " OK, so if if and if this is my image is represented by a function, then if I input any coordinates like three, four, that function should return."}, {"start": 319.0, "end": 326.0, "text": " What are the RGB values at that? Maybe it's like zero point five, zero point seven and zero point one."}, {"start": 326.0, "end": 339.0, "text": " Those are the RGB values at that. OK, so now the goal is to have this right here be a neural network where I have like a multilayer perceptron."}, {"start": 339.0, "end": 344.0, "text": " And they I think they always use like a five layer MLPs. So really simple neural networks."}, {"start": 344.0, "end": 351.0, "text": " And you simply input. So here you have two input neurons where this here goes."}, {"start": 351.0, "end": 356.0, "text": " So one gets the three, one gets the four. Then this travels through the network."}, {"start": 356.0, "end": 365.0, "text": " And at the end, the network should output three output nodes. And this should be like the point five point seven point one."}, {"start": 365.0, "end": 377.0, "text": " OK, now again, this network here is they now train this network to map input to output."}, {"start": 377.0, "end": 384.0, "text": " OK, to map coordinates to values. And this, of course, it is one particular image."}, {"start": 384.0, "end": 390.0, "text": " So you're going to have one neural network per image that you might reasonably ask, why?"}, {"start": 390.0, "end": 395.0, "text": " Why do we do it like this? Right. Why don't we just save the image as the pixel values?"}, {"start": 395.0, "end": 400.0, "text": " Why do we need like a function mapping the coordinates to the pixels?"}, {"start": 400.0, "end": 405.0, "text": " And that's a valid question, I guess. And the image is just one example of this."}, {"start": 405.0, "end": 411.0, "text": " But one advantage that you immediately get is that now you have a continuous representation."}, {"start": 411.0, "end": 421.0, "text": " So now you cannot not only do you know, because if you store an image like this, you only know its value at each of the pixel locations."}, {"start": 421.0, "end": 428.0, "text": " However, if you store an image like this, you know its value at any continuous in between location."}, {"start": 428.0, "end": 435.0, "text": " Right. So you can ask the network, what's the pixel value at three point two and four point one? Right."}, {"start": 435.0, "end": 441.0, "text": " It will give you an answer. And if the network is trained well, it will give you sort of an answer that makes sense."}, {"start": 441.0, "end": 449.0, "text": " That is, what's the exact color at this sub pixel location right here?"}, {"start": 449.0, "end": 457.0, "text": " Now, so far, so good. Right. So essentially, this boils down to not really a machine learning problem in the classic."}, {"start": 457.0, "end": 467.0, "text": " But an optimization problem, because all you have to do is you have to make the neural network match all input to all output."}, {"start": 467.0, "end": 473.0, "text": " There is not really a training and a test set right here. Namely, your data set is going to be all the pixels in the image."}, {"start": 473.0, "end": 479.0, "text": " So each pixel in the image is going to be one data point because it's one."}, {"start": 479.0, "end": 489.0, "text": " So each pixel is X, Y, two RGB. OK. And the way they train these networks at the examples of pixels, the way they train it,"}, {"start": 489.0, "end": 498.0, "text": " they simply sample a mini batch of pixels like this one, this one, this one, this one, this one."}, {"start": 498.0, "end": 504.0, "text": " They use that mini batch to train the network to do one step to train the network."}, {"start": 504.0, "end": 509.0, "text": " And then they sample another mini batch and so on. You might sample the same pixels multiple times."}, {"start": 509.0, "end": 515.0, "text": " But ultimately, what you want is sort of a continuous representation of the image that there."}, {"start": 515.0, "end": 523.0, "text": " This is not a new idea. And this has been around. And they cite a lot of literature where this has been around before."}, {"start": 523.0, "end": 530.0, "text": " So what their new thing is, is that they say these other representations."}, {"start": 530.0, "end": 539.0, "text": " So if you use a neural network in a classic sense like this and you do your training with the mini batches like this,"}, {"start": 539.0, "end": 546.0, "text": " what you'll end up with is a bad image. So if you then if you then simply go right once you've trained the network,"}, {"start": 546.0, "end": 551.0, "text": " you can take it and take your network and you can simply output each pixel location."}, {"start": 551.0, "end": 564.0, "text": " So you say, OK, now I'm going to reproduce this image using my network because if it's trained well, it could certainly give me back the positions at the pixels."}, {"start": 564.0, "end": 571.0, "text": " So you ask it, what's the zero zero? What's zero one? What's zero two? What's zero at zero three?"}, {"start": 571.0, "end": 577.0, "text": " And you can fill in the picture. And that usually gives you very bad outcomes or so they claim."}, {"start": 577.0, "end": 583.0, "text": " I mean, I haven't checked it particularly, but you can see right here this is the ground truth."}, {"start": 583.0, "end": 592.0, "text": " And the here you have a network that is parameterized with ReLU functions like with ReLU nonlinearities."}, {"start": 592.0, "end": 602.0, "text": " And as you can see, the ReLU network misses a lot of the sort of higher definition things in the image."}, {"start": 602.0, "end": 611.0, "text": " And so it depends on the architecture that you use, how well you can make a neural network represent those things."}, {"start": 611.0, "end": 618.0, "text": " Again, you kind of need to forget what you what you know about machine learning in the classic sense,"}, {"start": 618.0, "end": 624.0, "text": " because like I'd still see people who you go like, just use a GAN or something like this."}, {"start": 624.0, "end": 631.0, "text": " So, yes, a valid point. But we are in the business right now of of solving this particular problem."}, {"start": 631.0, "end": 639.0, "text": " And as we'll go on to see, it's not just about images, but images are a nice example of a natural signal."}, {"start": 639.0, "end": 646.0, "text": " So the 10H networks, you also see they I think they fail even harder. They have these artifacts back here even."}, {"start": 646.0, "end": 656.0, "text": " And this here, it gets better when you do ReLU networks with what is called a positional encoding."}, {"start": 656.0, "end": 662.0, "text": " So not only do you have your X and your Y coordinates go through a ReLU network,"}, {"start": 662.0, "end": 668.0, "text": " but you also have them go through a positional encoding. And that's very much like in like you would have in a transformer."}, {"start": 668.0, "end": 675.0, "text": " So if you watch my video about attention is all you need, I explain how the positional encodings work there."}, {"start": 675.0, "end": 682.0, "text": " But basically what you do is you map these things to cosine and sine waves."}, {"start": 682.0, "end": 693.0, "text": " So you're going to be like the sine of X times 10 and then the sine wave of X times 100 and so on."}, {"start": 693.0, "end": 702.0, "text": " So which you'll end up and you do the same for Y. And that ends you up with more features that sort of"}, {"start": 702.0, "end": 708.0, "text": " then the function can use to represent positions way better than just given the X and Y coordinates."}, {"start": 708.0, "end": 716.0, "text": " If you do that, you kind of recover some of the image. But you see here they also analyze how."}, {"start": 716.0, "end": 722.0, "text": " So this is the ground truth and this is the gradient of the ground truth, which is basically a Sobel filter."}, {"start": 722.0, "end": 727.0, "text": " If you know that it's basically an edge detector color gradient thing."}, {"start": 727.0, "end": 732.0, "text": " And then this here is the second derivative, the Laplacian of the image."}, {"start": 732.0, "end": 746.0, "text": " And ideally, if your implicit representation models the signal very well, it should also model the derivatives of the signal very well."}, {"start": 746.0, "end": 749.0, "text": " So now we're kind of connecting it to what we saw at the beginning."}, {"start": 749.0, "end": 762.0, "text": " Right. These SIREN networks are specifically designed to not only match the signal right here, but also match its derivatives."}, {"start": 762.0, "end": 776.0, "text": " And if you match maybe in an image, it's not so it's not that important to match the derivatives, even though it is because there are small things."}, {"start": 776.0, "end": 782.0, "text": " Like you can see right here, the grass isn't as well represented."}, {"start": 782.0, "end": 793.0, "text": " And here you mostly you get some artifacts that you see here in the in the gradient might not be as important for images in terms of human vision."}, {"start": 793.0, "end": 796.0, "text": " But for many signals, it's also important to match the derivatives."}, {"start": 796.0, "end": 806.0, "text": " And here the SIREN, even though it's trained on the image itself, you can see that its derivatives are very much in line with the original signal."}, {"start": 806.0, "end": 821.0, "text": " So simply by matching the signal, you this architecture manages to also capture the derivatives of the signal and therefore have a more faithful representation."}, {"start": 821.0, "end": 827.0, "text": " OK, so that was positional. RBF relu's are simply the relu network."}, {"start": 827.0, "end": 831.0, "text": " And I think somewhere in here there is an RBF kernel."}, {"start": 831.0, "end": 843.0, "text": " If you young kids don't know what an RBF kernel is, then yeah, no, I guess I guess I don't want to I don't want to dunk on anyone."}, {"start": 843.0, "end": 849.0, "text": " It's basically you. Oh, how do I explain it?"}, {"start": 849.0, "end": 858.0, "text": " You map it to an infinite dimensional space using Gaussian kernels."}, {"start": 858.0, "end": 862.0, "text": " Yeah, maybe Wikipedia is better at that than I am."}, {"start": 862.0, "end": 869.0, "text": " So SIRENs, what what do they do in order to be able to capture a signal very well?"}, {"start": 869.0, "end": 874.0, "text": " What do how does a SIREN different from like an RBF network?"}, {"start": 874.0, "end": 877.0, "text": " And the answer is pretty, pretty, pretty simple."}, {"start": 877.0, "end": 883.0, "text": " So the architecture of a SIREN network is the end. Does it already stand for network?"}, {"start": 883.0, "end": 890.0, "text": " I'm not sure. Honestly, maybe we'll find out."}, {"start": 890.0, "end": 896.0, "text": " Yes, it's the Sinusoidal Representation Network. So the end is network."}, {"start": 896.0, "end": 901.0, "text": " So we don't say SIREN network. We say SIREN."}, {"start": 901.0, "end": 905.0, "text": " And a SIREN is simply made of what is that?"}, {"start": 905.0, "end": 910.0, "text": " Here, it's a multi layer perceptron, basically."}, {"start": 910.0, "end": 915.0, "text": " Right. So it is a this here is the network, the network."}, {"start": 915.0, "end": 919.0, "text": " This is the final layer of the network, which is a linear layer."}, {"start": 919.0, "end": 928.0, "text": " Before that, you have all these layers just not concatenated, but following each other."}, {"start": 928.0, "end": 931.0, "text": " So it's a multi layer perceptron, pretty regular."}, {"start": 931.0, "end": 936.0, "text": " And each of the layers in the multi layer perceptron is made up like this."}, {"start": 936.0, "end": 944.0, "text": " You have an input, you multiply it by a weight matrix, you add a bias, and then you put it through a sine wave."}, {"start": 944.0, "end": 951.0, "text": " So the sine wave here is really that's that's the only change from a MLP otherwise."}, {"start": 951.0, "end": 959.0, "text": " So usually here you have something like a sigmoid or a ReLU function."}, {"start": 959.0, "end": 964.0, "text": " Now you have a sine wave. And I mean, it's a bit weird, right?"}, {"start": 964.0, "end": 971.0, "text": " Because a ReLU function is like this. So it has this center thing where it kind of switches."}, {"start": 971.0, "end": 975.0, "text": " But here it's linear and monotonic. And here it's kind of constant."}, {"start": 975.0, "end": 984.0, "text": " And even a even a sigmoid. So the sigmoid is I don't even remember like this."}, {"start": 984.0, "end": 988.0, "text": " Yes, I guess. So the sigmoid is like this."}, {"start": 988.0, "end": 991.0, "text": " So it's kind of constant here, constant here, monotonic, and so on."}, {"start": 991.0, "end": 997.0, "text": " We're used to monotonic activation functions. Whereas a sine wave is really different."}, {"start": 997.0, "end": 1004.0, "text": " The sine wave, of course, is something like this, right?"}, {"start": 1004.0, "end": 1010.0, "text": " It's not monotonic at all. Like if you if you want to increase your function value at any point,"}, {"start": 1010.0, "end": 1016.0, "text": " and you're here and you go up the hill and you do a step that's too large, you end up down the hill again."}, {"start": 1016.0, "end": 1028.0, "text": " But it turns out that these networks have some good properties if you want to capture natural signals."}, {"start": 1028.0, "end": 1035.0, "text": " And they have some bad properties, namely the fact that they are periodic and go down again."}, {"start": 1035.0, "end": 1045.0, "text": " And the reason why they get around the bad properties is because or so they claim they initialize the network in a very particular fashion."}, {"start": 1045.0, "end": 1050.0, "text": " Because I think at least I when I when I started in deep learning, I had this idea."}, {"start": 1050.0, "end": 1059.0, "text": " So a lot of other people must have had this idea too of like, hey, what if I just replaced a nonlinearity with like my sine function?"}, {"start": 1059.0, "end": 1065.0, "text": " Could I do something this and then tried it out and it didn't really work. So I scrapped that."}, {"start": 1065.0, "end": 1069.0, "text": " Now this here, of course, isn't simply replacing the neural network."}, {"start": 1069.0, "end": 1083.0, "text": " It's also using the neural network for something completely different than I would namely it's using the neural network to learn these implicit representations and not like I would to do simply for learning a data set."}, {"start": 1083.0, "end": 1093.0, "text": " But still, it seems like you need to initialize them fairly with with very careful consideration."}, {"start": 1093.0, "end": 1097.0, "text": " And we'll go on onto that right now."}, {"start": 1097.0, "end": 1122.0, "text": " So actually, they just describe it. It's not like a it's not very interesting, but you need to sample the weights uniformly from this uniform distribution where I think, yeah, and they have a proof in the supplementary material where they sort of show why that is."}, {"start": 1122.0, "end": 1131.0, "text": " So or not here we propose to draw weights with C equals six such that W is in this uniform distribution right here."}, {"start": 1131.0, "end": 1142.0, "text": " Oh, no, it's different. OK. This ensures that the input to each of the sine activation is normal distributed with a standard deviation of one."}, {"start": 1142.0, "end": 1151.0, "text": " Since only a few weights have magnitude larger than pi, the frequency throughout the sine network grows only slowly."}, {"start": 1151.0, "end": 1162.0, "text": " Finally, we propose to initialize the first layer of the sine network with weights so that the sine function spans multiple periods over negative one to one."}, {"start": 1162.0, "end": 1168.0, "text": " We found W zero to equals 30 to work well for all the applications in this work."}, {"start": 1168.0, "end": 1174.0, "text": " The proposed initialization scheme yielded fast and robust convergence using the atom optimizer for all experiments in this work."}, {"start": 1174.0, "end": 1182.0, "text": " So the initialization here takes a fairly prominent piece in that paper, which tells me maybe that they have spent a lot of time working on this."}, {"start": 1182.0, "end": 1193.0, "text": " And this is I mean, if this is the case, this is to their credit, because I guess most people like me would try out something like this and then after a while realize it doesn't work."}, {"start": 1193.0, "end": 1201.0, "text": " And to, you know, be so convinced to go and really figure out how do we need to initialize these to make it work."}, {"start": 1201.0, "end": 1211.0, "text": " And of course, as you're doing this, there's still like a 99 percent chance that it's not going to work once you've done that is quite respectable."}, {"start": 1211.0, "end": 1216.0, "text": " I find it might have been really different. This might have been the first thing they thought about and just worked it out."}, {"start": 1216.0, "end": 1222.0, "text": " But yeah. OK, so what what is the deal with all these derivatives?"}, {"start": 1222.0, "end": 1227.0, "text": " Now, since this network right here has these sine waves in it."}, {"start": 1227.0, "end": 1232.0, "text": " Right. So it's a neural network with sine waves as derivatives as nonlinearities."}, {"start": 1232.0, "end": 1241.0, "text": " What now? So we have a neural network. What now is the first derivative of that neural network?"}, {"start": 1241.0, "end": 1248.0, "text": " Right. With respect to its input. So we have an input. Now, what's the first derivative with respect to its input?"}, {"start": 1248.0, "end": 1253.0, "text": " And the cool thing about this is what's the first derivative of a sine wave?"}, {"start": 1253.0, "end": 1262.0, "text": " It's, of course, a sine wave that's shifted. So it's a cosine, which is a sine wave that's simply phase shifted."}, {"start": 1262.0, "end": 1267.0, "text": " And then the next derivative again is a shifted sine wave and so on."}, {"start": 1267.0, "end": 1274.0, "text": " So the derivative of a siren is a siren."}, {"start": 1274.0, "end": 1281.0, "text": " And that does not hold for any of these other nonlinearities."}, {"start": 1281.0, "end": 1286.0, "text": " So in relu's, it's the derivative of a relu network is like a con."}, {"start": 1286.0, "end": 1295.0, "text": " So if I take the derivative of this, it's like a constant zero right here and then a constant one right here."}, {"start": 1295.0, "end": 1299.0, "text": " And if I then take the derivative again, it's simply a constant zero function."}, {"start": 1299.0, "end": 1306.0, "text": " Right. And all these other nonlinearities, their derivatives are different from themselves."}, {"start": 1306.0, "end": 1318.0, "text": " And here, since we want to not only match a signal, but also the signal's derivatives, these property of this siren becoming very, very, very handy."}, {"start": 1318.0, "end": 1331.0, "text": " So how do you train a siren? We've already alluded to how you would do that in the kind of idea of matching an image where you simply train the pixel values to the RGB values."}, {"start": 1331.0, "end": 1341.0, "text": " But there's more that you can do with the sirens given that they basically given that their derivatives are also sirens."}, {"start": 1341.0, "end": 1347.0, "text": " What you can do. So with the image part, we've basically neglected all of this."}, {"start": 1347.0, "end": 1356.0, "text": " We simply said, we want to find a relationship between the input x and the output like this."}, {"start": 1356.0, "end": 1371.0, "text": " What we can also do is we can say, no, no, no, no, we want to find a relationship between the input and its first derivative and not even have this as part of the let's say of the loss function."}, {"start": 1371.0, "end": 1379.0, "text": " And then we can see what comes out. So that's what they do."}, {"start": 1379.0, "end": 1397.0, "text": " Oh, can I find it? Can I find it? That's what they do right here. OK, so here you see the ground truth image and this is its gradient and this is its Laplacian."}, {"start": 1397.0, "end": 1410.0, "text": " OK, now we've already seen that we can fit the image itself. But what if we just fit the first derivative? So we simply input this thing right here."}, {"start": 1410.0, "end": 1421.0, "text": " We input this into the siren. We do the same thing, right? The siren is now it maps x and y to RGB."}, {"start": 1421.0, "end": 1432.0, "text": " But our loss function isn't going to be mapping x and y to RGB. Our loss function is going to depend on the gradient of that."}, {"start": 1432.0, "end": 1451.0, "text": " So our loss function is going to be something like the gradient of the image. Let's call the image i minus the gradient of that function that maps x of this function right here."}, {"start": 1451.0, "end": 1467.0, "text": " OK, because we have these auto differentiation tools right now, we can easily make this into a loss function. So here we are looking for the function whose gradient matches the gradient of the image."}, {"start": 1467.0, "end": 1473.0, "text": " Now, again, you can say, why is this? Why can't we just match the image itself? And valid point."}, {"start": 1473.0, "end": 1480.0, "text": " But it's not about why can't we just it's about demonstrating the power of these networks."}, {"start": 1480.0, "end": 1489.0, "text": " So if you only match the gradients, right, what you'll find is if you then look at the function, right, you still find the function."}, {"start": 1489.0, "end": 1498.0, "text": " You don't you don't find the gradient. You still train the function. You still train the weights of the function itself."}, {"start": 1498.0, "end": 1502.0, "text": " But the loss function depends on the gradient of that function."}, {"start": 1502.0, "end": 1513.0, "text": " If you do that, you'll find that if you then look at the function, again, you can ask the function to produce the image by simply cycling over each of the coordinates."}, {"start": 1513.0, "end": 1525.0, "text": " You'll find that look at that just by matching the gradient, you'll match the image itself pretty, pretty well. Right. And that's pretty cool."}, {"start": 1525.0, "end": 1540.0, "text": " Now, of course, you're not going to match the RGB values. This is a grayscale image. And, you know, there's a there's kind of a reason for that, because since the gradient loses like constant bias information."}, {"start": 1540.0, "end": 1549.0, "text": " So what if you'd match an RGB image, I'm going to guess you're going to have like color, very much color distortions."}, {"start": 1549.0, "end": 1557.0, "text": " But and here, what you're going to have in this case is just distortions in luminosity."}, {"start": 1557.0, "end": 1573.0, "text": " Like, if you know that if you have a function, if you have the derivative of a function, and you will want to find the function itself, and you integrate, then the solution is always an entire space of functions."}, {"start": 1573.0, "end": 1593.0, "text": " Because you will integrate the function, this thing right here. And so with the whatever its input is, and you have to add a constant and you don't know what the constant was in the original function, because when you derive the function, the constant drops away."}, {"start": 1593.0, "end": 1612.0, "text": " So similarly here, what we'd expect is that the image that we're getting back will be faithful with respect to like its its borders, right, since we're matching the gradient, and the gradient is basically an edge detector will match the sort of edge information of the picture, which you can clearly see."}, {"start": 1612.0, "end": 1623.0, "text": " But what we would expect is some difference in overall luminosity. And I don't even know what how they exactly did this, because they now have to choose a constant to add."}, {"start": 1623.0, "end": 1633.0, "text": " Maybe they just chose it in some way, or maybe they just let the network do. But this is, you know, still pretty, pretty impressive. You can see there's some detail missing, but not much."}, {"start": 1633.0, "end": 1646.0, "text": " And the same exact same thing you can do for matching the second derivative. So now you match the Laplacian of the image. And remember, in the ReLU networks, they don't even have a Laplacian, it's a constant."}, {"start": 1646.0, "end": 1663.0, "text": " So this is something you could never do. And you can see that the outcome image is still pretty good, right? This is now missing the constant luminosity in the first and second derivative, sorry, in the zero and first derivative."}, {"start": 1663.0, "end": 1670.0, "text": " And still, the information is the reconstruction is pretty good."}, {"start": 1670.0, "end": 1679.0, "text": " Alright, so this demonstrates kind of the power of these networks. Again, we're not having our data set, our entire data set is just this image."}, {"start": 1679.0, "end": 1689.0, "text": " So if we fit something, then this thing right here is our entire data set. There's no, there's no big data set. And this is a test sample."}, {"start": 1689.0, "end": 1703.0, "text": " Like this is the data set and the test sample at the same, I guess you can consider the Laplacian here the data set, and then the actual image is the test sample, like the label or something like this."}, {"start": 1703.0, "end": 1710.0, "text": " So what does that buy you? Here is a thing you can do. If you want to mix two images, what do you do?"}, {"start": 1710.0, "end": 1726.0, "text": " So if you want to mix this and this, what you could do is linearly interpolate, but that would be not very cool. Because right here, you have a lot of, like, very bright pixels, which probably have like values of one."}, {"start": 1726.0, "end": 1740.0, "text": " And here, you'd have the dark pixels, which probably have values like more close to zero. And the if you simply mix them, if you simply add them together and divide by two, then you get kind of get a wash of the two."}, {"start": 1740.0, "end": 1751.0, "text": " And similarly, here, you kind of wash out the bear, because you'd have some pixel values here that would come over. And generally not not a good idea to mix images like this."}, {"start": 1751.0, "end": 1758.0, "text": " Now, you know, with GANs, we can do this, but we have to have like a training data set and so on."}, {"start": 1758.0, "end": 1769.0, "text": " Here, what we'll say is we'll simply say, we'll take the gradient of this, and we'll take the gradient of this, and then we'll add the two gradient maps."}, {"start": 1769.0, "end": 1786.0, "text": " Now, what this does is that, as you can see right here on the left is the composite gradients. And what this does is right here in the sky, there is no gradient information in this image because it's just a flat patch of sky."}, {"start": 1786.0, "end": 1809.0, "text": " So, and down, maybe down here, there's not that much gradient information, there is a bit right, but not here. So that's where this bear head is. And if you want to mix images, like it can be a good idea to mix their gradients, because generally the information in an image is where the gradients are."}, {"start": 1809.0, "end": 1823.0, "text": " So what we would expect the gradient to represent the gradient would carry over this portion, maybe carry over a bit of this portion, it would carry over this portion and this portion."}, {"start": 1823.0, "end": 1847.0, "text": " So everything where the signal is not flat. So here you can see the composite gradient. And if we fit, again, we fit our function such that the gradient of the function that we fit matches this mixed gradient right here, then this is the gradient of the function that we match, and this is the actual function."}, {"start": 1847.0, "end": 1872.0, "text": " And you can see, pretty, pretty good, right? It basically mixed everywhere where there was gradient. And this is now just reconstructed from this gradient, there is no, I think there is no, at least as I understand it, there is no pixel information carried over from either of those images, they're simply added to this gradient, the gradient is fit."}, {"start": 1872.0, "end": 1880.0, "text": " And then the function is asked to output pixel value at each location. And that's that."}, {"start": 1880.0, "end": 1887.0, "text": " Okay, so this is just a simple, you know, thing that you can play around with."}, {"start": 1887.0, "end": 1901.0, "text": " But they do, they do other more interesting things right here. For example, this representing shapes with signed distance functions."}, {"start": 1901.0, "end": 1909.0, "text": " So if you go over the formulation, the actual formulation of their loss function, we haven't actually done this right quite yet."}, {"start": 1909.0, "end": 1924.0, "text": " It's here, it's very complicatedly stated. But ultimately, what this means is so a component right here is are these cm, which are constraints."}, {"start": 1924.0, "end": 1944.0, "text": " So this loss function operates on these constraints. And the constraints are across a of x, which basically is just x, it's kind of a the anything depending on the input itself, then the output of the function, the gradient of the output of the function, the second derivative, third derivative, and so on."}, {"start": 1944.0, "end": 1961.0, "text": " So this, these sirens can fit anything that you can formulate as a set of constraints that relate the input of the function right here to its output or any of its derivatives."}, {"start": 1961.0, "end": 1983.0, "text": " And we've already seen that at once we if we fit an image, our only constraint is that these things match right here with the original image that the coordinates are mapped to the RGB values, then when we match the gradients, we don't care about this, we only care about the relation between this, and so on."}, {"start": 1983.0, "end": 2001.0, "text": " So the loss function is literally just over the entire signal space, which in our case was was over the entire image, we want these constraints to hold or to be as small as possible, or the constraints are always formulate such that if they are fulfilled, they equal zero."}, {"start": 2001.0, "end": 2015.0, "text": " And so the for example, the L2 loss between the RGB values of the true image and the RGB values that you fit the RGB loss, sorry, the L2 loss would be a constraint like this."}, {"start": 2015.0, "end": 2026.0, "text": " And of course, the more differentiable you make it, the more the easier this network has at fitting it right. So that's why there's this norm right here."}, {"start": 2026.0, "end": 2044.0, "text": " But it's not that complicated. It simply says, whatever you can formulate as a constraint on relating the inputs to the outputs or any of the derivatives of this implicit representation, that is the loss function."}, {"start": 2044.0, "end": 2051.0, "text": " Alright, so the in the next interesting thing we can do, as I said, is representing shapes with signed distance functions."}, {"start": 2051.0, "end": 2059.0, "text": " So we're going to go slowly. And this is, yeah, it's not that hard."}, {"start": 2059.0, "end": 2076.0, "text": " Inspired by recent work on shape representation with differentiable signed distance functions, SDFs, we fit SDFs directly on oriented point clouds, using both ReLU based implicit neural representations and sirens."}, {"start": 2076.0, "end": 2082.0, "text": " Okay, so what is an SDF, a signed distance function? That's pretty easy."}, {"start": 2082.0, "end": 2088.0, "text": " A signed distance function is simply a distance function with a sign like wow."}, {"start": 2088.0, "end": 2102.0, "text": " So, if you have a and it's usually done if you have like a boundary somewhere between things, then of course, any point here has a distance to the boundary."}, {"start": 2102.0, "end": 2109.0, "text": " But you if you have a signed distance function, it simply means that each point also has a sign in front of it."}, {"start": 2109.0, "end": 2117.0, "text": " And that means all the things on one side of the boundary maybe have a plus and all the things on the other side maybe have a minus."}, {"start": 2117.0, "end": 2127.0, "text": " So even though two points could be the same distance from the boundary, one is like plus five away and one is negative five away."}, {"start": 2127.0, "end": 2135.0, "text": " And you can do this. This is useful, for example, when you fit point clouds as they do in this example."}, {"start": 2135.0, "end": 2140.0, "text": " So when they have point clouds and that's usually in 3D space."}, {"start": 2140.0, "end": 2153.0, "text": " But if you have point clouds, you basically have points right here and you know that the points should represent some kind of shape, maybe a wall or so."}, {"start": 2153.0, "end": 2158.0, "text": " So they have these room interiors, as you can see right here."}, {"start": 2158.0, "end": 2162.0, "text": " So this is a 3D scene, but you only have a point cloud of the 3D scene."}, {"start": 2162.0, "end": 2169.0, "text": " And what that means is that maybe you were in this room and you put up a laser scanner right here. Laser scanner."}, {"start": 2169.0, "end": 2179.0, "text": " I don't know how a laser scanner looks. And the laser scanner kind of shoots lasers at random locations and always measures the distance."}, {"start": 2179.0, "end": 2189.0, "text": " And that's how you end up with a point cloud. So you'll end up with like a point cloud where in 3D space you know where the laser hit something."}, {"start": 2189.0, "end": 2205.0, "text": " And the reasonable assumption to make if you have like a dense sampling of this is that you should be able to connect those point clouds in some way to obtain the actual continuous shape of the thing that you measured."}, {"start": 2205.0, "end": 2216.0, "text": " And this is what we're going to try to do with these sirens, right? To go from point clouds to shape by training an implicit representation."}, {"start": 2216.0, "end": 2229.0, "text": " So we're going to train a neural network that represents this shape right here, basically by mapping coordinates to signed distance values."}, {"start": 2229.0, "end": 2241.0, "text": " So whenever we ask the neural network at this location here, what's the signed distance? And it's going to tell us, oh, it's plus five."}, {"start": 2241.0, "end": 2246.0, "text": " Or at this location here, what's the signed distance? It's going to tell us, ah, it's zero."}, {"start": 2246.0, "end": 2258.0, "text": " So we're going to train a neural network to do that. And hello? Yes? No? OK."}, {"start": 2258.0, "end": 2269.0, "text": " So this is a bit more complicated. And since we have these awesome power of these sirens, we can also do two more constraints."}, {"start": 2269.0, "end": 2284.0, "text": " So we know, and this goes on, this amounts to solving a particular iconal boundary value problem that constrains the norm of spatial gradients to be one almost everywhere."}, {"start": 2284.0, "end": 2297.0, "text": " So this iconal boundary value problem, this is a property of signed distance function that the norm of the gradients with respect to the input is one almost everywhere."}, {"start": 2297.0, "end": 2304.0, "text": " Almost everywhere means everywhere, I guess, except at the boundary itself where the distance is zero."}, {"start": 2304.0, "end": 2319.0, "text": " Though I could be wrong. Note that ReLU networks are seemingly ideal for representing SDFs as their gradients are locally constant and their second derivatives are zero."}, {"start": 2319.0, "end": 2323.0, "text": " Adequate training procedure for working directly with point clouds were described in prior work."}, {"start": 2323.0, "end": 2330.0, "text": " We fit a siren to an oriented point cloud using a loss of the form. And now we'll look at the loss."}, {"start": 2330.0, "end": 2340.0, "text": " So the first thing you observe in the loss is that it is made of three different integrals. And that simply means they now partition the space right here."}, {"start": 2340.0, "end": 2349.0, "text": " They partition it into two different regions, so to say."}, {"start": 2349.0, "end": 2354.0, "text": " So maybe go here. No, can I zoom here?"}, {"start": 2354.0, "end": 2363.0, "text": " So the first region is going to be whatever is on the boundary itself. Right. And that's basically wherever a point, wherever a point hit."}, {"start": 2363.0, "end": 2371.0, "text": " Right. Whenever you have a point or on the boundary itself, that's going to be your omega zero is going to be that."}, {"start": 2371.0, "end": 2379.0, "text": " And then all the other points right here are going to be part of your omega without the omega zero."}, {"start": 2379.0, "end": 2388.0, "text": " So you're going to have different constraints for all of these things right here, for example. And I have to pay attention that I don't say anything wrong."}, {"start": 2388.0, "end": 2396.0, "text": " You will have this this constraint of this gradient. My tablet."}, {"start": 2396.0, "end": 2402.0, "text": " Maybe I'll start monetizing just so I can get a new tablet."}, {"start": 2402.0, "end": 2412.0, "text": " OK, so. No, OK. This condition right here says that the gradient should be one. And that's actually everywhere."}, {"start": 2412.0, "end": 2419.0, "text": " Right. So I was wrong that the gradient is only one outside the boundary."}, {"start": 2419.0, "end": 2425.0, "text": " Then you can see right here."}, {"start": 2425.0, "end": 2436.0, "text": " The last part is all the points that are not on the boundary since our network maps any point in 3D space to assign distance function."}, {"start": 2436.0, "end": 2443.0, "text": " So most of these points aren't going to be on the boundary itself, even though in the mini batch where we train, where they train,"}, {"start": 2443.0, "end": 2454.0, "text": " they sample points on and off the on and off the boundary at the at equal rates just to to have the network train more stably."}, {"start": 2454.0, "end": 2460.0, "text": " So this is a condition on all the points off of the boundary."}, {"start": 2460.0, "end": 2468.0, "text": " And they say here this function is this exponential function with alpha larger than one."}, {"start": 2468.0, "end": 2475.0, "text": " It penalizes off surface points for creating SDF values close to zero."}, {"start": 2475.0, "end": 2485.0, "text": " So this is simply a regularizer that says whenever I input coordinates that are far away from the boundary from the surface,"}, {"start": 2485.0, "end": 2493.0, "text": " then there should be a large sine distance function like it should not be close to zero because it's away from a boundary."}, {"start": 2493.0, "end": 2502.0, "text": " OK. And in practice, how are you going to train this is if you have a point cloud, if your coordinates are far away from the next point,"}, {"start": 2502.0, "end": 2510.0, "text": " then this this is going to be a high. This should be a high value. Otherwise, the network is penalized."}, {"start": 2510.0, "end": 2517.0, "text": " So we have this condition right here on the gradients, which we know sign distance function should fulfill."}, {"start": 2517.0, "end": 2525.0, "text": " We have this thing right here, which is a regularizer, basically telling points far away from our data that they should have a high distance function."}, {"start": 2525.0, "end": 2533.0, "text": " And then we have this last thing right here, which is for all the points on the surface itself."}, {"start": 2533.0, "end": 2542.0, "text": " Here's what we'll what we require. First of all, we require their value to be zero or close to zero."}, {"start": 2542.0, "end": 2547.0, "text": " Right. This is the loss function. So we want to minimize this. And this is simply the output value."}, {"start": 2547.0, "end": 2553.0, "text": " So the sine distance function of points on the surface, you know, the things we actually measure, they should be zero."}, {"start": 2553.0, "end": 2560.0, "text": " Because the sine distance function measures how far away from the surface you are. So this is pretty intuitive."}, {"start": 2560.0, "end": 2576.0, "text": " But then also this right here, it says that the gradient of the sine distance function and the normal vector of that point should align."}, {"start": 2576.0, "end": 2584.0, "text": " And that basically means and this is now I think this is because we have an oriented point cloud or no."}, {"start": 2584.0, "end": 2594.0, "text": " Yes. So what we can do is we can kind of connect points next to each other and then calculate the normal vectors of that."}, {"start": 2594.0, "end": 2603.0, "text": " Right. And the signed the network, if we ask the network, hey, what do you think about this position right here?"}, {"start": 2603.0, "end": 2610.0, "text": " The network should tell us, first of all, the sine distance function should be zero because it's on the boundary."}, {"start": 2610.0, "end": 2620.0, "text": " Second of all, the norm of the gradient of the sine distance function at that point should be one because that's a property of sine distance function."}, {"start": 2620.0, "end": 2632.0, "text": " And third, and that's the thing right now, the gradient of the sine distance function should align with this normal vector."}, {"start": 2632.0, "end": 2640.0, "text": " Right. And that's pretty intuitive because you want you want the sine distance function to increase in value."}, {"start": 2640.0, "end": 2644.0, "text": " The gradient basically tells you where the highest increase in value of the function is."}, {"start": 2644.0, "end": 2650.0, "text": " You want it to increase along the normal direction and not along any other direction."}, {"start": 2650.0, "end": 2655.0, "text": " So that's a pretty good, pretty good constraint to have. So you can see right here."}, {"start": 2655.0, "end": 2664.0, "text": " I mean, you don't really have to understand exactly about sine distance functions and so on, but these sirens are pretty good at capturing all of these different constraints."}, {"start": 2664.0, "end": 2668.0, "text": " And this was a point, you know, on the surface points off the surface."}, {"start": 2668.0, "end": 2677.0, "text": " You additionally say, hey, you should have a pretty high value and actually not a zero value, but a pretty high value."}, {"start": 2677.0, "end": 2684.0, "text": " So and again, we only fit one particular scene. We only ever fit one scene with an entire network."}, {"start": 2684.0, "end": 2695.0, "text": " So the entire neural network, this this this whole structure right here, everything is captured by this neural network that we train on the point cloud."}, {"start": 2695.0, "end": 2708.0, "text": " And you can see that if you use a ReLU, what you'll get is super, super wobbly, because if even if you train the ReLU with the same loss function,"}, {"start": 2708.0, "end": 2717.0, "text": " these constraints on the gradients, they're just not going to work out with the ReLU because the gradients are like constant and discontinuous, right?"}, {"start": 2717.0, "end": 2729.0, "text": " Whereas the siren can basically fulfill all of these constraints on the different parts, like on the values and on the gradients of the of the loss function."}, {"start": 2729.0, "end": 2734.0, "text": " And they have another example right here where they fit this shape."}, {"start": 2734.0, "end": 2746.0, "text": " Yeah, so you see all the details are preserved way better where the ReLUs, they'll simply kind of flatten over everything and make it wobbly."}, {"start": 2746.0, "end": 2755.0, "text": " All right. So I hope this sort of made sense. And we'll go to the last thing right now."}, {"start": 2755.0, "end": 2771.0, "text": " While it is restarting, I wanted to show you the website right here they have for this. It's a pretty cool website to go along with it. And as you can see right here, they have all these samples that they have in the paper, but also in animated format."}, {"start": 2771.0, "end": 2779.0, "text": " And as you can see right here, this is the fitting process, the learning process of how you represent these images."}, {"start": 2779.0, "end": 2788.0, "text": " So as I said, there, you want to fit these functions to the ground truth, and that happens in steps. So this is very much like you would learn a deep learning functions."}, {"start": 2788.0, "end": 2795.0, "text": " I think they use the atom optimizer. It's just that the data set now comes all comes from this one ground truth image."}, {"start": 2795.0, "end": 2806.0, "text": " And you can see that the siren network on the right pretty quickly zeros in on the on the image and then gets the details subsequently right."}, {"start": 2806.0, "end": 2817.0, "text": " They also represent audio with this and you can watch that they represent video. Compare that to ReLU representations."}, {"start": 2817.0, "end": 2828.0, "text": " Then here solving the Poisson equation is where you only fit the gradients or the Laplacian of an image and still get out the good image."}, {"start": 2828.0, "end": 2844.0, "text": " That's pretty cool. And here you can see that you can actually play around with these things so you can click on them and look at this look at this learned thing."}, {"start": 2844.0, "end": 2854.0, "text": " So on the left, you can see what the siren network learned and scroll down here a bit. And on the right is a ReLU representation of the same thing."}, {"start": 2854.0, "end": 2861.0, "text": " So this is the same network with the same objective. It just has ReLUs instead of sine waves as activation functions."}, {"start": 2861.0, "end": 2870.0, "text": " So you can see how much of a difference that makes right here. And the middle is a ReLU with the positional encodings. Still not good."}, {"start": 2870.0, "end": 2878.0, "text": " The only the only thing right here that you have to think of, if you look at how big these sirens are, how many parameters they have,"}, {"start": 2878.0, "end": 2885.0, "text": " they're about at the order of magnitude of how many pixels there are in the image."}, {"start": 2885.0, "end": 2901.0, "text": " So I'm. Yeah, it's certainly a cool method, but to like this, it's not like you're the implicit representation here is very, very well at generalizing, though it would be very cool to see what happens outside."}, {"start": 2901.0, "end": 2914.0, "text": " Right. If you because now you have you can input any x y coordinates. So technically, you could continue the picture to the bottom and just see what the siren thinks should be here at the bottom."}, {"start": 2914.0, "end": 2921.0, "text": " So all of these things would be pretty, pretty cool to actually experiment with. And they have the code available to do that."}, {"start": 2921.0, "end": 2931.0, "text": " And you can see the fitting process of the Helmholtz equation right here and related projects. Pretty cool website. I definitely invite you to check it out."}, {"start": 2931.0, "end": 2937.0, "text": " And let's go back to the paper and we're back and my tablet crashed. And let's continue."}, {"start": 2937.0, "end": 2943.0, "text": " So they're now going on to use sirens in order to solve PDEs."}, {"start": 2943.0, "end": 2959.0, "text": " And so in physics, often you have these problems where you are given an equation, but the equation doesn't necessarily involve a function itself, but only involves derivatives of that function like or relates derivatives to the function and so on."}, {"start": 2959.0, "end": 2976.0, "text": " So one example here is this Helmholtz equation that's given as this, where the I think the the F is a known function, but this is the wave field we want to you want to get, you want to figure out which is unknown."}, {"start": 2976.0, "end": 2986.0, "text": " And then this H of M is including, for example, this right here, which is the Laplace operator."}, {"start": 2986.0, "end": 2994.0, "text": " So you're given the relation between the function and a Laplace operator of the wave that you want to find out."}, {"start": 2994.0, "end": 3001.0, "text": " And your task is to recover the wave. Now, I don't want to go very much into this right here."}, {"start": 3001.0, "end": 3005.0, "text": " But what you can do is basically you can measure."}, {"start": 3005.0, "end": 3021.0, "text": " You can have a room and you can have measurements of the wave or of its derivatives and so on. And then you kind of calculate backwards from the measurements to what the actual wave was."}, {"start": 3021.0, "end": 3027.0, "text": " And these sirens turn out to be very, very good at things like this."}, {"start": 3027.0, "end": 3044.0, "text": " And I guess that's in this solving for the wave field things. But essentially, what this amounts to is a numerical solution of these partial differential equations in physics using these sirens."}, {"start": 3044.0, "end": 3046.0, "text": " And that's pretty cool."}, {"start": 3046.0, "end": 3057.0, "text": " And the last thing they do is and this gets back to a more of the machine learning context, where they say learning a space of implicit functions."}, {"start": 3057.0, "end": 3067.0, "text": " So now they go ahead and say, yeah, so we can represent images in terms of these of these functions, right, but each image is basically its own function."}, {"start": 3067.0, "end": 3071.0, "text": " So each image is basically an optimization of fitting problem."}, {"start": 3071.0, "end": 3094.0, "text": " Can we somehow learn functions of functions? So this goes this comes now back to more of a machine learning context where you say, ah, so I have a network right here that"}, {"start": 3094.0, "end": 3099.0, "text": " I have a network that gives me the parameters of the siren."}, {"start": 3099.0, "end": 3106.0, "text": " So this right here is okay, let's let's go to an example."}, {"start": 3106.0, "end": 3119.0, "text": " In this example, what you'll have is you'll have an image like this one, where a few pixels are masked, actually, most of the pixels are masked."}, {"start": 3119.0, "end": 3130.0, "text": " And you want to put this into a CNN. And the CNN should output the parameters of the siren network."}, {"start": 3130.0, "end": 3139.0, "text": " So the parameters because the siren network, given its parameters, is the image itself."}, {"start": 3139.0, "end": 3149.0, "text": " So that's the siren, I said siren network, the siren is the image, if you know its parameters, right."}, {"start": 3149.0, "end": 3155.0, "text": " So here, you train a CNN to give you the parameters of the siren."}, {"start": 3155.0, "end": 3161.0, "text": " That's almost the same as training a CNN to give you the image directly."}, {"start": 3161.0, "end": 3173.0, "text": " But again, we don't want to have the explicit representation of an image, we want to have the implicit representation such that it's continuous, and we can manipulate it and so on."}, {"start": 3173.0, "end": 3187.0, "text": " So the CNN is now trained on a data set. So you take C410, and you construct a whole bunch of, of images with only kind of 100 pixels remaining."}, {"start": 3187.0, "end": 3195.0, "text": " And then you train a CNN to give you the parameters of the siren that would reconstruct the ground truth, right."}, {"start": 3195.0, "end": 3201.0, "text": " And then you can test that on the test image. And you can see right here, the results are pretty good."}, {"start": 3201.0, "end": 3209.0, "text": " So these are test samples. These are now, these are now images that were not seen during training of this CNN."}, {"start": 3209.0, "end": 3218.0, "text": " And therefore, the outcoming siren also hasn't seen that image, it's the siren is simply parameterized by the CNN."}, {"start": 3218.0, "end": 3226.0, "text": " You can see this works pretty well. So if you only have 10 pixels, you already get something out of it, right."}, {"start": 3226.0, "end": 3233.0, "text": " And if you have 100 pixel, you already get fairly close to the to the ground truth right here."}, {"start": 3233.0, "end": 3241.0, "text": " Now, this is not GAN quality images, of course, but it's pretty impressive to see that an implicit parameterization,"}, {"start": 3241.0, "end": 3248.0, "text": " an implicit representation of the images can be so powerful, right?"}, {"start": 3248.0, "end": 3260.0, "text": " Yeah, so this, this is a pretty cool thing. And again, it's better than, it's kind of more back to the machine learning framework that you're used to."}, {"start": 3260.0, "end": 3270.0, "text": " There's a train and test data set. And now the only thing is that the output is a function given by its parameters, and not the actual pixel values."}, {"start": 3270.0, "end": 3276.0, "text": " Okay, so let's look at the broader impact statement."}, {"start": 3276.0, "end": 3287.0, "text": " The proposed siren representation enables accurate representations of natural signals, such as images, audio and video in a deep learning framework."}, {"start": 3287.0, "end": 3296.0, "text": " This may be an enabler for downstream tasks involving such signals such as classification for images or speech to text systems for audio."}, {"start": 3296.0, "end": 3300.0, "text": " Such applications may be leveraged for both positive and negative ends."}, {"start": 3300.0, "end": 3306.0, "text": " Siren may in the future further enable novel approaches to the generation of such signals."}, {"start": 3306.0, "end": 3311.0, "text": " This has potential for misuse in impersonating actors without their consent."}, {"start": 3311.0, "end": 3317.0, "text": " For an in depth discussion of so called deep fakes, we refer the reader to a recent review article in neural rendering."}, {"start": 3317.0, "end": 3325.0, "text": " This has, this has like no perplexity, like, no perplexity at all."}, {"start": 3325.0, "end": 3330.0, "text": " Like, is anyone benefited by this? Seriously? Okay."}, {"start": 3330.0, "end": 3337.0, "text": " But at least we made the authors think of the consequences of their research."}, {"start": 3337.0, "end": 3344.0, "text": " Yeah, so I invite you to check out this paper, maybe with this right now, you can follow a bit better."}, {"start": 3344.0, "end": 3349.0, "text": " What happens here, this is a different paradigm of research. It's a cool paradigm."}, {"start": 3349.0, "end": 3353.0, "text": " It's away from your usual machine learning framework."}, {"start": 3353.0, "end": 3359.0, "text": " And yeah, so I'm excited what happens next in this. I also invite you to check out the websites."}, {"start": 3359.0, "end": 3367.0, "text": " They have lots of videos and goodies and so on. And with that, bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=2lkUNDZld-4
Big Self-Supervised Models are Strong Semi-Supervised Learners (Paper Explained)
This paper proposes SimCLRv2 and shows that semi-supervised learning benefits a lot from self-supervised pre-training. And stunningly, that effect gets larger the fewer labels are available and the more parameters the model has. OUTLINE: 0:00 - Intro & Overview 1:40 - Semi-Supervised Learning 3:50 - Pre-Training via Self-Supervision 5:45 - Contrastive Loss 10:50 - Retaining Projection Heads 13:10 - Supervised Fine-Tuning 13:45 - Unsupervised Distillation & Self-Training 18:45 - Architecture Recap 22:25 - Experiments 34:15 - Broader Impact Paper: https://arxiv.org/abs/2006.10029 Code: https://github.com/google-research/simclr Abstract: One paradigm for learning from few labeled examples while making best use of a large amount of unlabeled data is unsupervised pretraining followed by supervised fine-tuning. Although this paradigm uses unlabeled data in a task-agnostic way, in contrast to most previous approaches to semi-supervised learning for computer vision, we show that it is surprisingly effective for semi-supervised learning on ImageNet. A key ingredient of our approach is the use of a big (deep and wide) network during pretraining and fine-tuning. We find that, the fewer the labels, the more this approach (task-agnostic use of unlabeled data) benefits from a bigger network. After fine-tuning, the big network can be further improved and distilled into a much smaller one with little loss in classification accuracy by using the unlabeled examples for a second time, but in a task-specific way. The proposed semi-supervised learning algorithm can be summarized in three steps: unsupervised pretraining of a big ResNet model using SimCLRv2 (a modification of SimCLR), supervised fine-tuning on a few labeled examples, and distillation with unlabeled examples for refining and transferring the task-specific knowledge. This procedure achieves 73.9\% ImageNet top-1 accuracy with just 1\% of the labels (≤13 labeled images per class) using ResNet-50, a 10× improvement in label efficiency over the previous state-of-the-art. With 10\% of labels, ResNet-50 trained with our method achieves 77.5\% top-1 accuracy, outperforming standard supervised training with all of the labels. Authors: Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, Geoffrey Hinton Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we'll look at big self supervised models are strong semi supervised learners by Ting Chen, Simon Kornbluth, Kevin Swierski, Muhammad Nerozzi and Jeffrey Hinton of Google Brain. So this paper on a high level, it's also known as Sinclair v2 demonstrates that if you want to do semi supervised learning, that you're very well served by starting out with self supervised learning, and then doing fine tuning much like NLP models do rather than the kind of semi supervised approach that image image tasks had so far. And they present this Sinclair v2, which is an improvement over the Sinclair approach to self supervised pre training, and they demonstrate it outperforms a lot of the baselines. Alright, so if you like content like this, don't forget to share it out and leave a like and tell me what you think in the comments. So this paper, it sort of is kind of a club together thing of different of different things. So they present this new method like SIM, this Sinclair v2, which is a modification of Sinclair and we'll go over that. But they also try to make like a scientific claim, namely that the that somehow bigger models are better for this pathway of learning, and we'll try to untangle all of these things. So first of all, we're in the semi supervised learning regime right here. Semi supervised basically means that you have a data set and you only have labels for a part of that data set. So this could be like here the bottom 10% or so, because labels might be expensive to get. And so you only have a few of them, but you have much more data that's unlabeled. Now, sometimes this problem is formulated as this here is your data set. And then this here is like a different data set, but one that's close enough such that you can learn from it. And that's usually in NLP, you'll have your data set is like a sentiment classification task, but you have all of Wikipedia that is not labeled, but it's just text. So you can sort of pre train on it. In this case, we'll be in a situation where we'll artificially construct a small data set. So this entire thing here is going to be the ImageNet data set. And this right here is going to be our labeled portion, like we have labels. Now, usually one has labels for ImageNet as well, but we artificially restrict ourselves to simulate a situation where we have lots of data, and we only have a fixed budget. So we can only because to obtain labels, oftentimes you have to ask humans right to label images. And let's say we are a company and we've collected this big data set, but we only have like, maybe 500 bucks on Amazon Mechanical Turk. And we only managed to get a very like 1% of our data set labeled. Now we're in the in the regime of semi supervised learning. Okay, this is slightly different from what NLP does. And as I said, in NLP, usually assume you have different data sets, the large one being the different distribution. And in the semi supervised regime, you often assume that it is actually the same data distribution, but you only have labels for some of them. But there should be a fair bit of overlap between the two things. So, oh, I've recently made a video about OpenAI's image GPT that kind of goes into the into the same direction as this work right here, that basically says pre training on unlabeled data, like this whole data set without the labels can be a very good preconditioner for fine tuning later. And this paper says the same thing. So basically, in in the good old days, what you would do is you would devise a method that somehow takes, you know, takes in a devise a method that takes in a mini batch. And in the mini batch, you'd have your data samples, and then some of them would be labeled right here, you'd have y and here you'd have a y, but most of them would be not labeled. And you'd have like some sort of loss function that would put special weight on the ones that are labeled or somehow handle these ones that are unlabeled in a way, you might be doing like a some sort of a consistency loss such that if they are very nearest near neighbors to these in the feature space, they should have similar labels or things like this. So these semi supervised methods, they basically try to solve the problem at once. But while taking data that is labeled and not labeled, this paper goes into a different direction. This paper says, first, we should, it's actually three stages right here, and they have a diagram. So I don't need to draw. They have a three stage approach, three stages, the one on the left is unsupervised pre training. So they say, let's forget about the labels right now, even like your unlabeled data. So even the data where we have the labels, let's forget about the labels. And let's just do unsupervised pre training. Now unsupervised pre training in this kind of setting is also known as self supervised pre training. And this first stage is done using a contrastive loss. And that's very similar to sim clear to this contrastive loss. So what you'll do, and they describe it very, very well here. So what you'll do is given a randomly sampled mini batch of images, each image is augmented twice using random crop color distortion and Gaussian blur, creating two views of the same example. Okay, so you have an image in your mini batch, each image you take, and you make two versions of it. And each version you crop the random crop somewhere. So version one could be random cropped here, version two could be random cropped here. And then you put some Gaussian blur on it, and so on. So a little bit of, as you can see, random crop color distortion, Gaussian blur. So what you'll want is two different versions of the same image. Each of these versions has been augmented in a different way cropped in a different way, blurred in a different way, such it's, it's two slightly different versions of the same image. And now you want to enforce, you want to put this through your network. So ultimately, as you can see on the right side here, what you want to end up is a, a network. And then okay, we'll forget about this right now. What you want to train is this network right here, actually including these projection layers, we'll get to them later. This is the network that you want to train. So you want to put your take your unlabeled data, you take an image, you'd make two versions of it. And you put those through the network, right until the end right here. So you'll get z one, z two, these are the the output of the network for the two images. And then what you want to do is you want to take another image that's not this image, and also put it through the network, maybe also augmented first. And then you have z three. So now you have the outputs of two things that are supposed to come from the same image and one thing that's supposed to come from a different image. And now your loss is simply going to be make those two things close together, and push those two things apart, or those three actually. So the loss, and this is this is the contrastive loss of self supervised learning. As you know, you don't need any labels right here, you simply say the things that come from the same image should be close together. And the things that come from different images should be far apart. And this relies heavily on these data augmentations that you do right here. They also employ some other tricks like the momentum encoder from moco from momentum, contrast, and so on. But this is the main, the main part. So you can pull a lot of strings here to get like another percent of performance. But ultimately, they won't see the similarity of z i and z j, which are the outputs of the same image to be close together. And then this down here, they want to be far apart z i with z k, where k is all the other images. Okay, you can do this in a mini batch fashion. So this is self supervised learning. And the reason why you do this is you don't need labels and it tends we know it tends to give very, very good representations. So I'm past that. So what this network here will learn will be very good records for some reason, we still don't exactly know why combining augmentation with the self supervised loss with contrastive loss, for example, gives such good performance. There have been papers recently that modify the loss and so on. But it's not super well understood yet. But if you do it like this, there, the network here will give you already very, very good representation. And we know this because we can take a network like this, and then simply train a linear classifier on top of that on a data set and achieve very, very good performance. And mind you, you have trained it with unlabeled data, right? So the network has never been trained to solve like image net classification, it has simply been trained to look at the pictures and determine if, you know, two versions of a picture come from the same picture or from different pictures. And now, if you simply train a linear classifier on top of these representations, you're doing extremely well already. So we know these representations, they actually learn something about these images. So that's the first part. Then stage two, let's cancel all of that stage two is you want to do supervised fine tuning. Now, you already see that the arrow here coming out is not this task agnostic big CNN, the arrow is actually coming out of those grip those yellow boxes. And the yellow boxes are these projection heads. So in the original sim clear paper, what they did was they, they wanted originally, they wanted to train this network right here. This is like a resonant 50 is pretty standard in these kind of self supervised approaches and so on to train, or these few label approaches to train a a standardized network. And this is like a resonant 50. So in the original sim clear paper, they said, we want to make resonant 50 as strong as possible. But in order to do this loss right here, we are going to attach this projection head just to because the dimensionality here I think is like 2048. And we want to do this inner product in a lower dimension of like maybe 256 or so. So this these are just multi layer perceptrons, these are just fully connected layers that compress the representation down to that. And once we're done with the unsupervised pre training, we're going to throw those away, right? And this resonant is the thing that we really care about. Now, here they claim, okay, it actually works better. And they have experiments to prove this or to show this, if you use one, if you actually leave one of these layers here. So in the end, they I guess they converge on three projection head layers. And then they only throw away the top two. And like they make this big deal out of the fact where, you know, I can just call I can just call this part right here now, the encoder. And I don't so I don't know, exact, like, I don't see the giant deal here, like you just made your network one layer bigger. And now you consider that to be your encoder. And the projection head is now two layers. And that will be much easier than calling the projection had three layers, but we leave one layer and we train from the middle layer. In any case, they have this layer additional layer right here compared to the old sim clear. And then the representation of that goes into supervised fine tuning. Now, this is pretty easy. This is exactly what it sounds like. So now you use only only the data set that has labels. So the part of the data set that has labels, and you do the fine tuning and fine tuning is simply supervised learning, you train this network in a supervised fashion, on that small fraction of data that has class labels. And that already performs pretty well. And they show this in experiments. But then you can go a step further and do what's known as distillation or self training. And what's distillation or self training, it's so distillation is when you have a network that you call the teacher network. And that network has been trained to do some classification maybe into three classes, pretty, pretty well. Okay, but now, this is very large, and you want maybe a smaller model. So you just want like this tiny model because you want to ship it on a mobile device, right? But it's also supposed to do this. And you know, that if you just directly train this, which is called the student model, it doesn't perform as well as the teacher model, there is a better way. If you have the teacher model, you can sort of transfer the knowledge to the student model, you can distill the knowledge. And how do you do that? You do that by so what you what would you do in supervised training in supervised training, you would take an image, put it in, and then put the label that comes along with the image, you put it up here, and you compare the output to the label and that gives you the loss function, right? Now, you do that right here. If you distill, you put the image into both. Now the teacher is already trained. So its output will be a distribution over classes, it won't be a single label, it will be like, okay, 90% class one, 10%, class two, 0%, class three, something like this. And now you take this as like a pseudo label, this entire distribution, and you put it here, and you compare the output of the student to that of the teacher, and that's your loss function. So this kind of the teacher might have learned to put some nuance into the classification to say, well, I'm pretty sure this is class one, but I'm not 100% sure. And it can transfer that knowledge to the student. And that makes the student better than had you just trained it from the beginning from from with just the labels. Right, so this is distillation. And you can do this, even what they call self distillation here or self training. So apparently, this even helps if the teacher is if the student model is the same as the teacher model. Now, why does it help in this case? And I think it is not exactly the case in this case, because they always say their teacher model has this extra projection layer, right? And then the student model doesn't have that even if they do self training. But why does it help in this case? I mean, it's it's kind of shocking. And I'm pretty sure it helps in any case. But in this particular case, it helps because now you're using the unlabeled data again. So you have a teacher model and the teacher model is trained first using unsupervised, like this is the teacher model right here, using unsupervised training, then the teacher model is further fine tuned on the small data, right? So it is now already pretty good at the task. But how can you get a student model that's even better than the teacher model? It's by using again, this unlabeled data, you have this giant amount of data. So what you'll do is you take an image from the unlabeled data, and you ask the teacher model, teacher model, what do you think about that image, right? And the teacher model will give you a prediction, like let's say, again, this 90% 10% 0%. And then you take the student model, you input that image, and you compare its output to what the teacher said. So this combines the teacher model, you freeze the teacher model, right, the teacher model is only trained until here, you take it from here, the student model is now able to take basically the teacher, it takes everything that the teacher model knows, not only about this data, but about all the data. So it kind of gets to ask the teacher model, what do you think about this? What do you think about this? What do you think about this? And it it can incorporate all that knowledge about all of this unlabeled data. And that's why the student model here in the end, if it's the same size, will probably end up even better than the teacher model, right? So distillation, I think also is still kind of a mystery of why you get a better model or, I mean, to, to make it smaller, if you make it a lot smaller, usually you don't end up with a better model, but you end up with a pretty good model that you couldn't have gotten by just training the small model. But so that's already pretty cool. But why you get a better model with when they're the same size, that's, I don't think that's well understood yet. So that's the three stage approach. So recap, first, use all of the data without labels to do unsupervised or self supervised contrastive pre training. Second, use only the data that has labels to do fine tuning. Third, either distill the learned classifier to a smaller model, or distill it to a model of the same size again, with in both cases, you would again use the unlabeled all of the unlabeled data. Okay. And that's the three step approach. That's SimClear v2 in its in all of its form. Right, so they go into fine tuning right here. And yeah, so they say, we elaborate with a three layer projection head. So that's the three layer projection head. This here is the output of resnet 50, where sigma is a relu non linearity, and we ignore the bias term for brevity, blah, blah, blah, blah. So they contrast this here for fine tuning, SimClear uses this right here, which is just, it's basically just a classifier on top of the output of the resnet 50. Okay. Yada, yada, yada, yada. This is fine tuning from the input layer of the projection head to fine tune from the first layer of the projection head, we have a new encoder function as this, which is resnet followed by fully connected layers. And you see they take the resnet 50 output and they ship it through the first projection layer. And then there is a task specific classifier. Now, again, why? I don't even see why they make like this ginormous deal out of it, especially especially since the last layer of the resnet 50. I'm not okay, here is I'm not entirely sure. But are they taking the look? No, they probably not taking the log, it's okay. But it's Yeah, I'm, it's just weird. Like, is there even a non linearity at the end right here? Or is this really just like two matrix multiplications in a row, which I'm going to guess there's a big chance that that's the case that the last layer of this encoder is actually not even followed by non linearity. And therefore, you'll just kind of make the dimension different. And I don't see why you can't just just incorporate this into the model and have to like say it over and over again, that this is a new special thing, right? Again, this is equivalent of tuning from a middle layer of the projection head instead of the output layer. Okay, you just make your model a bit bigger. Yeah, so the third step is self training or knowledge distillation. And they give two variants right here. This variant, as you can see here, this is this is just the cross entropy. But instead of having labels right here, why? Or you have the teacher what the teacher model things, y is given x, okay, that's, that's cross entropy, but not with the true labels, but with the output of the teacher model. And you can even mix that. So you can, as you can see, right here, you can mix this with an actual supervised loss. So this would be the supervised loss, whatever. Yeah, I guess that I was wrong. That wasn't, I guess, p of y is always one in that case. But they don't use this particular kind, I think, except in one of the ablations. So how does this work? It works pretty well. And so one of their experiments, as you see up here, it works pretty well in that if you have 1% of the labels, only 1% of ImageNet labels, which they say is smaller or equal than 13 images per class. So there's 1000 classes, and you only have 13 labels per class or less. If you and they differentiate, if your encoder that you train is a ResNet 50, then you get and you can see the dashed line here is a supervised baseline, you almost get to the supervised baseline with 1% of the labels. And if you actually have a larger ResNet, then you get to the supervised performance without 99% of the labels. And if you have, excuse me, 10% of the labels, you pass the supervised baseline. So the supervised baseline is on 100% of the labels mind you, and you only have 10%. And this outperforms the supervised baseline. Now, of course, you could here you could have another graphic where you show 100% what if we you know, what if we do the whole procedure with 100% of the label. So first we don't label the data, we do supervised self supervision, then we fine tune on 100% of the data. And then we do this distillation again, you would of course be even better. And I think they have this somewhere in a table. But this is already pretty, pretty impressive. And another claim they make right here is about the model sizes. So and this figure is description, this now relates to the title, they say bigger models yield larger gains when fine tuning with fewer labeled examples. So there, there are three comparative statement words in one sentence. Let's unpack this. Bigger models yield larger gains. So the bigger, the bigger the model, the better the good, let's say, when fine tuning with fewer labeled examples, let's just look at the graph, it's pretty, it's really clear. So here we have a number of parameters going over. So these are the different models they look at how many parameters they have to do this whole procedure. And here is the relative improvement in percent over the top ImageNet one top accuracy. So if you do this whole thing with 100% of the labels, right, I'm going to guess this here, this here is where they start out. And you can see as you grow your models, you grow the performance. And this, this is just by increasing the model size, right, you have the same data set, you have the same amount of labels, you have the same number of steps that you train for and so on. Just by the fact that you make your model bigger, you gain in performance. Okay. Now you can see that these curves here are above one another. And these curves refer to getting a small, less and less labels. Okay. So if you only have 10% of the labels, your relative gains are larger. That doesn't mean that you perform better with 10% of the labels than with 100% of the labels, that would be that would be like ridiculous. Well, I guess in this day and age, nothing is ridiculous. But for now, we're still performing better by having more labels if we do the same procedure, right? It's not like here. So here, this baseline, the supervised baseline only does supervised training, right? So that's why we can outperform it with less of labels. But here we do the same procedure. This is relative improvement, right? So this right here, the starting point would be if you had 10% of labels and a 25 million model parameter model. And this right here, for example, is if you have the same amount of labels, but a 200 million parameter model, and this is relative improvement. Okay. But what the graph says is that the relative improvement is larger, the relative improvement is higher, the more parameters you have, which is the more you go to the right. And that effect in itself is higher, the fewer labels you have, which is the different graphs. And you can see that right here. So if you have fewer and fewer labels, it becomes more and more important that you have bigger models. And that's really counterintuitive, right? Because you would expect that the bigger models, they can overfit much more easily to the fewer labels. But that doesn't seem the case. So this self supervision, it really seems to be sort of a counter to this notion of overfitting. And if you have larger and larger models, that's what they argue in the paper, you might be able to learn more and more features that might be useful for classification. So if you have a larger model, you might you're going to learn more kinds of features, and then you're going to outperform because you have more chance that these features are going to be useful for classification. And I don't think they really make a statement as to why that happens more with the if you have less labels. So let's think about this. If I have very few labels, very, very few labels, why does it help me even more if I have a big model? Well, with the same argumentation, we could say and maybe they actually say this already. So I might be copying them involuntarily. Maybe with fewer and fewer labels, like let's say we have all the labels, that's probably too many, right? If we can learn a task with some accuracy, we probably had too many labels. Okay, it's like we like if we can't learn a task, we know we have too few somewhere, there is a border where we have enough, but that's like kind of one number. And everything else is too, too many, technically speaking, like learning theoretically speaking. So usually we have too many labels. And what does that mean? That probably means that there are multiple ways. Like if we have too many labels, there are multiple different features we can pick up to learn, there are multiple different paths to learn our goals. So if we have ImageNet, and like that, there's this weird task to recognize a three, and we get lots and lots and lots of examples of threes, right? We can, we can decide on a feature, we can say, oh, I all the threes that I see, they have this bow down here, or all the threes that I see, they have this bend here, and so on. But if I only have very few labels, there might only be like a single feature that is even theoretically possible to learn from the labels I'm given. And therefore, if I have a bigger model in cell in pre training, because the pre training happens with the same amount of data, right? If I have a, if I have a bigger model, that does the self supervised pre training is going to learn more features. And then there's a higher chance that that one feature that I'm that these very few labels that I am able to learn something from is going to be in these features. So that's kind of how I make sense of it in combination what with what they're saying right here. Okay, so this was the main points, they do a lot of empirical studies showing the effects of these sizes, they stress that it's important to have both deep and wide networks. And they also do this additional attention mechanism over the convolution filters, I don't want to go into that particularly, but they they also do linear evaluation compared to supervised compared to fine tuning on with 100% of the labels. So they do a very thorough empirical investigation. And yeah, I do appreciate that. And they kind of show the same things. And here they show the number of layers in the projection head. So as you increase the number of layers in the projection head, and train from the optimal layer in the middle, your performance goes up, as you can see, but it also this effect is stronger when you have fewer labels, right, you can see the differences here are greater than the differences here, or even here when you have 100% of the labels. So the fewer labels, the fewer the labels, the more benefit you have from the architecture right here. And here they show that it's not always optimal to train from the last projection layer, but here the first one, so that I guess they converge on three projection layers. And you always want to keep the first one around after self supervised training, as we mentioned before. Okay, they investigate different different distillation losses and show that it is actually important that you do the distillation loss on labeled and unlabeled sets, you can see here, if you only do it, if you only train with the labels after fine tuning, you get poor performance, if you do the label and distillation loss, but only do it on the data set where you have labels, then you get more performance. If you do label and distillation loss, but also include your unlabeled data, you get even more performance. And then if you do that, but you don't do the label loss. So before we've seen you can mix the distillation loss with the label loss, if you have lots of labels, then you drop in performance again. And you can see right here, the drop in performance is proportional to how many labeled examples you have. And that's, that's natural, right? If you have the labels, you can actually mix that information in with the distillation loss, and that will make you better. And here they drop point one percent, and here they drop less than 1% by leaving away the labels. But their point basically is that it is more important to, to distill using also unlabeled data, then it is to distill, including the label loss. And it's much easier to not include the label loss, so they don't do it, I guess. All right, so I think that was it. They compare, as I said, they compare like self distillation, where you distill into an equally sized model and down distillation where you distill into a smaller model. Maybe that's vice versa. And they do a lot of comparison to other methods. So this is a very thorough work, I feel. And yeah, if you want more about the exact experiments, I invite you to look at the paper. And let's just have a final look at the broader impact statement right here. So the broader, remember, the broader impact statement is supposed to force you to think about how society might be impacted at large by your work. So it says the finding described in this paper can potentially be harnessed to improve accuracy in any application or computer vision where it is more expensive or difficult to label additional data than to train larger models. Such applications are clearly beneficial to society. For example, in medical applications where acquiring high quality labels requires careful annotation by clinicians, better semi-supervised learning approaches can potentially help save lives. Application of computer vision to agriculture can increase crop yields, which may help to improve availability of food. However, we also recognize their approach can become a potential component of harmful surveillance systems. Moreover, there is an entire industry built around human labeling services and technology that reduces the need for these services could lead to short term loss of income for some of those currently employed or contracted to provide labels. So ask yourself how much of that statement has to do with the actual novelty of this paper? And the answer is, of course, zero, right? Like you can replace like our method in this thing with like machine learning or computer vision in general, like, oh, really, SimClear V2 specifically can increase crop yields, like that specific invention of this paper will lead to higher crop yields will lead to surveillance systems. So I'm, yeah, you know, I think like, I don't want to get too too upset about these. I mean, this, I think it's quite funny. But just, again, I, I wonder whether the people advocating for these things are happy with these statements, because clearly, clearly, this is just a template that you copy paste from paper to paper, replacing like a few words. And if it's computer vision, you're like, oh, my deep fakes. And if it's NLP, it's like, I'm a fake news. And yeah, I, I wonder if really anything, like, particularly is has I wonder whether these people are happy now. Yeah, I just I wonder. And if, if they are, I wonder whether it's really for the reason that they claim that, oh, now we have a statement here of how it impacts society, because I could have told you that before could have told you that before I even read the title of the paper, right? What the broader impact statements gonna be. In any case, rant too long, check out paper, share it out, leave like comment if you disagree or agree. Yeah, bye bye.
[{"start": 0.0, "end": 6.8, "text": " Hi there, today we'll look at big self supervised models are strong semi supervised learners"}, {"start": 6.8, "end": 13.040000000000001, "text": " by Ting Chen, Simon Kornbluth, Kevin Swierski, Muhammad Nerozzi and Jeffrey Hinton of Google"}, {"start": 13.040000000000001, "end": 20.96, "text": " Brain. So this paper on a high level, it's also known as Sinclair v2 demonstrates that"}, {"start": 20.96, "end": 26.86, "text": " if you want to do semi supervised learning, that you're very well served by starting out"}, {"start": 26.86, "end": 33.76, "text": " with self supervised learning, and then doing fine tuning much like NLP models do rather"}, {"start": 33.76, "end": 40.519999999999996, "text": " than the kind of semi supervised approach that image image tasks had so far. And they"}, {"start": 40.519999999999996, "end": 46.92, "text": " present this Sinclair v2, which is an improvement over the Sinclair approach to self supervised"}, {"start": 46.92, "end": 54.6, "text": " pre training, and they demonstrate it outperforms a lot of the baselines. Alright, so if you"}, {"start": 54.6, "end": 60.08, "text": " like content like this, don't forget to share it out and leave a like and tell me what you"}, {"start": 60.08, "end": 69.08, "text": " think in the comments. So this paper, it sort of is kind of a club together thing of different"}, {"start": 69.08, "end": 74.96000000000001, "text": " of different things. So they present this new method like SIM, this Sinclair v2, which"}, {"start": 74.96000000000001, "end": 80.92, "text": " is a modification of Sinclair and we'll go over that. But they also try to make like"}, {"start": 80.92, "end": 90.6, "text": " a scientific claim, namely that the that somehow bigger models are better for this pathway"}, {"start": 90.6, "end": 97.28, "text": " of learning, and we'll try to untangle all of these things. So first of all, we're in"}, {"start": 97.28, "end": 102.48, "text": " the semi supervised learning regime right here. Semi supervised basically means that"}, {"start": 102.48, "end": 109.98, "text": " you have a data set and you only have labels for a part of that data set. So this could"}, {"start": 109.98, "end": 116.76, "text": " be like here the bottom 10% or so, because labels might be expensive to get. And so you"}, {"start": 116.76, "end": 122.56, "text": " only have a few of them, but you have much more data that's unlabeled. Now, sometimes"}, {"start": 122.56, "end": 128.56, "text": " this problem is formulated as this here is your data set. And then this here is like"}, {"start": 128.56, "end": 133.16, "text": " a different data set, but one that's close enough such that you can learn from it. And"}, {"start": 133.16, "end": 139.96, "text": " that's usually in NLP, you'll have your data set is like a sentiment classification task,"}, {"start": 139.96, "end": 144.12, "text": " but you have all of Wikipedia that is not labeled, but it's just text. So you can sort"}, {"start": 144.12, "end": 151.28, "text": " of pre train on it. In this case, we'll be in a situation where we'll artificially construct"}, {"start": 151.28, "end": 158.52, "text": " a small data set. So this entire thing here is going to be the ImageNet data set. And"}, {"start": 158.52, "end": 164.68, "text": " this right here is going to be our labeled portion, like we have labels. Now, usually"}, {"start": 164.68, "end": 171.6, "text": " one has labels for ImageNet as well, but we artificially restrict ourselves to simulate"}, {"start": 171.6, "end": 178.28, "text": " a situation where we have lots of data, and we only have a fixed budget. So we can only"}, {"start": 178.28, "end": 183.56, "text": " because to obtain labels, oftentimes you have to ask humans right to label images. And let's"}, {"start": 183.56, "end": 190.28, "text": " say we are a company and we've collected this big data set, but we only have like, maybe"}, {"start": 190.28, "end": 196.84, "text": " 500 bucks on Amazon Mechanical Turk. And we only managed to get a very like 1% of our"}, {"start": 196.84, "end": 204.68, "text": " data set labeled. Now we're in the in the regime of semi supervised learning. Okay,"}, {"start": 204.68, "end": 210.08, "text": " this is slightly different from what NLP does. And as I said, in NLP, usually assume you"}, {"start": 210.08, "end": 215.08, "text": " have different data sets, the large one being the different distribution. And in the semi"}, {"start": 215.08, "end": 220.2, "text": " supervised regime, you often assume that it is actually the same data distribution, but"}, {"start": 220.2, "end": 224.72, "text": " you only have labels for some of them. But there should be a fair bit of overlap between"}, {"start": 224.72, "end": 232.88, "text": " the two things. So, oh, I've recently made a video about OpenAI's image GPT that kind"}, {"start": 232.88, "end": 238.23999999999998, "text": " of goes into the into the same direction as this work right here, that basically says"}, {"start": 238.23999999999998, "end": 244.79999999999998, "text": " pre training on unlabeled data, like this whole data set without the labels can be a"}, {"start": 244.8, "end": 253.92000000000002, "text": " very good preconditioner for fine tuning later. And this paper says the same thing. So basically,"}, {"start": 253.92000000000002, "end": 259.08000000000004, "text": " in in the good old days, what you would do is you would devise a method that somehow"}, {"start": 259.08000000000004, "end": 266.48, "text": " takes, you know, takes in a devise a method that takes in a mini batch. And in the mini"}, {"start": 266.48, "end": 272.24, "text": " batch, you'd have your data samples, and then some of them would be labeled right here,"}, {"start": 272.24, "end": 276.8, "text": " you'd have y and here you'd have a y, but most of them would be not labeled. And you'd"}, {"start": 276.8, "end": 282.2, "text": " have like some sort of loss function that would put special weight on the ones that"}, {"start": 282.2, "end": 287.68, "text": " are labeled or somehow handle these ones that are unlabeled in a way, you might be doing"}, {"start": 287.68, "end": 293.92, "text": " like a some sort of a consistency loss such that if they are very nearest near neighbors"}, {"start": 293.92, "end": 299.0, "text": " to these in the feature space, they should have similar labels or things like this. So"}, {"start": 299.0, "end": 305.88, "text": " these semi supervised methods, they basically try to solve the problem at once. But while"}, {"start": 305.88, "end": 310.64, "text": " taking data that is labeled and not labeled, this paper goes into a different direction."}, {"start": 310.64, "end": 317.2, "text": " This paper says, first, we should, it's actually three stages right here, and they have a diagram."}, {"start": 317.2, "end": 323.66, "text": " So I don't need to draw. They have a three stage approach, three stages, the one on the"}, {"start": 323.66, "end": 330.92, "text": " left is unsupervised pre training. So they say, let's forget about the labels right now,"}, {"start": 330.92, "end": 336.40000000000003, "text": " even like your unlabeled data. So even the data where we have the labels, let's forget"}, {"start": 336.40000000000003, "end": 342.48, "text": " about the labels. And let's just do unsupervised pre training. Now unsupervised pre training"}, {"start": 342.48, "end": 348.96000000000004, "text": " in this kind of setting is also known as self supervised pre training. And this first stage"}, {"start": 348.96, "end": 356.76, "text": " is done using a contrastive loss. And that's very similar to sim clear to this contrastive"}, {"start": 356.76, "end": 361.91999999999996, "text": " loss. So what you'll do, and they describe it very, very well here. So what you'll do"}, {"start": 361.91999999999996, "end": 368.28, "text": " is given a randomly sampled mini batch of images, each image is augmented twice using"}, {"start": 368.28, "end": 374.12, "text": " random crop color distortion and Gaussian blur, creating two views of the same example."}, {"start": 374.12, "end": 379.72, "text": " Okay, so you have an image in your mini batch, each image you take, and you make two versions"}, {"start": 379.72, "end": 385.12, "text": " of it. And each version you crop the random crop somewhere. So version one could be random"}, {"start": 385.12, "end": 390.88, "text": " cropped here, version two could be random cropped here. And then you put some Gaussian"}, {"start": 390.88, "end": 396.72, "text": " blur on it, and so on. So a little bit of, as you can see, random crop color distortion,"}, {"start": 396.72, "end": 402.96, "text": " Gaussian blur. So what you'll want is two different versions of the same image. Each"}, {"start": 402.96, "end": 408.76, "text": " of these versions has been augmented in a different way cropped in a different way,"}, {"start": 408.76, "end": 413.52, "text": " blurred in a different way, such it's, it's two slightly different versions of the same"}, {"start": 413.52, "end": 422.74, "text": " image. And now you want to enforce, you want to put this through your network. So ultimately,"}, {"start": 422.74, "end": 428.91999999999996, "text": " as you can see on the right side here, what you want to end up is a, a network. And then"}, {"start": 428.92, "end": 436.04, "text": " okay, we'll forget about this right now. What you want to train is this network right here,"}, {"start": 436.04, "end": 440.04, "text": " actually including these projection layers, we'll get to them later. This is the network"}, {"start": 440.04, "end": 444.8, "text": " that you want to train. So you want to put your take your unlabeled data, you take an"}, {"start": 444.8, "end": 452.48, "text": " image, you'd make two versions of it. And you put those through the network, right until"}, {"start": 452.48, "end": 461.04, "text": " the end right here. So you'll get z one, z two, these are the the output of the network"}, {"start": 461.04, "end": 465.28000000000003, "text": " for the two images. And then what you want to do is you want to take another image that's"}, {"start": 465.28000000000003, "end": 471.52000000000004, "text": " not this image, and also put it through the network, maybe also augmented first. And then"}, {"start": 471.52000000000004, "end": 477.8, "text": " you have z three. So now you have the outputs of two things that are supposed to come from"}, {"start": 477.8, "end": 481.88, "text": " the same image and one thing that's supposed to come from a different image. And now your"}, {"start": 481.88, "end": 489.64, "text": " loss is simply going to be make those two things close together, and push those two"}, {"start": 489.64, "end": 496.84, "text": " things apart, or those three actually. So the loss, and this is this is the contrastive"}, {"start": 496.84, "end": 502.88, "text": " loss of self supervised learning. As you know, you don't need any labels right here, you"}, {"start": 502.88, "end": 506.84, "text": " simply say the things that come from the same image should be close together. And the things"}, {"start": 506.84, "end": 512.56, "text": " that come from different images should be far apart. And this relies heavily on these"}, {"start": 512.56, "end": 518.24, "text": " data augmentations that you do right here. They also employ some other tricks like the"}, {"start": 518.24, "end": 525.0, "text": " momentum encoder from moco from momentum, contrast, and so on. But this is the main,"}, {"start": 525.0, "end": 531.92, "text": " the main part. So you can pull a lot of strings here to get like another percent of performance."}, {"start": 531.92, "end": 540.4799999999999, "text": " But ultimately, they won't see the similarity of z i and z j, which are the outputs of the"}, {"start": 540.4799999999999, "end": 548.12, "text": " same image to be close together. And then this down here, they want to be far apart"}, {"start": 548.12, "end": 556.7199999999999, "text": " z i with z k, where k is all the other images. Okay, you can do this in a mini batch fashion."}, {"start": 556.7199999999999, "end": 561.64, "text": " So this is self supervised learning. And the reason why you do this is you don't need labels"}, {"start": 561.64, "end": 570.36, "text": " and it tends we know it tends to give very, very good representations. So I'm past that."}, {"start": 570.36, "end": 576.68, "text": " So what this network here will learn will be very good records for some reason, we still"}, {"start": 576.68, "end": 582.68, "text": " don't exactly know why combining augmentation with the self supervised loss with contrastive"}, {"start": 582.68, "end": 591.78, "text": " loss, for example, gives such good performance. There have been papers recently that modify"}, {"start": 591.78, "end": 596.92, "text": " the loss and so on. But it's not super well understood yet. But if you do it like this,"}, {"start": 596.92, "end": 602.0, "text": " there, the network here will give you already very, very good representation. And we know"}, {"start": 602.0, "end": 607.64, "text": " this because we can take a network like this, and then simply train a linear classifier"}, {"start": 607.64, "end": 615.04, "text": " on top of that on a data set and achieve very, very good performance. And mind you, you have"}, {"start": 615.04, "end": 620.88, "text": " trained it with unlabeled data, right? So the network has never been trained to solve"}, {"start": 620.88, "end": 625.84, "text": " like image net classification, it has simply been trained to look at the pictures and determine"}, {"start": 625.84, "end": 630.6, "text": " if, you know, two versions of a picture come from the same picture or from different pictures."}, {"start": 630.6, "end": 635.96, "text": " And now, if you simply train a linear classifier on top of these representations, you're doing"}, {"start": 635.96, "end": 641.52, "text": " extremely well already. So we know these representations, they actually learn something about these"}, {"start": 641.52, "end": 650.24, "text": " images. So that's the first part. Then stage two, let's cancel all of that stage two is"}, {"start": 650.24, "end": 656.9200000000001, "text": " you want to do supervised fine tuning. Now, you already see that the arrow here coming"}, {"start": 656.9200000000001, "end": 663.6800000000001, "text": " out is not this task agnostic big CNN, the arrow is actually coming out of those grip"}, {"start": 663.68, "end": 669.12, "text": " those yellow boxes. And the yellow boxes are these projection heads. So in the original"}, {"start": 669.12, "end": 676.3599999999999, "text": " sim clear paper, what they did was they, they wanted originally, they wanted to train this"}, {"start": 676.3599999999999, "end": 682.0, "text": " network right here. This is like a resonant 50 is pretty standard in these kind of self"}, {"start": 682.0, "end": 688.5999999999999, "text": " supervised approaches and so on to train, or these few label approaches to train a a"}, {"start": 688.6, "end": 694.64, "text": " standardized network. And this is like a resonant 50. So in the original sim clear paper, they"}, {"start": 694.64, "end": 700.64, "text": " said, we want to make resonant 50 as strong as possible. But in order to do this loss"}, {"start": 700.64, "end": 707.2, "text": " right here, we are going to attach this projection head just to because the dimensionality here"}, {"start": 707.2, "end": 713.84, "text": " I think is like 2048. And we want to do this inner product in a lower dimension of like"}, {"start": 713.84, "end": 721.0, "text": " maybe 256 or so. So this these are just multi layer perceptrons, these are just fully connected"}, {"start": 721.0, "end": 728.6, "text": " layers that compress the representation down to that. And once we're done with the unsupervised"}, {"start": 728.6, "end": 732.2800000000001, "text": " pre training, we're going to throw those away, right? And this resonant is the thing that"}, {"start": 732.2800000000001, "end": 738.76, "text": " we really care about. Now, here they claim, okay, it actually works better. And they have"}, {"start": 738.76, "end": 746.12, "text": " experiments to prove this or to show this, if you use one, if you actually leave one"}, {"start": 746.12, "end": 751.16, "text": " of these layers here. So in the end, they I guess they converge on three projection"}, {"start": 751.16, "end": 757.84, "text": " head layers. And then they only throw away the top two. And like they make this big deal"}, {"start": 757.84, "end": 763.08, "text": " out of the fact where, you know, I can just call I can just call this part right here"}, {"start": 763.08, "end": 771.6800000000001, "text": " now, the encoder. And I don't so I don't know, exact, like, I don't see the giant deal here,"}, {"start": 771.6800000000001, "end": 777.08, "text": " like you just made your network one layer bigger. And now you consider that to be your"}, {"start": 777.08, "end": 782.36, "text": " encoder. And the projection head is now two layers. And that will be much easier than"}, {"start": 782.36, "end": 786.76, "text": " calling the projection had three layers, but we leave one layer and we train from the middle"}, {"start": 786.76, "end": 793.0400000000001, "text": " layer. In any case, they have this layer additional layer right here compared to the old sim clear."}, {"start": 793.04, "end": 798.16, "text": " And then the representation of that goes into supervised fine tuning. Now, this is pretty"}, {"start": 798.16, "end": 804.28, "text": " easy. This is exactly what it sounds like. So now you use only only the data set that"}, {"start": 804.28, "end": 809.4, "text": " has labels. So the part of the data set that has labels, and you do the fine tuning and"}, {"start": 809.4, "end": 815.24, "text": " fine tuning is simply supervised learning, you train this network in a supervised fashion,"}, {"start": 815.24, "end": 822.38, "text": " on that small fraction of data that has class labels. And that already performs pretty well."}, {"start": 822.38, "end": 827.96, "text": " And they show this in experiments. But then you can go a step further and do what's known"}, {"start": 827.96, "end": 837.28, "text": " as distillation or self training. And what's distillation or self training, it's so distillation"}, {"start": 837.28, "end": 842.88, "text": " is when you have a network that you call the teacher network. And that network has been"}, {"start": 842.88, "end": 851.16, "text": " trained to do some classification maybe into three classes, pretty, pretty well. Okay,"}, {"start": 851.16, "end": 857.04, "text": " but now, this is very large, and you want maybe a smaller model. So you just want like"}, {"start": 857.04, "end": 861.28, "text": " this tiny model because you want to ship it on a mobile device, right? But it's also supposed"}, {"start": 861.28, "end": 867.92, "text": " to do this. And you know, that if you just directly train this, which is called the student"}, {"start": 867.92, "end": 873.16, "text": " model, it doesn't perform as well as the teacher model, there is a better way. If you have"}, {"start": 873.16, "end": 877.9599999999999, "text": " the teacher model, you can sort of transfer the knowledge to the student model, you can"}, {"start": 877.96, "end": 883.24, "text": " distill the knowledge. And how do you do that? You do that by so what you what would you"}, {"start": 883.24, "end": 888.5600000000001, "text": " do in supervised training in supervised training, you would take an image, put it in, and then"}, {"start": 888.5600000000001, "end": 894.4000000000001, "text": " put the label that comes along with the image, you put it up here, and you compare the output"}, {"start": 894.4000000000001, "end": 901.6800000000001, "text": " to the label and that gives you the loss function, right? Now, you do that right here. If you"}, {"start": 901.68, "end": 908.52, "text": " distill, you put the image into both. Now the teacher is already trained. So its output"}, {"start": 908.52, "end": 913.9599999999999, "text": " will be a distribution over classes, it won't be a single label, it will be like, okay,"}, {"start": 913.9599999999999, "end": 921.06, "text": " 90% class one, 10%, class two, 0%, class three, something like this. And now you take this"}, {"start": 921.06, "end": 927.06, "text": " as like a pseudo label, this entire distribution, and you put it here, and you compare the output"}, {"start": 927.06, "end": 932.68, "text": " of the student to that of the teacher, and that's your loss function. So this kind of"}, {"start": 932.68, "end": 937.8199999999999, "text": " the teacher might have learned to put some nuance into the classification to say, well,"}, {"start": 937.8199999999999, "end": 943.8399999999999, "text": " I'm pretty sure this is class one, but I'm not 100% sure. And it can transfer that knowledge"}, {"start": 943.8399999999999, "end": 948.5799999999999, "text": " to the student. And that makes the student better than had you just trained it from the"}, {"start": 948.5799999999999, "end": 956.1199999999999, "text": " beginning from from with just the labels. Right, so this is distillation. And you can"}, {"start": 956.12, "end": 963.2, "text": " do this, even what they call self distillation here or self training. So apparently, this"}, {"start": 963.2, "end": 970.42, "text": " even helps if the teacher is if the student model is the same as the teacher model. Now,"}, {"start": 970.42, "end": 975.52, "text": " why does it help in this case? And I think it is not exactly the case in this case, because"}, {"start": 975.52, "end": 979.98, "text": " they always say their teacher model has this extra projection layer, right? And then the"}, {"start": 979.98, "end": 985.26, "text": " student model doesn't have that even if they do self training. But why does it help in"}, {"start": 985.26, "end": 990.24, "text": " this case? I mean, it's it's kind of shocking. And I'm pretty sure it helps in any case."}, {"start": 990.24, "end": 997.86, "text": " But in this particular case, it helps because now you're using the unlabeled data again."}, {"start": 997.86, "end": 1004.72, "text": " So you have a teacher model and the teacher model is trained first using unsupervised,"}, {"start": 1004.72, "end": 1009.68, "text": " like this is the teacher model right here, using unsupervised training, then the teacher"}, {"start": 1009.68, "end": 1016.54, "text": " model is further fine tuned on the small data, right? So it is now already pretty good at"}, {"start": 1016.54, "end": 1022.9399999999999, "text": " the task. But how can you get a student model that's even better than the teacher model?"}, {"start": 1022.9399999999999, "end": 1027.54, "text": " It's by using again, this unlabeled data, you have this giant amount of data. So what"}, {"start": 1027.54, "end": 1032.82, "text": " you'll do is you take an image from the unlabeled data, and you ask the teacher model, teacher"}, {"start": 1032.82, "end": 1038.54, "text": " model, what do you think about that image, right? And the teacher model will give you"}, {"start": 1038.54, "end": 1045.12, "text": " a prediction, like let's say, again, this 90% 10% 0%. And then you take the student"}, {"start": 1045.12, "end": 1051.82, "text": " model, you input that image, and you compare its output to what the teacher said. So this"}, {"start": 1051.82, "end": 1056.78, "text": " combines the teacher model, you freeze the teacher model, right, the teacher model is"}, {"start": 1056.78, "end": 1063.74, "text": " only trained until here, you take it from here, the student model is now able to take"}, {"start": 1063.74, "end": 1071.94, "text": " basically the teacher, it takes everything that the teacher model knows, not only about"}, {"start": 1071.94, "end": 1076.86, "text": " this data, but about all the data. So it kind of gets to ask the teacher model, what do"}, {"start": 1076.86, "end": 1080.46, "text": " you think about this? What do you think about this? What do you think about this? And it"}, {"start": 1080.46, "end": 1086.42, "text": " it can incorporate all that knowledge about all of this unlabeled data. And that's why"}, {"start": 1086.42, "end": 1093.02, "text": " the student model here in the end, if it's the same size, will probably end up even better"}, {"start": 1093.02, "end": 1098.22, "text": " than the teacher model, right? So distillation, I think also is still kind of a mystery of"}, {"start": 1098.22, "end": 1105.78, "text": " why you get a better model or, I mean, to, to make it smaller, if you make it a lot smaller,"}, {"start": 1105.78, "end": 1109.1, "text": " usually you don't end up with a better model, but you end up with a pretty good model that"}, {"start": 1109.1, "end": 1115.3799999999999, "text": " you couldn't have gotten by just training the small model. But so that's already pretty"}, {"start": 1115.3799999999999, "end": 1121.82, "text": " cool. But why you get a better model with when they're the same size, that's, I don't"}, {"start": 1121.82, "end": 1129.5, "text": " think that's well understood yet. So that's the three stage approach. So recap, first,"}, {"start": 1129.5, "end": 1136.3799999999999, "text": " use all of the data without labels to do unsupervised or self supervised contrastive pre training."}, {"start": 1136.3799999999999, "end": 1144.86, "text": " Second, use only the data that has labels to do fine tuning. Third, either distill the"}, {"start": 1144.86, "end": 1153.1799999999998, "text": " learned classifier to a smaller model, or distill it to a model of the same size again,"}, {"start": 1153.1799999999998, "end": 1160.8799999999999, "text": " with in both cases, you would again use the unlabeled all of the unlabeled data. Okay."}, {"start": 1160.8799999999999, "end": 1168.78, "text": " And that's the three step approach. That's SimClear v2 in its in all of its form. Right,"}, {"start": 1168.78, "end": 1177.96, "text": " so they go into fine tuning right here. And yeah, so they say, we elaborate with a three"}, {"start": 1177.96, "end": 1183.42, "text": " layer projection head. So that's the three layer projection head. This here is the output"}, {"start": 1183.42, "end": 1191.66, "text": " of resnet 50, where sigma is a relu non linearity, and we ignore the bias term for brevity, blah,"}, {"start": 1191.66, "end": 1198.7, "text": " blah, blah, blah. So they contrast this here for fine tuning, SimClear uses this right"}, {"start": 1198.7, "end": 1205.14, "text": " here, which is just, it's basically just a classifier on top of the output of the resnet"}, {"start": 1205.14, "end": 1213.7, "text": " 50. Okay. Yada, yada, yada, yada. This is fine tuning from the input layer of the projection"}, {"start": 1213.7, "end": 1218.42, "text": " head to fine tune from the first layer of the projection head, we have a new encoder"}, {"start": 1218.42, "end": 1224.6200000000001, "text": " function as this, which is resnet followed by fully connected layers. And you see they"}, {"start": 1224.6200000000001, "end": 1231.3000000000002, "text": " take the resnet 50 output and they ship it through the first projection layer. And then"}, {"start": 1231.3000000000002, "end": 1236.3600000000001, "text": " there is a task specific classifier. Now, again, why? I don't even see why they make"}, {"start": 1236.3600000000001, "end": 1242.3600000000001, "text": " like this ginormous deal out of it, especially especially since the last layer of the resnet"}, {"start": 1242.36, "end": 1249.1399999999999, "text": " 50. I'm not okay, here is I'm not entirely sure. But are they taking the look? No, they"}, {"start": 1249.1399999999999, "end": 1256.2199999999998, "text": " probably not taking the log, it's okay. But it's Yeah, I'm, it's just weird. Like, is"}, {"start": 1256.2199999999998, "end": 1261.8999999999999, "text": " there even a non linearity at the end right here? Or is this really just like two matrix"}, {"start": 1261.8999999999999, "end": 1266.26, "text": " multiplications in a row, which I'm going to guess there's a big chance that that's"}, {"start": 1266.26, "end": 1271.5, "text": " the case that the last layer of this encoder is actually not even followed by non linearity."}, {"start": 1271.5, "end": 1275.86, "text": " And therefore, you'll just kind of make the dimension different. And I don't see why you"}, {"start": 1275.86, "end": 1280.44, "text": " can't just just incorporate this into the model and have to like say it over and over"}, {"start": 1280.44, "end": 1285.1, "text": " again, that this is a new special thing, right? Again, this is equivalent of tuning from a"}, {"start": 1285.1, "end": 1290.18, "text": " middle layer of the projection head instead of the output layer. Okay, you just make your"}, {"start": 1290.18, "end": 1297.34, "text": " model a bit bigger. Yeah, so the third step is self training or knowledge distillation."}, {"start": 1297.34, "end": 1301.3999999999999, "text": " And they give two variants right here. This variant, as you can see here, this is this"}, {"start": 1301.3999999999999, "end": 1309.6599999999999, "text": " is just the cross entropy. But instead of having labels right here, why? Or you have"}, {"start": 1309.6599999999999, "end": 1318.58, "text": " the teacher what the teacher model things, y is given x, okay, that's, that's cross entropy,"}, {"start": 1318.58, "end": 1322.78, "text": " but not with the true labels, but with the output of the teacher model. And you can even"}, {"start": 1322.78, "end": 1330.66, "text": " mix that. So you can, as you can see, right here, you can mix this with an actual supervised"}, {"start": 1330.66, "end": 1335.2, "text": " loss. So this would be the supervised loss, whatever. Yeah, I guess that I was wrong."}, {"start": 1335.2, "end": 1342.66, "text": " That wasn't, I guess, p of y is always one in that case. But they don't use this particular"}, {"start": 1342.66, "end": 1352.3799999999999, "text": " kind, I think, except in one of the ablations. So how does this work? It works pretty well."}, {"start": 1352.38, "end": 1359.7600000000002, "text": " And so one of their experiments, as you see up here, it works pretty well in that if you"}, {"start": 1359.7600000000002, "end": 1368.5400000000002, "text": " have 1% of the labels, only 1% of ImageNet labels, which they say is smaller or equal"}, {"start": 1368.5400000000002, "end": 1375.38, "text": " than 13 images per class. So there's 1000 classes, and you only have 13 labels per class"}, {"start": 1375.38, "end": 1386.38, "text": " or less. If you and they differentiate, if your encoder that you train is a ResNet 50,"}, {"start": 1386.38, "end": 1392.5800000000002, "text": " then you get and you can see the dashed line here is a supervised baseline, you almost"}, {"start": 1392.5800000000002, "end": 1397.2800000000002, "text": " get to the supervised baseline with 1% of the labels. And if you actually have a larger"}, {"start": 1397.28, "end": 1406.5, "text": " ResNet, then you get to the supervised performance without 99% of the labels. And if you have,"}, {"start": 1406.5, "end": 1415.7, "text": " excuse me, 10% of the labels, you pass the supervised baseline. So the supervised baseline"}, {"start": 1415.7, "end": 1421.34, "text": " is on 100% of the labels mind you, and you only have 10%. And this outperforms the supervised"}, {"start": 1421.34, "end": 1425.94, "text": " baseline. Now, of course, you could here you could have another graphic where you show"}, {"start": 1425.94, "end": 1431.6200000000001, "text": " 100% what if we you know, what if we do the whole procedure with 100% of the label. So"}, {"start": 1431.6200000000001, "end": 1438.6200000000001, "text": " first we don't label the data, we do supervised self supervision, then we fine tune on 100%"}, {"start": 1438.6200000000001, "end": 1443.54, "text": " of the data. And then we do this distillation again, you would of course be even better."}, {"start": 1443.54, "end": 1448.1000000000001, "text": " And I think they have this somewhere in a table. But this is already pretty, pretty"}, {"start": 1448.1, "end": 1458.54, "text": " impressive. And another claim they make right here is about the model sizes. So and this"}, {"start": 1458.54, "end": 1466.4599999999998, "text": " figure is description, this now relates to the title, they say bigger models yield larger"}, {"start": 1466.4599999999998, "end": 1473.1399999999999, "text": " gains when fine tuning with fewer labeled examples. So there, there are three comparative"}, {"start": 1473.14, "end": 1483.1200000000001, "text": " statement words in one sentence. Let's unpack this. Bigger models yield larger gains. So"}, {"start": 1483.1200000000001, "end": 1490.8200000000002, "text": " the bigger, the bigger the model, the better the good, let's say, when fine tuning with"}, {"start": 1490.8200000000002, "end": 1494.7800000000002, "text": " fewer labeled examples, let's just look at the graph, it's pretty, it's really clear."}, {"start": 1494.7800000000002, "end": 1499.3600000000001, "text": " So here we have a number of parameters going over. So these are the different models they"}, {"start": 1499.36, "end": 1505.4599999999998, "text": " look at how many parameters they have to do this whole procedure. And here is the relative"}, {"start": 1505.4599999999998, "end": 1513.58, "text": " improvement in percent over the top ImageNet one top accuracy. So if you do this whole"}, {"start": 1513.58, "end": 1520.6999999999998, "text": " thing with 100% of the labels, right, I'm going to guess this here, this here is where"}, {"start": 1520.6999999999998, "end": 1528.1399999999999, "text": " they start out. And you can see as you grow your models, you grow the performance. And"}, {"start": 1528.14, "end": 1534.3400000000001, "text": " this, this is just by increasing the model size, right, you have the same data set, you"}, {"start": 1534.3400000000001, "end": 1538.7800000000002, "text": " have the same amount of labels, you have the same number of steps that you train for and"}, {"start": 1538.7800000000002, "end": 1547.5800000000002, "text": " so on. Just by the fact that you make your model bigger, you gain in performance. Okay."}, {"start": 1547.5800000000002, "end": 1554.7800000000002, "text": " Now you can see that these curves here are above one another. And these curves refer"}, {"start": 1554.78, "end": 1562.22, "text": " to getting a small, less and less labels. Okay. So if you only have 10% of the labels,"}, {"start": 1562.22, "end": 1568.3, "text": " your relative gains are larger. That doesn't mean that you perform better with 10% of the"}, {"start": 1568.3, "end": 1573.34, "text": " labels than with 100% of the labels, that would be that would be like ridiculous. Well,"}, {"start": 1573.34, "end": 1578.62, "text": " I guess in this day and age, nothing is ridiculous. But for now, we're still performing better"}, {"start": 1578.62, "end": 1587.82, "text": " by having more labels if we do the same procedure, right? It's not like here. So here, this baseline,"}, {"start": 1587.82, "end": 1592.86, "text": " the supervised baseline only does supervised training, right? So that's why we can outperform"}, {"start": 1592.86, "end": 1599.34, "text": " it with less of labels. But here we do the same procedure. This is relative improvement,"}, {"start": 1599.34, "end": 1608.58, "text": " right? So this right here, the starting point would be if you had 10% of labels and a 25"}, {"start": 1608.58, "end": 1614.58, "text": " million model parameter model. And this right here, for example, is if you have the same"}, {"start": 1614.58, "end": 1622.74, "text": " amount of labels, but a 200 million parameter model, and this is relative improvement. Okay."}, {"start": 1622.74, "end": 1631.6999999999998, "text": " But what the graph says is that the relative improvement is larger, the relative improvement"}, {"start": 1631.7, "end": 1639.9, "text": " is higher, the more parameters you have, which is the more you go to the right. And that"}, {"start": 1639.9, "end": 1646.06, "text": " effect in itself is higher, the fewer labels you have, which is the different graphs. And"}, {"start": 1646.06, "end": 1651.5800000000002, "text": " you can see that right here. So if you have fewer and fewer labels, it becomes more and"}, {"start": 1651.5800000000002, "end": 1656.82, "text": " more important that you have bigger models. And that's really counterintuitive, right?"}, {"start": 1656.82, "end": 1663.78, "text": " Because you would expect that the bigger models, they can overfit much more easily to the fewer"}, {"start": 1663.78, "end": 1669.06, "text": " labels. But that doesn't seem the case. So this self supervision, it really seems to"}, {"start": 1669.06, "end": 1675.54, "text": " be sort of a counter to this notion of overfitting. And if you have larger and larger models,"}, {"start": 1675.54, "end": 1681.1799999999998, "text": " that's what they argue in the paper, you might be able to learn more and more features that"}, {"start": 1681.1799999999998, "end": 1686.1, "text": " might be useful for classification. So if you have a larger model, you might you're"}, {"start": 1686.1, "end": 1691.58, "text": " going to learn more kinds of features, and then you're going to outperform because you"}, {"start": 1691.58, "end": 1696.3799999999999, "text": " have more chance that these features are going to be useful for classification. And I don't"}, {"start": 1696.3799999999999, "end": 1702.62, "text": " think they really make a statement as to why that happens more with the if you have less"}, {"start": 1702.62, "end": 1709.8999999999999, "text": " labels. So let's think about this. If I have very few labels, very, very few labels, why"}, {"start": 1709.8999999999999, "end": 1714.48, "text": " does it help me even more if I have a big model? Well, with the same argumentation,"}, {"start": 1714.48, "end": 1722.38, "text": " we could say and maybe they actually say this already. So I might be copying them involuntarily."}, {"start": 1722.38, "end": 1729.46, "text": " Maybe with fewer and fewer labels, like let's say we have all the labels, that's probably"}, {"start": 1729.46, "end": 1736.22, "text": " too many, right? If we can learn a task with some accuracy, we probably had too many labels."}, {"start": 1736.22, "end": 1741.14, "text": " Okay, it's like we like if we can't learn a task, we know we have too few somewhere,"}, {"start": 1741.14, "end": 1746.3000000000002, "text": " there is a border where we have enough, but that's like kind of one number. And everything"}, {"start": 1746.3000000000002, "end": 1754.42, "text": " else is too, too many, technically speaking, like learning theoretically speaking. So usually"}, {"start": 1754.42, "end": 1758.74, "text": " we have too many labels. And what does that mean? That probably means that there are multiple"}, {"start": 1758.74, "end": 1763.46, "text": " ways. Like if we have too many labels, there are multiple different features we can pick"}, {"start": 1763.46, "end": 1769.7, "text": " up to learn, there are multiple different paths to learn our goals. So if we have ImageNet,"}, {"start": 1769.7, "end": 1774.78, "text": " and like that, there's this weird task to recognize a three, and we get lots and lots"}, {"start": 1774.78, "end": 1780.78, "text": " and lots of examples of threes, right? We can, we can decide on a feature, we can say,"}, {"start": 1780.78, "end": 1784.8600000000001, "text": " oh, I all the threes that I see, they have this bow down here, or all the threes that"}, {"start": 1784.8600000000001, "end": 1790.18, "text": " I see, they have this bend here, and so on. But if I only have very few labels, there"}, {"start": 1790.18, "end": 1796.14, "text": " might only be like a single feature that is even theoretically possible to learn from"}, {"start": 1796.14, "end": 1802.26, "text": " the labels I'm given. And therefore, if I have a bigger model in cell in pre training,"}, {"start": 1802.26, "end": 1806.88, "text": " because the pre training happens with the same amount of data, right? If I have a, if"}, {"start": 1806.88, "end": 1811.74, "text": " I have a bigger model, that does the self supervised pre training is going to learn"}, {"start": 1811.74, "end": 1819.5, "text": " more features. And then there's a higher chance that that one feature that I'm that these"}, {"start": 1819.5, "end": 1825.7, "text": " very few labels that I am able to learn something from is going to be in these features. So"}, {"start": 1825.7, "end": 1832.94, "text": " that's kind of how I make sense of it in combination what with what they're saying right here."}, {"start": 1832.94, "end": 1840.22, "text": " Okay, so this was the main points, they do a lot of empirical studies showing the effects"}, {"start": 1840.22, "end": 1848.74, "text": " of these sizes, they stress that it's important to have both deep and wide networks. And they"}, {"start": 1848.74, "end": 1854.54, "text": " also do this additional attention mechanism over the convolution filters, I don't want"}, {"start": 1854.54, "end": 1862.46, "text": " to go into that particularly, but they they also do linear evaluation compared to supervised"}, {"start": 1862.46, "end": 1868.82, "text": " compared to fine tuning on with 100% of the labels. So they do a very thorough empirical"}, {"start": 1868.82, "end": 1880.3, "text": " investigation. And yeah, I do appreciate that. And they kind of show the same things. And"}, {"start": 1880.3, "end": 1886.1599999999999, "text": " here they show the number of layers in the projection head. So as you increase the number"}, {"start": 1886.1599999999999, "end": 1891.36, "text": " of layers in the projection head, and train from the optimal layer in the middle, your"}, {"start": 1891.36, "end": 1898.3799999999999, "text": " performance goes up, as you can see, but it also this effect is stronger when you have"}, {"start": 1898.3799999999999, "end": 1903.5, "text": " fewer labels, right, you can see the differences here are greater than the differences here,"}, {"start": 1903.5, "end": 1910.26, "text": " or even here when you have 100% of the labels. So the fewer labels, the fewer the labels,"}, {"start": 1910.26, "end": 1915.26, "text": " the more benefit you have from the architecture right here. And here they show that it's not"}, {"start": 1915.26, "end": 1920.74, "text": " always optimal to train from the last projection layer, but here the first one, so that I guess"}, {"start": 1920.74, "end": 1925.46, "text": " they converge on three projection layers. And you always want to keep the first one"}, {"start": 1925.46, "end": 1933.14, "text": " around after self supervised training, as we mentioned before. Okay, they investigate"}, {"start": 1933.14, "end": 1938.18, "text": " different different distillation losses and show that it is actually important that you"}, {"start": 1938.18, "end": 1946.14, "text": " do the distillation loss on labeled and unlabeled sets, you can see here, if you only do it,"}, {"start": 1946.14, "end": 1954.1000000000001, "text": " if you only train with the labels after fine tuning, you get poor performance, if you do"}, {"start": 1954.1000000000001, "end": 1960.26, "text": " the label and distillation loss, but only do it on the data set where you have labels,"}, {"start": 1960.26, "end": 1966.46, "text": " then you get more performance. If you do label and distillation loss, but also include your"}, {"start": 1966.46, "end": 1973.46, "text": " unlabeled data, you get even more performance. And then if you do that, but you don't do"}, {"start": 1973.46, "end": 1979.8, "text": " the label loss. So before we've seen you can mix the distillation loss with the label loss,"}, {"start": 1979.8, "end": 1985.04, "text": " if you have lots of labels, then you drop in performance again. And you can see right"}, {"start": 1985.04, "end": 1989.38, "text": " here, the drop in performance is proportional to how many labeled examples you have. And"}, {"start": 1989.38, "end": 1995.3600000000001, "text": " that's, that's natural, right? If you have the labels, you can actually mix that information"}, {"start": 1995.36, "end": 2000.5, "text": " in with the distillation loss, and that will make you better. And here they drop point"}, {"start": 2000.5, "end": 2007.74, "text": " one percent, and here they drop less than 1% by leaving away the labels. But their point"}, {"start": 2007.74, "end": 2016.24, "text": " basically is that it is more important to, to distill using also unlabeled data, then"}, {"start": 2016.24, "end": 2022.4599999999998, "text": " it is to distill, including the label loss. And it's much easier to not include the label"}, {"start": 2022.46, "end": 2031.5, "text": " loss, so they don't do it, I guess. All right, so I think that was it. They compare, as I"}, {"start": 2031.5, "end": 2037.3400000000001, "text": " said, they compare like self distillation, where you distill into an equally sized model"}, {"start": 2037.3400000000001, "end": 2044.4, "text": " and down distillation where you distill into a smaller model. Maybe that's vice versa."}, {"start": 2044.4, "end": 2050.54, "text": " And they do a lot of comparison to other methods. So this is a very thorough work, I feel. And"}, {"start": 2050.54, "end": 2057.9, "text": " yeah, if you want more about the exact experiments, I invite you to look at the paper. And let's"}, {"start": 2057.9, "end": 2065.62, "text": " just have a final look at the broader impact statement right here. So the broader, remember,"}, {"start": 2065.62, "end": 2074.34, "text": " the broader impact statement is supposed to force you to think about how society might"}, {"start": 2074.34, "end": 2081.54, "text": " be impacted at large by your work. So it says the finding described in this paper can potentially"}, {"start": 2081.54, "end": 2086.6600000000003, "text": " be harnessed to improve accuracy in any application or computer vision where it is more expensive"}, {"start": 2086.6600000000003, "end": 2091.5, "text": " or difficult to label additional data than to train larger models. Such applications"}, {"start": 2091.5, "end": 2097.42, "text": " are clearly beneficial to society. For example, in medical applications where acquiring high"}, {"start": 2097.42, "end": 2102.2200000000003, "text": " quality labels requires careful annotation by clinicians, better semi-supervised learning"}, {"start": 2102.22, "end": 2107.02, "text": " approaches can potentially help save lives. Application of computer vision to agriculture"}, {"start": 2107.02, "end": 2112.7, "text": " can increase crop yields, which may help to improve availability of food. However, we"}, {"start": 2112.7, "end": 2117.1, "text": " also recognize their approach can become a potential component of harmful surveillance"}, {"start": 2117.1, "end": 2123.7999999999997, "text": " systems. Moreover, there is an entire industry built around human labeling services and technology"}, {"start": 2123.7999999999997, "end": 2128.06, "text": " that reduces the need for these services could lead to short term loss of income for some"}, {"start": 2128.06, "end": 2134.2999999999997, "text": " of those currently employed or contracted to provide labels. So ask yourself how much"}, {"start": 2134.2999999999997, "end": 2142.34, "text": " of that statement has to do with the actual novelty of this paper? And the answer is,"}, {"start": 2142.34, "end": 2149.2999999999997, "text": " of course, zero, right? Like you can replace like our method in this thing with like machine"}, {"start": 2149.2999999999997, "end": 2156.7999999999997, "text": " learning or computer vision in general, like, oh, really, SimClear V2 specifically can increase"}, {"start": 2156.8, "end": 2164.46, "text": " crop yields, like that specific invention of this paper will lead to higher crop yields"}, {"start": 2164.46, "end": 2172.6600000000003, "text": " will lead to surveillance systems. So I'm, yeah, you know, I think like, I don't want"}, {"start": 2172.6600000000003, "end": 2180.5, "text": " to get too too upset about these. I mean, this, I think it's quite funny. But just,"}, {"start": 2180.5, "end": 2189.82, "text": " again, I, I wonder whether the people advocating for these things are happy with these statements,"}, {"start": 2189.82, "end": 2198.18, "text": " because clearly, clearly, this is just a template that you copy paste from paper to paper, replacing"}, {"start": 2198.18, "end": 2203.16, "text": " like a few words. And if it's computer vision, you're like, oh, my deep fakes. And if it's"}, {"start": 2203.16, "end": 2214.74, "text": " NLP, it's like, I'm a fake news. And yeah, I, I wonder if really anything, like, particularly"}, {"start": 2214.74, "end": 2221.74, "text": " is has I wonder whether these people are happy now. Yeah, I just I wonder. And if, if they"}, {"start": 2221.74, "end": 2228.66, "text": " are, I wonder whether it's really for the reason that they claim that, oh, now we have"}, {"start": 2228.66, "end": 2233.8999999999996, "text": " a statement here of how it impacts society, because I could have told you that before"}, {"start": 2233.8999999999996, "end": 2238.14, "text": " could have told you that before I even read the title of the paper, right? What the broader"}, {"start": 2238.14, "end": 2244.3399999999997, "text": " impact statements gonna be. In any case, rant too long, check out paper, share it out, leave"}, {"start": 2244.34, "end": 2260.7400000000002, "text": " like comment if you disagree or agree. Yeah, bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=THcuTJbeD34
On the Measure of Intelligence by François Chollet - Part 2: Human Priors (Paper Explained)
In this part, we go much more in-depth into the relationship between intelligence, generality, skill, experience, and prior knowledge and take a close look at what priors are built into humans. This will form the basis for comparing the intelligence of humans and AI systems. OUTLINE: 0:00 - Intro & Recap 3:00 - Optimize for Generality 5:45 - Buying Skill with Data and Priors 12:40 - The Human Scope 17:30 - Human Priors 24:05 - Core Knowledge 28:50 - Comments & Conclusion Paper: https://arxiv.org/abs/1911.01547 Tim Scarfe's Video: https://youtu.be/GpWLZUbPhr0 Abstract: To make deliberate progress towards more intelligent and more human-like artificial systems, we need to be following an appropriate feedback signal: we need to be able to define and evaluate intelligence in a way that enables comparisons between two systems, as well as comparisons with humans. Over the past hundred years, there has been an abundance of attempts to define and measure intelligence, across both the fields of psychology and AI. We summarize and critically assess these definitions and evaluation approaches, while making apparent the two historical conceptions of intelligence that have implicitly guided them. We note that in practice, the contemporary AI community still gravitates towards benchmarking intelligence by comparing the skill exhibited by AIs and humans at specific tasks such as board games and video games. We argue that solely measuring skill at any given task falls short of measuring intelligence, because skill is heavily modulated by prior knowledge and experience: unlimited priors or unlimited training data allow experimenters to "buy" arbitrary levels of skills for a system, in a way that masks the system's own generalization power. We then articulate a new formal definition of intelligence based on Algorithmic Information Theory, describing intelligence as skill-acquisition efficiency and highlighting the concepts of scope, generalization difficulty, priors, and experience. Using this definition, we propose a set of guidelines for what a general AI benchmark should look like. Finally, we present a benchmark closely following these guidelines, the Abstraction and Reasoning Corpus (ARC), built upon an explicit set of priors designed to be as close as possible to innate human priors. We argue that ARC can be used to measure a human-like form of general fluid intelligence and that it enables fair general intelligence comparisons between AI systems and humans. Authors: François Chollet Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we're going to continue with On the Measure of Intelligence by Francois Chollet. Now if you remember last time, if you haven't seen last time, go watch part one if you're interested. This is a multi-part series on this paper. Why? Because the paper itself is very long. It's 40 pages, the main part, and it's a big wall of text. So I've opted to basically pull out notes and show you the notes that I have pulled out. And to divide this into multiple parts. So last time we went over sort of the history of assessing intelligence and the basics. And I know I said this time I'm going to get into the math, but I lied. So I realized that there's still a lot that comes up in part two of the paper before we get into the actual math. So this part is going to be about the prerequisites to that and then next time math. I'm sorry to disappoint anyone. You might just skip this one if you want. I do have to shout out Tim Scarfe, who of course runs the Machine Learning Street Talk channel podcast with me and Connor Shorten together. Tim has just made an entire video about this paper, about On the Measure of Intelligence. And his videos are usually like super high quality, like higher than mine. And it's the entire paper. So if you want to know the end of the story or have a different take on the paper, definitely can recommend his video. I do make a guest appearance there. So yeah, that's a given. And I will still finish the paper on this channel just in my regular, in this style right here. So all the options are available to you. Let's dive into part two. So if you remember part one, we sort of went over what it means to be intelligent. And we differentiated basically two things, which are skills and abilities. So a skill is how well you achieve a given task or how well you can do in a given task. So this could be chess or, you know, go or like something very, very measurable. An IQ test is a specific task. So these things right here are all tasks. But these tasks aren't the thing we're interested in. Just because a machine is good at chess doesn't mean it's intelligent. And what we want is sort of a generalizable skill. So we want to assess how generalizable is an ability. So can I throw a computer at a new problem that it has never seen before, and it can solve that. And that's going to be this generalizability, this notion of can you solve things that you have never encountered before and weren't prepared for. That is going to be the basis for us to measure intelligence. So Chollet says you have to optimize directly for generality and flexibility rather than task performance if you want to build an intelligent agent. You have to sort of build something that is not just good at a thing. It is good at getting good at things. That's almost a quote, quote worthy thing. So if you just give it a single task, the learner will just take any available shortcuts. So if you just say you have to be good at chess, the developer of a system can exploit all the tricks that make you good at chess. And you don't have to be smart. You just know basically if you had enough memory, you could just memorize all the moves of all the chess games ever. That's why we say hard-coded chatbots are not intelligent. So hard-coded chatbots, they simply match your input to a database of reg exes and then they answer. And we're not very impressed because as soon as I give them something that is not covered by their reg exes, they fail. They just say I don't know or something like this. In fact, what is intelligent is the engineer in that case. So the engineer that makes the program is intelligent. So he has this drawing, I think I've shown it last time, where you have the environment and there is this agent. And if the agent is really good with the environment, you might consider that intelligent. But in Chollet's mind, you have to also consider here the developer of the agent. It could be that the developer is very intelligent and just builds the agent to interact with the environment in a matter that it gets a lot of reward. It's very good at a skill, but the agent itself might not be intelligent. So it says intelligence, the intelligence of a process is not encoded by the performance of a system, but by the fact that the same process can be applied to different tasks. So in this case, if I have a new task, a new environment, so E2 right here, the question is, could I throw the same agent at that even if it hasn't seen it before? Or would I be able to take the same developer that develops me a new agent, agent two, that then can solve the task? In the case where I can throw over the agent, that would make an argument that the agent is intelligent. But if I can't, you'd have to make the argument that the developer is the intelligent part here, which of course is the point of what he's saying right here. So hard coded programs themselves are not intelligent, but and this is the case, the same counts for adding more training data. So not only is the hard coding not intelligent, it's also Chollet says not intelligence if you simply add more training data. So a machine learning system that sort of learns to how to interact with these environments. If you can imagine that you have lots of environments, environment, environment, environment, environment, and so on, that give you a dense sampling of the environment space. So you have all of these environments, you build all of them, and you train this agent to interact well with all of them. So you give it lots of compute, lots of data, and the the environments are really a dense sampling of the environment space. It will be able even though it has never seen environment to write this environment right here, it might be just able to generalize to this environment, given that it has been trained on all the environments here. Like it has been trained on every possible environment around this environment that is similar to this environment, it could generally generalize to environment too. But also, we wouldn't view that as intelligent because it in a sense, this skill has been bought with data. And this notion of buying skill is is comes up a lot in this paper. So Shreya says there are two ways to buy a skill. And by buying, he basically means you don't buying as opposed to intelligently solving the skill. So whenever you buy a skill, that's not intelligence, Shreya says. And you can buy a skill by either hard coding the solution or giving lots of data. And there is like this spectrum, where you hard code, completely hard code a solution. And here is where you completely only feed data. So here would be something like GPT-3. Right, there are almost no priors there. It's just a transformer, big transformer. And you just throw in data, lots and lots and lots and lots and lots of data. So in this measure, last time I've had lots of people when GPT-3 came out, I've had people commenting on the part one of this paper saying, isn't GPT-3 intelligent because, you know, it can sort of generalize to these tasks that it hasn't been trained on. By the way, if you haven't seen the GPT-3 video, you should go watch it. Something tells me this video is popular. It might be the five times as many views as any other video. So at least it's not a terrible video. But in essence, GPT-3 can solve these tasks that it wasn't trained for. And therefore, you might argue in this definition right here, it could be intelligent because it can generalize. But there is this counteraction where Chollet says, maybe you have just bought that skill with lots and lots of data. Now, I actually don't know what to say to this, because, I mean, it really seems like GPT-3 generalizes to tasks it has never seen before. But also it has had a lot of data. And so as of right now, it is not really clear where the line is here. Like when are we going to argue that GPT-3 is actually like, it could be that it has had lots of data, but also it is intelligent. How are we going to make that distinction? And I guess we're going to get into the math part. But I can tell you right now, the math part is so abstract as it is not really practical. It is like a theoretical framework that you might be able to approximate. But, you know, there is like a wishy-washy thing going on. But he basically says, OK, there's this spectrum of hard coding over here and then fully learning from data. And with all of these methods and, you know, in between methods, like a CNN would be here because it has like considerable priors because of its architecture and so on. And over here would be something like an A star search with like a learned heuristic or things like this. You can get good with any of these things, but the intelligence is orthogonal to that. So orthogonal to that is the intelligence axis. It has nothing. Chollet says this has nothing to do with this dimension. You can buy skill with this, but it's basically like it's like a triangle almost sort of where you have hard coding data and then intelligence. And it's like its own axis. So the hard coding refers to the priors of a system that the developer has basically built in. And the learning from data refers to its experience. So basically, the more experience a system has had, the more it can generalize to a new skill. That doesn't mean it's intelligent. It just means had more experience or respectively more priors. So the example gives a locality sensitive hashing, which is basically like a nearest neighbor method with enough data can solve any task. Right. Like nearest neighbor enough data can solve any task. That's I think it's a famous theorem that that establishes that. So keep keep that in mind. That is why we basically need to pay it pay attention to how much data went into this algorithm and sort of subtract that from our notion of how good how intelligent it is. Yeah, that's what he says. When we measure intelligence via skill. And this is really the only thing we can measure. We can only measure how good an agent is at a given skill, anything higher than that we can't measure. So we must measure a skill, but we should factor out priors and experience. And that's going to come up later. We should also pay attention to generalization difficulty. So generally how difficult is the task to solve given the experience we had, because if the task is more difficult in a generalization sense. So if it's harder to from what we know, get to the point where we can solve the task, then that would display higher intelligence. Yeah, it says solving tasks via experience and priors has nothing to do with intelligence. It's just more experience, more priors. So goes back to human intelligence. He says how universal is actually human intelligence. And he gets to the to the point where he says it's not very universal because first of all, there's no free lunch theorem where it says any two optimization algorithms will perform the same. If you integrate across all possible problems. So it's even questionable whether something like general intelligence could even like universal intelligence could even exist. But if we look at the G factor, which is used sometimes to assess human intelligence, is the measure for human intelligence that is established right now. Then they only encompass tasks that humans can perform and understand. Of course, and I would say they only encompass tasks where human actually differ with respect to each other. Because if you're making these tests and you have a human for 40 minutes or so, you're not going to give the humans tasks where they don't differentiate from one another. So it's going to be arranged like a very, very small subset of tasks that are exactly hard enough such that a couple of humans can solve them. A couple of humans can't solve them. They're going to be, you know, understandable by humans. So and understandable ideally by any human. You know, you don't have to have special pre-knowledge, not have studied biology in order to answer the questions or not, you know, have a higher degree in math or something. So the reference for the G factor is very much a reference frame of human values. And he compares this to physical fitness. So if we call someone physically fit, what do we mean? We mean this general abstract concept, right, of physical fitness, where it's not really one skill. So you can measure humans in how fast they run, how high they jump, you know, how fast they swim and so on and how much they can lift. And across that, you'll find generally that all of these things correlate and the result we call physical fitness. But it's not like physical fitness is a universal measure. So it's we only measure humans at tasks that humans can solve and are different at. So the physical fitness is very human centric and so is intelligence. So that's the analogy is I think it's a very good one. He says he gives this example where humans are, for example, very, very good at shortest path traveling salesman problems. Give up to a certain number of nodes in the graph. Humans can solve them extremely well to like very good degree. But as soon as you go to longest path problem, which shouldn't be that much harder if you just look at it from it from an algorithmic perspective. But humans are terrible at it. Absolutely terrible. And that probably has to do with the fact that we have a prior and the prior is much, much more adapt to shortest path problems than the longest path problems. Because in our history and our evolutionary history, it made a lot of sense to build in a navigational unit in the brain that calculates shortest routings. But it's probably like the your fitness is not very much affected by you being able to calculate the longest path unless you want to really avoid some something. And just I don't I don't know you really want to walk in these shoes. So that should be taken into effect. And it shows that intelligence is a very human centric concept. So this when we talk about general artificial intelligence, we what we mean is it's tied to to a scope of problems. And that's going to be important that we can only measure intelligence in this framework with respect to a scope of problems. And the scope that we consider is the human scope. So why human centric? Because we must have a scope and the human scope is the only meaningful scope. It's the only one we know that, you know, there is one thing in the universe that we think is intelligent that we know of. And that's humans and or to a degree, like what can make the argument it's general biological life on Earth. But we measure intelligence with a human scope intelligence test. And that's the thing we have. We don't have anything else. So, yeah. So we ask ourselves, what are priors of humans? What has evolution built into humans? And Chollet decides on three levels of priors, the low level priors, which are like reflexes. So if I if I pinch you, you you flick you flick like if I flick you, you you move back. And if I shine a bright light at your eyes, you close them and so on. So this Chollet says it's not very interesting because as let's say nothing to do like we feel that it has nothing to do with intelligence. OK, and then there are, I'm going to skip this one, there are knowledge priors. So the knowledge priors are, you know, things like the fact that there are objects in this world. That's a knowledge prior that the human have that's built into you. The notion that the world consists of objects and you can interact with this with these objects. The navigation capability, we we say, OK, navigate there. Humans can do it very, very well, as I already said, they're very good at shortest path problems and so on. Intuitive navigation that's built into you by evolution. That's a prior goal directedness. Humans generally view the world in terms of agents and in terms of agents having a goal like chasing after something. He makes this example. And if we observe something, we often want to frame it in terms of agents that pursue goals. And as soon as we can do that, that allows us to some degree to predict the world. And that's probably why this evolved. So very valuable skill. Social intuition and things like counting, like basic arithmetic are built into humans. And Chollet says if we measure intelligence, this is what we must account for. OK, so these these things should not count towards intelligence because they're already built into humans if we measure human intelligence. So you wouldn't give you and test human intelligence by making them count because that's built into the humans. Now, the third kind of priors that you would have are meta learning priors and the meta learning priors is basically your ability to learn something. OK, this is your meta learning priors, just your ability to learn something that is not learned. No one has to teach you how to learn something. I guess they're like learning strategies and so on. But you as a human are incredibly good at picking up new skills and the skill of picking up new skills. That's your that's built into you. Among these are assumptions that the world is a hierarchical and causal place. That's how you see the world. And because you see the world like this, you can pick up these new skills very, very quickly. You can explain through explaining the world. You can pick up new skills. And that is usually what we mean by intelligence. If someone sees a new unencountered before situation, thinks about it, which basically interprets the world in the hierarchical and causal way, and then is able to come up with a skill that solves the problem. And we generally view that as intelligence. So if we want to measure intelligence, we should measure this. Basically, how good you are picking up new skills while accounting for these things. OK, when we compare to humans. So Chollet says tests of intelligence should be founded on human like knowledge priors. And basically makes the case that these should if we build machines and compare them to humans in, let's say, in terms of intelligence, we should build into the machines these things right here. These we should give them like we should give them a counting module that they can use like a calculator app. We should just build that in and make that available for the agent to use like basic arithmetic. You shouldn't have to learn this. We should build in the notion that there are objects. We should build in the basic navigation module and so on that the agent can use. You can almost think of it like, you know, there is whatever your reinforcement learning agent, A, it consists of like this, maybe this big neural network with lots of layers. But then each layer maybe has access to, you know, the calculator app right here. And each layer has access to maybe also memory. I would I would guess memory is one of those priors as well. Or, you know, it has access to a navigation prior. Let's draw a little world map right here. This is Google Maps. It can do that. It can query that sort of. And we shouldn't if we want to build something that's intelligent and just compared to humans, we shouldn't we should build in the navigation. We shouldn't at least as much as human can do it. I mean, it's cool to have a machine learning system learn navigation, but that makes it less comparable. So it says either we should match the humans or we should account for the difference. So we should kind of let the difference be in that the difference between the humans and the machines into the measure of our intelligence of the intelligence. Further, if you test intelligence, all of these priors should be explicitly described and not rely on additional priors. So that's often the case in IQ tests. There are so many priors that are not explicitly described because we just, you know, we just think, yeah, every human can count. We don't need to to write down that our prior assumptions are that the humans can count or understand language. And that's I hear sometimes a problem in IQ tests that basically the better you understand language, the better you score at these tests. And therefore the the tests are more like a measure of language ability than intelligence. So there this is a lot much informed by. So I think the the psychometrics community is on the same path right here. Yeah. He goes into this theory of human core knowledge where he basically expands on what the human priors are. So this core knowledge theory takes four takes on four different categories. So the first one is objectness and elementary physics, which means you as a human have an inherent knowledge that there are objects, as I said, but also of elementary physics. That stuff sticks together, persistence of objects. And some people say, you know, this is learned. So children, young children, they do they do not know object persistence. And that's why peekaboo is so interesting. But because they think you're gone, right? They think, you know, if if if a parent goes to the to the toilet, they really think the parent doesn't exist anymore. And only later they learn object persistence. But I would question whether or not that's actually a learned thing or simply a built in module that gets switched on at that particular point. Because probably evolution deems it not necessary to to waste resources on that module before that. So I would, you know, I would I would be cautionary saying that object persistence and all of these things, in fact, are learned. I I would argue more that they are built in and are simply switched on at a given time during development. Because we also know these things like if like object persistence, I think that's you can almost pinpoint the month of a human's life when that's switched on. That will be so accurate. And if this is really learned, then, you know, you'd have to assume like a very regular structure of the training data distribution that a baby gets to experience. So I'm not sure here. But, you know, it's not my opinion. It's a shoalace. Yeah. Contact interaction. The fact that you can interact with objects by contacting them or that objects can interact with each other by being next to each other. That's built into you as well. You don't have to learn that if you compare this to like an RL agent that has to learn all of this from pixels. Basically, you can see why Shalé has a problem with the current direction of deep learning and claiming that things are intelligent there because the comparison is just very invalid. So the second core knowledge you have is agentness and goal directness. And we have already discussed that. Then natural numbers and elementary arithmetic in, you know, you can small numbers, you can add, subtract, compare, sort that sort of thing. And elementary geometry and topology where in there would be orientation and navigation and then distance orientation if it's something is inside or outside of a room and so on. Now I have heard and this might be a myth that there are languages where left and right like relative directions have no meaning like doesn't exist in the language but they always use absolute directions. And then these people automatically like have a much, much better orientation at all time. Like if they get into a building, they can always tell you where north is. I don't know. That's maybe that's a myth but I would guess that's pretty cool and just shows you the flexibility of something like orientation. Sure we can all orient but it seems like by simply learning a different language you can sort of supercharge that drive for orientation. So again this it sort of feels like there is a lot of nature versus nurture going on in here and that all of these things, yes you probably have a tendency built in to learn objectness and physics and so on. But then also probably a lot of it might be learned in addition or you might just be able to, you know, supercharge one of these modules that's inside of you. Yeah I think there's lots of lots of room for discussion here. So he says tests for intelligence should only involve core knowledge and the AI systems taking these tests should hard code that core knowledge. So basically what he said before, we should build in these things right here, these core knowledge things we should build these into the AI systems, if we want to compare them to humans, because if they have these things and only these things built in, then they sort of have the same starting point as a human. Now in this case, this is where I sort of disagree because like the notion that we can ever explicitly list the priors that humans have to me seems a bit ridiculous. So I guess we can sort of approximate this at first but we will never exhaustively exactly describe what the priors are, what is learned, we've seen this with the orientation like how much of that is learned and prior. And then secondly, even if we could list them pretty exactly what says that we can exactly program them into an like an agent, such that it can make use of it. Like that's an entirely that's even harder challenge. So, I'm not so sure a bit this AI systems should hard code core knowledge. I'm going to try that with this arc challenge that we're going to look at in like the last part of this series, but, and it's a cool test for intelligence, I admit that but I, I doubt that anyone really manages to hard code, the core knowledge and he says, test should only involve core knowledge, but we're going to see how you know how valid that that claim is for his own arc challenge. Now, luckily in the math part that's going to come up, he, he doesn't, he doesn't strictly rely on these things. So, he gives us a way how we can compare even if the priors of two systems are different, we can compare which ones more intelligent. So, that's part two of this series, you know, it's already been a while now and this is only part two and I do promise next time we're going to get into the math. I hope you like this and go check out Tim scarves video on the same topic. As I said, usually much higher quality videos than mine, and I'll see you next time. Bye bye.
[{"start": 0.0, "end": 7.0, "text": " Hi there, today we're going to continue with On the Measure of Intelligence by Francois Chollet."}, {"start": 7.0, "end": 13.0, "text": " Now if you remember last time, if you haven't seen last time, go watch part one if you're interested."}, {"start": 13.0, "end": 19.0, "text": " This is a multi-part series on this paper. Why? Because the paper itself is very long."}, {"start": 19.0, "end": 23.0, "text": " It's 40 pages, the main part, and it's a big wall of text."}, {"start": 23.0, "end": 29.0, "text": " So I've opted to basically pull out notes and show you the notes that I have pulled out."}, {"start": 29.0, "end": 31.0, "text": " And to divide this into multiple parts."}, {"start": 31.0, "end": 36.0, "text": " So last time we went over sort of the history of assessing intelligence and the basics."}, {"start": 36.0, "end": 42.0, "text": " And I know I said this time I'm going to get into the math, but I lied."}, {"start": 42.0, "end": 49.0, "text": " So I realized that there's still a lot that comes up in part two of the paper before we get into the actual math."}, {"start": 49.0, "end": 55.0, "text": " So this part is going to be about the prerequisites to that and then next time math."}, {"start": 55.0, "end": 60.0, "text": " I'm sorry to disappoint anyone. You might just skip this one if you want."}, {"start": 60.0, "end": 70.0, "text": " I do have to shout out Tim Scarfe, who of course runs the Machine Learning Street Talk channel podcast with me and Connor Shorten together."}, {"start": 70.0, "end": 76.0, "text": " Tim has just made an entire video about this paper, about On the Measure of Intelligence."}, {"start": 76.0, "end": 81.0, "text": " And his videos are usually like super high quality, like higher than mine."}, {"start": 81.0, "end": 92.0, "text": " And it's the entire paper. So if you want to know the end of the story or have a different take on the paper, definitely can recommend his video."}, {"start": 92.0, "end": 98.0, "text": " I do make a guest appearance there. So yeah, that's a given."}, {"start": 98.0, "end": 105.0, "text": " And I will still finish the paper on this channel just in my regular, in this style right here."}, {"start": 105.0, "end": 109.0, "text": " So all the options are available to you."}, {"start": 109.0, "end": 117.0, "text": " Let's dive into part two. So if you remember part one, we sort of went over what it means to be intelligent."}, {"start": 117.0, "end": 124.0, "text": " And we differentiated basically two things, which are skills and abilities."}, {"start": 124.0, "end": 132.0, "text": " So a skill is how well you achieve a given task or how well you can do in a given task."}, {"start": 132.0, "end": 141.0, "text": " So this could be chess or, you know, go or like something very, very measurable. An IQ test is a specific task."}, {"start": 141.0, "end": 147.0, "text": " So these things right here are all tasks. But these tasks aren't the thing we're interested in."}, {"start": 147.0, "end": 151.0, "text": " Just because a machine is good at chess doesn't mean it's intelligent."}, {"start": 151.0, "end": 161.0, "text": " And what we want is sort of a generalizable skill. So we want to assess how generalizable is an ability."}, {"start": 161.0, "end": 167.0, "text": " So can I throw a computer at a new problem that it has never seen before, and it can solve that."}, {"start": 167.0, "end": 176.0, "text": " And that's going to be this generalizability, this notion of can you solve things that you have never encountered before and weren't prepared for."}, {"start": 176.0, "end": 181.0, "text": " That is going to be the basis for us to measure intelligence."}, {"start": 181.0, "end": 192.0, "text": " So Chollet says you have to optimize directly for generality and flexibility rather than task performance if you want to build an intelligent agent."}, {"start": 192.0, "end": 200.0, "text": " You have to sort of build something that is not just good at a thing. It is good at getting good at things."}, {"start": 200.0, "end": 206.0, "text": " That's almost a quote, quote worthy thing."}, {"start": 206.0, "end": 213.0, "text": " So if you just give it a single task, the learner will just take any available shortcuts."}, {"start": 213.0, "end": 221.0, "text": " So if you just say you have to be good at chess, the developer of a system can exploit all the tricks that make you good at chess."}, {"start": 221.0, "end": 229.0, "text": " And you don't have to be smart. You just know basically if you had enough memory, you could just memorize all the moves of all the chess games ever."}, {"start": 229.0, "end": 234.0, "text": " That's why we say hard-coded chatbots are not intelligent."}, {"start": 234.0, "end": 241.0, "text": " So hard-coded chatbots, they simply match your input to a database of reg exes and then they answer."}, {"start": 241.0, "end": 250.0, "text": " And we're not very impressed because as soon as I give them something that is not covered by their reg exes, they fail."}, {"start": 250.0, "end": 253.0, "text": " They just say I don't know or something like this."}, {"start": 253.0, "end": 257.0, "text": " In fact, what is intelligent is the engineer in that case."}, {"start": 257.0, "end": 262.0, "text": " So the engineer that makes the program is intelligent."}, {"start": 262.0, "end": 273.0, "text": " So he has this drawing, I think I've shown it last time, where you have the environment and there is this agent."}, {"start": 273.0, "end": 278.0, "text": " And if the agent is really good with the environment, you might consider that intelligent."}, {"start": 278.0, "end": 285.0, "text": " But in Chollet's mind, you have to also consider here the developer of the agent."}, {"start": 285.0, "end": 294.0, "text": " It could be that the developer is very intelligent and just builds the agent to interact with the environment in a matter that it gets a lot of reward."}, {"start": 294.0, "end": 300.0, "text": " It's very good at a skill, but the agent itself might not be intelligent."}, {"start": 300.0, "end": 312.0, "text": " So it says intelligence, the intelligence of a process is not encoded by the performance of a system, but by the fact that the same process can be applied to different tasks."}, {"start": 312.0, "end": 323.0, "text": " So in this case, if I have a new task, a new environment, so E2 right here, the question is, could I throw the same agent at that even if it hasn't seen it before?"}, {"start": 323.0, "end": 332.0, "text": " Or would I be able to take the same developer that develops me a new agent, agent two, that then can solve the task?"}, {"start": 332.0, "end": 338.0, "text": " In the case where I can throw over the agent, that would make an argument that the agent is intelligent."}, {"start": 338.0, "end": 348.0, "text": " But if I can't, you'd have to make the argument that the developer is the intelligent part here, which of course is the point of what he's saying right here."}, {"start": 348.0, "end": 357.0, "text": " So hard coded programs themselves are not intelligent, but and this is the case, the same counts for adding more training data."}, {"start": 357.0, "end": 367.0, "text": " So not only is the hard coding not intelligent, it's also Chollet says not intelligence if you simply add more training data."}, {"start": 367.0, "end": 373.0, "text": " So a machine learning system that sort of learns to how to interact with these environments."}, {"start": 373.0, "end": 386.0, "text": " If you can imagine that you have lots of environments, environment, environment, environment, environment, and so on, that give you a dense sampling of the environment space."}, {"start": 386.0, "end": 392.0, "text": " So you have all of these environments, you build all of them, and you train this agent to interact well with all of them."}, {"start": 392.0, "end": 400.0, "text": " So you give it lots of compute, lots of data, and the the environments are really a dense sampling of the environment space."}, {"start": 400.0, "end": 409.0, "text": " It will be able even though it has never seen environment to write this environment right here, it might be just able to generalize to this environment,"}, {"start": 409.0, "end": 413.0, "text": " given that it has been trained on all the environments here."}, {"start": 413.0, "end": 423.0, "text": " Like it has been trained on every possible environment around this environment that is similar to this environment, it could generally generalize to environment too."}, {"start": 423.0, "end": 431.0, "text": " But also, we wouldn't view that as intelligent because it in a sense, this skill has been bought with data."}, {"start": 431.0, "end": 436.0, "text": " And this notion of buying skill is is comes up a lot in this paper."}, {"start": 436.0, "end": 448.0, "text": " So Shreya says there are two ways to buy a skill. And by buying, he basically means you don't buying as opposed to intelligently solving the skill."}, {"start": 448.0, "end": 457.0, "text": " So whenever you buy a skill, that's not intelligence, Shreya says. And you can buy a skill by either hard coding the solution or giving lots of data."}, {"start": 457.0, "end": 467.0, "text": " And there is like this spectrum, where you hard code, completely hard code a solution. And here is where you completely only feed data."}, {"start": 467.0, "end": 474.0, "text": " So here would be something like GPT-3. Right, there are almost no priors there."}, {"start": 474.0, "end": 482.0, "text": " It's just a transformer, big transformer. And you just throw in data, lots and lots and lots and lots and lots of data."}, {"start": 482.0, "end": 491.0, "text": " So in this measure, last time I've had lots of people when GPT-3 came out, I've had people commenting on the part one of this paper saying,"}, {"start": 491.0, "end": 499.0, "text": " isn't GPT-3 intelligent because, you know, it can sort of generalize to these tasks that it hasn't been trained on."}, {"start": 499.0, "end": 504.0, "text": " By the way, if you haven't seen the GPT-3 video, you should go watch it."}, {"start": 504.0, "end": 515.0, "text": " Something tells me this video is popular. It might be the five times as many views as any other video. So at least it's not a terrible video."}, {"start": 515.0, "end": 521.0, "text": " But in essence, GPT-3 can solve these tasks that it wasn't trained for."}, {"start": 521.0, "end": 527.0, "text": " And therefore, you might argue in this definition right here, it could be intelligent because it can generalize."}, {"start": 527.0, "end": 536.0, "text": " But there is this counteraction where Chollet says, maybe you have just bought that skill with lots and lots of data."}, {"start": 536.0, "end": 544.0, "text": " Now, I actually don't know what to say to this, because, I mean, it really seems like GPT-3 generalizes to tasks it has never seen before."}, {"start": 544.0, "end": 554.0, "text": " But also it has had a lot of data. And so as of right now, it is not really clear where the line is here."}, {"start": 554.0, "end": 561.0, "text": " Like when are we going to argue that GPT-3 is actually like, it could be that it has had lots of data, but also it is intelligent."}, {"start": 561.0, "end": 567.0, "text": " How are we going to make that distinction? And I guess we're going to get into the math part."}, {"start": 567.0, "end": 576.0, "text": " But I can tell you right now, the math part is so abstract as it is not really practical."}, {"start": 576.0, "end": 586.0, "text": " It is like a theoretical framework that you might be able to approximate. But, you know, there is like a wishy-washy thing going on."}, {"start": 586.0, "end": 593.0, "text": " But he basically says, OK, there's this spectrum of hard coding over here and then fully learning from data."}, {"start": 593.0, "end": 601.0, "text": " And with all of these methods and, you know, in between methods, like a CNN would be here because it has like considerable priors because of its architecture and so on."}, {"start": 601.0, "end": 610.0, "text": " And over here would be something like an A star search with like a learned heuristic or things like this."}, {"start": 610.0, "end": 616.0, "text": " You can get good with any of these things, but the intelligence is orthogonal to that."}, {"start": 616.0, "end": 622.0, "text": " So orthogonal to that is the intelligence axis. It has nothing."}, {"start": 622.0, "end": 637.0, "text": " Chollet says this has nothing to do with this dimension. You can buy skill with this, but it's basically like it's like a triangle almost sort of where you have hard coding data and then intelligence."}, {"start": 637.0, "end": 642.0, "text": " And it's like its own axis."}, {"start": 642.0, "end": 649.0, "text": " So the hard coding refers to the priors of a system that the developer has basically built in."}, {"start": 649.0, "end": 655.0, "text": " And the learning from data refers to its experience."}, {"start": 655.0, "end": 661.0, "text": " So basically, the more experience a system has had, the more it can generalize to a new skill."}, {"start": 661.0, "end": 668.0, "text": " That doesn't mean it's intelligent. It just means had more experience or respectively more priors."}, {"start": 668.0, "end": 676.0, "text": " So the example gives a locality sensitive hashing, which is basically like a nearest neighbor method with enough data can solve any task."}, {"start": 676.0, "end": 686.0, "text": " Right. Like nearest neighbor enough data can solve any task. That's I think it's a famous theorem that that establishes that."}, {"start": 686.0, "end": 703.0, "text": " So keep keep that in mind. That is why we basically need to pay it pay attention to how much data went into this algorithm and sort of subtract that from our notion of how good how intelligent it is."}, {"start": 703.0, "end": 708.0, "text": " Yeah, that's what he says. When we measure intelligence via skill. And this is really the only thing we can measure."}, {"start": 708.0, "end": 714.0, "text": " We can only measure how good an agent is at a given skill, anything higher than that we can't measure."}, {"start": 714.0, "end": 720.0, "text": " So we must measure a skill, but we should factor out priors and experience."}, {"start": 720.0, "end": 725.0, "text": " And that's going to come up later. We should also pay attention to generalization difficulty."}, {"start": 725.0, "end": 736.0, "text": " So generally how difficult is the task to solve given the experience we had, because if the task is more difficult in a generalization sense."}, {"start": 736.0, "end": 748.0, "text": " So if it's harder to from what we know, get to the point where we can solve the task, then that would display higher intelligence."}, {"start": 748.0, "end": 757.0, "text": " Yeah, it says solving tasks via experience and priors has nothing to do with intelligence. It's just more experience, more priors."}, {"start": 757.0, "end": 763.0, "text": " So goes back to human intelligence. He says how universal is actually human intelligence."}, {"start": 763.0, "end": 775.0, "text": " And he gets to the to the point where he says it's not very universal because first of all, there's no free lunch theorem where it says any two optimization algorithms will perform the same."}, {"start": 775.0, "end": 786.0, "text": " If you integrate across all possible problems. So it's even questionable whether something like general intelligence could even like universal intelligence could even exist."}, {"start": 786.0, "end": 798.0, "text": " But if we look at the G factor, which is used sometimes to assess human intelligence, is the measure for human intelligence that is established right now."}, {"start": 798.0, "end": 803.0, "text": " Then they only encompass tasks that humans can perform and understand."}, {"start": 803.0, "end": 809.0, "text": " Of course, and I would say they only encompass tasks where human actually differ with respect to each other."}, {"start": 809.0, "end": 819.0, "text": " Because if you're making these tests and you have a human for 40 minutes or so, you're not going to give the humans tasks where they don't differentiate from one another."}, {"start": 819.0, "end": 829.0, "text": " So it's going to be arranged like a very, very small subset of tasks that are exactly hard enough such that a couple of humans can solve them."}, {"start": 829.0, "end": 835.0, "text": " A couple of humans can't solve them. They're going to be, you know, understandable by humans."}, {"start": 835.0, "end": 850.0, "text": " So and understandable ideally by any human. You know, you don't have to have special pre-knowledge, not have studied biology in order to answer the questions or not, you know, have a higher degree in math or something."}, {"start": 850.0, "end": 859.0, "text": " So the reference for the G factor is very much a reference frame of human values."}, {"start": 859.0, "end": 867.0, "text": " And he compares this to physical fitness. So if we call someone physically fit, what do we mean?"}, {"start": 867.0, "end": 874.0, "text": " We mean this general abstract concept, right, of physical fitness, where it's not really one skill."}, {"start": 874.0, "end": 883.0, "text": " So you can measure humans in how fast they run, how high they jump, you know, how fast they swim and so on and how much they can lift."}, {"start": 883.0, "end": 891.0, "text": " And across that, you'll find generally that all of these things correlate and the result we call physical fitness."}, {"start": 891.0, "end": 895.0, "text": " But it's not like physical fitness is a universal measure."}, {"start": 895.0, "end": 901.0, "text": " So it's we only measure humans at tasks that humans can solve and are different at."}, {"start": 901.0, "end": 907.0, "text": " So the physical fitness is very human centric and so is intelligence."}, {"start": 907.0, "end": 912.0, "text": " So that's the analogy is I think it's a very good one."}, {"start": 912.0, "end": 922.0, "text": " He says he gives this example where humans are, for example, very, very good at shortest path traveling salesman problems."}, {"start": 922.0, "end": 925.0, "text": " Give up to a certain number of nodes in the graph."}, {"start": 925.0, "end": 933.0, "text": " Humans can solve them extremely well to like very good degree. But as soon as you go to longest path problem,"}, {"start": 933.0, "end": 939.0, "text": " which shouldn't be that much harder if you just look at it from it from an algorithmic perspective."}, {"start": 939.0, "end": 943.0, "text": " But humans are terrible at it. Absolutely terrible."}, {"start": 943.0, "end": 950.0, "text": " And that probably has to do with the fact that we have a prior and the prior is much,"}, {"start": 950.0, "end": 955.0, "text": " much more adapt to shortest path problems than the longest path problems."}, {"start": 955.0, "end": 965.0, "text": " Because in our history and our evolutionary history, it made a lot of sense to build in a navigational unit in the brain that calculates shortest routings."}, {"start": 965.0, "end": 978.0, "text": " But it's probably like the your fitness is not very much affected by you being able to calculate the longest path unless you want to really avoid some something."}, {"start": 978.0, "end": 984.0, "text": " And just I don't I don't know you really want to walk in these shoes."}, {"start": 984.0, "end": 991.0, "text": " So that should be taken into effect. And it shows that intelligence is a very human centric concept."}, {"start": 991.0, "end": 1000.0, "text": " So this when we talk about general artificial intelligence, we what we mean is it's tied to to a scope of problems."}, {"start": 1000.0, "end": 1007.0, "text": " And that's going to be important that we can only measure intelligence in this framework with respect to a scope of problems."}, {"start": 1007.0, "end": 1015.0, "text": " And the scope that we consider is the human scope."}, {"start": 1015.0, "end": 1022.0, "text": " So why human centric? Because we must have a scope and the human scope is the only meaningful scope."}, {"start": 1022.0, "end": 1030.0, "text": " It's the only one we know that, you know, there is one thing in the universe that we think is intelligent that we know of."}, {"start": 1030.0, "end": 1038.0, "text": " And that's humans and or to a degree, like what can make the argument it's general biological life on Earth."}, {"start": 1038.0, "end": 1045.0, "text": " But we measure intelligence with a human scope intelligence test. And that's the thing we have."}, {"start": 1045.0, "end": 1054.0, "text": " We don't have anything else. So, yeah. So we ask ourselves, what are priors of humans?"}, {"start": 1054.0, "end": 1066.0, "text": " What has evolution built into humans? And Chollet decides on three levels of priors, the low level priors, which are like reflexes."}, {"start": 1066.0, "end": 1072.0, "text": " So if I if I pinch you, you you flick you flick like if I flick you, you you move back."}, {"start": 1072.0, "end": 1079.0, "text": " And if I shine a bright light at your eyes, you close them and so on."}, {"start": 1079.0, "end": 1087.0, "text": " So this Chollet says it's not very interesting because as let's say nothing to do like we feel that it has nothing to do with intelligence."}, {"start": 1087.0, "end": 1093.0, "text": " OK, and then there are, I'm going to skip this one, there are knowledge priors."}, {"start": 1093.0, "end": 1102.0, "text": " So the knowledge priors are, you know, things like the fact that there are objects in this world."}, {"start": 1102.0, "end": 1106.0, "text": " That's a knowledge prior that the human have that's built into you."}, {"start": 1106.0, "end": 1114.0, "text": " The notion that the world consists of objects and you can interact with this with these objects."}, {"start": 1114.0, "end": 1120.0, "text": " The navigation capability, we we say, OK, navigate there."}, {"start": 1120.0, "end": 1126.0, "text": " Humans can do it very, very well, as I already said, they're very good at shortest path problems and so on."}, {"start": 1126.0, "end": 1134.0, "text": " Intuitive navigation that's built into you by evolution. That's a prior goal directedness."}, {"start": 1134.0, "end": 1143.0, "text": " Humans generally view the world in terms of agents and in terms of agents having a goal like chasing after something."}, {"start": 1143.0, "end": 1151.0, "text": " He makes this example. And if we observe something, we often want to frame it in terms of agents that pursue goals."}, {"start": 1151.0, "end": 1155.0, "text": " And as soon as we can do that, that allows us to some degree to predict the world."}, {"start": 1155.0, "end": 1160.0, "text": " And that's probably why this evolved. So very valuable skill."}, {"start": 1160.0, "end": 1167.0, "text": " Social intuition and things like counting, like basic arithmetic are built into humans."}, {"start": 1167.0, "end": 1173.0, "text": " And Chollet says if we measure intelligence, this is what we must account for."}, {"start": 1173.0, "end": 1182.0, "text": " OK, so these these things should not count towards intelligence because they're already built into humans if we measure human intelligence."}, {"start": 1182.0, "end": 1191.0, "text": " So you wouldn't give you and test human intelligence by making them count because that's built into the humans."}, {"start": 1191.0, "end": 1202.0, "text": " Now, the third kind of priors that you would have are meta learning priors and the meta learning priors is basically your ability to learn something."}, {"start": 1202.0, "end": 1207.0, "text": " OK, this is your meta learning priors, just your ability to learn something that is not learned."}, {"start": 1207.0, "end": 1213.0, "text": " No one has to teach you how to learn something. I guess they're like learning strategies and so on."}, {"start": 1213.0, "end": 1221.0, "text": " But you as a human are incredibly good at picking up new skills and the skill of picking up new skills."}, {"start": 1221.0, "end": 1231.0, "text": " That's your that's built into you. Among these are assumptions that the world is a hierarchical and causal place."}, {"start": 1231.0, "end": 1238.0, "text": " That's how you see the world. And because you see the world like this, you can pick up these new skills very, very quickly."}, {"start": 1238.0, "end": 1246.0, "text": " You can explain through explaining the world. You can pick up new skills. And that is usually what we mean by intelligence."}, {"start": 1246.0, "end": 1256.0, "text": " If someone sees a new unencountered before situation, thinks about it, which basically interprets the world in the hierarchical and causal way,"}, {"start": 1256.0, "end": 1264.0, "text": " and then is able to come up with a skill that solves the problem. And we generally view that as intelligence."}, {"start": 1264.0, "end": 1274.0, "text": " So if we want to measure intelligence, we should measure this. Basically, how good you are picking up new skills while accounting for these things."}, {"start": 1274.0, "end": 1284.0, "text": " OK, when we compare to humans. So Chollet says tests of intelligence should be founded on human like knowledge priors."}, {"start": 1284.0, "end": 1295.0, "text": " And basically makes the case that these should if we build machines and compare them to humans in, let's say, in terms of intelligence,"}, {"start": 1295.0, "end": 1306.0, "text": " we should build into the machines these things right here. These we should give them like we should give them a counting module that they can use like a calculator app."}, {"start": 1306.0, "end": 1312.0, "text": " We should just build that in and make that available for the agent to use like basic arithmetic."}, {"start": 1312.0, "end": 1317.0, "text": " You shouldn't have to learn this. We should build in the notion that there are objects."}, {"start": 1317.0, "end": 1322.0, "text": " We should build in the basic navigation module and so on that the agent can use."}, {"start": 1322.0, "end": 1329.0, "text": " You can almost think of it like, you know, there is whatever your reinforcement learning agent, A, it consists of like this,"}, {"start": 1329.0, "end": 1338.0, "text": " maybe this big neural network with lots of layers. But then each layer maybe has access to, you know, the calculator app right here."}, {"start": 1338.0, "end": 1346.0, "text": " And each layer has access to maybe also memory. I would I would guess memory is one of those priors as well."}, {"start": 1346.0, "end": 1352.0, "text": " Or, you know, it has access to a navigation prior. Let's draw a little world map right here. This is Google Maps."}, {"start": 1352.0, "end": 1362.0, "text": " It can do that. It can query that sort of. And we shouldn't if we want to build something that's intelligent and just compared to humans,"}, {"start": 1362.0, "end": 1369.0, "text": " we shouldn't we should build in the navigation. We shouldn't at least as much as human can do it."}, {"start": 1369.0, "end": 1375.0, "text": " I mean, it's cool to have a machine learning system learn navigation, but that makes it less comparable."}, {"start": 1375.0, "end": 1380.0, "text": " So it says either we should match the humans or we should account for the difference."}, {"start": 1380.0, "end": 1391.0, "text": " So we should kind of let the difference be in that the difference between the humans and the machines into the measure of our intelligence of the intelligence."}, {"start": 1391.0, "end": 1400.0, "text": " Further, if you test intelligence, all of these priors should be explicitly described and not rely on additional priors."}, {"start": 1400.0, "end": 1412.0, "text": " So that's often the case in IQ tests. There are so many priors that are not explicitly described because we just, you know, we just think, yeah, every human can count."}, {"start": 1412.0, "end": 1420.0, "text": " We don't need to to write down that our prior assumptions are that the humans can count or understand language."}, {"start": 1420.0, "end": 1428.0, "text": " And that's I hear sometimes a problem in IQ tests that basically the better you understand language, the better you score at these tests."}, {"start": 1428.0, "end": 1434.0, "text": " And therefore the the tests are more like a measure of language ability than intelligence."}, {"start": 1434.0, "end": 1447.0, "text": " So there this is a lot much informed by. So I think the the psychometrics community is on the same path right here."}, {"start": 1447.0, "end": 1454.0, "text": " Yeah. He goes into this theory of human core knowledge where he basically expands on what the human priors are."}, {"start": 1454.0, "end": 1460.0, "text": " So this core knowledge theory takes four takes on four different categories."}, {"start": 1460.0, "end": 1470.0, "text": " So the first one is objectness and elementary physics, which means you as a human have an inherent knowledge that there are objects, as I said, but also of elementary physics."}, {"start": 1470.0, "end": 1476.0, "text": " That stuff sticks together, persistence of objects. And some people say, you know, this is learned."}, {"start": 1476.0, "end": 1483.0, "text": " So children, young children, they do they do not know object persistence. And that's why peekaboo is so interesting."}, {"start": 1483.0, "end": 1494.0, "text": " But because they think you're gone, right? They think, you know, if if if a parent goes to the to the toilet, they really think the parent doesn't exist anymore."}, {"start": 1494.0, "end": 1505.0, "text": " And only later they learn object persistence. But I would question whether or not that's actually a learned thing or simply a built in module that gets switched on at that particular point."}, {"start": 1505.0, "end": 1513.0, "text": " Because probably evolution deems it not necessary to to waste resources on that module before that."}, {"start": 1513.0, "end": 1522.0, "text": " So I would, you know, I would I would be cautionary saying that object persistence and all of these things, in fact, are learned."}, {"start": 1522.0, "end": 1531.0, "text": " I I would argue more that they are built in and are simply switched on at a given time during development."}, {"start": 1531.0, "end": 1541.0, "text": " Because we also know these things like if like object persistence, I think that's you can almost pinpoint the month of a human's life when that's switched on."}, {"start": 1541.0, "end": 1554.0, "text": " That will be so accurate. And if this is really learned, then, you know, you'd have to assume like a very regular structure of the training data distribution that a baby gets to experience."}, {"start": 1554.0, "end": 1563.0, "text": " So I'm not sure here. But, you know, it's not my opinion. It's a shoalace. Yeah. Contact interaction."}, {"start": 1563.0, "end": 1572.0, "text": " The fact that you can interact with objects by contacting them or that objects can interact with each other by being next to each other."}, {"start": 1572.0, "end": 1580.0, "text": " That's built into you as well. You don't have to learn that if you compare this to like an RL agent that has to learn all of this from pixels."}, {"start": 1580.0, "end": 1597.0, "text": " Basically, you can see why Shal\u00e9 has a problem with the current direction of deep learning and claiming that things are intelligent there because the comparison is just very invalid."}, {"start": 1597.0, "end": 1601.0, "text": " So the second core knowledge you have is agentness and goal directness."}, {"start": 1601.0, "end": 1612.0, "text": " And we have already discussed that. Then natural numbers and elementary arithmetic in, you know, you can small numbers, you can add, subtract, compare, sort that sort of thing."}, {"start": 1612.0, "end": 1625.0, "text": " And elementary geometry and topology where in there would be orientation and navigation and then distance orientation if it's something is inside or outside of a room and so on."}, {"start": 1625.0, "end": 1640.0, "text": " Now I have heard and this might be a myth that there are languages where left and right like relative directions have no meaning like doesn't exist in the language but they always use absolute directions."}, {"start": 1640.0, "end": 1646.0, "text": " And then these people automatically like have a much, much better orientation at all time."}, {"start": 1646.0, "end": 1651.0, "text": " Like if they get into a building, they can always tell you where north is."}, {"start": 1651.0, "end": 1659.0, "text": " I don't know. That's maybe that's a myth but I would guess that's pretty cool and just shows you the flexibility of something like orientation."}, {"start": 1659.0, "end": 1669.0, "text": " Sure we can all orient but it seems like by simply learning a different language you can sort of supercharge that drive for orientation."}, {"start": 1669.0, "end": 1683.0, "text": " So again this it sort of feels like there is a lot of nature versus nurture going on in here and that all of these things, yes you probably have a tendency built in to learn objectness and physics and so on."}, {"start": 1683.0, "end": 1694.0, "text": " But then also probably a lot of it might be learned in addition or you might just be able to, you know, supercharge one of these modules that's inside of you."}, {"start": 1694.0, "end": 1700.0, "text": " Yeah I think there's lots of lots of room for discussion here."}, {"start": 1700.0, "end": 1711.0, "text": " So he says tests for intelligence should only involve core knowledge and the AI systems taking these tests should hard code that core knowledge."}, {"start": 1711.0, "end": 1732.0, "text": " So basically what he said before, we should build in these things right here, these core knowledge things we should build these into the AI systems, if we want to compare them to humans, because if they have these things and only these things built in, then they sort of have the same starting point as a human."}, {"start": 1732.0, "end": 1745.0, "text": " Now in this case, this is where I sort of disagree because like the notion that we can ever explicitly list the priors that humans have to me seems a bit ridiculous."}, {"start": 1745.0, "end": 1759.0, "text": " So I guess we can sort of approximate this at first but we will never exhaustively exactly describe what the priors are, what is learned, we've seen this with the orientation like how much of that is learned and prior."}, {"start": 1759.0, "end": 1773.0, "text": " And then secondly, even if we could list them pretty exactly what says that we can exactly program them into an like an agent, such that it can make use of it."}, {"start": 1773.0, "end": 1776.0, "text": " Like that's an entirely that's even harder challenge."}, {"start": 1776.0, "end": 1782.0, "text": " So, I'm not so sure a bit this AI systems should hard code core knowledge."}, {"start": 1782.0, "end": 1801.0, "text": " I'm going to try that with this arc challenge that we're going to look at in like the last part of this series, but, and it's a cool test for intelligence, I admit that but I, I doubt that anyone really manages to hard code, the core knowledge and he says, test should only involve core knowledge,"}, {"start": 1801.0, "end": 1816.0, "text": " but we're going to see how you know how valid that that claim is for his own arc challenge. Now, luckily in the math part that's going to come up, he, he doesn't, he doesn't strictly rely on these things."}, {"start": 1816.0, "end": 1826.0, "text": " So, he gives us a way how we can compare even if the priors of two systems are different, we can compare which ones more intelligent."}, {"start": 1826.0, "end": 1837.0, "text": " So, that's part two of this series, you know, it's already been a while now and this is only part two and I do promise next time we're going to get into the math."}, {"start": 1837.0, "end": 1844.0, "text": " I hope you like this and go check out Tim scarves video on the same topic."}, {"start": 1844.0, "end": 1861.0, "text": " As I said, usually much higher quality videos than mine, and I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=YBlNQK0Ao6g
Image GPT: Generative Pretraining from Pixels (Paper Explained)
BERT and GPT-2/3 have shown the enormous power of using generative models as pre-training for classification tasks. However, for images, pre-training is usually done with supervised or self-supervised objectives. This paper investigates how far you can get when applying the principles from the world of NLP to the world of images. OUTLINE: 0:00 - Intro & Overview 2:50 - Generative Models for Pretraining 4:50 - Pretraining for Visual Tasks 7:40 - Model Architecture 15:15 - Linear Probe Experiments 24:15 - Fine-Tuning Experiments 30:25 - Conclusion & Comments Paper: https://cdn.openai.com/papers/Generative_Pretraining_from_Pixels_V2.pdf Blog: https://openai.com/blog/image-gpt/ Code: https://github.com/openai/image-gpt Abstract: Inspired by progress in unsupervised representation learning for natural language, we examine whether similar models can learn useful representations for images. We train a sequence Transformer to auto-regressively predict pixels, without incorporating knowledge of the 2D input structure. Despite training on low-resolution ImageNet without labels, we find that a GPT-2 scale model learns strong image representations as measured by linear probing, fine-tuning, and low-data classification. On CIFAR-10, we achieve 96.3% accuracy with a linear probe, outperforming a supervised Wide ResNet, and 99.0% accuracy with full finetuning, matching the top supervised pre-trained models. An even larger model trained on a mixture of ImageNet and web images is competitive with self-supervised benchmarks on ImageNet, achieving 72.0% top-1 accuracy on a linear probe of our features. Authors: Mark Chen, Alec Radford, Rewon Child, Jeff Wu, Heewoo Jun, Prafulla Dhariwal, David Luan, Ilya Sutskever Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Okay, I'm sure many of you have already seen this because it was rather widely announced, but the open AI team has announced a new model that produces pictures instead of text. So as you can see right here, on the left, you'll always see like a half a picture. And on the right is the ground truth. So they took this picture, they simply cut the bottom half right here. And then they let the model sort of imagine what they cut away. And what it comes up with is pretty cool, I have to say, like, look at the birds, like, this is just awesome. But the special thing about this isn't that it simply completes pictures. The special thing about it is it does it one pixel by pixel. So basically, it goes at this pixel right here and asks, Okay, what's that pixel? And then what's that pixel? And then what's that pixel, and so on. So it is basically a like a language model, but for pixels in that it goes over the images in order, basically like this, or like always from left to right, left to right, left to right. And it has no clue of the spatial relations between the pixels, it needs to learn that by itself, as opposed to a convolutional neural network, which is specifically designed such that if you want to predict this pixel right here, then it's specifically designed to say, okay, the most important information is probably around that pixel. And then some like other important information is widely around that pixel. So CNNs are built with this in mind. Whereas this model right here, which is also known as image GPT isn't doesn't have any of that. It's simply a transformer model that goes over these pixels one by one. And we'll see how that's done. There's some more examples right here. Particularly cool is the cat. And you see that there is the beginning of this little white thing right here, which is this card. And the completions of the model. Yes, very interesting. The model can of course, as a language model can also sample by itself, just random images, you sample them once through. And this is what it comes up with. So these are pretty good quality images for a model for a model that just produces one pixel by one pixel. Now this idea of one pixel by pixel isn't new. This has been around before. But the investigation here is basically how much can we how far can we push these generative models for pre training? Hi, there. This is Janek from post production. I've realized that I've forgotten to even read the name of the paper. So it's called generative pre training from pixels by Mark Chen, Alec Radford, round child, Jeff Wu, he won't do profile a diary wall, David Luan, and Ilya Satsuki. And since Henry AI labs has already made a video on this, this video is going to be more of kind of a rumble rant about what I find interesting about the paper and some thoughts about it rather than like a classic explanation. I hope you still enjoy that. So what you saw on the right wasn't even the this isn't the final result, the supposed result. This is simply the pre training task. It's fun to look at it. But the actual object objective of the paper is the following. What if we train we pre train on a large data set to generate what good images like these, or we to complete images like these. And then we fine tune on a classification task. And the answer is here. They say, on c410, we achieve sick the 96.3% accuracy with a linear probe outperforming a super wide supervised wide resonant and a 99% accuracy with full fine tuning matching the top supervised pre trained models. And even larger model trained on a mixture of image net and web images is competitive with self supervised benchmarks on image net achieving 72 top one accuracy on a linear probe of our features. So the goal here is that you have a data set that you want to try and like train a classifier on. So usually you have a data set and the data set has images, and you put them through like a convolutional neural network. And then you have to classify the image into one of I don't know how many classes on c410. That's 10 classes on image and it's 1000. And the data set is these images together with these labels. Now, the idea of pre training is that you some where have a bigger data set that is sort of similar to the small data set. But yeah, it's similar enough such that the network could learn something. So what you want to do first is you first want to take the large data set, train this network right here. And then in a second step, fine tune the network on this smaller data set. And you sort of hope that what you learn from the large data set right here, transfers over a little bit of knowledge, you already have a little bit of knowledge, and you can make better use of the data that you have right here. Now, the question is, how do you do this pre training? And of course, this has a long tradition, well long for maybe two or three years right now, in the language community, where people, they pre train these large models, like we've just seen GPT-3, or BERT was one of them. They pre train these large transformer models on text, and then to fine tune them on classification tasks for text. And that's what this paper is doing right here. They pre train a transformer that is a GPT-2 scale model. They pre train it on image generation. And then they fine tune it or transfer learn it to classification tasks. And the point of the paper is to say that, like in text data, in text data, we have made pretty good, pretty good experiences with doing this with pre training a generative model and then fine tuning on a classification task. While so far in images, all we've ever done is we've pre trained these pre training tasks usually is a classification task, or like a self supervised task with a contrastive loss or something like this. What they're doing new is the generative modeling in the as a pre training. And again, this isn't like entirely new, but they show that if you throw a lot of computers at it, and lots of data and a big model, then that can work equally well to the self supervised tasks. So their model, as I said, is pretty, pretty simple, they take an image, and they unroll the image now, and fully unrolled image on, let's say ImageNet has 224 squared pixels, and that times three, right, because you have three color channels, that's too large, even for an open AI supercomputer. So what they do is first, they downscale the image. So they downscale, it's not as drastic as here, where you just get a three by three image, but they do downscale it to like a 32 by 32, or a 64 by 64. Then they unroll it, which simply means they go through the image like this, and make a sequence out of it because their models are naturally made for text sequences. They simply put the image into a text sequence, they further simplify this by reducing the three color channels to a single one. So they have their own color representation. And basically, yeah, they reduce the three color channels to one channel that simply indexes the color in their color representation. And they say, it's still pretty good, it's pretty faithful. So ultimately, they end up with like a 32 squared length representation of their image. And then they do one of two things, they either do autoregressive generative pre training, which is the sort of GPT-2 style pre training. And the, the idea here is that you always want to predict the next pixel of a sequence. So you can see right here, that's the sequence that you are sorry, that's the sequence that you input. And you always want to predict what is the next pixel. And in this case, you've seen you see that we've already predicted everything. Here, we've already predicted everything up to this red pixel. So you want to know what's this next pixel, this thing right here. What's this going to be? And the diagram here basically shows you how the attention flows. So every position in this transformer, and if you don't know what a transformer is, I haven't made a video about attention is all you need, where these are explained. But briefly, every position here can sort of send information can send information only in one place. So you can only in one direction as to so you train all of these in parallel. And when you predict this pixel right here, you only want information from whatever was before that pixel, otherwise the model could cheat, right? Otherwise, the model could simply learn to copy over the value. But the attention pattern here is simply to show you that this is autoregressive and it's in one direction. So you always want to predict the next pixel. And then from all of this, you want to predict the next pixel. And then from all of this, you want to predict the next pixel. This is in contrast to this objective here that comes from BERT. And I've also made a video on BERT. What you do in BERT is you simply take that image and you cross the block out two of the pixels, or many of the pixels. And you simply ask your network to reconstruct those pixels, okay. And now you can see the attention flows in all direction. BERT, the B stands actually for bi-directional. So this is the contrast to the autoregressive pre-training framework. Now these two things have been applied in text both. The autoregressive is usually it's easier to actually make it produce something like we saw producing these images, because you can always just predict the next pixel and then the next and then the next and then the next. Whereas in BERT, it's a bit more unclear how you would produce things in a consistent manner, because the predictions of these two pixels right here, they are independent. It's one forward pass, and then both of these are predicted. But other papers have tried to solve this like this, not XLNet. I forget, I forget its name, it's something with an X. And yeah, but these are the two objectives they look at. And it turns out they sort of trade off a bit, they work equally well, or a bit better and a bit worse depending on the task. So once they have done this, so they simply feed images, and you will notice that you don't need any labels for this. So what you'll do is simply input an image and then simply take away half of it like this, and then predict that pixel. And then you want to predict that pixel, and then you want to predict that pixel, right? That's all like you do with text. And in BERT, you simply input an image, cross out pixels, and then predict them. So you don't need labels for this. And that's why you can do it with this big data set. And you can do it in an unsupervised fashion. So you can just crawl the internet for for images, and just feed this in into there. And it will sort of learn to produce these images. Now, the question is, if you produce, if you learn to produce these images, does that help you for classification? And there, they have two methods of, of assessing this. The bottom one here is the fine tuning method, where you simply, so this is supposed to be the representation you learn in the different layers of the network. So this is supposed to be this thing right here. What you'll do is you'll simply fine tune. That means you on top of this representation, you add a classification head that has two outputs, cat or dog. And you train this entire network on your small data set that we discussed before. So you train the entire network, all of the parameters, this is called fine tuning. In contrast to that, what you can do is you can simply, and this is the easy way, you can simply add this classification head with two outputs, and then only train this classification head. And that is won't perform as well. But it gives you sort of a better idea of how good that is the representation that this network right here learned. And on top of that, so if you spin this idea further, you can actually go and do this at any intermediate layer right here. So you can forward propagate until layer two right here. And then here, you add your classification head into the two into the two classes, and you only train the classification head. That being said, you can also do this with fine tuning. But in this case, this is called a linear probe. And it is often used to assess how good the a representation in intermediate layers is, whereas what it actually does is assessing how linearly classifiable a representation is, which isn't the same as how useful or how informative, but it is one way to to assess these things. Okay. So these are the two things they assess. Alright, so for as for data sets for c410, they use like c410 and c4100 as data sets and the STL 10. And there you have to keep in mind the pre training is done on ImageNet for those so that you pre train on ImageNet without the labels, and then you transfer learn or learn or fine tune or or linear probe on these small data sets. Whereas later, we're going to look at ImageNet in there, the pre training as I understand it is done on ImageNet itself, but also a wider collection of a 100 million or so images from the web from the internet. Okay. So as you can see right here, this is what happens if you do this linear probing. And you can see it works pretty well. So you get like a 95 96% accuracy with linear probes. This is very powerful. So it's not easy to get 96% on c410. I mean, current state of the art is like 99%. But still 96% is pretty good. And this is the so the entire network, there is this big giant network that you input your image into. And then there is this one linear layer that does the classification. And all of this right here has not been trained with classification in mind, it simply has been trained to reproduce images. It hasn't even been trained on c410. As far as I understand, it's been trained on ImageNet. So the the this is to stress how cool or how significant this result is basically that just a linear probe on top of that will give you such a good accuracy. And the second thing that is obvious right here is this bottom axis is the layer. So this is the layer where they attach the linear probe. And usually if you pre train a network with a classification task in mind, so you pre train it with the labels, or maybe even without the labels in a self supervised way, or something like this, usually, the last layer has the best representation for classification. But here, the special thing is that the intermediate layers in the middle have the best representation, you can see that the representation quality in terms of linear probing falls off as they sort of it falls off as they go into higher layers. And this is consistent across the data sets, as you can see, and the the idea here is or the way they interpret it is that if you have an image right here, and the you've blocked part of it, so you've blocked this and this wrong way around this. So you've generated everything. And now your task is to predict the next pixel, right? So you're you train to predict this next pixel right here. And the idea is that as you put the image through the network, what it will do is sort of since the first layers, they're going to be, they're going to be similar to a CNN, they're going to be doing some low level low level feature transformation thing, right? But also the last layers, they're going to really care about what's the exact pixel that goes here, right? Since it's their job to to do that, they're going to care what color does it need to have, you know, what exact luminosity and so on, how does it fit in with the previous pixels and so on, where as so that's, that's also good. But it's not just low level information and consistency with other pixels or something like this. At some point, if you want to generate consistent images, and we saw that this model can generate consistent images, at some point, there needs to be some kind of a notion of the global information in the picture, right? Such because the images are consistent throughout. So there needs to be some some notion of what is in that image as a whole. And that's the exact information that we need for classification. And the only way that could actually be is here in the middle, since you know, that's the place. So the hypothesis is that the these models somehow learn a higher level representation of global information somewhere in the middle before they then specify that information again, down to predict the actual pixel. And that's why the best representations for classification are in the middle. So this is one of the this is actually the interesting finding or one of the interesting findings of this paper. I mean, it's cool that they can reach a good accuracy. But to recognize that maybe in these, these generative models, they have some intermediate stage where they represent the global information. And that will actually make the best representation. Okay, the second cool thing right here is that you can see they have different sizes of models. So the IGP TL, I believe is something like 60 layers, then this is like 48 layers, and this is 32 layers, we don't really so these are on the all of on the scale of GPT two, either a little bigger or a little smaller. It's not like GPT three scale where you need ginormous supercomputer, though they do do a lot of computation. But this still sort of fits within hardware of a standard size and not like exascale. What's interesting right here is that you can see the larger models, they reach a lower validation loss. So here is the validation loss larger model if you train them on. So these checkpoints here are always after the same amount of steps, the larger models do reach a lower validation loss right here, as you can see. So this is the large, this is the medium, this is the small. And also, you can see that on this axis, the linear probe accuracy. So this is whenever you go and you find the best intermediate layer for linear probing, you probe it and you record the accuracy. So you can see a general trend as your validation loss goes down, the linear probe accuracy goes up. So there is a connection, like it is in text models. In text models, there's a connection of the perplexity of your language model, and the quality that of the representation you get for downstream tasks. In this model, it seems to be the exact same thing, there is a connection between reaching lower validation loss and reaching a higher performance on classification. So that's one interesting thing, the general trend to up to the upper right corner. The other interesting, and even arguably even more interesting thing is that if you look at the same validation loss, so at this point, all of these models have the same validation loss, yet still, the bigger model is better, right, you can see right here, the bigger model outperforms the smaller model, even though they have the same validation loss on the image modeling task. And this is also something that OpenAI in their in their text papers has stressed that the larger models, they seem to be somehow more capable of forming good representations, even, you know, even if they have the same loss. So again, this, this could just be sort of a training data, remember better training data remembering thing. And when I said that in GPT-3, I didn't actually mean explicit remembering of training data, I meant kind of a fuzzy remembering of training data of I formulate that in the in the comments, but I feel a lot of people have misunderstood me there. Here, I think it's a much harder, harder to estimate what's going on. Also, since image pixels, humans don't have a super good model on image pixels in their head, as we have about text, as you can see, if you then fine tune, so for now, we've just do linear probing. If you fine tune these architectures, then you reach like a 99% accuracy on C410, which is on par with the best models that we have. So G pipe is supervised, pre trained on ImageNet, but also, I guess uses a bunch of data augmentation while these image GPT, it uses minimal data augmentation, I think they simply random crop a little bit. And that's about it. So they also experiment around with this BERT objective. So until now, this was all the, this was all these autoregressive objective. And I feel the open AI people are a bit more of a fan of the autoregressive objective, just given what they've done so far in their papers. And you can see here comparison of the two objectives on C410. And on ImageNet, again, C410 is pre trained with ImageNet. And ImageNet itself is pre trained with like a larger collection of images from the web, all the pre training is done without labels. Now, the blue is what you can reach with a linear probe. And the orange is then on top of that what you can reach by fine tuning, okay, so no linear probe, but fine tuning, I have to say that the fine tuning is always done at the end. So even though the linear probe, even though the linear probe can be attached anywhere in between, and it's often useful to do that, as we saw, because the in between layers are the best, they say they tried fine tuning also in from in between, but it always worked out best whenever you fine tune, whenever you fine tune, you take actually the last layer. So that kind of gives you an idea that the model is then it's sort of what seems to be important is this coming up with the higher level representation. And then once you fine tune, you're probably able to push that representation through to the end because of your training signal. But if you hadn't done the pre training, you wouldn't even have that higher level representation. And then the signal, I guess, is not strong enough to back propagate through the whole model, it would be very interesting if they investigate if they do this linear probe analysis again, after they fine tune the model, that and to see if then still it is the intermediate layers that have the best representation, or if now the best representation in a linear probe sense shifted towards the end, I'm going to guess it's shifted towards the end. But I sort of want to even see if the accuracy of the linear probe in the middle, does it keep the same, right? So does the curve go like this, this is the linear probe, when you simply pre train, right, this is linear probe accuracy. The question would be, does it change to be like this? Or does it change to be like this? This is supposed to be the same at the end. So basically, does it stay as good as it is, but simply get better at the end? Or does the representation like in this curve, does the good representation now shift towards the end, and leave the lower layer with even more capacity to do some low level stuff? Yeah, maybe they've done this, I haven't seen it. So and as you can see, these BERT and auto regressive objective, they sort of trade off. So the BERT, it tends to do poorly in the linear probe setting, but then it catches up during fine tuning in CIFAR-10, almost being at the level of the auto regressive and in ImageNet actually outperforming it. This darker thing here, it simply means that you average across different maskings of BERT, because I guess even in classification, it's not entirely clear how to get a signal out of BERT, because they don't do this CLS vector with BERT, what they do for classification and linear probing, and that's written up here, they simply take the they do an average pooling, I think they do an average pooling of the of all the representations of the sequence. And the last thing that I've also forgotten, there's a lot of stuff. When they fine tune, while fine tuning, come on, while fine tuning, the classification loss yields reasonable downstream performance, we find empirically that the joint objective, the generative objective and the classification objective works even better. Okay, so even when you fine tune with this model, you have to keep the generative modeling part, the generative loss around, and then it performs even more better, more well, whatever that word is. So that's also something to think about. I think this this paper right here, it kind of lays down a lot of cool things that you can think about. And it gives rise to a lot of hypotheses of how does this stuff work? Why does this stuff work? I don't even think that the numbers are the most important thing. It's mostly the fact of the effects. And what does it mean? Okay, so this was my take on it. It was, it's more kind of a my rant of what I find special about this paper than about the actual paper. You can look at the paper, their numbers are pretty good on ImageNet, they do not reach the same like super duper performance as they do on c410. And I guess that's probably because they have to downscale the ImageNet images way more than they have to downscale the c410 images, because those are of course, only 32 by 32. So because they have to downscale so much, they lose probably a lot of information. And I would be interested to see if there is a way to involve convolutions in this, in all of this. So to do the downscaling that in a learned manner with convolutions or something, I'm sure this has all been done already. I'm just lazy to look it up. Yeah, so I invite you to look at their blog post where they have these samples, they look pretty, pretty funny. And these full samples up here look fairly, you know, fairly cool for what it's trained to do and that it has no spatial awareness whatsoever. It simply uses learn position encodings. And yeah, check it out. That was it for me. Bye bye.
[{"start": 0.8, "end": 6.5600000000000005, "text": " Okay, I'm sure many of you have already seen this because it was rather widely announced,"}, {"start": 6.5600000000000005, "end": 14.08, "text": " but the open AI team has announced a new model that produces pictures instead of text."}, {"start": 15.120000000000001, "end": 22.240000000000002, "text": " So as you can see right here, on the left, you'll always see like a half a picture. And on the right"}, {"start": 22.240000000000002, "end": 28.72, "text": " is the ground truth. So they took this picture, they simply cut the bottom half right here. And"}, {"start": 28.72, "end": 35.36, "text": " then they let the model sort of imagine what they cut away. And what it comes up with is pretty cool,"}, {"start": 35.36, "end": 43.76, "text": " I have to say, like, look at the birds, like, this is just awesome. But the special thing about this"}, {"start": 43.76, "end": 50.0, "text": " isn't that it simply completes pictures. The special thing about it is it does it one pixel by"}, {"start": 50.0, "end": 57.92, "text": " pixel. So basically, it goes at this pixel right here and asks, Okay, what's that pixel? And then"}, {"start": 57.92, "end": 67.36, "text": " what's that pixel? And then what's that pixel, and so on. So it is basically a like a language model,"}, {"start": 67.36, "end": 73.6, "text": " but for pixels in that it goes over the images in order, basically like this,"}, {"start": 74.56, "end": 82.64, "text": " or like always from left to right, left to right, left to right. And it has no clue of the spatial"}, {"start": 82.64, "end": 87.6, "text": " relations between the pixels, it needs to learn that by itself, as opposed to a convolutional"}, {"start": 87.6, "end": 94.39999999999999, "text": " neural network, which is specifically designed such that if you want to predict this pixel right"}, {"start": 94.39999999999999, "end": 100.24, "text": " here, then it's specifically designed to say, okay, the most important information is probably"}, {"start": 100.24, "end": 107.84, "text": " around that pixel. And then some like other important information is widely around that pixel."}, {"start": 107.84, "end": 114.32, "text": " So CNNs are built with this in mind. Whereas this model right here, which is also known as image GPT"}, {"start": 114.32, "end": 121.44, "text": " isn't doesn't have any of that. It's simply a transformer model that goes over these pixels"}, {"start": 121.44, "end": 127.44, "text": " one by one. And we'll see how that's done. There's some more examples right here. Particularly cool"}, {"start": 127.44, "end": 133.44, "text": " is the cat. And you see that there is the beginning of this little white thing right here,"}, {"start": 133.44, "end": 147.68, "text": " which is this card. And the completions of the model. Yes, very interesting. The model can of"}, {"start": 147.68, "end": 154.96, "text": " course, as a language model can also sample by itself, just random images, you sample them once"}, {"start": 154.96, "end": 161.84, "text": " through. And this is what it comes up with. So these are pretty good quality images for a model"}, {"start": 161.84, "end": 168.16, "text": " for a model that just produces one pixel by one pixel. Now this idea of one pixel by pixel isn't"}, {"start": 168.16, "end": 176.4, "text": " new. This has been around before. But the investigation here is basically how much can we"}, {"start": 176.4, "end": 183.12, "text": " how far can we push these generative models for pre training? Hi, there. This is Janek from"}, {"start": 183.12, "end": 189.2, "text": " post production. I've realized that I've forgotten to even read the name of the paper. So it's called"}, {"start": 189.2, "end": 195.83999999999997, "text": " generative pre training from pixels by Mark Chen, Alec Radford, round child, Jeff Wu, he won't do"}, {"start": 196.39999999999998, "end": 204.64, "text": " profile a diary wall, David Luan, and Ilya Satsuki. And since Henry AI labs has already"}, {"start": 204.64, "end": 210.79999999999998, "text": " made a video on this, this video is going to be more of kind of a rumble rant about what I find"}, {"start": 210.79999999999998, "end": 216.72, "text": " interesting about the paper and some thoughts about it rather than like a classic explanation."}, {"start": 216.72, "end": 222.08, "text": " I hope you still enjoy that. So what you saw on the right wasn't even the this isn't the final"}, {"start": 222.08, "end": 228.32, "text": " result, the supposed result. This is simply the pre training task. It's fun to look at it. But the"}, {"start": 228.32, "end": 236.8, "text": " actual object objective of the paper is the following. What if we train we pre train on a"}, {"start": 236.8, "end": 248.48000000000002, "text": " large data set to generate what good images like these, or we to complete images like these. And"}, {"start": 248.48000000000002, "end": 258.32, "text": " then we fine tune on a classification task. And the answer is here. They say, on c410, we achieve"}, {"start": 258.32, "end": 265.28000000000003, "text": " sick the 96.3% accuracy with a linear probe outperforming a super wide supervised wide"}, {"start": 265.28, "end": 272.96, "text": " resonant and a 99% accuracy with full fine tuning matching the top supervised pre trained models."}, {"start": 274.23999999999995, "end": 280.55999999999995, "text": " And even larger model trained on a mixture of image net and web images is competitive with"}, {"start": 280.55999999999995, "end": 287.84, "text": " self supervised benchmarks on image net achieving 72 top one accuracy on a linear probe of our"}, {"start": 287.84, "end": 296.56, "text": " features. So the goal here is that you have a data set that you want to try and like train a"}, {"start": 296.56, "end": 304.79999999999995, "text": " classifier on. So usually you have a data set and the data set has images, and you put them through"}, {"start": 304.79999999999995, "end": 310.96, "text": " like a convolutional neural network. And then you have to classify the image into one of I don't"}, {"start": 310.96, "end": 317.52, "text": " know how many classes on c410. That's 10 classes on image and it's 1000. And the data set is these"}, {"start": 317.52, "end": 323.91999999999996, "text": " images together with these labels. Now, the idea of pre training is that you some where have a"}, {"start": 323.91999999999996, "end": 332.08, "text": " bigger data set that is sort of similar to the small data set. But yeah, it's similar enough such"}, {"start": 332.08, "end": 336.71999999999997, "text": " that the network could learn something. So what you want to do first is you first want to take the"}, {"start": 336.71999999999997, "end": 344.0, "text": " large data set, train this network right here. And then in a second step, fine tune the network"}, {"start": 344.0, "end": 348.8, "text": " on this smaller data set. And you sort of hope that what you learn from the large data set right"}, {"start": 348.8, "end": 354.48, "text": " here, transfers over a little bit of knowledge, you already have a little bit of knowledge,"}, {"start": 354.48, "end": 360.08, "text": " and you can make better use of the data that you have right here. Now, the question is,"}, {"start": 360.08, "end": 365.92, "text": " how do you do this pre training? And of course, this has a long tradition, well long for maybe"}, {"start": 366.56, "end": 373.2, "text": " two or three years right now, in the language community, where people, they pre train these"}, {"start": 373.2, "end": 380.96, "text": " large models, like we've just seen GPT-3, or BERT was one of them. They pre train these large"}, {"start": 380.96, "end": 387.84, "text": " transformer models on text, and then to fine tune them on classification tasks for text. And that's"}, {"start": 387.84, "end": 395.91999999999996, "text": " what this paper is doing right here. They pre train a transformer that is a GPT-2 scale model."}, {"start": 395.92, "end": 402.96000000000004, "text": " They pre train it on image generation. And then they fine tune it or transfer learn it to"}, {"start": 402.96000000000004, "end": 411.28000000000003, "text": " classification tasks. And the point of the paper is to say that, like in text data, in text data,"}, {"start": 411.28000000000003, "end": 420.08000000000004, "text": " we have made pretty good, pretty good experiences with doing this with pre training a generative"}, {"start": 420.08, "end": 426.56, "text": " model and then fine tuning on a classification task. While so far in images, all we've ever done"}, {"start": 426.56, "end": 433.76, "text": " is we've pre trained these pre training tasks usually is a classification task, or like a"}, {"start": 433.76, "end": 441.2, "text": " self supervised task with a contrastive loss or something like this. What they're doing new is"}, {"start": 441.2, "end": 448.32, "text": " the generative modeling in the as a pre training. And again, this isn't like entirely new, but they"}, {"start": 448.32, "end": 457.12, "text": " show that if you throw a lot of computers at it, and lots of data and a big model, then that can"}, {"start": 457.12, "end": 462.96, "text": " work equally well to the self supervised tasks. So their model, as I said, is pretty, pretty simple,"}, {"start": 462.96, "end": 470.24, "text": " they take an image, and they unroll the image now, and fully unrolled image on, let's say ImageNet"}, {"start": 470.24, "end": 478.16, "text": " has 224 squared pixels, and that times three, right, because you have three color channels, that's"}, {"start": 478.16, "end": 487.36, "text": " too large, even for an open AI supercomputer. So what they do is first, they downscale the image."}, {"start": 487.36, "end": 492.40000000000003, "text": " So they downscale, it's not as drastic as here, where you just get a three by three image, but"}, {"start": 492.4, "end": 500.0, "text": " they do downscale it to like a 32 by 32, or a 64 by 64. Then they unroll it, which simply means they"}, {"start": 500.79999999999995, "end": 507.44, "text": " go through the image like this, and make a sequence out of it because their models are naturally"}, {"start": 507.44, "end": 515.4399999999999, "text": " made for text sequences. They simply put the image into a text sequence, they further simplify this"}, {"start": 515.44, "end": 522.6400000000001, "text": " by reducing the three color channels to a single one. So they have their own color representation."}, {"start": 522.6400000000001, "end": 529.84, "text": " And basically, yeah, they reduce the three color channels to one channel that simply indexes the"}, {"start": 529.84, "end": 536.6400000000001, "text": " color in their color representation. And they say, it's still pretty good, it's pretty faithful."}, {"start": 536.64, "end": 544.64, "text": " So ultimately, they end up with like a 32 squared length representation of their image."}, {"start": 545.76, "end": 552.24, "text": " And then they do one of two things, they either do autoregressive generative pre training, which is"}, {"start": 552.24, "end": 560.3199999999999, "text": " the sort of GPT-2 style pre training. And the, the idea here is that you always want to predict the"}, {"start": 560.32, "end": 566.48, "text": " next pixel of a sequence. So you can see right here, that's the sequence that you are sorry,"}, {"start": 567.44, "end": 574.32, "text": " that's the sequence that you input. And you always want to predict what is the next pixel."}, {"start": 575.12, "end": 580.24, "text": " And in this case, you've seen you see that we've already predicted everything. Here, we've already"}, {"start": 580.24, "end": 586.4000000000001, "text": " predicted everything up to this red pixel. So you want to know what's this next pixel, this thing"}, {"start": 586.4, "end": 594.3199999999999, "text": " right here. What's this going to be? And the diagram here basically shows you how the attention"}, {"start": 594.3199999999999, "end": 599.52, "text": " flows. So every position in this transformer, and if you don't know what a transformer is,"}, {"start": 599.52, "end": 605.36, "text": " I haven't made a video about attention is all you need, where these are explained. But briefly,"}, {"start": 605.36, "end": 614.96, "text": " every position here can sort of send information can send information only in one place. So you"}, {"start": 614.96, "end": 622.1600000000001, "text": " can only in one direction as to so you train all of these in parallel. And when you predict this"}, {"start": 622.1600000000001, "end": 629.2, "text": " pixel right here, you only want information from whatever was before that pixel, otherwise the"}, {"start": 629.2, "end": 635.2800000000001, "text": " model could cheat, right? Otherwise, the model could simply learn to copy over the value."}, {"start": 637.0400000000001, "end": 642.08, "text": " But the attention pattern here is simply to show you that this is autoregressive and it's in one"}, {"start": 642.08, "end": 646.0, "text": " direction. So you always want to predict the next pixel. And then from all of this, you want to"}, {"start": 646.0, "end": 650.64, "text": " predict the next pixel. And then from all of this, you want to predict the next pixel. This is in"}, {"start": 650.64, "end": 657.2800000000001, "text": " contrast to this objective here that comes from BERT. And I've also made a video on BERT. What you"}, {"start": 657.2800000000001, "end": 664.48, "text": " do in BERT is you simply take that image and you cross the block out two of the pixels, or many of"}, {"start": 664.48, "end": 670.88, "text": " the pixels. And you simply ask your network to reconstruct those pixels, okay. And now you can"}, {"start": 670.88, "end": 677.52, "text": " see the attention flows in all direction. BERT, the B stands actually for bi-directional. So this"}, {"start": 677.52, "end": 685.4399999999999, "text": " is the contrast to the autoregressive pre-training framework. Now these two things have been applied"}, {"start": 685.4399999999999, "end": 691.92, "text": " in text both. The autoregressive is usually it's easier to actually make it produce something like"}, {"start": 691.92, "end": 697.68, "text": " we saw producing these images, because you can always just predict the next pixel and then the"}, {"start": 697.68, "end": 703.28, "text": " next and then the next and then the next. Whereas in BERT, it's a bit more unclear how you would"}, {"start": 703.28, "end": 709.3599999999999, "text": " produce things in a consistent manner, because the predictions of these two pixels right here,"}, {"start": 709.92, "end": 714.3199999999999, "text": " they are independent. It's one forward pass, and then both of these are predicted."}, {"start": 716.16, "end": 724.24, "text": " But other papers have tried to solve this like this, not XLNet. I forget, I forget its name,"}, {"start": 724.24, "end": 733.76, "text": " it's something with an X. And yeah, but these are the two objectives they look at. And it turns out"}, {"start": 733.76, "end": 740.24, "text": " they sort of trade off a bit, they work equally well, or a bit better and a bit worse depending"}, {"start": 740.24, "end": 745.84, "text": " on the task. So once they have done this, so they simply feed images, and you will notice that you"}, {"start": 745.84, "end": 753.84, "text": " don't need any labels for this. So what you'll do is simply input an image and then simply take away"}, {"start": 753.84, "end": 761.0400000000001, "text": " half of it like this, and then predict that pixel. And then you want to predict that pixel,"}, {"start": 761.0400000000001, "end": 765.6800000000001, "text": " and then you want to predict that pixel, right? That's all like you do with text. And in BERT,"}, {"start": 765.6800000000001, "end": 772.24, "text": " you simply input an image, cross out pixels, and then predict them. So you don't need labels for"}, {"start": 772.24, "end": 777.6800000000001, "text": " this. And that's why you can do it with this big data set. And you can do it in an unsupervised"}, {"start": 777.68, "end": 784.0, "text": " fashion. So you can just crawl the internet for for images, and just feed this in into there."}, {"start": 784.0, "end": 789.92, "text": " And it will sort of learn to produce these images. Now, the question is, if you produce,"}, {"start": 789.92, "end": 796.4, "text": " if you learn to produce these images, does that help you for classification? And there,"}, {"start": 797.68, "end": 803.8399999999999, "text": " they have two methods of, of assessing this. The bottom one here is the fine tuning method,"}, {"start": 803.84, "end": 810.1600000000001, "text": " where you simply, so this is supposed to be the representation you learn in the different layers"}, {"start": 810.1600000000001, "end": 816.48, "text": " of the network. So this is supposed to be this thing right here. What you'll do is you'll simply"}, {"start": 816.48, "end": 822.1600000000001, "text": " fine tune. That means you on top of this representation, you add a classification head"}, {"start": 822.1600000000001, "end": 830.1600000000001, "text": " that has two outputs, cat or dog. And you train this entire network on your small data set that"}, {"start": 830.16, "end": 834.7199999999999, "text": " we discussed before. So you train the entire network, all of the parameters, this is called"}, {"start": 834.7199999999999, "end": 842.0799999999999, "text": " fine tuning. In contrast to that, what you can do is you can simply, and this is the easy way,"}, {"start": 842.0799999999999, "end": 848.24, "text": " you can simply add this classification head with two outputs, and then only train this classification"}, {"start": 848.24, "end": 855.04, "text": " head. And that is won't perform as well. But it gives you sort of a better idea of how good"}, {"start": 855.04, "end": 861.76, "text": " that is the representation that this network right here learned. And on top of that, so if you spin"}, {"start": 861.76, "end": 869.4399999999999, "text": " this idea further, you can actually go and do this at any intermediate layer right here. So you can"}, {"start": 869.4399999999999, "end": 875.36, "text": " forward propagate until layer two right here. And then here, you add your classification head into"}, {"start": 875.36, "end": 882.3199999999999, "text": " the two into the two classes, and you only train the classification head. That being said, you can"}, {"start": 882.32, "end": 889.84, "text": " also do this with fine tuning. But in this case, this is called a linear probe. And it is often"}, {"start": 889.84, "end": 895.9200000000001, "text": " used to assess how good the a representation in intermediate layers is, whereas what it actually"}, {"start": 895.9200000000001, "end": 902.8000000000001, "text": " does is assessing how linearly classifiable a representation is, which isn't the same as how"}, {"start": 902.8000000000001, "end": 911.7600000000001, "text": " useful or how informative, but it is one way to to assess these things. Okay. So these are the"}, {"start": 911.76, "end": 919.68, "text": " two things they assess. Alright, so for as for data sets for c410, they use like c410 and c4100"}, {"start": 920.72, "end": 927.68, "text": " as data sets and the STL 10. And there you have to keep in mind the pre training is done on ImageNet"}, {"start": 927.68, "end": 933.76, "text": " for those so that you pre train on ImageNet without the labels, and then you transfer learn or"}, {"start": 933.76, "end": 943.04, "text": " learn or fine tune or or linear probe on these small data sets. Whereas later, we're going to"}, {"start": 943.04, "end": 949.84, "text": " look at ImageNet in there, the pre training as I understand it is done on ImageNet itself, but also"}, {"start": 949.84, "end": 960.72, "text": " a wider collection of a 100 million or so images from the web from the internet. Okay. So as you"}, {"start": 960.72, "end": 969.36, "text": " can see right here, this is what happens if you do this linear probing. And you can see it works"}, {"start": 969.36, "end": 978.0, "text": " pretty well. So you get like a 95 96% accuracy with linear probes. This is very powerful. So it's not"}, {"start": 978.0, "end": 989.2, "text": " easy to get 96% on c410. I mean, current state of the art is like 99%. But still 96% is pretty good."}, {"start": 989.2, "end": 996.88, "text": " And this is the so the entire network, there is this big giant network that you input your image"}, {"start": 996.88, "end": 1003.9200000000001, "text": " into. And then there is this one linear layer that does the classification. And all of this right"}, {"start": 1003.9200000000001, "end": 1010.72, "text": " here has not been trained with classification in mind, it simply has been trained to reproduce"}, {"start": 1010.72, "end": 1017.44, "text": " images. It hasn't even been trained on c410. As far as I understand, it's been trained on ImageNet."}, {"start": 1017.44, "end": 1027.44, "text": " So the the this is to stress how cool or how significant this result is basically that just"}, {"start": 1027.44, "end": 1035.04, "text": " a linear probe on top of that will give you such a good accuracy. And the second thing that is"}, {"start": 1035.04, "end": 1042.4, "text": " obvious right here is this bottom axis is the layer. So this is the layer where they attach the"}, {"start": 1042.4, "end": 1049.52, "text": " linear probe. And usually if you pre train a network with a classification task in mind,"}, {"start": 1049.52, "end": 1054.3200000000002, "text": " so you pre train it with the labels, or maybe even without the labels in a self supervised way,"}, {"start": 1054.3200000000002, "end": 1061.1200000000001, "text": " or something like this, usually, the last layer has the best representation for classification."}, {"start": 1061.1200000000001, "end": 1067.6000000000001, "text": " But here, the special thing is that the intermediate layers in the middle have the best"}, {"start": 1067.6, "end": 1074.08, "text": " representation, you can see that the representation quality in terms of linear probing falls off as"}, {"start": 1074.08, "end": 1083.6799999999998, "text": " they sort of it falls off as they go into higher layers. And this is consistent across the data"}, {"start": 1083.6799999999998, "end": 1092.8799999999999, "text": " sets, as you can see, and the the idea here is or the way they interpret it is that if you have an"}, {"start": 1092.88, "end": 1102.4, "text": " image right here, and the you've blocked part of it, so you've blocked this and this"}, {"start": 1104.48, "end": 1115.3600000000001, "text": " wrong way around this. So you've generated everything. And now your task is to predict"}, {"start": 1115.36, "end": 1124.24, "text": " the next pixel, right? So you're you train to predict this next pixel right here. And the idea"}, {"start": 1124.24, "end": 1133.76, "text": " is that as you put the image through the network, what it will do is sort of since the first layers,"}, {"start": 1133.76, "end": 1139.6, "text": " they're going to be, they're going to be similar to a CNN, they're going to be doing some low level"}, {"start": 1139.6, "end": 1146.32, "text": " low level feature transformation thing, right? But also the last layers, they're going to really care"}, {"start": 1146.32, "end": 1152.1599999999999, "text": " about what's the exact pixel that goes here, right? Since it's their job to to do that,"}, {"start": 1152.8, "end": 1158.9599999999998, "text": " they're going to care what color does it need to have, you know, what exact luminosity and so on,"}, {"start": 1158.9599999999998, "end": 1166.56, "text": " how does it fit in with the previous pixels and so on, where as so that's, that's also good. But"}, {"start": 1166.56, "end": 1172.48, "text": " it's not just low level information and consistency with other pixels or something like this."}, {"start": 1173.44, "end": 1179.6799999999998, "text": " At some point, if you want to generate consistent images, and we saw that this model can generate"}, {"start": 1179.6799999999998, "end": 1186.56, "text": " consistent images, at some point, there needs to be some kind of a notion of the global information"}, {"start": 1186.56, "end": 1194.24, "text": " in the picture, right? Such because the images are consistent throughout. So there needs to be some"}, {"start": 1194.24, "end": 1200.72, "text": " some notion of what is in that image as a whole. And that's the exact information that we need for"}, {"start": 1200.72, "end": 1207.04, "text": " classification. And the only way that could actually be is here in the middle, since you know,"}, {"start": 1207.04, "end": 1213.68, "text": " that's the place. So the hypothesis is that the these models somehow learn a higher level"}, {"start": 1213.68, "end": 1219.92, "text": " representation of global information somewhere in the middle before they then specify that"}, {"start": 1219.92, "end": 1225.68, "text": " information again, down to predict the actual pixel. And that's why the best representations"}, {"start": 1225.68, "end": 1232.8000000000002, "text": " for classification are in the middle. So this is one of the this is actually the interesting"}, {"start": 1232.8000000000002, "end": 1236.3200000000002, "text": " finding or one of the interesting findings of this paper. I mean, it's cool that they can"}, {"start": 1236.3200000000002, "end": 1242.64, "text": " reach a good accuracy. But to recognize that maybe in these, these generative models,"}, {"start": 1244.72, "end": 1249.68, "text": " they have some intermediate stage where they represent the global information. And that"}, {"start": 1249.68, "end": 1257.04, "text": " will actually make the best representation. Okay, the second cool thing right here is that you can"}, {"start": 1257.04, "end": 1266.5600000000002, "text": " see they have different sizes of models. So the IGP TL, I believe is something like 60 layers,"}, {"start": 1267.3600000000001, "end": 1273.68, "text": " then this is like 48 layers, and this is 32 layers, we don't really so these are on the all"}, {"start": 1273.68, "end": 1280.5600000000002, "text": " of on the scale of GPT two, either a little bigger or a little smaller. It's not like GPT three scale"}, {"start": 1280.5600000000002, "end": 1289.52, "text": " where you need ginormous supercomputer, though they do do a lot of computation. But this still"}, {"start": 1289.52, "end": 1298.64, "text": " sort of fits within hardware of a standard size and not like exascale. What's interesting right"}, {"start": 1298.64, "end": 1305.1200000000001, "text": " here is that you can see the larger models, they reach a lower validation loss. So here is the"}, {"start": 1305.1200000000001, "end": 1310.3200000000002, "text": " validation loss larger model if you train them on. So these checkpoints here are always after the"}, {"start": 1310.3200000000002, "end": 1317.2800000000002, "text": " same amount of steps, the larger models do reach a lower validation loss right here, as you can see."}, {"start": 1317.2800000000002, "end": 1326.0800000000002, "text": " So this is the large, this is the medium, this is the small. And also, you can see that on this"}, {"start": 1326.08, "end": 1331.36, "text": " axis, the linear probe accuracy. So this is whenever you go and you find the best intermediate"}, {"start": 1331.36, "end": 1337.36, "text": " layer for linear probing, you probe it and you record the accuracy. So you can see a general"}, {"start": 1337.36, "end": 1344.0, "text": " trend as your validation loss goes down, the linear probe accuracy goes up. So there is a connection,"}, {"start": 1344.6399999999999, "end": 1350.08, "text": " like it is in text models. In text models, there's a connection of the perplexity of your language"}, {"start": 1350.08, "end": 1357.1999999999998, "text": " model, and the quality that of the representation you get for downstream tasks. In this model,"}, {"start": 1357.1999999999998, "end": 1362.6399999999999, "text": " it seems to be the exact same thing, there is a connection between reaching lower validation loss"}, {"start": 1363.1999999999998, "end": 1370.3999999999999, "text": " and reaching a higher performance on classification. So that's one interesting"}, {"start": 1370.3999999999999, "end": 1378.24, "text": " thing, the general trend to up to the upper right corner. The other interesting, and even arguably"}, {"start": 1378.24, "end": 1384.24, "text": " even more interesting thing is that if you look at the same validation loss, so at this point,"}, {"start": 1384.24, "end": 1390.4, "text": " all of these models have the same validation loss, yet still, the bigger model is better,"}, {"start": 1390.4, "end": 1396.4, "text": " right, you can see right here, the bigger model outperforms the smaller model, even though they"}, {"start": 1396.4, "end": 1404.72, "text": " have the same validation loss on the image modeling task. And this is also something that OpenAI in"}, {"start": 1404.72, "end": 1410.88, "text": " their in their text papers has stressed that the larger models, they seem to be somehow more"}, {"start": 1410.88, "end": 1418.24, "text": " capable of forming good representations, even, you know, even if they have the same loss. So"}, {"start": 1420.24, "end": 1426.24, "text": " again, this, this could just be sort of a training data, remember better training data remembering"}, {"start": 1426.24, "end": 1432.4, "text": " thing. And when I said that in GPT-3, I didn't actually mean explicit remembering of training"}, {"start": 1432.4, "end": 1438.8000000000002, "text": " data, I meant kind of a fuzzy remembering of training data of I formulate that in the in the"}, {"start": 1438.8000000000002, "end": 1446.0800000000002, "text": " comments, but I feel a lot of people have misunderstood me there. Here, I think it's a much"}, {"start": 1446.0800000000002, "end": 1452.5600000000002, "text": " harder, harder to estimate what's going on. Also, since image pixels, humans don't have a super good"}, {"start": 1452.5600000000002, "end": 1460.16, "text": " model on image pixels in their head, as we have about text, as you can see, if you then fine tune,"}, {"start": 1460.16, "end": 1467.2, "text": " so for now, we've just do linear probing. If you fine tune these architectures, then you reach like"}, {"start": 1467.2, "end": 1478.88, "text": " a 99% accuracy on C410, which is on par with the best models that we have. So G pipe is supervised,"}, {"start": 1478.88, "end": 1486.0, "text": " pre trained on ImageNet, but also, I guess uses a bunch of data augmentation while these image GPT,"}, {"start": 1486.0, "end": 1495.76, "text": " it uses minimal data augmentation, I think they simply random crop a little bit. And that's about"}, {"start": 1495.76, "end": 1506.4, "text": " it. So they also experiment around with this BERT objective. So until now, this was all the,"}, {"start": 1506.96, "end": 1512.96, "text": " this was all these autoregressive objective. And I feel the open AI people are a bit more of a fan"}, {"start": 1512.96, "end": 1520.0, "text": " of the autoregressive objective, just given what they've done so far in their papers. And you can"}, {"start": 1520.0, "end": 1530.72, "text": " see here comparison of the two objectives on C410. And on ImageNet, again, C410 is pre trained with"}, {"start": 1530.72, "end": 1536.64, "text": " ImageNet. And ImageNet itself is pre trained with like a larger collection of images from the web,"}, {"start": 1536.64, "end": 1544.4, "text": " all the pre training is done without labels. Now, the blue is what you can reach with a linear probe."}, {"start": 1545.2, "end": 1551.8400000000001, "text": " And the orange is then on top of that what you can reach by fine tuning, okay, so no linear probe,"}, {"start": 1551.8400000000001, "end": 1557.1200000000001, "text": " but fine tuning, I have to say that the fine tuning is always done at the end. So even though"}, {"start": 1557.1200000000001, "end": 1565.3600000000001, "text": " the linear probe, even though the linear probe can be attached anywhere in between, and it's often"}, {"start": 1565.36, "end": 1570.7199999999998, "text": " useful to do that, as we saw, because the in between layers are the best, they say they tried"}, {"start": 1570.7199999999998, "end": 1577.84, "text": " fine tuning also in from in between, but it always worked out best whenever you fine tune,"}, {"start": 1577.84, "end": 1584.6399999999999, "text": " whenever you fine tune, you take actually the last layer. So that kind of gives you an idea that the"}, {"start": 1584.6399999999999, "end": 1592.7199999999998, "text": " model is then it's sort of what seems to be important is this coming up with the higher level"}, {"start": 1592.72, "end": 1598.8, "text": " representation. And then once you fine tune, you're probably able to push that representation"}, {"start": 1600.64, "end": 1606.56, "text": " through to the end because of your training signal. But if you hadn't done the pre training,"}, {"start": 1606.56, "end": 1611.6000000000001, "text": " you wouldn't even have that higher level representation. And then the signal, I guess,"}, {"start": 1611.6000000000001, "end": 1616.96, "text": " is not strong enough to back propagate through the whole model, it would be very interesting"}, {"start": 1616.96, "end": 1623.44, "text": " if they investigate if they do this linear probe analysis again, after they fine tune the model,"}, {"start": 1623.44, "end": 1630.96, "text": " that and to see if then still it is the intermediate layers that have the best representation,"}, {"start": 1630.96, "end": 1638.32, "text": " or if now the best representation in a linear probe sense shifted towards the end, I'm going to"}, {"start": 1638.32, "end": 1645.1200000000001, "text": " guess it's shifted towards the end. But I sort of want to even see if the accuracy of the linear"}, {"start": 1645.12, "end": 1652.6399999999999, "text": " probe in the middle, does it keep the same, right? So does the curve go like this, this is the linear"}, {"start": 1652.6399999999999, "end": 1659.84, "text": " probe, when you simply pre train, right, this is linear probe accuracy. The question would be,"}, {"start": 1659.84, "end": 1668.56, "text": " does it change to be like this? Or does it change to be like this? This is supposed to be the same"}, {"start": 1668.56, "end": 1675.76, "text": " at the end. So basically, does it stay as good as it is, but simply get better at the end? Or does"}, {"start": 1675.76, "end": 1681.36, "text": " the representation like in this curve, does the good representation now shift towards the end,"}, {"start": 1681.36, "end": 1687.76, "text": " and leave the lower layer with even more capacity to do some low level stuff? Yeah,"}, {"start": 1688.72, "end": 1694.56, "text": " maybe they've done this, I haven't seen it. So and as you can see, these BERT and auto"}, {"start": 1694.56, "end": 1701.6799999999998, "text": " regressive objective, they sort of trade off. So the BERT, it tends to do poorly in the linear"}, {"start": 1701.6799999999998, "end": 1708.6399999999999, "text": " probe setting, but then it catches up during fine tuning in CIFAR-10, almost being at the level of"}, {"start": 1708.6399999999999, "end": 1717.36, "text": " the auto regressive and in ImageNet actually outperforming it. This darker thing here,"}, {"start": 1717.36, "end": 1723.2, "text": " it simply means that you average across different maskings of BERT, because I guess even in"}, {"start": 1723.2, "end": 1730.8, "text": " classification, it's not entirely clear how to get a signal out of BERT, because they don't do this"}, {"start": 1730.8, "end": 1737.28, "text": " CLS vector with BERT, what they do for classification and linear probing, and that's"}, {"start": 1737.28, "end": 1746.56, "text": " written up here, they simply take the they do an average pooling, I think they do an average pooling"}, {"start": 1746.56, "end": 1754.1599999999999, "text": " of the of all the representations of the sequence. And the last thing that I've also forgotten,"}, {"start": 1754.96, "end": 1761.2, "text": " there's a lot of stuff. When they fine tune, while fine tuning,"}, {"start": 1763.52, "end": 1770.8799999999999, "text": " come on, while fine tuning, the classification loss yields reasonable downstream performance,"}, {"start": 1770.88, "end": 1776.96, "text": " we find empirically that the joint objective, the generative objective and the classification"}, {"start": 1776.96, "end": 1784.3200000000002, "text": " objective works even better. Okay, so even when you fine tune with this model, you have to keep"}, {"start": 1784.3200000000002, "end": 1792.96, "text": " the generative modeling part, the generative loss around, and then it performs even more better,"}, {"start": 1792.96, "end": 1801.68, "text": " more well, whatever that word is. So that's also something to think about. I think this this paper"}, {"start": 1801.68, "end": 1808.72, "text": " right here, it kind of lays down a lot of cool things that you can think about. And it gives"}, {"start": 1808.72, "end": 1816.24, "text": " rise to a lot of hypotheses of how does this stuff work? Why does this stuff work? I don't even think"}, {"start": 1816.24, "end": 1823.28, "text": " that the numbers are the most important thing. It's mostly the fact of the effects. And what does it"}, {"start": 1823.28, "end": 1833.1200000000001, "text": " mean? Okay, so this was my take on it. It was, it's more kind of a my rant of what I find special"}, {"start": 1833.1200000000001, "end": 1839.52, "text": " about this paper than about the actual paper. You can look at the paper, their numbers are"}, {"start": 1839.52, "end": 1846.48, "text": " pretty good on ImageNet, they do not reach the same like super duper performance as they do on"}, {"start": 1846.48, "end": 1853.44, "text": " c410. And I guess that's probably because they have to downscale the ImageNet images way more"}, {"start": 1853.44, "end": 1858.24, "text": " than they have to downscale the c410 images, because those are of course, only 32 by 32."}, {"start": 1860.32, "end": 1864.8799999999999, "text": " So because they have to downscale so much, they lose probably a lot of information."}, {"start": 1864.88, "end": 1871.68, "text": " And I would be interested to see if there is a way to involve convolutions in this,"}, {"start": 1872.72, "end": 1879.44, "text": " in all of this. So to do the downscaling that in a learned manner with convolutions or something,"}, {"start": 1879.44, "end": 1885.7600000000002, "text": " I'm sure this has all been done already. I'm just lazy to look it up. Yeah, so I invite you to look"}, {"start": 1885.7600000000002, "end": 1892.64, "text": " at their blog post where they have these samples, they look pretty, pretty funny. And these full"}, {"start": 1892.64, "end": 1898.64, "text": " samples up here look fairly, you know, fairly cool for what it's trained to do and that it has no"}, {"start": 1898.64, "end": 1904.48, "text": " spatial awareness whatsoever. It simply uses learn position encodings. And yeah, check it out. That"}, {"start": 1904.48, "end": 1922.96, "text": " was it for me. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=YPfUiOMYOEE
BYOL: Bootstrap Your Own Latent: A New Approach to Self-Supervised Learning (Paper Explained)
Self-supervised representation learning relies on negative samples to keep the encoder from collapsing to trivial solutions. However, this paper shows that negative samples, which are a nuisance to implement, are not necessary for learning good representation, and their algorithm BYOL is able to outperform other baselines using just positive samples. OUTLINE: 0:00 - Intro & Overview 1:10 - Image Representation Learning 3:55 - Self-Supervised Learning 5:35 - Negative Samples 10:50 - BYOL 23:20 - Experiments 30:10 - Conclusion & Broader Impact Paper: https://arxiv.org/abs/2006.07733 Abstract: We introduce Bootstrap Your Own Latent (BYOL), a new approach to self-supervised image representation learning. BYOL relies on two neural networks, referred to as online and target networks, that interact and learn from each other. From an augmented view of an image, we train the online network to predict the target network representation of the same image under a different augmented view. At the same time, we update the target network with a slow-moving average of the online network. While state-of-the art methods intrinsically rely on negative pairs, BYOL achieves a new state of the art without them. BYOL reaches 74.3% top-1 classification accuracy on ImageNet using the standard linear evaluation protocol with a ResNet-50 architecture and 79.6% with a larger ResNet. We show that BYOL performs on par or better than the current state of the art on both transfer and semi-supervised benchmarks. Authors: Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H. Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, Bilal Piot, Koray Kavukcuoglu, Rémi Munos, Michal Valko Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hello there, today we're looking at Bootstrap Your Own Latent, a new approach to self supervised learning by researchers of DeepMind and Imperial College. So not almost no day goes by where we don't hear some sort of new self supervised algorithm right here. This paper on a high level tries to get rid of the necessary negative samples when doing the contrastive loss for self supervised learning. And they basically combine momentum contrast and SimClear and then remove the negative samples. And that seems to work pretty well even though it's magic. So yeah, if you if you want to see how it's done, stick around, share the video out if you want other people to see how it's done and leave a comment. This one, I really don't get what's going on. So if you have ideas, put them there, I'll read them through, it'll be fun. Alright so they say we introduced Bootstrap Your Own Latent or BOL, a new approach to self supervised image representation learning. Okay, so image representation learning is the simple task of taking an image and then feeding it through a function which is usually like a neural network. Let's just say this is a neural network. And in fact, all of these, the community has sort of standardized this to be most of the time it's something like a ResNet-50. Okay, so what you want to do is you want to train a neural network like a ResNet-50 to give you a good representation of the image. So this would be like H and H is a vector. And H is a representation of this image and the representation should be such that you can then take this representation and solve many tasks with it, which either can be like linear, you can put a linear classifier on top of the H or you can fine tune the entire architecture to solve some other tasks. The idea is, if you have a large data set here, you may use this data set to train these good representations of these images. And then you can transfer this to a task where you might not have as much data. And because you don't have as much data, it's not enough to completely train an architecture like this. But it is enough to take an architecture that's been trained with the large data set and just adapt it to your small data set. And that usually, it tends to work pretty well. This is called transfer learning. This step here is called fine tuning, sometimes. And it's sort of the approach that comes from natural language processing from these big transformers like BERT, where you first train on a really big data set that might not be the data set that you want in the end, but it's really big. So you can sort of learn a lot of things from that data set. And then the only thing left to do is to fine tune it to basically adapt it to the nuances of your data set. But it will have learned most things already. And that's called representation learning. So the goal is to learn a good representation. Now the self supervised here is also important because representation learning can be as easy as if this here is ImageNet, the ImageNet data set contains like a million images all with labels, you can simply train your ResNet-50 to predict the class. This is the, this is called supervised pre-training or supervised representation learning. And that works pretty well, but you need a labeled data set. In self supervised learning, you do not need labels. What you do is you do self supervision. And self supervision, it has many, there are many ways to do self supervision. But what we'll see in this particular paper is that you will take an image and you'll make different variants of that same image. So you'll take the image and you'll make many, many variants of it. Well, let's just say two. So you have some procedure to sort of change the picture a little bit, but it's essentially still the same. And you do that through data augmentation. So this could be a random crop or you color jitter or you rotate it or something like this. And then you exploit the fact that you know that these two things, they should be still sort of the same image. So once you send them through your, through your encoder, the representations of the two images, they should be fairly close. Now let's actually read on right here. All relies on two neural networks referred to as online and target networks that interact and learn from each other. From an augmented view of an image, we train the online network to predict the target representation of the same image under a different augmented view. Okay, that's sort of what we saw. So we have, we have the same image under a different augmented view. So what does it mean? What what I just said, you make two versions of the same image. One that are slightly different, and then their representation should be close. Now, until this point, we have always thought that this would degenerate. Because what if you think of this neural network that does this encoding to the hidden space, this resnet 50, right here, if it wants to, if you simply want to make the two representations close, what's the best thing it can do, it can simply map all map the hidden, it can simply have the constant function h equals zero, or something like this, just a constant function, because then this loss here is always going to be zero, like perfect. Okay, so no matter what image comes in, if you always map it to the same thing, you will always be close in representation space. And therefore, you always win. That doesn't learn a really good representation, right? So what people have done is they have included so called negative samples, where you'll say, I'll take a different image from you know, from this data set, but it's a different image than this image. And I also do some maybe some data augmentation with that image. And then I send this through the same encoder to also give me an age. So this is the age, let's call that age original. This is age plus, because it's the same image, but slightly differently augmented. And this is age minus, which is a different image. And now the task is, let's make those two very similar to each other. But let's distance them from this other one. So we want we want this to be as far away as possible, and these two to be close to each other. Now the network can't simply map everything to a constant function anymore, right? It needs to actually do something to make these be close together and this be far apart. And the combination of this together with the augmentation procedure that goes into augmenting the images has been sort of a good combo to learn good representations. And a lot of papers have alluded to the fact that this is so the negative samples are to to not have these degeneracy, right? So to not have the simple solutions. But the fact that the representation then is actually good, like is good for image, image tasks down the line, probably comes from the fact of these augmentations right here. And there's a lot of evidence of from the fact that depending on which augmentations we choose, these representations are going to be better or worse. For example, random cropping of an image. So the random sub, like taking a random crop from the image tends to be very, very beneficial because, so here, this is the same image twice, right? Let's say we take a random crop here, and one up here, it's sort of maybe there's an overlap here in the middle, right? So it sort of needs to understand that these random crops sort of needs to communicate between these two places in these random crops. So the representation has to somehow make sure that the object that is overlapping here is somehow represented, but it can't represent it just as a pixel value, because it doesn't know where the crops come from. So there's a lot of evidence that these representations are the thing that's responsible for making the representation so good. Okay, now this paper simply says, do we really need these negative samples right here? Let's just get rid of them. And with a couple of tricks, this seems to work. And this is, this is what seems like magic to me. Because as we go forward, think of it, nothing, nothing keeps this model right here from doing the degenerate solution, H equals constant, nothing, right? Now, for some reason, it doesn't do that. And I have the feeling that this is a super delicate balance that you have to do. Because when you train when you start out, it's probably not the constant function, right? It's probably some, some distribution. And then simply by the fact that you train it and kind of keep it in the so this is certainly an optimal solution. But you might be like in some sort of local minimum, once you start training, and you simply don't get out of it during training. And that's why the network has an easier time step by step as it updates itself in very small incremental steps, it has an easier time actually going for the good representation, then it has to see this solution right here and converge to that. But yeah, it seems delicate. So what are they doing? They are taking that idea of taking an input image right here. And so by the way, why is it important that there are no negative samples? Because now the question is always, oh, where do you get these negative samples from? Right? Should they be uniformly sampled? Should we keep a buffer? Should we order them? There is this task of hard negative mining where you say, oh, any old negative won't do. And if we take negatives that are, you know, just hard enough, there is a curriculum learning problems and so on. So it'd be best to actually just get rid of these negative things. So that's why we want to get rid of them. So that's the approach. BYOL, Bootstrap Your Own Latent. There is the input image, we take one image at a time, and you apply two different random augmentations to it, right? So you create two slightly different variants of that image through augmentation. And again, this can be something like a random crop, it can be a horizontal flip randomly, you color jitter, you solarize, you blur, and so on. There are all these variants of data augmentation. And the fact that down the line, that the representation of these two things has to be close to each other, I think these random these augmentations here are responsible to make the these augmentations are responsible to make the representations powerful. Okay, the fact that later down the line, the network has to sort of learn to ignore these, it has to learn that, oh, you know, it doesn't matter where in the image this object is, because it's been random cropped for different, you know, at different locations. It doesn't matter where in the image this object is, I simply need to have my hidden representation have this particular object in the image. And that's what makes it powerful. Okay, I've said that enough now. Then you have these two slightly different versions, and then you map it through your encoder. Okay, let's go the top path first. You see the bottom path has the same encoder, but the parameters are different. And this is going to be one of the crucial elements right here. So this here are your actual parameters that you learn. And this here are what are called the target parameters. Now after each and you can see this for all of these components right here. So what happens is that the target parameters are basically a copy of these, what's what are called the online parameters. Okay, so after each step, you copy over from the online parameters, you copy over to the target parameters, you never learn the target parameters, you simply copy them after each step. Now you don't copy them outright, what you do is you do an exponential moving average. So the target parameters are always going to be sort of a lagging average of your online parameters. And the idea comes from the momentum contrast principle, where the reasoning sort of behind it is that you need a kind of a stable, you kind of need a stable representation as a target. But I think it hasn't been fully explored or explained why exactly that is so helpful. But we just know that if if we have the target to be not the same as the the online parameters, but actually a kind of a stable version of the past of the online parameters, then that tends to work well. Again, it's kind of the same principle as with the augmentations. With the augmentations, we have two different versions of the same image. And now with this procedure here, we sort of have two different versions of the same neural network, but they're slightly different, right? And this idea has been around for much longer, like the first Q deep Q networks and so on, they had the same principles where they had the the network that they actually learned and then the target network that is copied over every such and such episodes, and so on. So this, this seems to work, seems to be a fundamental principle that seems to work. Alright, so we take our two slightly different augmented versions of the same image, and we run them through our two slightly different encoders to obtain two representations. Now this thing right here, that's going to be our representer. So after this procedure, we discard the entire thing right here, except that. So this here is your whatever your ResNet-50. Okay, after that follows a projection. And the projection is, is here to reduce the dimensionality. And honestly, I'm actually not sure why it is here, because you can do it without like technically, the algorithm doesn't require this projection. So you can imagine the algorithm without the projection, but just really quickly, the projection simply brings down the representation, which is like 2048 dimensional that comes out of the ResNet-50. It has it is a two layer neural network that first pumps this up to like 4092, and then compresses it down to 256 dimensions. Okay, so that's the projection network. Again, there is a part that's learned, and then the target projector is simply the exponential moving average of the online projector. But again, this is why exactly this is here, probably simply because it works, right? But probably, because there is no there is no distinction, because you don't have different losses, you simply back propagate through everything and then train everything. So there is no logical distinction between the projection and the representation other than you have a different dimensionality. But maybe that's the point here that you make a different dimensionality, even though you could, you could do the rest in this 2048 space. Yeah, so for now, just this doesn't exist. Let's just say this doesn't exist. And we just work with this representation here. Let's call this z, z prime. Okay. So what happens is we take the representation, and now we have one neural network, the predictor right here, that takes the representation of one of the image versions. And it simply tries to predict the representation of the other image version. So what you want is that q of z equals z prime. Okay, and if we expand that is that q of f of z is equal to f target of z prime. And if we expand that even further, you can see that q, I'll just write q and f for now, q of f of a, which is an augmentation of z, should be one bracket, two bracket, three bracket, should be f of a of z, sorry, not z, that's the image x. All right, so this makes a lot of sense. You're simply with q, since these are all different here, so f is the target instead of the online parameters, a is also different, it's a different augmentation that you do, but the x is the same. Okay, so the q simply tries to somehow negate this augmentation. And this difference between the target and the online parameters, but you don't tell the q which augmentation was used, and you don't tell the q, what are the exact parameters of that network. So what the q has to do is it has to somehow, it's like, it's like, it has to take its best guess, right? So basically, the q is trained to output the expected value of the representation, right, the expected value of the representation f of a of x under all of the different possible image augmentations. And that's why it learns to ignore these augmentations. So your entire goal with these methods is you learn to ignore these augmentations. So you want to learn some method that is independent of the augmentations. So by crafting the augmentations in a smart way, we can make these representations contain a lot of semantic information. Because what we want to do with the augmentation is basically we want to destroy all the non semantic information, sorry, non semantic information. And random cropping is one of those methods. Horizontal flipping is one of those methods. Because we say, well, whether an image goes left to right or right to left, most of the time, the semantics are the same, the pixels are different, but the semantics are the same. So by putting an augmentation in there, we learn to ignore that augmentation, because our representation now needs to be predictable, right q need we learn q to predict the the representation under the expectation of our augmentations. And that means it can't be dependent on one particular augmentation, okay, learns to ignore it. So that's basically what's happening here. Again, there is nothing keeping this from simply collapsing it to a trivial solution. And it's probably a combination of the of the initialization and the learning procedure itself, that it, you know, goes on in little little steps, one by one, that keeps it in the realm of rather having to like, it's easier to learn a good representation than it is to collapse to that to that solution. Okay. So again, components is image, then you augment differently, then you run it through different encoders. But the encoders are similar in the fact that one is the exponential moving average of the other. And then you try to predict one from the other. And that ultimately makes the representation be independent of the augmentation. And that means that the representation can only include things that are not destroyed by the augmentations. And if you construct the augmentations smartly, that means you only retain the semantic information. That's it. So the loss function is pretty simple. As you can see right here, what you want is and this bar is a normalization, what you want is the L2 norm between the this representation be close to the queue of that representation. So the queue simply tries to predict the other representation. And you do that for both ways. So you want to stick the image in here and try to predict the other one. And you do it vice versa. So you get two loss components each time it's a symmetric loss. Okay. And that's it. That's the method. And they beat all the other self supervised methods and they get pretty close to the supervised representation learning method. As you can see right here, as the number of parameters goes up in their model, so one of them is ResNet 50, but I'm going to guess this one right here. But you can also get to higher architectures. And then it appears to work even better and come even closer to this supervised baseline. This could be because, you know, if you have more parameters, technically in a supervised method, you would also need more labeled images, maybe, and therefore it doesn't scale as well. I don't, I don't know. There is a lot of un-clarity in this research. Like, all they show is that their numbers are good, which is cool, right? And it's cool that you don't need your you don't need the negative samples anymore. And it actually doesn't collapse when you do that kind of stuff. But there's a lot of, I don't know, there's a lot of things here. For example, we use a batch size of 4096 split over 512 TPU v3 cores. With this setup, training takes approximately eight hours for ResNet 50. So they train eight hours on 512 TPUs. Just imagine that. So that's sort of crazy amount of computation again going into these models. And then the second thing here is that you can see that there are some things missing right here. And there are these all these annotations, which probably means that they take these numbers from those papers. Now, they allude to the fact that they try to follow their protocol as closely as possible. But I mean, that's never, that's never given, or almost never unless they release like the exact code, and even then, there are still going to be differences in even like you'd have to replicate the exact thing on the exact same number of TPU cores and whatnot. So I, I highly like these numbers seem to be I'm not sure, especially if you then go and look, and at some point, they actually do reproduce the SimClear baseline. So you can see right here that they have a own implementation of SimClear. And they actually compare this to the numbers that they find in the SimClear paper. And you can see, for example, here, there's like four percentage points that the that the their implementation of SimClear gains above this implementation. And if you look at this supervised baseline, that's also from that paper. And there is a graph further down, where they also implement their own version of the their own version of the supervised baseline, I've got here. So you can see that between the supervised in that paper and the supervised of them, sometimes there's like a giant gap right here for the same model, it seems. So all of these numbers, I'm, I'm not sure you should put too much weight on the fact that this is now outperforming the other methods, I would not put like, unless this is like super duper replicated very often, I would not put a lot of weight on the fact that it is better. What I would put a lot of weight on is the fact that it works at all and and achieves, you know, good performance. And there is more they make they have like experiments right here that show that their method, the BOL, the B Y O L is much more resistant to like changes in hyperparameters. So here you can see that it falls off much later when you reduce the batch size, which makes sense, right, because SIMCLEAR is one of these methods that uses negative samples. And for negative samples, it uses the other samples in the mini batch. Now if you have less samples in the mini batch, that means you have a less representative distribution of your entire data set as negative samples. And therefore, if you increase as decrease the mini batch, then this drops off. And also, they show that, for example, their method is much more robust to the removal of a couple of these image augmentations. So all of this, I find actually pretty cool. But the the actual numbers here, first, I'm not super duper interested that they get like a two or one points more in something. But they do perform like a lot of experiments. It shows that you can apply the method to different things. It's not only like in one setting. So that's pretty cool. It works at least, you can say it works at least as well as other methods. And it is a lot easier because you don't have this negative sample things. Now the last quarrel I have with the paper and where is it? Where is it? Somewhere they say that we release the code, they release the pseudo code. They don't release the code, they release the pseudo code in the appendix. So I mean, there are reasons why you sometimes want to release pseudo code. And that's if an algorithm is so high level and so simple in its high levelity and so modular to be fleshed out that you can't, like it makes more sense. But here it's like pseudo code in jacks. And come on. Is it really that competitively advantageous to retain your code? This is it's just not reproducible with this. You know that they have like 50 billion hacks in their code. And yeah, so DeepMind has this history of just not releasing like publishing behind paywalls and just giving pseudo code that has lots of mistakes in them like the mu0 pseudo code, you can't even like run it in its basic form if you fill in the things. It's a bit annoying. In any way, the method itself seems promising for representation learning, as I said, especially because it's pretty simple. It still heavily relies on these augmentation methods. So and that's what they say right here. Nevertheless, BYOL remains dependent on existing sets of augmentations that are specific to vision applications. To generalize BOL to other modalities, it is necessary to obtain similarly suitable augmentations for each of them. Designing such augmentations may require significant effort and expertise. Therefore automating the search for these augmentations would be an important next step to generalize BYOL to other modalities. And I'm not sure if you can do this automating the search for these augmentations. I guess you can do it if you have like a supervised data set, and then you can search and then you can use those augmentations for the unsupervised but it seems a bit bootstrap. No pun intended right here. I think the power of these representations again comes from the fact that we have these augmentations carefully constructed. So oh yes, the last thing, broader impact statement. Just read this, like try to estimate the perplexity of this broader impact statement. Let's go. The presented research should be categorized as research in the field of unsupervised learning. This work may inspire new algorithms, theoretical and experimental investigation. The algorithm presented here can be used for many different vision applications and a particular use may have both positive or negative impacts, which is known as the dual use problem. Besides as vision data sets could be biased, the representation learned by BYOL could be susceptible to replicate these biases. Like come on. So people who advocated for making everyone do this, is this what you wanted? Is this like, is this a satisfactory result for you? And if you have this as a reviewer, is this okay? Would not. I mean, let's just cross out some words here. Blank, let's like field, let's just put field or machine learning. Why not machine learning? This work inspire new algorithms, yes, the algorithm presented here can be used for many different machine learning applications and a particular use may have both negative, yes. Besides as data sets could be biased, the representation learned by this paper could be susceptible to replicate these biases. Well there is a copy paste thing that you can apparently put into any and all papers that you write from now on and hey, DeepMind is doing it. So you know, there you go. Okay maybe a bit cynical, but I'm like I told you this would happen. I told you and you know. Okay so that was it for my comments right here. They do have like a giant ton of experiments and I appreciate that right. They really try to show that it works in many different situations and yeah, yet to solve why this doesn't collapse, but apparently it doesn't. So try it out, give it a try and I'll see you next time. Bye bye.
[{"start": 0.0, "end": 6.04, "text": " Hello there, today we're looking at Bootstrap Your Own Latent, a new approach to self supervised"}, {"start": 6.04, "end": 11.18, "text": " learning by researchers of DeepMind and Imperial College."}, {"start": 11.18, "end": 18.44, "text": " So not almost no day goes by where we don't hear some sort of new self supervised algorithm"}, {"start": 18.44, "end": 19.52, "text": " right here."}, {"start": 19.52, "end": 25.5, "text": " This paper on a high level tries to get rid of the necessary negative samples when doing"}, {"start": 25.5, "end": 29.26, "text": " the contrastive loss for self supervised learning."}, {"start": 29.26, "end": 35.760000000000005, "text": " And they basically combine momentum contrast and SimClear and then remove the negative"}, {"start": 35.760000000000005, "end": 37.28, "text": " samples."}, {"start": 37.28, "end": 40.6, "text": " And that seems to work pretty well even though it's magic."}, {"start": 40.6, "end": 47.28, "text": " So yeah, if you if you want to see how it's done, stick around, share the video out if"}, {"start": 47.28, "end": 52.760000000000005, "text": " you want other people to see how it's done and leave a comment."}, {"start": 52.760000000000005, "end": 55.24, "text": " This one, I really don't get what's going on."}, {"start": 55.24, "end": 62.04, "text": " So if you have ideas, put them there, I'll read them through, it'll be fun."}, {"start": 62.04, "end": 69.84, "text": " Alright so they say we introduced Bootstrap Your Own Latent or BOL, a new approach to"}, {"start": 69.84, "end": 72.68, "text": " self supervised image representation learning."}, {"start": 72.68, "end": 80.1, "text": " Okay, so image representation learning is the simple task of taking an image and then"}, {"start": 80.1, "end": 83.32000000000001, "text": " feeding it through a function which is usually like a neural network."}, {"start": 83.32, "end": 86.03999999999999, "text": " Let's just say this is a neural network."}, {"start": 86.03999999999999, "end": 92.88, "text": " And in fact, all of these, the community has sort of standardized this to be most of the"}, {"start": 92.88, "end": 95.08, "text": " time it's something like a ResNet-50."}, {"start": 95.08, "end": 101.11999999999999, "text": " Okay, so what you want to do is you want to train a neural network like a ResNet-50 to"}, {"start": 101.11999999999999, "end": 104.11999999999999, "text": " give you a good representation of the image."}, {"start": 104.11999999999999, "end": 107.8, "text": " So this would be like H and H is a vector."}, {"start": 107.8, "end": 114.88, "text": " And H is a representation of this image and the representation should be such that you"}, {"start": 114.88, "end": 121.44, "text": " can then take this representation and solve many tasks with it, which either can be like"}, {"start": 121.44, "end": 127.75999999999999, "text": " linear, you can put a linear classifier on top of the H or you can fine tune the entire"}, {"start": 127.75999999999999, "end": 130.24, "text": " architecture to solve some other tasks."}, {"start": 130.24, "end": 137.16, "text": " The idea is, if you have a large data set here, you may use this data set to train these"}, {"start": 137.16, "end": 139.84, "text": " good representations of these images."}, {"start": 139.84, "end": 146.56, "text": " And then you can transfer this to a task where you might not have as much data."}, {"start": 146.56, "end": 151.12, "text": " And because you don't have as much data, it's not enough to completely train an architecture"}, {"start": 151.12, "end": 152.78, "text": " like this."}, {"start": 152.78, "end": 157.35999999999999, "text": " But it is enough to take an architecture that's been trained with the large data set and just"}, {"start": 157.35999999999999, "end": 159.92, "text": " adapt it to your small data set."}, {"start": 159.92, "end": 162.68, "text": " And that usually, it tends to work pretty well."}, {"start": 162.68, "end": 165.28, "text": " This is called transfer learning."}, {"start": 165.28, "end": 169.08, "text": " This step here is called fine tuning, sometimes."}, {"start": 169.08, "end": 175.32, "text": " And it's sort of the approach that comes from natural language processing from these big"}, {"start": 175.32, "end": 181.24, "text": " transformers like BERT, where you first train on a really big data set that might not be"}, {"start": 181.24, "end": 184.76, "text": " the data set that you want in the end, but it's really big."}, {"start": 184.76, "end": 188.58, "text": " So you can sort of learn a lot of things from that data set."}, {"start": 188.58, "end": 194.92000000000002, "text": " And then the only thing left to do is to fine tune it to basically adapt it to the nuances"}, {"start": 194.92, "end": 196.55999999999997, "text": " of your data set."}, {"start": 196.55999999999997, "end": 198.78, "text": " But it will have learned most things already."}, {"start": 198.78, "end": 200.55999999999997, "text": " And that's called representation learning."}, {"start": 200.55999999999997, "end": 204.76, "text": " So the goal is to learn a good representation."}, {"start": 204.76, "end": 211.54, "text": " Now the self supervised here is also important because representation learning can be as"}, {"start": 211.54, "end": 218.23999999999998, "text": " easy as if this here is ImageNet, the ImageNet data set contains like a million images all"}, {"start": 218.23999999999998, "end": 223.32, "text": " with labels, you can simply train your ResNet-50 to predict the class."}, {"start": 223.32, "end": 229.66, "text": " This is the, this is called supervised pre-training or supervised representation learning."}, {"start": 229.66, "end": 233.92, "text": " And that works pretty well, but you need a labeled data set."}, {"start": 233.92, "end": 237.48, "text": " In self supervised learning, you do not need labels."}, {"start": 237.48, "end": 240.35999999999999, "text": " What you do is you do self supervision."}, {"start": 240.35999999999999, "end": 245.48, "text": " And self supervision, it has many, there are many ways to do self supervision."}, {"start": 245.48, "end": 252.88, "text": " But what we'll see in this particular paper is that you will take an image and you'll"}, {"start": 252.88, "end": 256.32, "text": " make different variants of that same image."}, {"start": 256.32, "end": 261.88, "text": " So you'll take the image and you'll make many, many variants of it."}, {"start": 261.88, "end": 263.92, "text": " Well, let's just say two."}, {"start": 263.92, "end": 268.82, "text": " So you have some procedure to sort of change the picture a little bit, but it's essentially"}, {"start": 268.82, "end": 270.0, "text": " still the same."}, {"start": 270.0, "end": 272.46, "text": " And you do that through data augmentation."}, {"start": 272.46, "end": 278.64, "text": " So this could be a random crop or you color jitter or you rotate it or something like"}, {"start": 278.64, "end": 279.64, "text": " this."}, {"start": 279.64, "end": 285.12, "text": " And then you exploit the fact that you know that these two things, they should be still"}, {"start": 285.12, "end": 286.84, "text": " sort of the same image."}, {"start": 286.84, "end": 293.12, "text": " So once you send them through your, through your encoder, the representations of the two"}, {"start": 293.12, "end": 297.15999999999997, "text": " images, they should be fairly close."}, {"start": 297.15999999999997, "end": 306.24, "text": " Now let's actually read on right here."}, {"start": 306.24, "end": 310.84000000000003, "text": " All relies on two neural networks referred to as online and target networks that interact"}, {"start": 310.84000000000003, "end": 312.04, "text": " and learn from each other."}, {"start": 312.04, "end": 317.24, "text": " From an augmented view of an image, we train the online network to predict the target representation"}, {"start": 317.24, "end": 320.8, "text": " of the same image under a different augmented view."}, {"start": 320.8, "end": 323.12, "text": " Okay, that's sort of what we saw."}, {"start": 323.12, "end": 330.68, "text": " So we have, we have the same image under a different augmented view."}, {"start": 330.68, "end": 331.84000000000003, "text": " So what does it mean?"}, {"start": 331.84000000000003, "end": 335.28000000000003, "text": " What what I just said, you make two versions of the same image."}, {"start": 335.28, "end": 339.4, "text": " One that are slightly different, and then their representation should be close."}, {"start": 339.4, "end": 346.44, "text": " Now, until this point, we have always thought that this would degenerate."}, {"start": 346.44, "end": 352.52, "text": " Because what if you think of this neural network that does this encoding to the hidden space,"}, {"start": 352.52, "end": 358.64, "text": " this resnet 50, right here, if it wants to, if you simply want to make the two representations"}, {"start": 358.64, "end": 364.52, "text": " close, what's the best thing it can do, it can simply map all map the hidden, it can"}, {"start": 364.52, "end": 370.32, "text": " simply have the constant function h equals zero, or something like this, just a constant"}, {"start": 370.32, "end": 376.12, "text": " function, because then this loss here is always going to be zero, like perfect."}, {"start": 376.12, "end": 381.12, "text": " Okay, so no matter what image comes in, if you always map it to the same thing, you will"}, {"start": 381.12, "end": 384.15999999999997, "text": " always be close in representation space."}, {"start": 384.15999999999997, "end": 386.76, "text": " And therefore, you always win."}, {"start": 386.76, "end": 390.32, "text": " That doesn't learn a really good representation, right?"}, {"start": 390.32, "end": 398.8, "text": " So what people have done is they have included so called negative samples, where you'll say,"}, {"start": 398.8, "end": 404.18, "text": " I'll take a different image from you know, from this data set, but it's a different image"}, {"start": 404.18, "end": 405.98, "text": " than this image."}, {"start": 405.98, "end": 411.1, "text": " And I also do some maybe some data augmentation with that image."}, {"start": 411.1, "end": 415.62, "text": " And then I send this through the same encoder to also give me an age."}, {"start": 415.62, "end": 419.38, "text": " So this is the age, let's call that age original."}, {"start": 419.38, "end": 425.76, "text": " This is age plus, because it's the same image, but slightly differently augmented."}, {"start": 425.76, "end": 430.0, "text": " And this is age minus, which is a different image."}, {"start": 430.0, "end": 436.58, "text": " And now the task is, let's make those two very similar to each other."}, {"start": 436.58, "end": 440.15999999999997, "text": " But let's distance them from this other one."}, {"start": 440.15999999999997, "end": 445.8, "text": " So we want we want this to be as far away as possible, and these two to be close to"}, {"start": 445.8, "end": 447.58, "text": " each other."}, {"start": 447.58, "end": 452.4, "text": " Now the network can't simply map everything to a constant function anymore, right?"}, {"start": 452.4, "end": 460.28, "text": " It needs to actually do something to make these be close together and this be far apart."}, {"start": 460.28, "end": 465.52, "text": " And the combination of this together with the augmentation procedure that goes into"}, {"start": 465.52, "end": 472.12, "text": " augmenting the images has been sort of a good combo to learn good representations."}, {"start": 472.12, "end": 478.92, "text": " And a lot of papers have alluded to the fact that this is so the negative samples are to"}, {"start": 478.92, "end": 481.18, "text": " to not have these degeneracy, right?"}, {"start": 481.18, "end": 483.66, "text": " So to not have the simple solutions."}, {"start": 483.66, "end": 490.96, "text": " But the fact that the representation then is actually good, like is good for image,"}, {"start": 490.96, "end": 495.92, "text": " image tasks down the line, probably comes from the fact of these augmentations right"}, {"start": 495.92, "end": 496.92, "text": " here."}, {"start": 496.92, "end": 501.84000000000003, "text": " And there's a lot of evidence of from the fact that depending on which augmentations"}, {"start": 501.84000000000003, "end": 506.82, "text": " we choose, these representations are going to be better or worse."}, {"start": 506.82, "end": 509.62, "text": " For example, random cropping of an image."}, {"start": 509.62, "end": 520.08, "text": " So the random sub, like taking a random crop from the image tends to be very, very beneficial"}, {"start": 520.08, "end": 523.96, "text": " because, so here, this is the same image twice, right?"}, {"start": 523.96, "end": 529.7800000000001, "text": " Let's say we take a random crop here, and one up here, it's sort of maybe there's an"}, {"start": 529.7800000000001, "end": 532.24, "text": " overlap here in the middle, right?"}, {"start": 532.24, "end": 540.6600000000001, "text": " So it sort of needs to understand that these random crops sort of needs to communicate"}, {"start": 540.6600000000001, "end": 542.74, "text": " between these two places in these random crops."}, {"start": 542.74, "end": 549.86, "text": " So the representation has to somehow make sure that the object that is overlapping here"}, {"start": 549.86, "end": 555.6800000000001, "text": " is somehow represented, but it can't represent it just as a pixel value, because it doesn't"}, {"start": 555.6800000000001, "end": 558.12, "text": " know where the crops come from."}, {"start": 558.12, "end": 564.44, "text": " So there's a lot of evidence that these representations are the thing that's responsible for making"}, {"start": 564.44, "end": 567.6800000000001, "text": " the representation so good."}, {"start": 567.6800000000001, "end": 575.88, "text": " Okay, now this paper simply says, do we really need these negative samples right here?"}, {"start": 575.88, "end": 578.1800000000001, "text": " Let's just get rid of them."}, {"start": 578.18, "end": 582.04, "text": " And with a couple of tricks, this seems to work."}, {"start": 582.04, "end": 586.78, "text": " And this is, this is what seems like magic to me."}, {"start": 586.78, "end": 595.9399999999999, "text": " Because as we go forward, think of it, nothing, nothing keeps this model right here from doing"}, {"start": 595.9399999999999, "end": 601.9399999999999, "text": " the degenerate solution, H equals constant, nothing, right?"}, {"start": 601.9399999999999, "end": 605.4799999999999, "text": " Now, for some reason, it doesn't do that."}, {"start": 605.48, "end": 610.02, "text": " And I have the feeling that this is a super delicate balance that you have to do."}, {"start": 610.02, "end": 614.4200000000001, "text": " Because when you train when you start out, it's probably not the constant function, right?"}, {"start": 614.4200000000001, "end": 617.4, "text": " It's probably some, some distribution."}, {"start": 617.4, "end": 623.14, "text": " And then simply by the fact that you train it and kind of keep it in the so this is certainly"}, {"start": 623.14, "end": 625.0600000000001, "text": " an optimal solution."}, {"start": 625.0600000000001, "end": 632.1, "text": " But you might be like in some sort of local minimum, once you start training, and you"}, {"start": 632.1, "end": 634.5, "text": " simply don't get out of it during training."}, {"start": 634.5, "end": 641.26, "text": " And that's why the network has an easier time step by step as it updates itself in very"}, {"start": 641.26, "end": 647.34, "text": " small incremental steps, it has an easier time actually going for the good representation,"}, {"start": 647.34, "end": 652.46, "text": " then it has to see this solution right here and converge to that."}, {"start": 652.46, "end": 655.52, "text": " But yeah, it seems delicate."}, {"start": 655.52, "end": 657.9, "text": " So what are they doing?"}, {"start": 657.9, "end": 665.06, "text": " They are taking that idea of taking an input image right here."}, {"start": 665.06, "end": 668.78, "text": " And so by the way, why is it important that there are no negative samples?"}, {"start": 668.78, "end": 673.02, "text": " Because now the question is always, oh, where do you get these negative samples from?"}, {"start": 673.02, "end": 674.02, "text": " Right?"}, {"start": 674.02, "end": 676.36, "text": " Should they be uniformly sampled?"}, {"start": 676.36, "end": 677.4, "text": " Should we keep a buffer?"}, {"start": 677.4, "end": 678.64, "text": " Should we order them?"}, {"start": 678.64, "end": 683.26, "text": " There is this task of hard negative mining where you say, oh, any old negative won't"}, {"start": 683.26, "end": 684.26, "text": " do."}, {"start": 684.26, "end": 690.78, "text": " And if we take negatives that are, you know, just hard enough, there is a curriculum learning"}, {"start": 690.78, "end": 692.06, "text": " problems and so on."}, {"start": 692.06, "end": 697.7, "text": " So it'd be best to actually just get rid of these negative things."}, {"start": 697.7, "end": 699.3, "text": " So that's why we want to get rid of them."}, {"start": 699.3, "end": 701.14, "text": " So that's the approach."}, {"start": 701.14, "end": 705.22, "text": " BYOL, Bootstrap Your Own Latent."}, {"start": 705.22, "end": 712.02, "text": " There is the input image, we take one image at a time, and you apply two different random"}, {"start": 712.02, "end": 714.12, "text": " augmentations to it, right?"}, {"start": 714.12, "end": 720.58, "text": " So you create two slightly different variants of that image through augmentation."}, {"start": 720.58, "end": 726.1, "text": " And again, this can be something like a random crop, it can be a horizontal flip randomly,"}, {"start": 726.1, "end": 729.82, "text": " you color jitter, you solarize, you blur, and so on."}, {"start": 729.82, "end": 734.42, "text": " There are all these variants of data augmentation."}, {"start": 734.42, "end": 742.34, "text": " And the fact that down the line, that the representation of these two things has to"}, {"start": 742.34, "end": 751.0600000000001, "text": " be close to each other, I think these random these augmentations here are responsible to"}, {"start": 751.0600000000001, "end": 756.9, "text": " make the these augmentations are responsible to make the representations powerful."}, {"start": 756.9, "end": 762.62, "text": " Okay, the fact that later down the line, the network has to sort of learn to ignore these,"}, {"start": 762.62, "end": 768.36, "text": " it has to learn that, oh, you know, it doesn't matter where in the image this object is,"}, {"start": 768.36, "end": 774.02, "text": " because it's been random cropped for different, you know, at different locations."}, {"start": 774.02, "end": 778.08, "text": " It doesn't matter where in the image this object is, I simply need to have my hidden"}, {"start": 778.08, "end": 782.5, "text": " representation have this particular object in the image."}, {"start": 782.5, "end": 783.9, "text": " And that's what makes it powerful."}, {"start": 783.9, "end": 786.98, "text": " Okay, I've said that enough now."}, {"start": 786.98, "end": 791.58, "text": " Then you have these two slightly different versions, and then you map it through your"}, {"start": 791.58, "end": 792.58, "text": " encoder."}, {"start": 792.58, "end": 795.26, "text": " Okay, let's go the top path first."}, {"start": 795.26, "end": 800.1, "text": " You see the bottom path has the same encoder, but the parameters are different."}, {"start": 800.1, "end": 803.46, "text": " And this is going to be one of the crucial elements right here."}, {"start": 803.46, "end": 808.42, "text": " So this here are your actual parameters that you learn."}, {"start": 808.42, "end": 812.2, "text": " And this here are what are called the target parameters."}, {"start": 812.2, "end": 817.9, "text": " Now after each and you can see this for all of these components right here."}, {"start": 817.9, "end": 823.54, "text": " So what happens is that the target parameters are basically a copy of these, what's what"}, {"start": 823.54, "end": 825.62, "text": " are called the online parameters."}, {"start": 825.62, "end": 832.18, "text": " Okay, so after each step, you copy over from the online parameters, you copy over to the"}, {"start": 832.18, "end": 837.3, "text": " target parameters, you never learn the target parameters, you simply copy them after each"}, {"start": 837.3, "end": 838.56, "text": " step."}, {"start": 838.56, "end": 844.26, "text": " Now you don't copy them outright, what you do is you do an exponential moving average."}, {"start": 844.26, "end": 850.78, "text": " So the target parameters are always going to be sort of a lagging average of your online"}, {"start": 850.78, "end": 851.78, "text": " parameters."}, {"start": 851.78, "end": 858.9, "text": " And the idea comes from the momentum contrast principle, where the reasoning sort of behind"}, {"start": 858.9, "end": 866.18, "text": " it is that you need a kind of a stable, you kind of need a stable representation as a"}, {"start": 866.18, "end": 867.3, "text": " target."}, {"start": 867.3, "end": 875.42, "text": " But I think it hasn't been fully explored or explained why exactly that is so helpful."}, {"start": 875.42, "end": 883.74, "text": " But we just know that if if we have the target to be not the same as the the online parameters,"}, {"start": 883.74, "end": 889.9799999999999, "text": " but actually a kind of a stable version of the past of the online parameters, then that"}, {"start": 889.9799999999999, "end": 891.54, "text": " tends to work well."}, {"start": 891.54, "end": 895.18, "text": " Again, it's kind of the same principle as with the augmentations."}, {"start": 895.18, "end": 899.38, "text": " With the augmentations, we have two different versions of the same image."}, {"start": 899.38, "end": 904.8399999999999, "text": " And now with this procedure here, we sort of have two different versions of the same"}, {"start": 904.84, "end": 908.7800000000001, "text": " neural network, but they're slightly different, right?"}, {"start": 908.7800000000001, "end": 916.84, "text": " And this idea has been around for much longer, like the first Q deep Q networks and so on,"}, {"start": 916.84, "end": 921.86, "text": " they had the same principles where they had the the network that they actually learned"}, {"start": 921.86, "end": 926.34, "text": " and then the target network that is copied over every such and such episodes, and so"}, {"start": 926.34, "end": 927.34, "text": " on."}, {"start": 927.34, "end": 933.22, "text": " So this, this seems to work, seems to be a fundamental principle that seems to work."}, {"start": 933.22, "end": 941.1, "text": " Alright, so we take our two slightly different augmented versions of the same image, and"}, {"start": 941.1, "end": 948.82, "text": " we run them through our two slightly different encoders to obtain two representations."}, {"start": 948.82, "end": 952.82, "text": " Now this thing right here, that's going to be our representer."}, {"start": 952.82, "end": 960.0400000000001, "text": " So after this procedure, we discard the entire thing right here, except that."}, {"start": 960.04, "end": 963.5, "text": " So this here is your whatever your ResNet-50."}, {"start": 963.5, "end": 967.3399999999999, "text": " Okay, after that follows a projection."}, {"start": 967.3399999999999, "end": 973.02, "text": " And the projection is, is here to reduce the dimensionality."}, {"start": 973.02, "end": 980.8, "text": " And honestly, I'm actually not sure why it is here, because you can do it without like"}, {"start": 980.8, "end": 984.06, "text": " technically, the algorithm doesn't require this projection."}, {"start": 984.06, "end": 989.8199999999999, "text": " So you can imagine the algorithm without the projection, but just really quickly, the"}, {"start": 989.82, "end": 997.3000000000001, "text": " projection simply brings down the representation, which is like 2048 dimensional that comes"}, {"start": 997.3000000000001, "end": 999.1, "text": " out of the ResNet-50."}, {"start": 999.1, "end": 1006.5400000000001, "text": " It has it is a two layer neural network that first pumps this up to like 4092, and then"}, {"start": 1006.5400000000001, "end": 1010.7, "text": " compresses it down to 256 dimensions."}, {"start": 1010.7, "end": 1013.98, "text": " Okay, so that's the projection network."}, {"start": 1013.98, "end": 1019.0200000000001, "text": " Again, there is a part that's learned, and then the target projector is simply the exponential"}, {"start": 1019.02, "end": 1022.26, "text": " moving average of the online projector."}, {"start": 1022.26, "end": 1032.62, "text": " But again, this is why exactly this is here, probably simply because it works, right?"}, {"start": 1032.62, "end": 1037.82, "text": " But probably, because there is no there is no distinction, because you don't have different"}, {"start": 1037.82, "end": 1041.68, "text": " losses, you simply back propagate through everything and then train everything."}, {"start": 1041.68, "end": 1046.44, "text": " So there is no logical distinction between the projection and the representation other"}, {"start": 1046.44, "end": 1049.74, "text": " than you have a different dimensionality."}, {"start": 1049.74, "end": 1053.94, "text": " But maybe that's the point here that you make a different dimensionality, even though you"}, {"start": 1053.94, "end": 1059.5800000000002, "text": " could, you could do the rest in this 2048 space."}, {"start": 1059.5800000000002, "end": 1063.6200000000001, "text": " Yeah, so for now, just this doesn't exist."}, {"start": 1063.6200000000001, "end": 1065.44, "text": " Let's just say this doesn't exist."}, {"start": 1065.44, "end": 1068.42, "text": " And we just work with this representation here."}, {"start": 1068.42, "end": 1070.94, "text": " Let's call this z, z prime."}, {"start": 1070.94, "end": 1071.94, "text": " Okay."}, {"start": 1071.94, "end": 1079.26, "text": " So what happens is we take the representation, and now we have one neural network, the predictor"}, {"start": 1079.26, "end": 1087.3, "text": " right here, that takes the representation of one of the image versions."}, {"start": 1087.3, "end": 1091.6200000000001, "text": " And it simply tries to predict the representation of the other image version."}, {"start": 1091.6200000000001, "end": 1098.74, "text": " So what you want is that q of z equals z prime."}, {"start": 1098.74, "end": 1112.78, "text": " Okay, and if we expand that is that q of f of z is equal to f target of z prime."}, {"start": 1112.78, "end": 1121.98, "text": " And if we expand that even further, you can see that q, I'll just write q and f for now,"}, {"start": 1121.98, "end": 1133.78, "text": " q of f of a, which is an augmentation of z, should be one bracket, two bracket, three"}, {"start": 1133.78, "end": 1142.6200000000001, "text": " bracket, should be f of a of z, sorry, not z, that's the image x."}, {"start": 1142.6200000000001, "end": 1149.74, "text": " All right, so this makes a lot of sense."}, {"start": 1149.74, "end": 1156.06, "text": " You're simply with q, since these are all different here, so f is the target instead"}, {"start": 1156.06, "end": 1162.32, "text": " of the online parameters, a is also different, it's a different augmentation that you do,"}, {"start": 1162.32, "end": 1163.98, "text": " but the x is the same."}, {"start": 1163.98, "end": 1171.18, "text": " Okay, so the q simply tries to somehow negate this augmentation."}, {"start": 1171.18, "end": 1176.22, "text": " And this difference between the target and the online parameters, but you don't tell"}, {"start": 1176.22, "end": 1183.14, "text": " the q which augmentation was used, and you don't tell the q, what are the exact parameters"}, {"start": 1183.14, "end": 1184.78, "text": " of that network."}, {"start": 1184.78, "end": 1193.14, "text": " So what the q has to do is it has to somehow, it's like, it's like, it has to take its best"}, {"start": 1193.14, "end": 1194.38, "text": " guess, right?"}, {"start": 1194.38, "end": 1202.46, "text": " So basically, the q is trained to output the expected value of the representation, right,"}, {"start": 1202.46, "end": 1214.74, "text": " the expected value of the representation f of a of x under all of the different possible"}, {"start": 1214.74, "end": 1218.74, "text": " image augmentations."}, {"start": 1218.74, "end": 1222.3400000000001, "text": " And that's why it learns to ignore these augmentations."}, {"start": 1222.3400000000001, "end": 1227.8600000000001, "text": " So your entire goal with these methods is you learn to ignore these augmentations."}, {"start": 1227.86, "end": 1232.74, "text": " So you want to learn some method that is independent of the augmentations."}, {"start": 1232.74, "end": 1239.1599999999999, "text": " So by crafting the augmentations in a smart way, we can make these representations contain"}, {"start": 1239.1599999999999, "end": 1241.56, "text": " a lot of semantic information."}, {"start": 1241.56, "end": 1245.78, "text": " Because what we want to do with the augmentation is basically we want to destroy all the non"}, {"start": 1245.78, "end": 1249.74, "text": " semantic information, sorry, non semantic information."}, {"start": 1249.74, "end": 1253.1, "text": " And random cropping is one of those methods."}, {"start": 1253.1, "end": 1254.9799999999998, "text": " Horizontal flipping is one of those methods."}, {"start": 1254.98, "end": 1259.46, "text": " Because we say, well, whether an image goes left to right or right to left, most of the"}, {"start": 1259.46, "end": 1264.6200000000001, "text": " time, the semantics are the same, the pixels are different, but the semantics are the same."}, {"start": 1264.6200000000001, "end": 1271.18, "text": " So by putting an augmentation in there, we learn to ignore that augmentation, because"}, {"start": 1271.18, "end": 1281.06, "text": " our representation now needs to be predictable, right q need we learn q to predict the the"}, {"start": 1281.06, "end": 1286.06, "text": " representation under the expectation of our augmentations."}, {"start": 1286.06, "end": 1292.1799999999998, "text": " And that means it can't be dependent on one particular augmentation, okay, learns to ignore"}, {"start": 1292.1799999999998, "end": 1293.36, "text": " it."}, {"start": 1293.36, "end": 1297.54, "text": " So that's basically what's happening here."}, {"start": 1297.54, "end": 1303.76, "text": " Again, there is nothing keeping this from simply collapsing it to a trivial solution."}, {"start": 1303.76, "end": 1311.06, "text": " And it's probably a combination of the of the initialization and the learning procedure"}, {"start": 1311.06, "end": 1316.18, "text": " itself, that it, you know, goes on in little little steps, one by one, that keeps it in"}, {"start": 1316.18, "end": 1321.7, "text": " the realm of rather having to like, it's easier to learn a good representation than it is"}, {"start": 1321.7, "end": 1325.58, "text": " to collapse to that to that solution."}, {"start": 1325.58, "end": 1327.42, "text": " Okay."}, {"start": 1327.42, "end": 1334.2, "text": " So again, components is image, then you augment differently, then you run it through different"}, {"start": 1334.2, "end": 1335.2, "text": " encoders."}, {"start": 1335.2, "end": 1339.26, "text": " But the encoders are similar in the fact that one is the exponential moving average of the"}, {"start": 1339.26, "end": 1340.26, "text": " other."}, {"start": 1340.26, "end": 1345.5800000000002, "text": " And then you try to predict one from the other."}, {"start": 1345.5800000000002, "end": 1351.5, "text": " And that ultimately makes the representation be independent of the augmentation."}, {"start": 1351.5, "end": 1356.26, "text": " And that means that the representation can only include things that are not destroyed"}, {"start": 1356.26, "end": 1358.18, "text": " by the augmentations."}, {"start": 1358.18, "end": 1366.54, "text": " And if you construct the augmentations smartly, that means you only retain the semantic information."}, {"start": 1366.54, "end": 1367.54, "text": " That's it."}, {"start": 1367.54, "end": 1368.98, "text": " So the loss function is pretty simple."}, {"start": 1368.98, "end": 1374.7, "text": " As you can see right here, what you want is and this bar is a normalization, what you"}, {"start": 1374.7, "end": 1383.66, "text": " want is the L2 norm between the this representation be close to the queue of that representation."}, {"start": 1383.66, "end": 1388.3400000000001, "text": " So the queue simply tries to predict the other representation."}, {"start": 1388.3400000000001, "end": 1389.68, "text": " And you do that for both ways."}, {"start": 1389.68, "end": 1395.3000000000002, "text": " So you want to stick the image in here and try to predict the other one."}, {"start": 1395.3000000000002, "end": 1396.68, "text": " And you do it vice versa."}, {"start": 1396.68, "end": 1400.8200000000002, "text": " So you get two loss components each time it's a symmetric loss."}, {"start": 1400.8200000000002, "end": 1402.1000000000001, "text": " Okay."}, {"start": 1402.1000000000001, "end": 1403.1000000000001, "text": " And that's it."}, {"start": 1403.1000000000001, "end": 1404.3000000000002, "text": " That's the method."}, {"start": 1404.3000000000002, "end": 1411.98, "text": " And they beat all the other self supervised methods and they get pretty close to the supervised"}, {"start": 1411.98, "end": 1414.8, "text": " representation learning method."}, {"start": 1414.8, "end": 1419.8, "text": " As you can see right here, as the number of parameters goes up in their model, so one"}, {"start": 1419.8, "end": 1423.82, "text": " of them is ResNet 50, but I'm going to guess this one right here."}, {"start": 1423.82, "end": 1427.26, "text": " But you can also get to higher architectures."}, {"start": 1427.26, "end": 1433.5, "text": " And then it appears to work even better and come even closer to this supervised baseline."}, {"start": 1433.5, "end": 1438.5, "text": " This could be because, you know, if you have more parameters, technically in a supervised"}, {"start": 1438.5, "end": 1444.18, "text": " method, you would also need more labeled images, maybe, and therefore it doesn't scale as well."}, {"start": 1444.18, "end": 1446.14, "text": " I don't, I don't know."}, {"start": 1446.14, "end": 1449.46, "text": " There is a lot of un-clarity in this research."}, {"start": 1449.46, "end": 1454.02, "text": " Like, all they show is that their numbers are good, which is cool, right?"}, {"start": 1454.02, "end": 1458.14, "text": " And it's cool that you don't need your you don't need the negative samples anymore."}, {"start": 1458.14, "end": 1462.7, "text": " And it actually doesn't collapse when you do that kind of stuff."}, {"start": 1462.7, "end": 1468.26, "text": " But there's a lot of, I don't know, there's a lot of things here."}, {"start": 1468.26, "end": 1479.62, "text": " For example, we use a batch size of 4096 split over 512 TPU v3 cores."}, {"start": 1479.62, "end": 1483.54, "text": " With this setup, training takes approximately eight hours for ResNet 50."}, {"start": 1483.54, "end": 1489.68, "text": " So they train eight hours on 512 TPUs."}, {"start": 1489.68, "end": 1492.04, "text": " Just imagine that."}, {"start": 1492.04, "end": 1497.54, "text": " So that's sort of crazy amount of computation again going into these models."}, {"start": 1497.54, "end": 1501.48, "text": " And then the second thing here is that you can see that there are some things missing"}, {"start": 1501.48, "end": 1502.48, "text": " right here."}, {"start": 1502.48, "end": 1506.54, "text": " And there are these all these annotations, which probably means that they take these"}, {"start": 1506.54, "end": 1509.42, "text": " numbers from those papers."}, {"start": 1509.42, "end": 1518.18, "text": " Now, they allude to the fact that they try to follow their protocol as closely as possible."}, {"start": 1518.18, "end": 1524.1399999999999, "text": " But I mean, that's never, that's never given, or almost never unless they release like the"}, {"start": 1524.14, "end": 1532.0200000000002, "text": " exact code, and even then, there are still going to be differences in even like you'd"}, {"start": 1532.0200000000002, "end": 1539.5800000000002, "text": " have to replicate the exact thing on the exact same number of TPU cores and whatnot."}, {"start": 1539.5800000000002, "end": 1548.5, "text": " So I, I highly like these numbers seem to be I'm not sure, especially if you then go"}, {"start": 1548.5, "end": 1555.76, "text": " and look, and at some point, they actually do reproduce the SimClear baseline."}, {"start": 1555.76, "end": 1561.14, "text": " So you can see right here that they have a own implementation of SimClear."}, {"start": 1561.14, "end": 1566.1, "text": " And they actually compare this to the numbers that they find in the SimClear paper."}, {"start": 1566.1, "end": 1571.78, "text": " And you can see, for example, here, there's like four percentage points that the that"}, {"start": 1571.78, "end": 1577.54, "text": " the their implementation of SimClear gains above this implementation."}, {"start": 1577.54, "end": 1582.6599999999999, "text": " And if you look at this supervised baseline, that's also from that paper."}, {"start": 1582.6599999999999, "end": 1591.06, "text": " And there is a graph further down, where they also implement their own version of the their"}, {"start": 1591.06, "end": 1595.68, "text": " own version of the supervised baseline, I've got here."}, {"start": 1595.68, "end": 1602.58, "text": " So you can see that between the supervised in that paper and the supervised of them,"}, {"start": 1602.58, "end": 1608.46, "text": " sometimes there's like a giant gap right here for the same model, it seems."}, {"start": 1608.46, "end": 1615.34, "text": " So all of these numbers, I'm, I'm not sure you should put too much weight on the fact"}, {"start": 1615.34, "end": 1622.6799999999998, "text": " that this is now outperforming the other methods, I would not put like, unless this is like"}, {"start": 1622.6799999999998, "end": 1628.1799999999998, "text": " super duper replicated very often, I would not put a lot of weight on the fact that it"}, {"start": 1628.1799999999998, "end": 1629.22, "text": " is better."}, {"start": 1629.22, "end": 1635.18, "text": " What I would put a lot of weight on is the fact that it works at all and and achieves,"}, {"start": 1635.18, "end": 1637.38, "text": " you know, good performance."}, {"start": 1637.38, "end": 1642.54, "text": " And there is more they make they have like experiments right here that show that their"}, {"start": 1642.54, "end": 1650.66, "text": " method, the BOL, the B Y O L is much more resistant to like changes in hyperparameters."}, {"start": 1650.66, "end": 1657.38, "text": " So here you can see that it falls off much later when you reduce the batch size, which"}, {"start": 1657.38, "end": 1662.1000000000001, "text": " makes sense, right, because SIMCLEAR is one of these methods that uses negative samples."}, {"start": 1662.1000000000001, "end": 1666.38, "text": " And for negative samples, it uses the other samples in the mini batch."}, {"start": 1666.38, "end": 1671.5400000000002, "text": " Now if you have less samples in the mini batch, that means you have a less representative"}, {"start": 1671.5400000000002, "end": 1675.42, "text": " distribution of your entire data set as negative samples."}, {"start": 1675.42, "end": 1680.8600000000001, "text": " And therefore, if you increase as decrease the mini batch, then this drops off."}, {"start": 1680.86, "end": 1687.54, "text": " And also, they show that, for example, their method is much more robust to the removal"}, {"start": 1687.54, "end": 1692.1799999999998, "text": " of a couple of these image augmentations."}, {"start": 1692.1799999999998, "end": 1695.78, "text": " So all of this, I find actually pretty cool."}, {"start": 1695.78, "end": 1702.3999999999999, "text": " But the the actual numbers here, first, I'm not super duper interested that they get like"}, {"start": 1702.3999999999999, "end": 1706.54, "text": " a two or one points more in something."}, {"start": 1706.54, "end": 1711.78, "text": " But they do perform like a lot of experiments."}, {"start": 1711.78, "end": 1716.06, "text": " It shows that you can apply the method to different things."}, {"start": 1716.06, "end": 1717.74, "text": " It's not only like in one setting."}, {"start": 1717.74, "end": 1718.74, "text": " So that's pretty cool."}, {"start": 1718.74, "end": 1725.12, "text": " It works at least, you can say it works at least as well as other methods."}, {"start": 1725.12, "end": 1730.76, "text": " And it is a lot easier because you don't have this negative sample things."}, {"start": 1730.76, "end": 1737.3799999999999, "text": " Now the last quarrel I have with the paper and where is it?"}, {"start": 1737.3799999999999, "end": 1740.74, "text": " Where is it?"}, {"start": 1740.74, "end": 1749.14, "text": " Somewhere they say that we release the code, they release the pseudo code."}, {"start": 1749.14, "end": 1753.0, "text": " They don't release the code, they release the pseudo code in the appendix."}, {"start": 1753.0, "end": 1759.5, "text": " So I mean, there are reasons why you sometimes want to release pseudo code."}, {"start": 1759.5, "end": 1765.38, "text": " And that's if an algorithm is so high level and so simple in its high levelity and so"}, {"start": 1765.38, "end": 1772.86, "text": " modular to be fleshed out that you can't, like it makes more sense."}, {"start": 1772.86, "end": 1776.58, "text": " But here it's like pseudo code in jacks."}, {"start": 1776.58, "end": 1780.14, "text": " And come on."}, {"start": 1780.14, "end": 1785.82, "text": " Is it really that competitively advantageous to retain your code?"}, {"start": 1785.82, "end": 1788.32, "text": " This is it's just not reproducible with this."}, {"start": 1788.32, "end": 1792.1799999999998, "text": " You know that they have like 50 billion hacks in their code."}, {"start": 1792.1799999999998, "end": 1798.1599999999999, "text": " And yeah, so DeepMind has this history of just not releasing like publishing behind"}, {"start": 1798.1599999999999, "end": 1804.8999999999999, "text": " paywalls and just giving pseudo code that has lots of mistakes in them like the mu0"}, {"start": 1804.8999999999999, "end": 1811.12, "text": " pseudo code, you can't even like run it in its basic form if you fill in the things."}, {"start": 1811.12, "end": 1814.02, "text": " It's a bit annoying."}, {"start": 1814.02, "end": 1820.3, "text": " In any way, the method itself seems promising for representation learning, as I said, especially"}, {"start": 1820.3, "end": 1822.58, "text": " because it's pretty simple."}, {"start": 1822.58, "end": 1826.22, "text": " It still heavily relies on these augmentation methods."}, {"start": 1826.22, "end": 1828.66, "text": " So and that's what they say right here."}, {"start": 1828.66, "end": 1834.48, "text": " Nevertheless, BYOL remains dependent on existing sets of augmentations that are specific to"}, {"start": 1834.48, "end": 1836.1, "text": " vision applications."}, {"start": 1836.1, "end": 1842.5, "text": " To generalize BOL to other modalities, it is necessary to obtain similarly suitable"}, {"start": 1842.5, "end": 1844.98, "text": " augmentations for each of them."}, {"start": 1844.98, "end": 1849.34, "text": " Designing such augmentations may require significant effort and expertise."}, {"start": 1849.34, "end": 1852.14, "text": " Therefore automating the search for these augmentations would be an important next step"}, {"start": 1852.14, "end": 1855.7, "text": " to generalize BYOL to other modalities."}, {"start": 1855.7, "end": 1860.9, "text": " And I'm not sure if you can do this automating the search for these augmentations."}, {"start": 1860.9, "end": 1865.54, "text": " I guess you can do it if you have like a supervised data set, and then you can search and then"}, {"start": 1865.54, "end": 1870.06, "text": " you can use those augmentations for the unsupervised but it seems a bit bootstrap."}, {"start": 1870.06, "end": 1871.9, "text": " No pun intended right here."}, {"start": 1871.9, "end": 1879.1000000000001, "text": " I think the power of these representations again comes from the fact that we have these"}, {"start": 1879.1000000000001, "end": 1884.1000000000001, "text": " augmentations carefully constructed."}, {"start": 1884.1000000000001, "end": 1887.6000000000001, "text": " So oh yes, the last thing, broader impact statement."}, {"start": 1887.6000000000001, "end": 1893.26, "text": " Just read this, like try to estimate the perplexity of this broader impact statement."}, {"start": 1893.26, "end": 1894.38, "text": " Let's go."}, {"start": 1894.38, "end": 1901.1000000000001, "text": " The presented research should be categorized as research in the field of unsupervised learning."}, {"start": 1901.1, "end": 1907.08, "text": " This work may inspire new algorithms, theoretical and experimental investigation."}, {"start": 1907.08, "end": 1913.3799999999999, "text": " The algorithm presented here can be used for many different vision applications and a particular"}, {"start": 1913.3799999999999, "end": 1920.26, "text": " use may have both positive or negative impacts, which is known as the dual use problem."}, {"start": 1920.26, "end": 1926.58, "text": " Besides as vision data sets could be biased, the representation learned by BYOL could be"}, {"start": 1926.58, "end": 1930.4199999999998, "text": " susceptible to replicate these biases."}, {"start": 1930.42, "end": 1932.14, "text": " Like come on."}, {"start": 1932.14, "end": 1936.7, "text": " So people who advocated for making everyone do this, is this what you wanted?"}, {"start": 1936.7, "end": 1940.8600000000001, "text": " Is this like, is this a satisfactory result for you?"}, {"start": 1940.8600000000001, "end": 1944.26, "text": " And if you have this as a reviewer, is this okay?"}, {"start": 1944.26, "end": 1945.26, "text": " Would not."}, {"start": 1945.26, "end": 1948.74, "text": " I mean, let's just cross out some words here."}, {"start": 1948.74, "end": 1954.8600000000001, "text": " Blank, let's like field, let's just put field or machine learning."}, {"start": 1954.8600000000001, "end": 1957.22, "text": " Why not machine learning?"}, {"start": 1957.22, "end": 1963.14, "text": " This work inspire new algorithms, yes, the algorithm presented here can be used for many"}, {"start": 1963.14, "end": 1969.34, "text": " different machine learning applications and a particular use may have both negative, yes."}, {"start": 1969.34, "end": 1977.8600000000001, "text": " Besides as data sets could be biased, the representation learned by this paper could"}, {"start": 1977.8600000000001, "end": 1982.06, "text": " be susceptible to replicate these biases."}, {"start": 1982.06, "end": 1986.8, "text": " Well there is a copy paste thing that you can apparently put into any and all papers"}, {"start": 1986.8, "end": 1990.4199999999998, "text": " that you write from now on and hey, DeepMind is doing it."}, {"start": 1990.4199999999998, "end": 1993.5, "text": " So you know, there you go."}, {"start": 1993.5, "end": 1997.86, "text": " Okay maybe a bit cynical, but I'm like I told you this would happen."}, {"start": 1997.86, "end": 2001.7, "text": " I told you and you know."}, {"start": 2001.7, "end": 2006.08, "text": " Okay so that was it for my comments right here."}, {"start": 2006.08, "end": 2010.86, "text": " They do have like a giant ton of experiments and I appreciate that right."}, {"start": 2010.86, "end": 2017.4599999999998, "text": " They really try to show that it works in many different situations and yeah, yet to solve"}, {"start": 2017.4599999999998, "end": 2020.02, "text": " why this doesn't collapse, but apparently it doesn't."}, {"start": 2020.02, "end": 2024.1799999999998, "text": " So try it out, give it a try and I'll see you next time."}, {"start": 2024.18, "end": 2044.7, "text": " Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=sEG8hD64c_Q
TUNIT: Rethinking the Truly Unsupervised Image-to-Image Translation (Paper Explained)
Image-to-Image translation usually requires corresponding samples or at least domain labels of the dataset. This paper removes that restriction and allows for fully unsupervised image translation of a source image to the style of one or many reference images. This is achieved by jointly training a guiding network that provides style information and pseudo-labels. OUTLINE: 0:00 - Intro & Overview 1:20 - Unsupervised Image-to-Image Translation 7:05 - Architecture Overview 14:15 - Pseudo-Label Loss 19:30 - Encoder Style Contrastive Loss 25:30 - Adversarial Loss 31:20 - Generator Style Contrastive Loss 35:15 - Image Reconstruction Loss 36:55 - Architecture Recap 39:55 - Full Loss 42:05 - Experiments Paper: https://arxiv.org/abs/2006.06500 Code: https://github.com/clovaai/tunit Abstract: Every recent image-to-image translation model uses either image-level (i.e. input-output pairs) or set-level (i.e. domain labels) supervision at minimum. However, even the set-level supervision can be a serious bottleneck for data collection in practice. In this paper, we tackle image-to-image translation in a fully unsupervised setting, i.e., neither paired images nor domain labels. To this end, we propose the truly unsupervised image-to-image translation method (TUNIT) that simultaneously learns to separate image domains via an information-theoretic approach and generate corresponding images using the estimated domain labels. Experimental results on various datasets show that the proposed method successfully separates domains and translates images across those domains. In addition, our model outperforms existing set-level supervised methods under a semi-supervised setting, where a subset of domain labels is provided. The source code is available at this https URL Authors: Kyungjune Baek, Yunjey Choi, Youngjung Uh, Jaejun Yoo, Hyunjung Shim Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there! Today we'll look at rethinking the truly unsupervised image to image translation by Kyungjoon Baek, Yoonjae Choi, Yongjoon Woo, JaJoon Yoo and Hyunjoon Shim. So in this paper we'll deal with image to image translation in an unsupervised fashion. So on a high level they replace the need for domain or really single image label annotations in image to image translation by training a guiding network that is able to sort of do a self clustering of the image domain and therefore that guides the image to image translation instead of the previously needed labels. I myself don't know too much about image to image translation and style transfer and all of this stuff. This has always been kind of a mystery to me and we'll try to make as much sense as possible out of this paper if you're with me. I might not get everything right but I will give my best of course. As always if you like content like this consider sharing it out and leaving a like and a comment. I do read the comments so I get a good idea of what you have to say about it. Cool, so what we're seeing here is an example of image to image translation of like a sort of a style transfer. Now what you'll have on the left is a source image. Now the goal is to translate this source image to a different domain while sort of keeping the features of the image the same and here is sort of I'm always confused because here it's like we keep the pose of the cat the same. Okay so we sort of keep the same cat but we want to change its style which means its breed in this particular case. So on the top you can see that the domain images are they come in these different groups and in fact it's not only those four but the entire data set is split into these different groups and among these different groups you have some sort of a shared style. Now this shared style is what you would like to transfer to the source image. So if you transfer the style of all of these cats right here which all seem to be sort of ginger cats to this instance right here what you'll end up with is a cat. Okay it was ginger before. Might not be the best example but you sort of get what I mean is that the thing that you transfer is whatever is common among these domain images. Okay and that's what I guess explains why the pose of the cat stays the same because it only it is basically taught to keep the image the same except to transfer whatever is common among the images in the domain class and that's image to image transfer or translation. Now until this paper at least that's what the paper claims these image to image translation models they required labels and why is that? That's because you need to know how to build these domains here at the top to get these different style vectors out or you actually would need label annotations for each image for each single image you would need to know which one you need to know which one of the source corresponds to which one of the target. So they have a graphic right here where they explain the sort of different the different stages that image to image translation went through historically. So first you'd have to have corresponding images one to one where you say okay here is an example of a sketch of a shoe and here is the corresponding shoe here is the sketch of another shoe and here is the corresponding shoe and so on and from that you could learn a model that translates from one domain to the other because you have corresponding image level annotations which image corresponds to which so basically which element of the domain a corresponds to which element in the domain B then the next stage of this was when you only need set level annotations and that's sort of what we looked at if you had supervised labels for domains so what you'll say is that there are three domains a B and C and actually let's let's forget C for a moment and just deal with A and B to make it equivalent to the thing on the left now I just know that these things are instances of class A and these things are instances of class B yet I don't there's no correspondence right there is no this corresponds to this or or something like this so image to image translation is now possible between domains when I just have domain level labels but this is still expensive collecting these labels you know it's is like collecting labels for a supervised data set a human needs to look at each image and then conclude what sort of domain it is their paper introduces the following where you do not have domains anymore you simply have a data set X now this data set your hypothesis is that there are still going to be domains in the data set they can I guess they can be overlapping or not but there are still going to be domains you just don't know what they are so in this case I guess you could differentiate these people into many many different ways but in essence you're going to assume that there is some kind of a domain structure you just don't know what it is but if you knew what it was then you could just simply apply methods from here to the data set and you'd be done now their paper shows that if you apply something like a self clustering approach and we've seen these approaches before in the paper about learning to classify images without labels if you have techniques like this you can do like a self clustering approach on this data set X right here and then you could learn your image to image translation yet this paper shows that if you do that the quality is not as good as if you do both things jointly so what this paper does is it jointly learns to cluster let's say to self label the images and to make the to do this image to image translation and by doing the tasks jointly they help each other perform better okay that's the general overview so how do they do this they have three different parts to their model there is the encoder or they call this the guiding network there is the generator and there is the discriminator so the generator and the discriminator they are fairly standard GAN generators and discriminators so general adversarial network but they have like a bit of some sort of twists so you can already see from the design from the drawings right here the discriminator is probably the easiest the discriminator gets an image right here it doesn't have to be a generated it is a either a generated image or a real image and it needs to decide you can see right here this means that the input domain is a vector or an image in this case and the output is a number it needs to decide if it's real or fake now in fact it's not as easy because you can see there are these multiple heads right here so this whole thing as I said is built on this kind of pseudo clustering approach there is this pseudo label that comes out of the left side we're going to look at that in a second but in essence you assume that there are multiple classes multiple domains in the data set and the discriminator here has one classification head for each of those classes so from somewhere outside it will get the information oh this is now supposed to be one of those ginger cats right as opposed to one of those black and white cats or one of the brown haired cats no it's one of the ginger cats and then there is a special head on top of the classifier that only classifies fake from real ginger cats okay which is a different classifier from the other domains so the discriminator it's sort of a conditional discriminator conditioned on a label okay from the discriminators point of view it's simply a label conditioned discriminator discriminating between real and false and I think that's yeah how you train the discriminator is you would give an image and you would let these encoder here this guiding network label the image and how we come up with this label again that will look in a second but this just gives a label and then you'd sell you for that particular label you'd classify the image into real or false now the fact that there is this shared part right here of course is you could also think of having one discriminator per class but the shared part it gives you some shared features and so on but it's not necessary it's not the the point is that there is a discriminator per class it's class conditional okay so what about the generator I think is I guess is the most complex what about this this encoding network right here it's E for encoder I guess but they also call it the guiding network so what this does is this is what's this supposed to do is it'll take an image any image and it will output two things one is a label and one is a style code so the label is supposed to be a number between 0 and k minus 1 so that's supposed to be a class label and how do you know how many classes there are if there are no labels you just guess and your best bet is to slightly over guess so if you expect there to be between 10 and 15 classes maybe put k to 20 okay you don't want to under guess but you can over guess but not by too much of course so you have to have this this estimation of how many classes but then this E it simply comes up with a class label and it also comes up with the style code now these two things are going to go then different pathways in this in this network the label is directly going to the discriminator right the generator does not see the label okay the style code does not go to the discriminator but goes to the generator all right so the two inputs from the encoder they one goes to the discriminator which is the label and one goes to the generator which is the style now the generator lastly it takes a source image and it takes this style code right here now the style code is encapsulating as we said the style of the reference image so the style is supposed to be whatever whatever whatever makes this domain of images the same so the style the way we're going to train this is that the style is going to describe somehow all the images that are from this label the style is going to describe whatever the style is it's very hard to it's very hard to explain if we look at the loss it becomes clearer why the things are how they are so it takes the style code and it takes the source image and it combines them and its task is to output this generated image as you can see in this example the generated image is basically this cat but with the style of the reference image and it outputs an image and the discriminator of course then is tasked with differentiating whether that image is real or fake for the given label over here okay so this is the entire thing and you all train this jointly so you jointly train the encoder to produce these class labels and the styles you train the generator to take in the styles and the source images and output the generated image to fool the discriminator and the discriminator at the same time is trained to differentiate between real and fake images based on the label that the encoder gives very very convoluted and complicated but there are a few things that make it easier first of all as you can see here the pseudo label is detached is argmaxed and detached so the pseudo label really is a number and there is no gradient back propagation along this line okay that makes that makes it a lot easier so the so what we first need is we need a way to train the encoder to come up with suitable class labels even though it doesn't get any back propagation signal into that part of its network so that's where we start with the loss functions the way we're going to do this is we're going to take the following approach we're going to take an image and we're going to take a randomly augmented version so for example a random crop or a horizontal flip and so on so the now we bring in ideas from self-supervision and again if you watch the video on learning to classify images without labels this is one of their main staples these self-supervised approaches really tend to learn representations that allow you to self cluster now in that paper they go further and they do this nearest neighbor thing in this paper they just do sort of the first step of this self clustering which i guess makes it such that you could potentially improve this paper by applying the other paper but who knows so we're going to take an image and we we're going to augment it okay so that means we're going to like random crop it or in change its luminance or whatnot so we have two versions of the same image and what we want to maximize we want to maximize the mutual information between not between the images themselves but p is going to be this output of the encoder so x goes into the encoder and the encoder outputs the style and the class label and the class label here so p is going to be the class distribution all right so this is going to be like a histogram or maybe the log it's it's good or the yeah so it's going to be a histogram over classes from which we're going to sample the label c or l or whatnot y hat y but the p is the distribution over output classes so since we don't have a label we can't train the distribution like in a supervised way supervised way so what we'll have to say is we want to maximize the mutual information between the output distribution of the image and the output distribution of the augmented image now that entails the following two quantities there's the entropy of p and there's the conditional entropy of p given p augmented now first of all it means we want to maximize this the entropy of p and that's supposed to be over the entire data set so this is the entropy over the entire data set x what it means is that we want different x's so if there's x1 x2 x3 and so on we want those to have different distributions in labels okay so if if the entropy is really high of the distribution p that means that different images get assigned to different classes some something like this all right if this is low then that would mean all the images basically get assigned to the same class and that's not good we want our classifier since we don't have labels it's a it's basically a cluster we want our cluster to sort of fill the space of possible clusters with the images so that's the first thing we want to maximize the mutual information we need to maximize this entropy and then second since this is a minus here we need to minimize the conditional entropy of p given p augmented what does that mean that means if we know the augmented version of an image its class labeling should be the same as the un-augmented version so that means that if I now take one of these x's to x1 augmented or they do a plus augmented right then that shouldn't really change its class label and this is what these so that should sort of keep the class labeling this is horrible but the idea here is that it's kind of a reverse thinking from supervised learning in supervised learning we have the label like this is class this is class 5 okay this image is class 5 and our thinking is this augmentation techniques if I random crop an image or if I change its colorization a little bit the class is not going to change right an airplane with a in front of a blue sky is still an airplane in front of a bit bluer sky so I assume that it'll still have the same label here I don't have the label but what I can require is to say whatever you output for the image it should be the same for the augmented image so these two objectives are enough to give you sort of a rough clustering of the output space maximize the entropy minimize the conditional entropy between two versions of the same image okay that's how we train this pseudo labeling approach so now we have a we have a model that can give a label to each image very cool so how do we train the other parts now there are additional additional losses here so I'm not sure yeah we'll go over it so this style part is also has to be trained right this encoder outputs a labeling we got that covered and it outputs a style part now the style part if you can see from the graphic it actually goes into let me erase some of that stuff here the style part actually is down here and it feeds into the generator and luckily they write detach here and since they don't write to detach anywhere here that means that we do get gradient back propagation from the generator to the style code so that means our our encoder here is trained to help the generator with its task of fooling the discriminator okay but first of all we're going to forget about that for now what we're going to do is simply look at a loss that they impose on the style that wouldn't they don't have to impose that loss but they have an additional loss on the style codes for the encoder in addition to the fact that there is gradient back propagating from G so the second loss we're going to look at is this style loss the style loss is almost the same so the style loss loss is a contrastive loss so what you want to do is if you have your data set you have your data set of images and you you know take images out and you train your network on and you train then take the next image or you take batches of image you take train and so on like this right and now you have this image what you want to do for this to work is you want to build up sort of a queue of images that you have already looked at like these images these are going and the queue can be let's say 10 long and you would always throw out the oldest and and in Q and U so when you're done with this image right here you'll put it into the queue you load your next image and so on so now what does this mean you now always have a queue of other images and it's not important what they are as long as they are others right because now we're going to compare ourselves with others and this is this contrastive loss right here so the style loss is going to be a contrastive loss between this and this now the bottom part this here these are the others these are the other images and whether the individual quantities so s is the style code of the image you're considering right now s plus you could have already guessed it is the style code of the augmented image right so we had our image X let's go again with X 1 X 2 X 3 are different images so we put X 1 through the encoder that gives us s the style it also gives us the class label but now we care about this head that gives us the style code and we augment X 1 to be X 1 plus and we go we put that through the encoder that gives us s plus and now we also put all of these other images remember these are the images that we've looked at previously but the only real importance is that there are other images we put those through here and they get the s minus I in this case three and two so now what will require is that the s the style code of our image is closer to the style code of its augmented version so the same principle again we want we'll say that you know these augmentations they don't really change anything about the style now this argument is a bit more wonky but if you think of you know random crops and random flips don't really change anything about the fur color or so of a of a cat so we want those two to be closer together then s is to any of these other images okay so this is a contrast of loss where you pull together two things that you think should be close and you push apart things that you think should be far away from each other so this style loss basically guarantees that you have a distinct style for each image that is robust to the kind of transformations that you do under augmentation okay specifically this style loss doesn't care about the domain right this is for each image you don't know if these other images are from the same domain or from different domains and that's why the style is basically individual to the image but as we as we're going to see the style does capture something of the domain as well but this loss right here is supposed to be each image has a style right so this is the style code of x this n plus one way classification enables e to utilize not only the similarity of the positive pair but also the dissimilarity of the negative pairs where the negative style codes are stored into a queue using previously sampled images we observe that adding this objective significantly improves unsupervised classification accuracy and animal faces from this to that compared to the previous over clustering approach okay so we have two outputs now and now we go to the adversarial loss so the question is how do we train the generator and the discriminator so they have three different losses for the generator and the discriminator and the most important one of course is this adversarial loss right here so the discriminator simply tries to distinguish is an image real or fake conditioned on a class so in case of a real image and that's this line right here it tries to distinguish is this real or fake based on y and y is x fed to the encoder and the encoder gives you a label all right that's and the label selects the head of the discriminator at the same time that the discriminator is trying to distinguish real from fake so these two lines the generator is trying to fool the discriminator so the upper if you've never seen a GAN loss the upper part here that's the real data and the bottom part here is the fake data now at the same time the discriminator is trying to distinguish real from fake and the generator is trying to make the discriminator fool the discriminator so both are of the generator and the discriminator are actually using that loss but the sign in front of it is different okay and since the generator is not involved in the top line you can usually leave that away because there's no back prop path through that and there's no back prop path here because we detach the graph right here so there is no gradient signal going to the encoder so this bottom line what does it mean the generator will take in an image and the style now s tilde comes from x tilde it's x tilde going through the encoder giving you s tilde so this is the reference image right this is you want this style right here this is the reference image and x is the source image so the generator is supposed to take the source image and basically apply the style from the reference image and generate x I don't even know how to call this x. It's not tilde whatever x fake x f and that's supposed to fool the discriminator now the question is which discriminator right because you need a label for the discriminator the label is conditional with this discriminator is pretty easy because it's simply the label of this image now however as you can see the generator learns to translate x to the top target domain while reflecting the style code s tilde so y tilde is going to be the label that comes out of this x so this encoder right here is also going to give us y tilde and that's going to go here. All right so recap what we want to put into the discriminator is one time a real image like we do up up here and we get its label from the encoder encoder gets us a label for each image very cool we'll also take the same image put it through the generator task the generator with transferring the style of another image from here onto it we get the style from the encoder and then the generator is supposed to make an image and we feed that to the discriminator and the discriminator discriminates assuming it comes from class y tilde now see right here the generator never has access to y tilde ok so the generator is kind of at a disadvantage here the discriminator gets told what kind of image it is in terms of class while the generator because it needs to fool the discriminator it needs to come up with an image of that class but it has no idea of the class it only has the style code so it is forced to learn to sort of it is forced to learn to map a style to associate a style with a particular class and that's how you get the domain into the style that's why the style can capture something like fur color of the different cat breeds because the generator is forced to take the style that the encoder gives and map it to an image of the class y tilde that it also the encoder gives but doesn't tell to the generator ok and in fact there is a more path because you now back propagate the loss to the encoder which means that the encoder will even help the generator it will help the generator make style codes that are very class specific now you can maybe think why why wouldn't you just have one output why doesn't the encoder simply output the label also as the style because that would be the easiest and the reason is because we have different losses on the style and the label ok otherwise that would be a valid tactic so that's cool that's the adversary loss that's the most important loss now there's also additional losses so they they do additional losses that they add on top for the generator they say in order to prevent degenerate situation where the generator ignores the style code and synthesizes a random image in the domain y or in the domain y tilde we impose a style contrastive loss to the generator so now there's still the danger that the degenerator simply produces a valid image right from the data set or even from the domain y tilde though I don't know how it would know y tilde or I've just not seen something in my mind it doesn't get the y tilde but it could read it from the style but here the danger is to ignore the style I'm slightly I'm slightly confused by this part but maybe looking at the loss will clear it out so they say we impose a style contrastive loss to the generator now this is almost the same as we imposed on the encoder so the generator you can see there is a contrastive loss again where you want to be you want these things to be close and you want these things to be far apart so these s minuses these are going to be the ones from your the style codes of the images from your queue so these are just going to be other images here s tilde that's going to be the style that you get from your reference image so your reference image is going through the encoder and that's going to give you this right here now the question is what is s prime here because in the before we simply had s which was our source image our source image style now what is s prime here s prime is going to be it gets more complicated yes s prime is going to be whoops it's going to be the round trip to the encoder so it's going to be if I generate my image from the source image X and the style s tilde of the reference and then I ask my generate my encoder again what style does this have I get the s prime so it's kind of a round trip right so I take I take this I'd ask the encoder what style is it that's s tilde right then I take s tilde go to the generator together with a source image X and that gives me like X fake and then I ask my generator again what style would you assign to the fake image I just produced and then the encoder will tell you I'll give it s fake or s prime in this case and then I compare that s prime with the one I gave before okay so it's sort of a round trip loss of my reference image right so what does that do if I now and then I ask that s prime be close to s tilde so that means if I generate an image with the style of my reference image the outcoming image should better have the style of the reference image that's all it says so the style of the thing I generate given this style they should better be close and especially closer together than the style with any other image in my queue it makes sense but it's kind of convoluted so you go with your out it's kind of a reconstruction loss except in style space alright and then the last thing is an actual image reconstruction loss so what you'll do is your generator will produce X sorry will produce an image from the source image and its own style right here that's important before we input s tilde here so this now is we input the source image and its own style so we go with X we go to the E and we put the style here and we tell the generator if I input the source image and its own style then what you give me back better be the source image itself right this is a consistency loss that tells the generator that basically it learns now the generator learns to the generator learns to map to recognize an image with its own style sort of because it doesn't know right it doesn't know that what's coming in here is the style of it of the image X but now you teach it and I think before this loss you'd have a good chance that the styles would just be all over the place they would sort of be consistent but they will not be aligned and with this you force that the style of an image itself if you gen if you put that into the generator it will lead to that image itself okay that's it so this is this is extremely convoluted right the discriminator is the easiest the discriminator is a class conditional discriminator that gets the label from some mechanism that decides on a label right okay that's the easiest the encoder has two parts the pseudo label which is over here which is trained completely unsupervised detached from everything else in a self clustering approach while the style part here is trained first of all in a contrastive way which makes sense and also in a back propagated way from the generator so the style generation mechanism tries to help the generator okay and that means it's going to leak some information about the label into the style because that helps the generator the generator needs to if the generator knows what sort of class it's going to produce it's going to be better okay so you can count on that information being in there but also also because of all the other losses that the generator has and the contrastive loss on the style the style code is going to sort of describe the individual style of an image and but is also going to describe what the style of that class is because it technically needs to contain information about the class and that's why I think this works with the style because there is no inherent notion of like this is this is a this is the pose of a cat or something like this yeah it still seems like a bit magic to me and then the generator is first of all trained to fool the discriminator given an image a source image and a style and you can fool the discriminator by producing an image that's so good it looks real and specifically it looks real in the class that the pseudo label has given right so in the class that the encoder has given to it so the generator must somehow come up with an image that's of that class and so it will it will be forced to interpret the style code in terms of that class label which makes the style code the style code and also we have these two additional losses which is the round trip loss to the style space so whatever the generator outputs you should be able to recover the style from it by putting it through the encoder again and then lastly there is a consistency loss where you say if I own put an image into a source image and I own put its own style again going through the encoder you should give me back the source image itself very complex and all of the generator loss is back propagated through to the encoder so this is the full loss as I said discriminator easy adversarial loss generator adversarial loss plus this style round trip consistency plus the own image round trip consistency encoder gets all of the generator loss all of it so all of this goes here so the encoder fully helps the generator and it is also trained with this mutual information and the style contrastive loss wow that's some losses wow that that's a lot of damage so they do different investigations into their model here and I don't even know if we've missed some of the pictures but ultimately what you can now do is you can do image to image translation either that's the cool thing you can have a reference image for one or what you can do is you can ask your discriminator what kind of domains are there sorry you can ask your encoder what kind of domains are there you've guessed the number of domains so it's maybe 10 or in this case it's 8 8 8 domains of cats and you can simply divide your data set into these 8 domains right 1 2 3 4 5 and so on now this is 10 okay I can't see anymore so 10 domains and then you can simply calculate for each image you calculate the style vector so the style the style and then you simply take the average one over the number in that in that domain you take the average style vector and that's going to be your target style so you can do image to image translation with a reference image or you can do image to image translation for an entire group of images for example all the images in a given domain and that's how they do these graphs right here now just quickly wait until my tablet decides to show me the paper again thank you all right they do a bunch of investigations into their holy unholy mixture of losses especially the first concern is couldn't we just train the guiding network like by its own on its own and then after that train this GAN thing right that's what we had at the very beginning we said there's this guiding network and it does the clustering and all and couldn't we just train this GAN architecture on top of the frozen guiding network and their conclusion is no if we train everything together it works better so on the left you have whenever you train the guiding network by itself and what you're seeing here is the t-SNE visualization t-SNE is a a down like a nonlinear visualization tool of style codes extracted by our guiding network the ground truth domains of all test images is represented in different colors so this is a data set that has labels but you don't you don't provide the labels to this algorithm the algorithm is completely unlabeled for but for purposes of investigating will visualize the labels with colors and what you'll see here are the the t-SNE visualizations of the style codes so things that are close together they have similar style codes and the ideal case would be if things that are close together here have the same label and that means the style is sort of representative of the domain okay that's what we want we want the style to capture the domain of an image and ideally not the image itself too much now on the left you see that there is quite a bit of overlap between these quite a bit of wash between the style and the group and on the right if you jointly train the GAN together with the guiding network you see that these classes of the style codes which have no reason to cluster are much more clustered and separated and they are separated much more along the lines of the ground truth classes okay so that's pretty cool now I would actually be interested in what happens if you do the separate training with the full pipeline of this learning to classify images without labels thing and their nearest neighbor thing because they've also shown that just purely this self clustering doesn't work too well but if you then do the nearest neighbor thing on top then that improves the classification significantly so this could potentially help either the separate or the joint training right here and there might be a connection between the joint training and whatever they're doing in any case they also show that then these FID which is a quality metric for GANs lower is better that the joint training goes way lower in the FID than the separate training okay that's that's the reason why they built this convoluted thing because it works way better and here they ablate they ablate some of the losses to investigate what's really going on and in this case t-SNE visualization of the star space of our guiding network trained on this since this does not have ground truth domain labels each data point is colored with the guiding networks prediction so each color is whatever the guiding network says the classes and the dot is one style each dot is one style vector and they're projected down to two dimensions you can see pretty clearly that the individual classes the individual clusters of style vectors correspond to different labels of the guiding network which is to be expected but also since they overestimate the number of classes in this case you can see that the even though the class label is different the style network will group the very similar classes together you can see here these are both cheetahs and here are both lions so it'll group them together which is pretty cool and sort of verifies that it recognizes these these different things because you force the guiding network to make 10 classes but the style network is simply continuous so it's cool to see that the style network will make one cluster with styles even though it's different labels and here you can see different samples from these domains just to verify that the guiding network has actually learned to separate things I still find this pretty pretty magical to this is completely unsupervised and it sort of finds these clusters by itself right they have a bunch of images here as I said this is no longer with one reference images image this is where you take the entire domain so you self label with your guiding network and then you take the mean vector and that's going to be your target style vector and these are the source images that you transfer and you can see that you know works pretty well today I always have like one adult animal and one child animal and I guess not or just two different ones here this is particularly cute though I have to show you this Fox right here what's going on with that Fox like someone help that Fox yeah so we're not at perfection yet as you can see but it's you know that looks like a pretty pretty cool for maybe okay where did it go maybe it slipped maybe it's an it's an offshoot of this one on the top left yeah who knows these data sets they have their way and so this is sort of where you can see the limitations right here that's not how a baby snow leopard looks you see the limitations here in that all of these animal faces they're still pretty aligned like they're fairly frontal not exactly but they're fairly frontal pictures they're fairly standardized and so on so we're I don't think we're yet at a level where we can just do you know fully image to image and you see it especially with faces because we as us humans are extremely good at you know seeing when there's something wrong with a face but still it's still pretty impressive what's possible and I think if the past is of any indication here is summer to winter that actually looks good if the past is of any indication then this technology will be pushed pretty hard and soon we'll be able to do this with a simple smartphone app or something like this so I invite you to check out the paper right here they have lots and lots and lots of examples and t-snip plots and whatnot in their appendix they have the code online as far as I have seen and with that let me know what you think in the comments bye bye
[{"start": 0.0, "end": 6.5, "text": " Hi there! Today we'll look at rethinking the truly unsupervised image to image translation"}, {"start": 6.5, "end": 16.84, "text": " by Kyungjoon Baek, Yoonjae Choi, Yongjoon Woo, JaJoon Yoo and Hyunjoon Shim."}, {"start": 16.84, "end": 23.72, "text": " So in this paper we'll deal with image to image translation in an unsupervised fashion."}, {"start": 23.72, "end": 31.599999999999998, "text": " So on a high level they replace the need for domain or really single image label annotations"}, {"start": 31.599999999999998, "end": 37.26, "text": " in image to image translation by training a guiding network that is able to sort of"}, {"start": 37.26, "end": 44.099999999999994, "text": " do a self clustering of the image domain and therefore that guides the image to image translation"}, {"start": 44.099999999999994, "end": 48.879999999999995, "text": " instead of the previously needed labels."}, {"start": 48.879999999999995, "end": 53.58, "text": " I myself don't know too much about image to image translation and style transfer and all"}, {"start": 53.58, "end": 59.76, "text": " of this stuff. This has always been kind of a mystery to me and we'll try to make as much"}, {"start": 59.76, "end": 65.44, "text": " sense as possible out of this paper if you're with me. I might not get everything right"}, {"start": 65.44, "end": 72.68, "text": " but I will give my best of course. As always if you like content like this consider sharing"}, {"start": 72.68, "end": 79.08, "text": " it out and leaving a like and a comment. I do read the comments so I get a good idea"}, {"start": 79.08, "end": 81.28, "text": " of what you have to say about it."}, {"start": 81.28, "end": 87.52, "text": " Cool, so what we're seeing here is an example of image to image translation of like a sort"}, {"start": 87.52, "end": 94.12, "text": " of a style transfer. Now what you'll have on the left is a source image. Now the goal"}, {"start": 94.12, "end": 100.76, "text": " is to translate this source image to a different domain while sort of keeping the features"}, {"start": 100.76, "end": 106.8, "text": " of the image the same and here is sort of I'm always confused because here it's like"}, {"start": 106.8, "end": 112.08, "text": " we keep the pose of the cat the same. Okay so we sort of keep the same cat but we want"}, {"start": 112.08, "end": 119.02, "text": " to change its style which means its breed in this particular case. So on the top you"}, {"start": 119.02, "end": 125.97999999999999, "text": " can see that the domain images are they come in these different groups and in fact it's"}, {"start": 125.97999999999999, "end": 131.34, "text": " not only those four but the entire data set is split into these different groups and among"}, {"start": 131.34, "end": 138.6, "text": " these different groups you have some sort of a shared style. Now this shared style is"}, {"start": 138.6, "end": 144.68, "text": " what you would like to transfer to the source image. So if you transfer the style of all"}, {"start": 144.68, "end": 150.66, "text": " of these cats right here which all seem to be sort of ginger cats to this instance right"}, {"start": 150.66, "end": 156.08, "text": " here what you'll end up with is a cat. Okay it was ginger before. Might not be the best"}, {"start": 156.08, "end": 162.84, "text": " example but you sort of get what I mean is that the thing that you transfer is whatever"}, {"start": 162.84, "end": 171.04000000000002, "text": " is common among these domain images. Okay and that's what I guess explains why the pose"}, {"start": 171.04000000000002, "end": 178.32000000000002, "text": " of the cat stays the same because it only it is basically taught to keep the image the"}, {"start": 178.32, "end": 186.35999999999999, "text": " same except to transfer whatever is common among the images in the domain class and that's"}, {"start": 186.35999999999999, "end": 192.56, "text": " image to image transfer or translation. Now until this paper at least that's what the"}, {"start": 192.56, "end": 199.98, "text": " paper claims these image to image translation models they required labels and why is that?"}, {"start": 199.98, "end": 207.68, "text": " That's because you need to know how to build these domains here at the top to get these"}, {"start": 207.68, "end": 213.68, "text": " different style vectors out or you actually would need label annotations for each image"}, {"start": 213.68, "end": 218.52, "text": " for each single image you would need to know which one you need to know which one of the"}, {"start": 218.52, "end": 222.94, "text": " source corresponds to which one of the target. So they have a graphic right here where they"}, {"start": 222.94, "end": 230.32, "text": " explain the sort of different the different stages that image to image translation went"}, {"start": 230.32, "end": 236.56, "text": " through historically. So first you'd have to have corresponding images one to one where"}, {"start": 236.56, "end": 243.08, "text": " you say okay here is an example of a sketch of a shoe and here is the corresponding shoe"}, {"start": 243.08, "end": 247.4, "text": " here is the sketch of another shoe and here is the corresponding shoe and so on and from"}, {"start": 247.4, "end": 254.36, "text": " that you could learn a model that translates from one domain to the other because you have"}, {"start": 254.36, "end": 261.02, "text": " corresponding image level annotations which image corresponds to which so basically which"}, {"start": 261.02, "end": 266.79999999999995, "text": " element of the domain a corresponds to which element in the domain B then the next stage"}, {"start": 266.79999999999995, "end": 272.59999999999997, "text": " of this was when you only need set level annotations and that's sort of what we looked at if you"}, {"start": 272.59999999999997, "end": 278.64, "text": " had supervised labels for domains so what you'll say is that there are three domains"}, {"start": 278.64, "end": 286.76, "text": " a B and C and actually let's let's forget C for a moment and just deal with A and B"}, {"start": 286.76, "end": 291.34, "text": " to make it equivalent to the thing on the left now I just know that these things are"}, {"start": 291.34, "end": 297.92, "text": " instances of class A and these things are instances of class B yet I don't there's no"}, {"start": 297.92, "end": 305.8, "text": " correspondence right there is no this corresponds to this or or something like this so image"}, {"start": 305.8, "end": 313.71999999999997, "text": " to image translation is now possible between domains when I just have domain level labels"}, {"start": 313.72, "end": 318.46000000000004, "text": " but this is still expensive collecting these labels you know it's is like collecting labels"}, {"start": 318.46000000000004, "end": 323.34000000000003, "text": " for a supervised data set a human needs to look at each image and then conclude what"}, {"start": 323.34000000000003, "end": 330.72, "text": " sort of domain it is their paper introduces the following where you do not have domains"}, {"start": 330.72, "end": 337.84000000000003, "text": " anymore you simply have a data set X now this data set your hypothesis is that there are"}, {"start": 337.84000000000003, "end": 343.14000000000004, "text": " still going to be domains in the data set they can I guess they can be overlapping or"}, {"start": 343.14, "end": 347.88, "text": " not but there are still going to be domains you just don't know what they are so in this"}, {"start": 347.88, "end": 356.4, "text": " case I guess you could differentiate these people into many many different ways but in"}, {"start": 356.4, "end": 359.91999999999996, "text": " essence you're going to assume that there is some kind of a domain structure you just"}, {"start": 359.91999999999996, "end": 367.03999999999996, "text": " don't know what it is but if you knew what it was then you could just simply apply methods"}, {"start": 367.04, "end": 375.28000000000003, "text": " from here to the data set and you'd be done now their paper shows that if you apply something"}, {"start": 375.28000000000003, "end": 379.6, "text": " like a self clustering approach and we've seen these approaches before in the paper"}, {"start": 379.6, "end": 385.92, "text": " about learning to classify images without labels if you have techniques like this you"}, {"start": 385.92, "end": 391.78000000000003, "text": " can do like a self clustering approach on this data set X right here and then you could"}, {"start": 391.78, "end": 397.67999999999995, "text": " learn your image to image translation yet this paper shows that if you do that the quality"}, {"start": 397.67999999999995, "end": 405.35999999999996, "text": " is not as good as if you do both things jointly so what this paper does is it jointly learns"}, {"start": 405.35999999999996, "end": 413.23999999999995, "text": " to cluster let's say to self label the images and to make the to do this image to image"}, {"start": 413.23999999999995, "end": 420.9, "text": " translation and by doing the tasks jointly they help each other perform better okay that's"}, {"start": 420.9, "end": 428.64, "text": " the general overview so how do they do this they have three different parts to their model"}, {"start": 428.64, "end": 437.0, "text": " there is the encoder or they call this the guiding network there is the generator and"}, {"start": 437.0, "end": 442.56, "text": " there is the discriminator so the generator and the discriminator they are fairly standard"}, {"start": 442.56, "end": 448.79999999999995, "text": " GAN generators and discriminators so general adversarial network but they have like a bit"}, {"start": 448.8, "end": 455.0, "text": " of some sort of twists so you can already see from the design from the drawings right"}, {"start": 455.0, "end": 462.56, "text": " here the discriminator is probably the easiest the discriminator gets an image right here"}, {"start": 462.56, "end": 468.88, "text": " it doesn't have to be a generated it is a either a generated image or a real image and"}, {"start": 468.88, "end": 474.92, "text": " it needs to decide you can see right here this means that the input domain is a vector"}, {"start": 474.92, "end": 480.64000000000004, "text": " or an image in this case and the output is a number it needs to decide if it's real or"}, {"start": 480.64000000000004, "end": 487.44, "text": " fake now in fact it's not as easy because you can see there are these multiple heads"}, {"start": 487.44, "end": 494.44, "text": " right here so this whole thing as I said is built on this kind of pseudo clustering approach"}, {"start": 494.44, "end": 500.0, "text": " there is this pseudo label that comes out of the left side we're going to look at that"}, {"start": 500.0, "end": 506.08, "text": " in a second but in essence you assume that there are multiple classes multiple domains"}, {"start": 506.08, "end": 511.84, "text": " in the data set and the discriminator here has one classification head for each of those"}, {"start": 511.84, "end": 517.52, "text": " classes so from somewhere outside it will get the information oh this is now supposed"}, {"start": 517.52, "end": 523.48, "text": " to be one of those ginger cats right as opposed to one of those black and white cats or one"}, {"start": 523.48, "end": 529.92, "text": " of the brown haired cats no it's one of the ginger cats and then there is a special head"}, {"start": 529.92, "end": 536.92, "text": " on top of the classifier that only classifies fake from real ginger cats okay which is a"}, {"start": 536.92, "end": 542.56, "text": " different classifier from the other domains so the discriminator it's sort of a conditional"}, {"start": 542.56, "end": 548.0799999999999, "text": " discriminator conditioned on a label okay from the discriminators point of view it's"}, {"start": 548.0799999999999, "end": 555.36, "text": " simply a label conditioned discriminator discriminating between real and false and I think that's"}, {"start": 555.36, "end": 564.08, "text": " yeah how you train the discriminator is you would give an image and you would let these"}, {"start": 564.08, "end": 569.6800000000001, "text": " encoder here this guiding network label the image and how we come up with this label again"}, {"start": 569.6800000000001, "end": 575.52, "text": " that will look in a second but this just gives a label and then you'd sell you for that particular"}, {"start": 575.52, "end": 582.2, "text": " label you'd classify the image into real or false now the fact that there is this shared"}, {"start": 582.2, "end": 587.84, "text": " part right here of course is you could also think of having one discriminator per class"}, {"start": 587.84, "end": 592.12, "text": " but the shared part it gives you some shared features and so on but it's not necessary"}, {"start": 592.12, "end": 599.0400000000001, "text": " it's not the the point is that there is a discriminator per class it's class conditional"}, {"start": 599.0400000000001, "end": 607.84, "text": " okay so what about the generator I think is I guess is the most complex what about this"}, {"start": 607.84, "end": 613.08, "text": " this encoding network right here it's E for encoder I guess but they also call it the"}, {"start": 613.08, "end": 619.64, "text": " guiding network so what this does is this is what's this supposed to do is it'll take"}, {"start": 619.64, "end": 627.88, "text": " an image any image and it will output two things one is a label and one is a style code"}, {"start": 627.88, "end": 638.76, "text": " so the label is supposed to be a number between 0 and k minus 1 so that's supposed to be a"}, {"start": 638.76, "end": 643.8, "text": " class label and how do you know how many classes there are if there are no labels you just"}, {"start": 643.8, "end": 650.36, "text": " guess and your best bet is to slightly over guess so if you expect there to be between"}, {"start": 650.36, "end": 656.72, "text": " 10 and 15 classes maybe put k to 20 okay you don't want to under guess but you can over"}, {"start": 656.72, "end": 665.38, "text": " guess but not by too much of course so you have to have this this estimation of how many"}, {"start": 665.38, "end": 672.0400000000001, "text": " classes but then this E it simply comes up with a class label and it also comes up with"}, {"start": 672.0400000000001, "end": 680.6, "text": " the style code now these two things are going to go then different pathways in this in this"}, {"start": 680.6, "end": 687.48, "text": " network the label is directly going to the discriminator right the generator does not"}, {"start": 687.48, "end": 696.44, "text": " see the label okay the style code does not go to the discriminator but goes to the generator"}, {"start": 696.44, "end": 701.72, "text": " all right so the two inputs from the encoder they one goes to the discriminator which is"}, {"start": 701.72, "end": 710.0, "text": " the label and one goes to the generator which is the style now the generator lastly it takes"}, {"start": 710.0, "end": 718.16, "text": " a source image and it takes this style code right here now the style code is encapsulating"}, {"start": 718.16, "end": 727.48, "text": " as we said the style of the reference image so the style is supposed to be whatever whatever"}, {"start": 727.48, "end": 732.88, "text": " whatever makes this domain of images the same so the style the way we're going to train"}, {"start": 732.88, "end": 739.68, "text": " this is that the style is going to describe somehow all the images that are from this"}, {"start": 739.68, "end": 746.12, "text": " label the style is going to describe whatever the style is it's very hard to it's very hard"}, {"start": 746.12, "end": 753.3199999999999, "text": " to explain if we look at the loss it becomes clearer why the things are how they are so"}, {"start": 753.3199999999999, "end": 759.9599999999999, "text": " it takes the style code and it takes the source image and it combines them and its task is"}, {"start": 759.9599999999999, "end": 764.16, "text": " to output this generated image as you can see in this example the generated image is"}, {"start": 764.16, "end": 772.04, "text": " basically this cat but with the style of the reference image and it outputs an image and"}, {"start": 772.04, "end": 776.5799999999999, "text": " the discriminator of course then is tasked with differentiating whether that image is"}, {"start": 776.5799999999999, "end": 783.64, "text": " real or fake for the given label over here okay so this is the entire thing and you all"}, {"start": 783.64, "end": 789.8399999999999, "text": " train this jointly so you jointly train the encoder to produce these class labels and"}, {"start": 789.84, "end": 795.4, "text": " the styles you train the generator to take in the styles and the source images and output"}, {"start": 795.4, "end": 800.5400000000001, "text": " the generated image to fool the discriminator and the discriminator at the same time is"}, {"start": 800.5400000000001, "end": 806.2, "text": " trained to differentiate between real and fake images based on the label that the encoder"}, {"start": 806.2, "end": 816.52, "text": " gives very very convoluted and complicated but there are a few things that make it easier"}, {"start": 816.52, "end": 823.96, "text": " first of all as you can see here the pseudo label is detached is argmaxed and detached"}, {"start": 823.96, "end": 829.8, "text": " so the pseudo label really is a number and there is no gradient back propagation along"}, {"start": 829.8, "end": 838.3, "text": " this line okay that makes that makes it a lot easier so the so what we first need is"}, {"start": 838.3, "end": 845.0799999999999, "text": " we need a way to train the encoder to come up with suitable class labels even though"}, {"start": 845.08, "end": 851.1600000000001, "text": " it doesn't get any back propagation signal into that part of its network so that's where"}, {"start": 851.1600000000001, "end": 857.0, "text": " we start with the loss functions the way we're going to do this is we're going to take the"}, {"start": 857.0, "end": 866.1600000000001, "text": " following approach we're going to take an image and we're going to take a randomly augmented"}, {"start": 866.1600000000001, "end": 871.96, "text": " version so for example a random crop or a horizontal flip and so on so the now we bring"}, {"start": 871.96, "end": 877.12, "text": " in ideas from self-supervision and again if you watch the video on learning to classify"}, {"start": 877.12, "end": 884.24, "text": " images without labels this is one of their main staples these self-supervised approaches"}, {"start": 884.24, "end": 889.88, "text": " really tend to learn representations that allow you to self cluster now in that paper"}, {"start": 889.88, "end": 894.36, "text": " they go further and they do this nearest neighbor thing in this paper they just do sort of the"}, {"start": 894.36, "end": 899.96, "text": " first step of this self clustering which i guess makes it such that you could potentially"}, {"start": 899.96, "end": 907.9200000000001, "text": " improve this paper by applying the other paper but who knows so we're going to take an image"}, {"start": 907.9200000000001, "end": 913.64, "text": " and we we're going to augment it okay so that means we're going to like random crop it or"}, {"start": 913.64, "end": 919.84, "text": " in change its luminance or whatnot so we have two versions of the same image and what we"}, {"start": 919.84, "end": 925.98, "text": " want to maximize we want to maximize the mutual information between not between the images"}, {"start": 925.98, "end": 933.9200000000001, "text": " themselves but p is going to be this output of the encoder so x goes into the encoder"}, {"start": 933.9200000000001, "end": 940.8000000000001, "text": " and the encoder outputs the style and the class label and the class label here so p"}, {"start": 940.8000000000001, "end": 946.44, "text": " is going to be the class distribution all right so this is going to be like a histogram"}, {"start": 946.44, "end": 952.5600000000001, "text": " or maybe the log it's it's good or the yeah so it's going to be a histogram over classes"}, {"start": 952.56, "end": 961.76, "text": " from which we're going to sample the label c or l or whatnot y hat y but the p is the"}, {"start": 961.76, "end": 967.8399999999999, "text": " distribution over output classes so since we don't have a label we can't train the distribution"}, {"start": 967.8399999999999, "end": 974.2399999999999, "text": " like in a supervised way supervised way so what we'll have to say is we want to maximize"}, {"start": 974.2399999999999, "end": 979.2399999999999, "text": " the mutual information between the output distribution of the image and the output distribution"}, {"start": 979.24, "end": 986.36, "text": " of the augmented image now that entails the following two quantities there's the entropy"}, {"start": 986.36, "end": 994.88, "text": " of p and there's the conditional entropy of p given p augmented now first of all it means"}, {"start": 994.88, "end": 1002.72, "text": " we want to maximize this the entropy of p and that's supposed to be over the entire"}, {"start": 1002.72, "end": 1011.9, "text": " data set so this is the entropy over the entire data set x what it means is that we want different"}, {"start": 1011.9, "end": 1021.64, "text": " x's so if there's x1 x2 x3 and so on we want those to have different distributions in labels"}, {"start": 1021.64, "end": 1029.24, "text": " okay so if if the entropy is really high of the distribution p that means that different"}, {"start": 1029.24, "end": 1036.06, "text": " images get assigned to different classes some something like this all right if this is low"}, {"start": 1036.06, "end": 1040.08, "text": " then that would mean all the images basically get assigned to the same class and that's"}, {"start": 1040.08, "end": 1046.72, "text": " not good we want our classifier since we don't have labels it's a it's basically a cluster"}, {"start": 1046.72, "end": 1052.76, "text": " we want our cluster to sort of fill the space of possible clusters with the images so that's"}, {"start": 1052.76, "end": 1057.88, "text": " the first thing we want to maximize the mutual information we need to maximize this entropy"}, {"start": 1057.88, "end": 1064.0400000000002, "text": " and then second since this is a minus here we need to minimize the conditional entropy"}, {"start": 1064.0400000000002, "end": 1072.7600000000002, "text": " of p given p augmented what does that mean that means if we know the augmented version"}, {"start": 1072.7600000000002, "end": 1081.2800000000002, "text": " of an image its class labeling should be the same as the un-augmented version so that means"}, {"start": 1081.28, "end": 1089.92, "text": " that if I now take one of these x's to x1 augmented or they do a plus augmented right"}, {"start": 1089.92, "end": 1096.3999999999999, "text": " then that shouldn't really change its class label and this is what these so that should"}, {"start": 1096.3999999999999, "end": 1103.52, "text": " sort of keep the class labeling this is horrible but the idea here is that it's kind of a reverse"}, {"start": 1103.52, "end": 1109.56, "text": " thinking from supervised learning in supervised learning we have the label like this is class"}, {"start": 1109.56, "end": 1116.36, "text": " this is class 5 okay this image is class 5 and our thinking is this augmentation techniques"}, {"start": 1116.36, "end": 1121.56, "text": " if I random crop an image or if I change its colorization a little bit the class is not"}, {"start": 1121.56, "end": 1126.76, "text": " going to change right an airplane with a in front of a blue sky is still an airplane in"}, {"start": 1126.76, "end": 1134.28, "text": " front of a bit bluer sky so I assume that it'll still have the same label here I don't"}, {"start": 1134.28, "end": 1140.0, "text": " have the label but what I can require is to say whatever you output for the image it should"}, {"start": 1140.0, "end": 1146.26, "text": " be the same for the augmented image so these two objectives are enough to give you sort"}, {"start": 1146.26, "end": 1151.6399999999999, "text": " of a rough clustering of the output space maximize the entropy minimize the conditional"}, {"start": 1151.6399999999999, "end": 1159.68, "text": " entropy between two versions of the same image okay that's how we train this pseudo labeling"}, {"start": 1159.68, "end": 1167.8, "text": " approach so now we have a we have a model that can give a label to each image very cool"}, {"start": 1167.8, "end": 1181.04, "text": " so how do we train the other parts now there are additional additional losses here so I'm"}, {"start": 1181.04, "end": 1188.5600000000002, "text": " not sure yeah we'll go over it so this style part is also has to be trained right this"}, {"start": 1188.56, "end": 1194.52, "text": " encoder outputs a labeling we got that covered and it outputs a style part now the style"}, {"start": 1194.52, "end": 1201.08, "text": " part if you can see from the graphic it actually goes into let me erase some of that stuff"}, {"start": 1201.08, "end": 1209.2, "text": " here the style part actually is down here and it feeds into the generator and luckily"}, {"start": 1209.2, "end": 1214.12, "text": " they write detach here and since they don't write to detach anywhere here that means that"}, {"start": 1214.12, "end": 1221.56, "text": " we do get gradient back propagation from the generator to the style code so that means"}, {"start": 1221.56, "end": 1230.84, "text": " our our encoder here is trained to help the generator with its task of fooling the discriminator"}, {"start": 1230.84, "end": 1237.2399999999998, "text": " okay but first of all we're going to forget about that for now what we're going to do"}, {"start": 1237.2399999999998, "end": 1242.36, "text": " is simply look at a loss that they impose on the style that wouldn't they don't have"}, {"start": 1242.36, "end": 1248.52, "text": " to impose that loss but they have an additional loss on the style codes for the encoder in"}, {"start": 1248.52, "end": 1253.7199999999998, "text": " addition to the fact that there is gradient back propagating from G so the second loss"}, {"start": 1253.7199999999998, "end": 1260.8, "text": " we're going to look at is this style loss the style loss is almost the same so the style"}, {"start": 1260.8, "end": 1268.8, "text": " loss loss is a contrastive loss so what you want to do is if you have your data set you"}, {"start": 1268.8, "end": 1274.3999999999999, "text": " have your data set of images and you you know take images out and you train your network"}, {"start": 1274.3999999999999, "end": 1278.76, "text": " on and you train then take the next image or you take batches of image you take train"}, {"start": 1278.76, "end": 1285.44, "text": " and so on like this right and now you have this image what you want to do for this to"}, {"start": 1285.44, "end": 1289.8799999999999, "text": " work is you want to build up sort of a queue of images that you have already looked at"}, {"start": 1289.8799999999999, "end": 1295.1399999999999, "text": " like these images these are going and the queue can be let's say 10 long and you would"}, {"start": 1295.14, "end": 1299.46, "text": " always throw out the oldest and and in Q and U so when you're done with this image right"}, {"start": 1299.46, "end": 1304.5600000000002, "text": " here you'll put it into the queue you load your next image and so on so now what does"}, {"start": 1304.5600000000002, "end": 1311.2, "text": " this mean you now always have a queue of other images and it's not important what they are"}, {"start": 1311.2, "end": 1320.5600000000002, "text": " as long as they are others right because now we're going to compare ourselves with others"}, {"start": 1320.56, "end": 1326.44, "text": " and this is this contrastive loss right here so the style loss is going to be a contrastive"}, {"start": 1326.44, "end": 1334.32, "text": " loss between this and this now the bottom part this here these are the others these"}, {"start": 1334.32, "end": 1343.74, "text": " are the other images and whether the individual quantities so s is the style code of the image"}, {"start": 1343.74, "end": 1350.34, "text": " you're considering right now s plus you could have already guessed it is the style code"}, {"start": 1350.34, "end": 1358.56, "text": " of the augmented image right so we had our image X let's go again with X 1 X 2 X 3 are"}, {"start": 1358.56, "end": 1365.84, "text": " different images so we put X 1 through the encoder that gives us s the style it also"}, {"start": 1365.84, "end": 1370.48, "text": " gives us the class label but now we care about this head that gives us the style code and"}, {"start": 1370.48, "end": 1379.32, "text": " we augment X 1 to be X 1 plus and we go we put that through the encoder that gives us"}, {"start": 1379.32, "end": 1387.08, "text": " s plus and now we also put all of these other images remember these are the images that"}, {"start": 1387.08, "end": 1391.6799999999998, "text": " we've looked at previously but the only real importance is that there are other images"}, {"start": 1391.6799999999998, "end": 1401.02, "text": " we put those through here and they get the s minus I in this case three and two so now"}, {"start": 1401.02, "end": 1408.58, "text": " what will require is that the s the style code of our image is closer to the style code"}, {"start": 1408.58, "end": 1415.3, "text": " of its augmented version so the same principle again we want we'll say that you know these"}, {"start": 1415.3, "end": 1419.62, "text": " augmentations they don't really change anything about the style now this argument is a bit"}, {"start": 1419.62, "end": 1425.12, "text": " more wonky but if you think of you know random crops and random flips don't really change"}, {"start": 1425.12, "end": 1433.52, "text": " anything about the fur color or so of a of a cat so we want those two to be closer together"}, {"start": 1433.52, "end": 1440.0, "text": " then s is to any of these other images okay so this is a contrast of loss where you pull"}, {"start": 1440.0, "end": 1447.04, "text": " together two things that you think should be close and you push apart things that you"}, {"start": 1447.04, "end": 1454.48, "text": " think should be far away from each other so this style loss basically guarantees that"}, {"start": 1454.48, "end": 1460.62, "text": " you have a distinct style for each image that is robust to the kind of transformations that"}, {"start": 1460.62, "end": 1469.3999999999999, "text": " you do under augmentation okay specifically this style loss doesn't care about the domain"}, {"start": 1469.3999999999999, "end": 1474.56, "text": " right this is for each image you don't know if these other images are from the same domain"}, {"start": 1474.56, "end": 1481.86, "text": " or from different domains and that's why the style is basically individual to the image"}, {"start": 1481.86, "end": 1489.78, "text": " but as we as we're going to see the style does capture something of the domain as well"}, {"start": 1489.78, "end": 1496.6399999999999, "text": " but this loss right here is supposed to be each image has a style right so this is the"}, {"start": 1496.6399999999999, "end": 1501.58, "text": " style code of x this n plus one way classification enables e to utilize not only the similarity"}, {"start": 1501.58, "end": 1507.16, "text": " of the positive pair but also the dissimilarity of the negative pairs where the negative style"}, {"start": 1507.16, "end": 1514.04, "text": " codes are stored into a queue using previously sampled images we observe that adding this"}, {"start": 1514.04, "end": 1519.08, "text": " objective significantly improves unsupervised classification accuracy and animal faces from"}, {"start": 1519.08, "end": 1526.1599999999999, "text": " this to that compared to the previous over clustering approach okay so we have two outputs"}, {"start": 1526.1599999999999, "end": 1535.12, "text": " now and now we go to the adversarial loss so the question is how do we train the generator"}, {"start": 1535.12, "end": 1541.9199999999998, "text": " and the discriminator so they have three different losses for the generator and the discriminator"}, {"start": 1541.9199999999998, "end": 1548.32, "text": " and the most important one of course is this adversarial loss right here so the discriminator"}, {"start": 1548.32, "end": 1557.4199999999998, "text": " simply tries to distinguish is an image real or fake conditioned on a class so in case"}, {"start": 1557.4199999999998, "end": 1564.12, "text": " of a real image and that's this line right here it tries to distinguish is this real"}, {"start": 1564.12, "end": 1572.6799999999998, "text": " or fake based on y and y is x fed to the encoder and the encoder gives you a label all right"}, {"start": 1572.68, "end": 1579.48, "text": " that's and the label selects the head of the discriminator at the same time that the discriminator"}, {"start": 1579.48, "end": 1584.24, "text": " is trying to distinguish real from fake so these two lines the generator is trying to"}, {"start": 1584.24, "end": 1590.74, "text": " fool the discriminator so the upper if you've never seen a GAN loss the upper part here"}, {"start": 1590.74, "end": 1598.0, "text": " that's the real data and the bottom part here is the fake data now at the same time the"}, {"start": 1598.0, "end": 1605.44, "text": " discriminator is trying to distinguish real from fake and the generator is trying to make"}, {"start": 1605.44, "end": 1610.6, "text": " the discriminator fool the discriminator so both are of the generator and the discriminator"}, {"start": 1610.6, "end": 1616.8, "text": " are actually using that loss but the sign in front of it is different okay and since"}, {"start": 1616.8, "end": 1621.48, "text": " the generator is not involved in the top line you can usually leave that away because there's"}, {"start": 1621.48, "end": 1629.76, "text": " no back prop path through that and there's no back prop path here because we detach the"}, {"start": 1629.76, "end": 1636.6, "text": " graph right here so there is no gradient signal going to the encoder so this bottom line what"}, {"start": 1636.6, "end": 1645.1200000000001, "text": " does it mean the generator will take in an image and the style now s tilde comes from"}, {"start": 1645.12, "end": 1652.1399999999999, "text": " x tilde it's x tilde going through the encoder giving you s tilde so this is the reference"}, {"start": 1652.1399999999999, "end": 1658.8799999999999, "text": " image right this is you want this style right here this is the reference image and x is"}, {"start": 1658.8799999999999, "end": 1666.84, "text": " the source image so the generator is supposed to take the source image and basically apply"}, {"start": 1666.84, "end": 1674.9599999999998, "text": " the style from the reference image and generate x I don't even know how to call this x."}, {"start": 1674.96, "end": 1686.56, "text": " It's not tilde whatever x fake x f and that's supposed to fool the discriminator now the"}, {"start": 1686.56, "end": 1692.04, "text": " question is which discriminator right because you need a label for the discriminator the"}, {"start": 1692.04, "end": 1697.28, "text": " label is conditional with this discriminator is pretty easy because it's simply the label"}, {"start": 1697.28, "end": 1704.94, "text": " of this image now however as you can see the generator learns to translate x to the top"}, {"start": 1704.94, "end": 1712.52, "text": " target domain while reflecting the style code s tilde so y tilde is going to be the label"}, {"start": 1712.52, "end": 1721.48, "text": " that comes out of this x so this encoder right here is also going to give us y tilde and"}, {"start": 1721.48, "end": 1724.56, "text": " that's going to go here."}, {"start": 1724.56, "end": 1733.52, "text": " All right so recap what we want to put into the discriminator is one time a real image"}, {"start": 1733.52, "end": 1742.92, "text": " like we do up up here and we get its label from the encoder encoder gets us a label"}, {"start": 1742.92, "end": 1750.28, "text": " for each image very cool we'll also take the same image put it through the generator task"}, {"start": 1750.28, "end": 1756.58, "text": " the generator with transferring the style of another image from here onto it we get"}, {"start": 1756.58, "end": 1764.8, "text": " the style from the encoder and then the generator is supposed to make an image and we feed that"}, {"start": 1764.8, "end": 1770.1599999999999, "text": " to the discriminator and the discriminator discriminates assuming it comes from class"}, {"start": 1770.1599999999999, "end": 1779.96, "text": " y tilde now see right here the generator never has access to y tilde ok so the generator"}, {"start": 1779.96, "end": 1786.24, "text": " is kind of at a disadvantage here the discriminator gets told what kind of image it is in terms"}, {"start": 1786.24, "end": 1792.24, "text": " of class while the generator because it needs to fool the discriminator it needs to come"}, {"start": 1792.24, "end": 1797.08, "text": " up with an image of that class but it has no idea of the class it only has the style"}, {"start": 1797.08, "end": 1807.04, "text": " code so it is forced to learn to sort of it is forced to learn to map a style to associate"}, {"start": 1807.04, "end": 1811.64, "text": " a style with a particular class and that's how you get the domain into the style that's"}, {"start": 1811.64, "end": 1817.3600000000001, "text": " why the style can capture something like fur color of the different cat breeds because"}, {"start": 1817.3600000000001, "end": 1824.64, "text": " the generator is forced to take the style that the encoder gives and map it to an image"}, {"start": 1824.64, "end": 1831.8400000000001, "text": " of the class y tilde that it also the encoder gives but doesn't tell to the generator ok"}, {"start": 1831.8400000000001, "end": 1838.24, "text": " and in fact there is a more path because you now back propagate the loss to the encoder"}, {"start": 1838.24, "end": 1847.44, "text": " which means that the encoder will even help the generator it will help the generator make"}, {"start": 1847.44, "end": 1853.84, "text": " style codes that are very class specific now you can maybe think why why wouldn't you just"}, {"start": 1853.84, "end": 1859.42, "text": " have one output why doesn't the encoder simply output the label also as the style because"}, {"start": 1859.42, "end": 1865.68, "text": " that would be the easiest and the reason is because we have different losses on the style"}, {"start": 1865.68, "end": 1874.92, "text": " and the label ok otherwise that would be a valid tactic so that's cool that's the adversary"}, {"start": 1874.92, "end": 1882.3600000000001, "text": " loss that's the most important loss now there's also additional losses so they they do additional"}, {"start": 1882.3600000000001, "end": 1888.68, "text": " losses that they add on top for the generator they say in order to prevent degenerate situation"}, {"start": 1888.68, "end": 1893.46, "text": " where the generator ignores the style code and synthesizes a random image in the domain"}, {"start": 1893.46, "end": 1899.3600000000001, "text": " y or in the domain y tilde we impose a style contrastive loss to the generator so now there's"}, {"start": 1899.3600000000001, "end": 1905.08, "text": " still the danger that the degenerator simply produces a valid image right from the data"}, {"start": 1905.08, "end": 1912.56, "text": " set or even from the domain y tilde though I don't know how it would know y tilde or"}, {"start": 1912.56, "end": 1923.1200000000001, "text": " I've just not seen something in my mind it doesn't get the y tilde but it could read"}, {"start": 1923.12, "end": 1930.1599999999999, "text": " it from the style but here the danger is to ignore the style I'm slightly I'm slightly"}, {"start": 1930.1599999999999, "end": 1935.3, "text": " confused by this part but maybe looking at the loss will clear it out so they say we"}, {"start": 1935.3, "end": 1942.12, "text": " impose a style contrastive loss to the generator now this is almost the same as we imposed"}, {"start": 1942.12, "end": 1949.6, "text": " on the encoder so the generator you can see there is a contrastive loss again where you"}, {"start": 1949.6, "end": 1955.24, "text": " want to be you want these things to be close and you want these things to be far apart"}, {"start": 1955.24, "end": 1961.8, "text": " so these s minuses these are going to be the ones from your the style codes of the images"}, {"start": 1961.8, "end": 1969.4399999999998, "text": " from your queue so these are just going to be other images here s tilde that's going"}, {"start": 1969.4399999999998, "end": 1974.84, "text": " to be the style that you get from your reference image so your reference image is going through"}, {"start": 1974.84, "end": 1981.36, "text": " the encoder and that's going to give you this right here now the question is what is s prime"}, {"start": 1981.36, "end": 1988.48, "text": " here because in the before we simply had s which was our source image our source image"}, {"start": 1988.48, "end": 1996.4399999999998, "text": " style now what is s prime here s prime is going to be it gets more complicated yes s"}, {"start": 1996.44, "end": 2005.8, "text": " prime is going to be whoops it's going to be the round trip to the encoder so it's"}, {"start": 2005.8, "end": 2014.96, "text": " going to be if I generate my image from the source image X and the style s tilde of the"}, {"start": 2014.96, "end": 2025.16, "text": " reference and then I ask my generate my encoder again what style does this have I get the"}, {"start": 2025.16, "end": 2034.0400000000002, "text": " s prime so it's kind of a round trip right so I take I take this I'd ask the encoder"}, {"start": 2034.0400000000002, "end": 2042.0600000000002, "text": " what style is it that's s tilde right then I take s tilde go to the generator together"}, {"start": 2042.0600000000002, "end": 2050.64, "text": " with a source image X and that gives me like X fake and then I ask my generator again what"}, {"start": 2050.64, "end": 2056.7, "text": " style would you assign to the fake image I just produced and then the encoder will tell"}, {"start": 2056.7, "end": 2066.96, "text": " you I'll give it s fake or s prime in this case and then I compare that s prime with"}, {"start": 2066.96, "end": 2075.8399999999997, "text": " the one I gave before okay so it's sort of a round trip loss of my reference image right"}, {"start": 2075.84, "end": 2082.8, "text": " so what does that do if I now and then I ask that s prime be close to s tilde so that means"}, {"start": 2082.8, "end": 2088.7200000000003, "text": " if I generate an image with the style of my reference image the outcoming image should"}, {"start": 2088.7200000000003, "end": 2094.6000000000004, "text": " better have the style of the reference image that's all it says so the style of the thing"}, {"start": 2094.6000000000004, "end": 2102.76, "text": " I generate given this style they should better be close and especially closer together than"}, {"start": 2102.76, "end": 2108.84, "text": " the style with any other image in my queue it makes sense but it's kind of convoluted"}, {"start": 2108.84, "end": 2116.6000000000004, "text": " so you go with your out it's kind of a reconstruction loss except in style space alright and then"}, {"start": 2116.6000000000004, "end": 2124.96, "text": " the last thing is an actual image reconstruction loss so what you'll do is your generator will"}, {"start": 2124.96, "end": 2132.76, "text": " produce X sorry will produce an image from the source image and its own style right here"}, {"start": 2132.76, "end": 2142.64, "text": " that's important before we input s tilde here so this now is we input the source image and"}, {"start": 2142.64, "end": 2150.96, "text": " its own style so we go with X we go to the E and we put the style here and we tell the"}, {"start": 2150.96, "end": 2157.2400000000002, "text": " generator if I input the source image and its own style then what you give me back better"}, {"start": 2157.2400000000002, "end": 2163.2, "text": " be the source image itself right this is a consistency loss that tells the generator"}, {"start": 2163.2, "end": 2174.66, "text": " that basically it learns now the generator learns to the generator learns to map to recognize"}, {"start": 2174.66, "end": 2179.8, "text": " an image with its own style sort of because it doesn't know right it doesn't know that"}, {"start": 2179.8, "end": 2190.44, "text": " what's coming in here is the style of it of the image X but now you teach it and I think"}, {"start": 2190.44, "end": 2196.38, "text": " before this loss you'd have a good chance that the styles would just be all over the"}, {"start": 2196.38, "end": 2200.86, "text": " place they would sort of be consistent but they will not be aligned and with this you"}, {"start": 2200.86, "end": 2207.1400000000003, "text": " force that the style of an image itself if you gen if you put that into the generator"}, {"start": 2207.14, "end": 2216.72, "text": " it will lead to that image itself okay that's it so this is this is extremely convoluted"}, {"start": 2216.72, "end": 2222.3199999999997, "text": " right the discriminator is the easiest the discriminator is a class conditional discriminator"}, {"start": 2222.3199999999997, "end": 2230.8799999999997, "text": " that gets the label from some mechanism that decides on a label right okay that's the easiest"}, {"start": 2230.88, "end": 2238.1600000000003, "text": " the encoder has two parts the pseudo label which is over here which is trained completely"}, {"start": 2238.1600000000003, "end": 2245.96, "text": " unsupervised detached from everything else in a self clustering approach while the style"}, {"start": 2245.96, "end": 2254.8, "text": " part here is trained first of all in a contrastive way which makes sense and also in a back propagated"}, {"start": 2254.8, "end": 2262.7200000000003, "text": " way from the generator so the style generation mechanism tries to help the generator okay"}, {"start": 2262.7200000000003, "end": 2267.36, "text": " and that means it's going to leak some information about the label into the style because that"}, {"start": 2267.36, "end": 2272.52, "text": " helps the generator the generator needs to if the generator knows what sort of class"}, {"start": 2272.52, "end": 2277.48, "text": " it's going to produce it's going to be better okay so you can count on that information"}, {"start": 2277.48, "end": 2282.7000000000003, "text": " being in there but also also because of all the other losses that the generator has and"}, {"start": 2282.7, "end": 2289.96, "text": " the contrastive loss on the style the style code is going to sort of describe the individual"}, {"start": 2289.96, "end": 2296.4399999999996, "text": " style of an image and but is also going to describe what the style of that class is because"}, {"start": 2296.4399999999996, "end": 2304.8599999999997, "text": " it technically needs to contain information about the class and that's why I think this"}, {"start": 2304.8599999999997, "end": 2310.7599999999998, "text": " works with the style because there is no inherent notion of like this is this is a this is the"}, {"start": 2310.76, "end": 2317.84, "text": " pose of a cat or something like this yeah it still seems like a bit magic to me and"}, {"start": 2317.84, "end": 2323.36, "text": " then the generator is first of all trained to fool the discriminator given an image a"}, {"start": 2323.36, "end": 2329.36, "text": " source image and a style and you can fool the discriminator by producing an image that's"}, {"start": 2329.36, "end": 2338.88, "text": " so good it looks real and specifically it looks real in the class that the pseudo label"}, {"start": 2338.88, "end": 2344.12, "text": " has given right so in the class that the encoder has given to it so the generator must somehow"}, {"start": 2344.12, "end": 2352.56, "text": " come up with an image that's of that class and so it will it will be forced to interpret"}, {"start": 2352.56, "end": 2358.76, "text": " the style code in terms of that class label which makes the style code the style code"}, {"start": 2358.76, "end": 2365.6, "text": " and also we have these two additional losses which is the round trip loss to the style"}, {"start": 2365.6, "end": 2373.2799999999997, "text": " space so whatever the generator outputs you should be able to recover the style from it"}, {"start": 2373.2799999999997, "end": 2378.2799999999997, "text": " by putting it through the encoder again and then lastly there is a consistency loss where"}, {"start": 2378.2799999999997, "end": 2384.7599999999998, "text": " you say if I own put an image into a source image and I own put its own style again going"}, {"start": 2384.7599999999998, "end": 2393.14, "text": " through the encoder you should give me back the source image itself very complex and all"}, {"start": 2393.14, "end": 2399.4, "text": " of the generator loss is back propagated through to the encoder so this is the full loss as"}, {"start": 2399.4, "end": 2406.66, "text": " I said discriminator easy adversarial loss generator adversarial loss plus this style"}, {"start": 2406.66, "end": 2414.96, "text": " round trip consistency plus the own image round trip consistency encoder gets all of"}, {"start": 2414.96, "end": 2424.48, "text": " the generator loss all of it so all of this goes here so the encoder fully helps the generator"}, {"start": 2424.48, "end": 2433.6, "text": " and it is also trained with this mutual information and the style contrastive loss wow that's"}, {"start": 2433.6, "end": 2441.42, "text": " some losses wow that that's a lot of damage so they do different investigations into their"}, {"start": 2441.42, "end": 2446.6800000000003, "text": " model here and I don't even know if we've missed some of the pictures but ultimately"}, {"start": 2446.6800000000003, "end": 2451.32, "text": " what you can now do is you can do image to image translation either that's the cool thing"}, {"start": 2451.32, "end": 2459.04, "text": " you can have a reference image for one or what you can do is you can ask your discriminator"}, {"start": 2459.04, "end": 2465.76, "text": " what kind of domains are there sorry you can ask your encoder what kind of domains are"}, {"start": 2465.76, "end": 2473.2400000000002, "text": " there you've guessed the number of domains so it's maybe 10 or in this case it's 8 8"}, {"start": 2473.2400000000002, "end": 2480.6800000000003, "text": " 8 domains of cats and you can simply divide your data set into these 8 domains right 1"}, {"start": 2480.6800000000003, "end": 2488.4, "text": " 2 3 4 5 and so on now this is 10 okay I can't see anymore so 10 domains and then you can"}, {"start": 2488.4, "end": 2494.96, "text": " simply calculate for each image you calculate the style vector so the style the style and"}, {"start": 2494.96, "end": 2502.2, "text": " then you simply take the average one over the number in that in that domain you take"}, {"start": 2502.2, "end": 2507.88, "text": " the average style vector and that's going to be your target style so you can do image"}, {"start": 2507.88, "end": 2512.66, "text": " to image translation with a reference image or you can do image to image translation for"}, {"start": 2512.66, "end": 2518.2, "text": " an entire group of images for example all the images in a given domain and that's how"}, {"start": 2518.2, "end": 2524.42, "text": " they do these graphs right here now just quickly wait until my tablet decides to show me the"}, {"start": 2524.42, "end": 2531.86, "text": " paper again thank you all right they do a bunch of investigations into their holy unholy"}, {"start": 2531.86, "end": 2541.4, "text": " mixture of losses especially the first concern is couldn't we just train the guiding network"}, {"start": 2541.4, "end": 2547.32, "text": " like by its own on its own and then after that train this GAN thing right that's what"}, {"start": 2547.32, "end": 2552.32, "text": " we had at the very beginning we said there's this guiding network and it does the clustering"}, {"start": 2552.32, "end": 2557.6800000000003, "text": " and all and couldn't we just train this GAN architecture on top of the frozen guiding"}, {"start": 2557.6800000000003, "end": 2564.36, "text": " network and their conclusion is no if we train everything together it works better so on"}, {"start": 2564.36, "end": 2572.1600000000003, "text": " the left you have whenever you train the guiding network by itself and what you're seeing here"}, {"start": 2572.1600000000003, "end": 2580.4, "text": " is the t-SNE visualization t-SNE is a a down like a nonlinear visualization tool of style"}, {"start": 2580.4, "end": 2586.4, "text": " codes extracted by our guiding network the ground truth domains of all test images is"}, {"start": 2586.4, "end": 2592.2400000000002, "text": " represented in different colors so this is a data set that has labels but you don't you"}, {"start": 2592.2400000000002, "end": 2596.1600000000003, "text": " don't provide the labels to this algorithm the algorithm is completely unlabeled for"}, {"start": 2596.1600000000003, "end": 2602.02, "text": " but for purposes of investigating will visualize the labels with colors and what you'll see"}, {"start": 2602.02, "end": 2607.84, "text": " here are the the t-SNE visualizations of the style codes so things that are close together"}, {"start": 2607.84, "end": 2616.44, "text": " they have similar style codes and the ideal case would be if things that are close together"}, {"start": 2616.44, "end": 2623.7200000000003, "text": " here have the same label and that means the style is sort of representative of the domain"}, {"start": 2623.7200000000003, "end": 2630.1600000000003, "text": " okay that's what we want we want the style to capture the domain of an image and ideally"}, {"start": 2630.1600000000003, "end": 2636.96, "text": " not the image itself too much now on the left you see that there is quite a bit of overlap"}, {"start": 2636.96, "end": 2642.4, "text": " between these quite a bit of wash between the style and the group and on the right if"}, {"start": 2642.4, "end": 2648.5, "text": " you jointly train the GAN together with the guiding network you see that these classes"}, {"start": 2648.5, "end": 2655.36, "text": " of the style codes which have no reason to cluster are much more clustered and separated"}, {"start": 2655.36, "end": 2662.36, "text": " and they are separated much more along the lines of the ground truth classes okay so"}, {"start": 2662.36, "end": 2668.32, "text": " that's pretty cool now I would actually be interested in what happens if you do the separate"}, {"start": 2668.32, "end": 2673.6200000000003, "text": " training with the full pipeline of this learning to classify images without labels thing and"}, {"start": 2673.6200000000003, "end": 2679.2400000000002, "text": " their nearest neighbor thing because they've also shown that just purely this self clustering"}, {"start": 2679.2400000000002, "end": 2684.76, "text": " doesn't work too well but if you then do the nearest neighbor thing on top then that improves"}, {"start": 2684.76, "end": 2692.6000000000004, "text": " the classification significantly so this could potentially help either the separate or the"}, {"start": 2692.6000000000004, "end": 2697.44, "text": " joint training right here and there might be a connection between the joint training"}, {"start": 2697.44, "end": 2704.6000000000004, "text": " and whatever they're doing in any case they also show that then these FID which is a quality"}, {"start": 2704.6000000000004, "end": 2712.34, "text": " metric for GANs lower is better that the joint training goes way lower in the FID than the"}, {"start": 2712.34, "end": 2718.1200000000003, "text": " separate training okay that's that's the reason why they built this convoluted thing because"}, {"start": 2718.1200000000003, "end": 2723.92, "text": " it works way better and here they ablate they ablate some of the losses to investigate what's"}, {"start": 2723.92, "end": 2731.6400000000003, "text": " really going on and in this case t-SNE visualization of the star space of our guiding network trained"}, {"start": 2731.6400000000003, "end": 2736.48, "text": " on this since this does not have ground truth domain labels each data point is colored with"}, {"start": 2736.48, "end": 2744.2, "text": " the guiding networks prediction so each color is whatever the guiding network says the classes"}, {"start": 2744.2, "end": 2752.36, "text": " and the dot is one style each dot is one style vector and they're projected down to two dimensions"}, {"start": 2752.36, "end": 2760.3, "text": " you can see pretty clearly that the individual classes the individual clusters of style vectors"}, {"start": 2760.3, "end": 2766.6000000000004, "text": " correspond to different labels of the guiding network which is to be expected but also since"}, {"start": 2766.6000000000004, "end": 2773.92, "text": " they overestimate the number of classes in this case you can see that the even though"}, {"start": 2773.92, "end": 2781.1200000000003, "text": " the class label is different the style network will group the very similar classes together"}, {"start": 2781.1200000000003, "end": 2787.1600000000003, "text": " you can see here these are both cheetahs and here are both lions so it'll group them together"}, {"start": 2787.16, "end": 2794.12, "text": " which is pretty cool and sort of verifies that it recognizes these these different things"}, {"start": 2794.12, "end": 2798.7999999999997, "text": " because you force the guiding network to make 10 classes but the style network is simply"}, {"start": 2798.7999999999997, "end": 2805.7999999999997, "text": " continuous so it's cool to see that the style network will make one cluster with styles"}, {"start": 2805.7999999999997, "end": 2810.2799999999997, "text": " even though it's different labels and here you can see different samples from these domains"}, {"start": 2810.2799999999997, "end": 2816.3399999999997, "text": " just to verify that the guiding network has actually learned to separate things I still"}, {"start": 2816.34, "end": 2823.1600000000003, "text": " find this pretty pretty magical to this is completely unsupervised and it sort of finds"}, {"start": 2823.1600000000003, "end": 2830.2000000000003, "text": " these clusters by itself right they have a bunch of images here as I said this is no"}, {"start": 2830.2000000000003, "end": 2835.88, "text": " longer with one reference images image this is where you take the entire domain so you"}, {"start": 2835.88, "end": 2840.9, "text": " self label with your guiding network and then you take the mean vector and that's going"}, {"start": 2840.9, "end": 2845.92, "text": " to be your target style vector and these are the source images that you transfer and you"}, {"start": 2845.92, "end": 2851.08, "text": " can see that you know works pretty well today I always have like one adult animal and one"}, {"start": 2851.08, "end": 2859.6, "text": " child animal and I guess not or just two different ones here this is particularly cute though"}, {"start": 2859.6, "end": 2867.82, "text": " I have to show you this Fox right here what's going on with that Fox like someone help that"}, {"start": 2867.82, "end": 2876.9, "text": " Fox yeah so we're not at perfection yet as you can see but it's you know that looks like"}, {"start": 2876.9, "end": 2886.2000000000003, "text": " a pretty pretty cool for maybe okay where did it go maybe it slipped maybe it's an it's"}, {"start": 2886.2000000000003, "end": 2893.2400000000002, "text": " an offshoot of this one on the top left yeah who knows these data sets they have their"}, {"start": 2893.24, "end": 2899.9199999999996, "text": " way and so this is sort of where you can see the limitations right here that's not how"}, {"start": 2899.9199999999996, "end": 2908.14, "text": " a baby snow leopard looks you see the limitations here in that all of these animal faces they're"}, {"start": 2908.14, "end": 2916.52, "text": " still pretty aligned like they're fairly frontal not exactly but they're fairly frontal pictures"}, {"start": 2916.52, "end": 2922.7599999999998, "text": " they're fairly standardized and so on so we're I don't think we're yet at a level where we"}, {"start": 2922.76, "end": 2930.0, "text": " can just do you know fully image to image and you see it especially with faces because"}, {"start": 2930.0, "end": 2935.5600000000004, "text": " we as us humans are extremely good at you know seeing when there's something wrong with"}, {"start": 2935.5600000000004, "end": 2943.2400000000002, "text": " a face but still it's still pretty impressive what's possible and I think if the past is"}, {"start": 2943.2400000000002, "end": 2949.6200000000003, "text": " of any indication here is summer to winter that actually looks good if the past is of"}, {"start": 2949.62, "end": 2956.88, "text": " any indication then this technology will be pushed pretty hard and soon we'll be able"}, {"start": 2956.88, "end": 2962.8599999999997, "text": " to do this with a simple smartphone app or something like this so I invite you to check"}, {"start": 2962.8599999999997, "end": 2968.18, "text": " out the paper right here they have lots and lots and lots of examples and t-snip plots"}, {"start": 2968.18, "end": 2976.48, "text": " and whatnot in their appendix they have the code online as far as I have seen and with"}, {"start": 2976.48, "end": 2979.84, "text": " that let me know what you think in the comments bye bye"}]
Yannic Kilchner
https://www.youtube.com/watch?v=DLq1DUcMh1Q
A bio-inspired bistable recurrent cell allows for long-lasting memory (Paper Explained)
Even though LSTMs and GRUs solve the vanishing and exploding gradient problems, they have trouble learning to remember things over very long time spans. Inspired from bistability, a property of biological neurons, this paper constructs a recurrent cell with an inherent memory property, with only minimal modification to existing architectures. OUTLINE: 0:00 - Intro & Overview 1:10 - Recurrent Neural Networks 6:00 - Gated Recurrent Unit 14:40 - Neuronal Bistability 22:50 - Bistable Recurrent Cell 31:00 - Neuromodulation 32:50 - Copy First Benchmark 37:35 - Denoising Benchmark 48:00 - Conclusion & Comments Paper: https://arxiv.org/abs/2006.05252 Code: https://github.com/nvecoven/BRC Abstract: Recurrent neural networks (RNNs) provide state-of-the-art performances in a wide variety of tasks that require memory. These performances can often be achieved thanks to gated recurrent cells such as gated recurrent units (GRU) and long short-term memory (LSTM). Standard gated cells share a layer internal state to store information at the network level, and long term memory is shaped by network-wide recurrent connection weights. Biological neurons on the other hand are capable of holding information at the cellular level for an arbitrary long amount of time through a process called bistability. Through bistability, cells can stabilize to different stable states depending on their own past state and inputs, which permits the durable storing of past information in neuron state. In this work, we take inspiration from biological neuron bistability to embed RNNs with long-lasting memory at the cellular level. This leads to the introduction of a new bistable biologically-inspired recurrent cell that is shown to strongly improves RNN performance on time-series which require very long memory, despite using only cellular connections (all recurrent connections are from neurons to themselves, i.e. a neuron state is not influenced by the state of other neurons). Furthermore, equipping this cell with recurrent neuromodulation permits to link them to standard GRU cells, taking a step towards the biological plausibility of GRU. Authors: Nicolas Vecoven, Damien Ernst, Guillaume Drion Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we're looking at a bio-inspired bistable recurrent cell allows for long lasting memory by Nicolas Vécovin, Damien Ernst and Jean-Drian of the University of Liège. This paper here is not a paper that wants to push state of the art on anything. It is a paper that takes a concept from the biological research on actual neurons, which is the bistability property, and tries to introduce it to recurrent neural networks. And on toy data or small data, they show that this has the interesting property that these recurrent neural networks can then remember important things for much, much longer than our current recurrent architectures can do. This I believe this is a very interesting paper. And it's a nice, you know, refresher from the whole state of the art number pushing papers. So dive in with me to explore this. If you like content like this, also consider subscribing if you aren't and sharing it out and leaving a like and a comment if you have any sort of comments. Alright, they, they basically say recurrent neural networks provide state of the art performance in a wide variety of tasks that require memory, which is true, right. So we have these recurrent neural networks. And what the recurrent neural networks do is they're basically so a classic recurrent neural network goes something like this, there is a hidden state at time step t, and there is a sequence of inputs that you have to work with. So we'll call them x one, x two, x three, x four, and so on. And then at some point, you have to provide an output. This could be at every single time step, or sometimes it's just at the end, you have to provide an output y. So for example, this here could be a piece of text, and you need to decide whether or not that piece of text, maybe it's an email, whether or not that's spam. This could be a time series of a patient in an ICU and you need to decide whether or not to give some medication to the patient. So the the applications of this are very wide, and any sort of of series data will do. So there's this hidden state. And at each time step, this hidden state is updated to a new hidden state. So this called it called this h zero, it's updated to a new hidden state by incorporating the input. So somehow the input x and the previous hidden state are made into a new hidden state. And then the next input is taken in and by using this hidden state, a new hidden state is made and so on. So one property here is that the newest hidden state always only depends on the previous hidden state. And it doesn't really directly depend on like the hidden state two before itself, it only depends on the hidden state right before itself, and the input that corresponds to it. So this is the information for the other important property here is that these connections that make a hidden state into the next hidden state, and also that incorporate input, they're always the same. So these, these functions here that incorporate the input, they're always the same in each time step. So the parameters are shared between them. And the same, the same goes for the the functions here that transform one hidden state into the next hidden state. Of course, this there is a joint function between the two that actually produces the next hidden state. So these weights are all shared, and it for each time step. And that's what makes the network recurrent. So we call the single time step here, we call that a recurrent cell. And the question now is, how do you construct a recurrent cell, usually recurrent neural networks, they run into this problem of either gradient explosion or vanishing gradients. Because usually this here, if you are into neural networks, you know this, this is a weight matrix multiplied by the previous hidden state. And if you just multiply the same weight matrix over and over and over again, it pretty much depends on the singular value of that weight matrix, if the top singular value is higher than one, then the signal is going to explode. And if it's lower than one, the signal is going to fade over time. And there's pretty much nothing you can do. So classic RNNs have been looked have looked like this right here. So the next hidden state is a nonlinear function g. And g can be some non linearity like a sigmoid or a hyperbolic tangent. But it's a non it's a function of the current input and the last hidden state by simply matrix multiplying these two things by some weight matrices, and then adding them up. So that's what we've just looked at. Now this is problematic, as I said, because of the vanishing or exploding gradients. And therefore, people have come up with methods to solve this. And you might know things like LSTMs and GRUs that are used to solve this. Now these cells here are much more complicated than the standard cell that we saw here. But they also are much more effective, because they don't have this vanishing or exploding gradient problems. Their promise is that they can remember things for longer, because they allow the gradient to flow without these problems during back propagation. Now how does one of these look? In this paper, they mainly look at the GRU, the gated recurrent unit, which is a simpler version of the LSTM. The LSTM is slightly more complex. But the principles are the same. So they look at the GRU right here. What does the GRU do? These are the formulas for the GI GRU. And we're going to try to deconstruct these formulas. So as you can see, the inputs are the same inputs are going to be this points input, this time steps input, and the last hidden state. Okay, those are all the quantities that we need. And we need to output somehow the next hidden state, okay, the last hidden state is then used to predict the y, by the way, in all of these cases. So first, we need to calculate two things called a Z and R. And both of them are the same, they're multiplying these two things by weight matrices, and then running them through a sigmoid non linearity. Okay, let's do that. Let's say we have x, sorry, the last hidden state here. And we have xt here. So first, we're going to calculate the Zt and the RT from that. Now every one of these arrows right here is a multiplication by a weight matrix. So every one of these arrows is transforming the input. And let's also let's join this into a sigmoid node. And that gives you Zt. And let's join these into a sigmoid that gives you RT. Okay, so far, so good. Now we need to combine all of this in this last line right here. So you can see that the Z thing here sort of acts as a switch. So Z is the result of a sigmoid. And therefore it's between zero and one. And here this is the Hadamard product, this is the element wise product between vectors, which sort of mean this is like a gating, this is like a switch. If it's one, it selects this quantity. And if it's zero, it selects the quantity over here. And of course, it can be between zero and one. But those are the ends of the spectrum. So Z is a switch that selects between the last hidden state. So let's draw that right here. So the last hidden state goes here and is one of the options of the output, right? And the option is given by Z. So Zt, how do we draw a switch? Like this, maybe? So Zt is responsible for modulating this switch right here. Okay, this gives you the next hidden state. You see Zt modulates that switch. So Ht is a one possibility that the switch can select. What's the other possibility? The other possibility is this quantity right here, which is a hyperbolic tangent of whatever that is. So that is combined of X. So let's go from the back right here, tanh. What's the input to the tanh? It's two things. First of all, the X is an input to the tanh. So we can draw directly a line from here. The X modulated every arrow, as you might remember, can be a function. Not all arrows are functions. Like this arrow right here is not a function. It's just an arrow. Maybe that's confusing. You get what I mean. And the next thing is R times the hidden, the last hidden state or the last hidden state modulated by this matrix. So R is an R is acting as another gate, R can be again between zero and one because it's the result of a sigmoid. So this hidden state will also go here, it will be modulated running out of colors here, it will be modulated by R here as a sort of gate. So R can either close or open this gate right here. And then that's fed into the tanh. So it's rather complicated setup, as you can see right here. So let's analyze this. First of all, the hidden state is either the last hidden state, or it is something new. And that's modulated by this Z right here. And Z is calculated from the hidden state and the current input. Okay, so this allows the cell to basically look at the hidden state is sort of the information of what happened so far. And the current input is the new information that it gets from the sequence. And it sort of gets to look at these two things and decides, do I even want to update my hidden state? If not, I can just select this path right here, and then nothing happens to the hidden state, the next hidden state will be exactly the same as the last hidden state. If it decides if it thinks, wow, this new thing in the sequence, that's actually important, I should remember that, right? Because remember, these, the task of the network sometimes is to remember things from the sequence. I think we drew this over here. So if this is an email, and we want to detect whether it's spam, then this word in the sequence right here might be really important, because it would say something like gold, like buy gold, these two things might be buy gold. And you need to remember that in the hidden state, because the only way that information from x is going to flow to y is through the hidden states. So you would want at this point, you would want to remember this input in the hidden state, so you'd actually want to update the hidden state. And then this here might be not as important. So you might want to say, I don't want to, I don't want to, I still want my hidden state to be the old hidden state. Okay, so Z is that gate that allows us to do this. If we decide to update the hidden state, then what do we do? Again, if we decide to update the hidden state, we can, we can, we will incorporate the new input. But we will, we can also decide to mix that how to mix that new input with the old hidden state. Okay. So if we decide to update the hidden state, we don't simply discard the old hidden state, because the old hidden state will still have a path to the to, to be sort of still there to be remembered. But it's a longer path. And it needs to go through this thing here and through this thing here. So this thing here decides which of the old hidden state pass through. So at each you can see right here, this is an element wise product, this R is going to be between zero and one at each point in the vector. So at each point in the vector, the R decides, is this worth remembering or not? Okay. And if it's not worth remembering, then this is going to be zero and that that position of the old hidden state is going to be zero. And then that's going to be forgotten. And that's the opportunity for for the hidden state to incorporate new information because then there's a, it can delete this old information, and then it can incorporate the new input. And that will result then on this path on the new hidden state. Okay, so there's two major things. First, we can decide whether or not to even incorporate new information that's achieved by the Z gate. And then we can decide which parts of the old hidden state if we want to update it, which parts to forget, that's the R gate. And how to update it is then basically a result of the weight matrix that's associated with this function right here. Alright, so that's the gated recurrent unit. And it works a lot better than the classic RNNs. So having said that, they now turn to this property of neuronal bi stability that happens in actual neurons. So this here is sort of a model of a neuron with this property. Now forget everything we said about GRUs, we're just going to look at this right now. What happens in a neuron usually is you have, this is a single neuron, you have input synapses from other neurons. So these are connections coming from other neurons in into you, they are accumulated right here. Usually they are just in a classic model of a neuron, they're just summed up, you would sum up all these all these input signals. And then you decide, you'd run it through like a step function. So if the sum of all the things is smaller than a particular threshold, the output would be just nothing. And if it's higher than a particular threshold, then the output of the neuron would be sort of a firing of the neuron. This can be weighted and whatnot. But in this case, it's just a function of the inputs, and that gives you your input signal. So this is like, this is this is your input signal to the neuron. Now there is this property right here that makes it interesting. The signal goes out here and is integrated. This is an integrator and that's going to be in the output signal. But there's this this connection, this back connection right here. And that means that the signal that comes out at time step t is going to be fed back into the signal and actually added to the signal before itself. And sort of self modulating, right, the signal comes out is sent back is added to this input. And then sent through again, and this here is just an integrator that's integrating everything that's happening. So if you if you look a bit closer, you'll see that there is a minus here. So it's actually not added, it's subtracted. And there is an F here, which means that this is a nonlinear function. Now if this weren't a nonlinear function, we can just sort of try, or let's say this is a monotonic function. We can just sort of try to estimate what happens if all of this right here is very high. It's a high number, big number. This will be a big number, then this sum will be a big number, this output will be a big number. What happens is this here will be a big number. This is monotonic, so it will also be a big number. And that means it will subtract that big number. So that means when whenever the neuron is going to, to be very excited, this feedback would actually push it back. Now when it is not very excited, so when it's a very low number, very negatively excited, then the feedback would work in the exact opposite direction, this will be very negative, this will be very negative. And this here would push it towards the positive. So this neuron somehow self stabilizes over time to this to the zero point right here. And that's simply if this f is a is the identity function right now. So you can sort of see how this property works. Now we'll make it a bit more complicated in that we'll assume that this f here is not the identity function, but let's say they have it somewhere. But this right here, so the f of v post is this here, it's v post minus alpha tan h of v post. Or is this the entire f? Yes, that's this, this thing right here. If this is the case, if this is that this, if this is the signal minus the tan h, then something very, very, very interesting happens. And that that's depending on this alpha right here, in that if this alpha is between if the alpha is between zero and one, then we simply have our monotonic function. So here, you can see how big v post is. So how big the output signal is here, that's the experiment we made before. And here you can see what the feedback signal is, okay. Or the integrator, the integrated signal, maybe this is in the wrong place. And maybe f is just minus the tan h, I'm not sure. But in any case, the way they build it after in the GRU, it's pretty explicit. So this is the thing we said before, namely, if if the signal is very high, then this signal here will be high as well. And because it's subtracted right here, it's going to push the signal back towards zero. Again, if this is lower than zero, then this thing here will also be lower than zero. And because it's subtracted, it's going to push the signal towards zero. So this thing here is the stable point, it always push it back towards zero. However, if we change the function, and we change just the parameter alpha to be 1.5, a very different thing happens that you can see right here. Then it turns out, if your output signal is very, is very high, the same thing happens is going to be pushed back. But if your output signal is between zero and this point right here, there is a regime where actually, even though the output signal is positive, you will be pushed towards this point right here. And therefore, there is there are these two stable points right now. And the stable point basically means if you deviate, if the signal deviates from it, it's going to be pushed back towards that point. And you can see these two stable points, they're not at zero, they're actually at these two points here. And that's pretty interesting, because that means you can potentially remember things with the cell, right, an output signal of zero is basically not informative. But here, you can be in either the state here, or in the state here. And the little little perturbations will still keep you in that state. So you could potentially be in this state right here as an output, and the cell will just keep updating itself, and be stable and always output that signal right here. And then you could go ahead and if you can provide some huge input signal right here, you could potentially throw this over to the other side over this hill, and then it would stabilize at this point. So this is sort of a way to remember things within these biological cells. Pretty cool. Now, this here is a non filled out circle, that means it's an unstable point, it's technically stable in the sense that if you're exactly at zero, you will remain at zero. But if you perturb even a little bit, you will go if you perturb a bit, you will go away from it. Okay, I hope this sort of property is right is clear and why this is so fascinating, because we can use this these this fact that the stable points are not at zero and are more than just one stable point for remembering things. And they're now trying to fill this into the gated recurrent unit. So they call this the bi stable recurrent cell. BRC. And the formulas are these right here. A little smaller, come on, can't zoom anymore. Okay. It looks almost the same as the GRU. So the formulas are these, this, and this. So let's analyze the differences to the GRU. The first most striking difference is that a lot of weight matrices here have become single numbers. So are single vectors, this here used to be a weight matrix. And this used to be a matrix multiplication. And you'll see this sort of throughout whenever the last hidden state is incorporated into these things, then you'll see that it is no longer a weight matrix, but is in fact a in a product with a vector a element wise product. And that has a reason, namely what they want to model is individual neurons. So on a biological level, a neuron can only feed back onto itself. If there is a layer of neurons right here, they can only each feed back onto themselves. Whereas in a recurrent neural network, my hidden vector, my hidden state is a vector. And if I transform this into the next hidden state or any quantity, let's say I transform this H into this R right here, and this R is a vector too. Then any interaction is possible. So any cell, any entry in the vector here can influence any other vector because there's a big weight matrix in the middle. They want to leave this away, they want to model this as close as possible to actual layers of neurons. And therefore they say, okay, the input x can, you know, be distributed to all the neurons because technically the input comes from some other neurons down here, and they can all have connections to these neurons. But these feedbacks, we only really observe them in individual neuron, this feedback cycle. So that's why they model these recurrent weight products by just element wise products with vectors. And then the second difference, you again see that there is this switch right here, this C switch. And the C switch is like before, it's a sigmoid with where combine the output and the previous hidden state, there's nothing new here. So this switch is the same, the cell has the possibility of letting in new information, or just ignoring the new current information, the xt. The second thing is here. And this is the same as well, right? The tanh, this is a combination of the new information, it's in case we want to let in the new information of the new information, and you need to decide what things of the old information to forget or remember. Now the difference here is in this a. So this a used to be again, this sigmoid of the combination, and now it's just slightly different. It used to be sigmoid. Now it's one plus tanh. This is a very, very slight modification. It's tanh, because tanh is between minus one and one instead of zero and one like the sigmoid, and the one plus makes it such that this is between zero and two. And we've seen before that this critical behavior, there's two regimes to these functions, when it's between zero and one, this behaves like a classic gated recurrent unit, like a classic GRU. But when it's between one and two, then you have that exact behavior that we saw before of the bi-stability. Okay, so depending on what the a is, if the a is zero to one, it's a classic cell. And if the a is one to two, it's a bi-stable cell. And the network can decide by itself what it wants to do, because here it has, it can actually learn how to do that. Alright, so this is the only change, the only change really, apart from it only being individual neurons feeding back on themselves, is that now this is no longer between zero and one with the sigmoid, this is now between zero and two, because it's one plus the tanh. Very simple change, but the effect of this is pretty, pretty cool. So they do some, here is like a schematic drawing of this. If this a is between zero and one, again, you have this stable state that's at zero. But if it's between one and two, you have two stable states at two non-zero points. And again, this, we already saw this, but now this is for, I believe, this recurrent cell, this bimodal recurrent cell, not for the neuron itself. And here they give an example of what happens when you run this particular signal, this particular time series, through a cell like this, while fixing the c and the a parameters. So now the c and a parameters are learned, they're just fixed, and you see what happens. Now, as you can see, the blue should be a classic, the classic behavior. So in this blue case, what happens, you see right here, this c is moderately low. So we saw the c is the switch of whether to leave in old information or take up new information. If it's low, it means we want to take up new information. This is reasonably low. And that's why when the signal goes up here, the blue line goes up as well. And when the signal goes down, the blue line goes down again, and so on. So the blue line pretty straightforwardly follows the signal right here. Okay, now in contrast to this, the red line is over this threshold. So a is fixed at 1.5, c is still at 0.2. So again, when this line goes up, then this line goes up. But because this is near a this stable point, if it goes down again, it doesn't appear to go down enough, it sort of remembers that state it was in, it doesn't go down with the signal, only now that it goes down even further, it's over this threshold. So we were in this situation now, and the first bump down was only like to here, and that pushed it up again. But now it jumps over here because the signal is even lower. And then the cell sort of switches to another state. As you can see here, it goes down. But then this bump here is not enough to bring it up again. So it kind of remains in the state. So you can see the, it sort of remembers the input and small deviations or small changes in signal don't manage to throw it away from that only larger things only it needs to go very the signal needs to go very much down in order for it to change state. So that's pretty cool that there's this remembering behavior. And now remember, in the actual implementation, these C and A parameters, this C and this A right here, aren't fixed, they are also determined by the cell itself. And therefore the cell can decide by itself, when it wants to remember things, how hard it wants to remember things, and so on. So we're going to check this out in an actual implementation. So there's this one last modification they make, where they say, okay, they tried this, and it doesn't really work, because it works sometimes. But there is this issue of these neurons connecting only back on themselves, which really makes the model much less powerful than a classic recurrent cell. It's closer to biology, but it's much less powerful. And there is this property they say of neural modulation, where technically, in real neurons, the one neuron here could influence another neuron by modulating these A and C parameters. Okay, these A and C parameters, this is called neural modulation. So there are interconnections between the neurons that influence how much other neurons remember and forget things. So they decide, let's model that and lo and behold, we're now back to having weight matrices right here. So this, this is sort of, they say, this is a not really a super biologically plausible way of implementing neural modulation. But it sort of, it's an easier way. And it brings us closer to the G back to the GRU. And yeah, so now the only difference to the GRU is that the fact that here, there was a sigmoid, now it's a one plus tanh. Okay. I find this this pretty cool. So now also, the only difference here is this property of bi stability, this is the only difference. And now we can actually compare. So let's compare. They first give they do these sort of benchmarks, which are, they're pretty, pretty neat. So they have this first benchmark where it's the copy first input benchmark, I'm having some trouble here moving this paper around with my fingers. So the copy first input benchmark is simply a time series. In this benchmark, the network is presented with a one dimensional time series of t time steps and the each entry is a is a random number. After receiving the last time step, the network output value should approximate the very, very first input step. Okay, so all the network needs to do is remember the first thing it sees. And that's that should be learnable, right? That should be learnable because you can so you can, it's not specified whether the zero with hidden state, the initial hidden state is given into the network. But technically, it doesn't matter, because it can just learn whatever that is, I can learn to have a designated bit in this hidden state. So this hidden state is of size 100, I believe, one designated bit in the hidden state of whether it has already encountered the first thing, or not, if it has not encountered, it means that it's at the first time step, therefore, it should incorporate the new information into the hidden state. And if and also set this bit, and then for each subsequent step, it can see I've already set this bit and it can simply close that gate that makes it incorporate new information. So it should be able to carry this information all the way to the end by simply always closing that gate after the first step. And what happens in this? So as you can see, when the result is all the results up here. So this is after three, so they train it for 300,000 gradient descent iterations. And you can see that when these time steps when the series are pretty small, the LSTM or the GRUs tend to perform well. But you can see that these BRCs, they don't tend to perform poorly, they're just performing worse, right? It's zero, it's still the 0.01 regime or something like this of error. However, when you go up to like 300 steps, then you can see the GRUs and the LSTMs, they start to fail, because they are not made explicitly to remember for that long, they don't have this by stability property. Whereas now these things excel, you can see they're still pretty low. And at 600 steps, these things completely fail, they completely forget the input. So and the NBRC at least is still able to remember the first thing pretty, pretty well. And yeah, so the second one is no, this is the first experiment, still the copy input benchmark, you can see right here that even at this three at this 100 thing, where the GRU still learns it, it learns it much, much later than the BRC, which learns it pretty fast. Only here, when the when it's only five, when the series are only five steps long, does the GRU slightly outperform the BRC. So the general notion here is that these classic cells are more powerful in like classic tasks, whereas these things are shining whenever these things fail, because they can't remember things for very long. So they're not these new cells are not state of the art yet. Possibly there are still some modifications to be made. We've had a pretty long history of optimizing GRUs and LSTMs, they haven't always worked so well as they do now, because we kind of know how to handle them. And I expect if these cells here take off, especially these NBRC, then with time will be as proficient at handling them, and they will probably become on par, or even outperform the LSTMs or GRUs on every day, like on all the tasks and then be especially good on tasks where you have to remember things. But for now, they're outperformed by LSTMs and GRUs. Okay, so the second thing is a more interesting experiment, the denoising benchmark, where they say the copy input benchmark is interesting, as a means to highlight the memorization capacity of the recurrent neural network, but it does not tackle its ability to successfully exploit complex relationships between different elements of the input signal to predict the output. They have a new benchmark. In the denoising benchmark, the network is presented with a two dimensional time series of t time steps, five different time steps are sampled uniformly with, okay, and are communicated to the network. Okay, I'll just tell you what's going on. So this new time series is two dimensional. In the lower dimension, you simply have a bunch of random numbers like 5829. Actually, these are numbers sampled from a uniform Gaussian or so. So they're not actually 5829. But you can imagine it like this 58293402, and so on. And in the second dimension, you have a negative one, I believe, almost anywhere. And then at some points, you have a one, so you have a negative one again, and then you have a one and a negative one again, and that last point of the sequence, you'll have a zero. And so the zero is simply a marker that it's the end of the sequence. What the network needs to do is it needs to output all the elements. So the output of the network should be in this case, should be nine, four. So all the elements where there was a one in order, okay. So it remember what it needs to learn, it needs to learn to every time it sees a one in the second dimension, it needs to take the first dimension, put it somehow into the hidden state, and then carry that hidden state forward. And sees a one again, it needs to take the second thing, also put it into the hidden state, but not override the first thing it put into the hidden state. Like if it were to just realize, I need to put this into the hidden state, then it would almost surely override the previous information. So it needs to be able to say, I've already kind of in my h is going to be a vector of 100 dimensions, it needs to be able to say, well, I've already stored a bunch of stuff in that part of the vector. Maybe I should store that thing here over here. So this is fairly complex things to remember. And technically, GRUs and LSTMs are able to do it. But as we'll see, they're not as much. The results are in this table, where you can clearly see that whenever the n so the n, the n is a parameter, that is how far how far in this direction are these ones. So when n is zero, the ones can be anywhere. But when n here is like five, that means that the last five ones surely don't contain a one. That means only the first whatever, l minus l minus five contain the one. So the higher this number n is, the harder the task because your learning signal is way, way farther away from the from what's when you get the output. So you can see when the n is low, then the GRUs and the LSTMs they perform pretty well, but also these cells perform pretty well. They're just not performing as well. However, when the task gets harder, and you actually need to learn a sparse signal over a long period of time where in between you don't get any signal, the GRUs and the LSTMs fail while the BRCs would still be able to learn these kinds of things. So that's, that's fairly cool. Now it's if from a researcher's perspective, I wonder if they just first tried this task, you know, as I described it, and then they discovered like, ah, crap, they can still do it and like, okay, how can we make it such that there is a difference? Okay, let's actually make the task harder like this. And then they did that. I wonder if they always had the idea with the n here, or just introduced this after after it, they failed to produce a difference in the first place. I'm not sure. But they have they have another benchmark, but they basically show that these cells are actually good, can incorporate this information, can reason about what they need to remember and whatnot. And in the end, they also have this sequential MNIST, where they just feed an MNIST digit, digit by digit, and at the end, I think the the output of the neural network needs to be the class of the of the MNIST digit. And again, here, they have a parameter called n black, which means that so they have an MNIST digit, it's like a three, they unroll it to a single vector, right? They feed this one by one into the recurrent network. And then after that, they attach a certain number of just empty pixels, black pixel. And after that, the network needs to predict the y. You can see, if they asked the network the class of the digit, immediately after it's done, then the GRUs and the LSTM perform fairly well, as do the BRCs. But if you attach a whole bunch of these black pixels, remember, an MNIST digit has some seven sorry, 784, maybe entries. So attaching 300 black pixels is quite significant in in terms of the length of the sequences. And then the GRUs and the LSTMs, they can't learn, they can't learn to ignore these things because the learning signal is just too far away right here. But these things, they can because they can exploit this by stability property and remember things. Again, I wonder how this came to be. It seems pretty funny. But the last thing they do is they investigate what happens in their cells. And this, I feel is the most interesting part. And they do this on this denoising benchmark. So the task we've looked at before where you need to remember five randomly selected numbers that are indicated by the second dimension. Here they show a sequence where the five numbers occur at 3100, 246, at 300, and at 376. So these are the five positions where the sequence indicates that the network should remember the thing in the first dimension and then output. They analyze two things. They analyze the proportion of bistable neurons. So basically, they analyze these A quantities. And they analyze how many of the neurons in the layer have an A that's higher than one, which means that they are in this bistable mode. And also they analyze what's the average value of C. So C, if you remember, if this is high, it means it doesn't let in new information. And if this is low, it means it lets in new information. If you first look at the C, you can see that every single time when the second dimension indicates that this is one of the inputs to remember, the network immediately drops the C values. The different colors here are different layers. The recurrent network has multiple layers of these cells, as is usual in the recurrent neural networks. So this C, as you can see, it goes up pretty quickly. And then as soon as one of these inputs appear, the C drops, which basically means that the network realizes it now must let in the new information. And then it immediately shoots back up, makes it seem like so the network says, okay, as long as so all of these inputs here, they have the negative one in the second dimension, right? So it recognizes it says there's no reason for me to incorporate that information. It's not important. And as soon as the second input comes, it immediately shoots down again. Now you can see this here is the last layer of the network, the highest layer, so sort of the highest abstractive information. And you can see that from input to input, this value of C gets higher and higher. And these spikes as they go down, but they go down to a higher and higher point, which, you know, is is the fact that it recognizes it needs to let in new information. But it lets in less and less new information, the more things it needs to remember. So not only does it recognize, wait, I need to remember this, it also recognizes, but I probably shouldn't, shouldn't, you know, completely forget what I had previously. Because I it is important for me to remember these previous things. So that's a pretty cool demonstration, the fact that these go down at the input and the fact that generally they go up every time after a new input is incorporated into the hidden state. This basically, this shows that the or this is a pretty good indication that what they're saying is really happening, right? Okay, the second thing shows almost the same, it shows how many of these neurons are actually in their bi stable mode. And you can also see right here that especially in the last layer, you can see that the number of neurons in the bi stable mode goes up and up and up and up after each of these steps. And these spikes here correspond to always the points where they have to let in new information. Okay, cool. So I find that I find this to be pretty cool. And I find this last experiment to be the coolest where they can actually show look here, there's a pretty good indication that the thing we we built does what we say it does. They also actually have a proof here of the bi stability. When this a is higher than one, I won't go through this right here. But if you want, you can look at that. I'm excited to see what happens with these kinds of architectures in the future, because it seems to be a pretty minor modification. And maybe with a little bit of more modification, or if we sort of just tune this a little bit and kind of figure out what we have to do to make these things actually compete with the classic GRUs and LSTMs in regimes where long memory isn't necessary. I feel this could be a you know, kind of a standard building block in the recurrent neural network toolkit, even though it's been sort of outperformed by transformers in previous years. All right, that was it for me. And I hope you had fun with this paper, I invite you to check it out. And bye bye.
[{"start": 0.0, "end": 7.04, "text": " Hi there, today we're looking at a bio-inspired bistable recurrent cell allows for long lasting"}, {"start": 7.04, "end": 14.16, "text": " memory by Nicolas V\u00e9covin, Damien Ernst and Jean-Drian of the University of Li\u00e8ge."}, {"start": 14.16, "end": 19.02, "text": " This paper here is not a paper that wants to push state of the art on anything."}, {"start": 19.02, "end": 25.740000000000002, "text": " It is a paper that takes a concept from the biological research on actual neurons, which"}, {"start": 25.74, "end": 31.64, "text": " is the bistability property, and tries to introduce it to recurrent neural networks."}, {"start": 31.64, "end": 38.28, "text": " And on toy data or small data, they show that this has the interesting property that these"}, {"start": 38.28, "end": 44.84, "text": " recurrent neural networks can then remember important things for much, much longer than"}, {"start": 44.84, "end": 48.72, "text": " our current recurrent architectures can do."}, {"start": 48.72, "end": 51.32, "text": " This I believe this is a very interesting paper."}, {"start": 51.32, "end": 57.56, "text": " And it's a nice, you know, refresher from the whole state of the art number pushing papers."}, {"start": 57.56, "end": 61.1, "text": " So dive in with me to explore this."}, {"start": 61.1, "end": 67.24, "text": " If you like content like this, also consider subscribing if you aren't and sharing it out"}, {"start": 67.24, "end": 71.2, "text": " and leaving a like and a comment if you have any sort of comments."}, {"start": 71.2, "end": 76.56, "text": " Alright, they, they basically say recurrent neural networks provide state of the art performance"}, {"start": 76.56, "end": 81.56, "text": " in a wide variety of tasks that require memory, which is true, right."}, {"start": 81.56, "end": 83.64, "text": " So we have these recurrent neural networks."}, {"start": 83.64, "end": 91.0, "text": " And what the recurrent neural networks do is they're basically so a classic recurrent"}, {"start": 91.0, "end": 97.1, "text": " neural network goes something like this, there is a hidden state at time step t, and there"}, {"start": 97.1, "end": 101.26, "text": " is a sequence of inputs that you have to work with."}, {"start": 101.26, "end": 106.94, "text": " So we'll call them x one, x two, x three, x four, and so on."}, {"start": 106.94, "end": 110.14, "text": " And then at some point, you have to provide an output."}, {"start": 110.14, "end": 114.4, "text": " This could be at every single time step, or sometimes it's just at the end, you have to"}, {"start": 114.4, "end": 116.44, "text": " provide an output y."}, {"start": 116.44, "end": 120.60000000000001, "text": " So for example, this here could be a piece of text, and you need to decide whether or"}, {"start": 120.60000000000001, "end": 125.56, "text": " not that piece of text, maybe it's an email, whether or not that's spam."}, {"start": 125.56, "end": 130.32, "text": " This could be a time series of a patient in an ICU and you need to decide whether or not"}, {"start": 130.32, "end": 133.22, "text": " to give some medication to the patient."}, {"start": 133.22, "end": 141.7, "text": " So the the applications of this are very wide, and any sort of of series data will do."}, {"start": 141.7, "end": 143.29999999999998, "text": " So there's this hidden state."}, {"start": 143.29999999999998, "end": 148.56, "text": " And at each time step, this hidden state is updated to a new hidden state."}, {"start": 148.56, "end": 155.01999999999998, "text": " So this called it called this h zero, it's updated to a new hidden state by incorporating"}, {"start": 155.01999999999998, "end": 156.01999999999998, "text": " the input."}, {"start": 156.02, "end": 163.76000000000002, "text": " So somehow the input x and the previous hidden state are made into a new hidden state."}, {"start": 163.76000000000002, "end": 168.74, "text": " And then the next input is taken in and by using this hidden state, a new hidden state"}, {"start": 168.74, "end": 170.68, "text": " is made and so on."}, {"start": 170.68, "end": 177.64000000000001, "text": " So one property here is that the newest hidden state always only depends on the previous"}, {"start": 177.64000000000001, "end": 178.64000000000001, "text": " hidden state."}, {"start": 178.64000000000001, "end": 184.46, "text": " And it doesn't really directly depend on like the hidden state two before itself, it only"}, {"start": 184.46, "end": 191.08, "text": " depends on the hidden state right before itself, and the input that corresponds to it."}, {"start": 191.08, "end": 196.8, "text": " So this is the information for the other important property here is that these connections that"}, {"start": 196.8, "end": 203.0, "text": " make a hidden state into the next hidden state, and also that incorporate input, they're always"}, {"start": 203.0, "end": 204.0, "text": " the same."}, {"start": 204.0, "end": 209.42000000000002, "text": " So these, these functions here that incorporate the input, they're always the same in each"}, {"start": 209.42000000000002, "end": 210.42000000000002, "text": " time step."}, {"start": 210.42000000000002, "end": 212.96, "text": " So the parameters are shared between them."}, {"start": 212.96, "end": 219.0, "text": " And the same, the same goes for the the functions here that transform one hidden state into"}, {"start": 219.0, "end": 220.0, "text": " the next hidden state."}, {"start": 220.0, "end": 224.0, "text": " Of course, this there is a joint function between the two that actually produces the"}, {"start": 224.0, "end": 225.5, "text": " next hidden state."}, {"start": 225.5, "end": 230.84, "text": " So these weights are all shared, and it for each time step."}, {"start": 230.84, "end": 233.9, "text": " And that's what makes the network recurrent."}, {"start": 233.9, "end": 240.12, "text": " So we call the single time step here, we call that a recurrent cell."}, {"start": 240.12, "end": 244.76, "text": " And the question now is, how do you construct a recurrent cell, usually recurrent neural"}, {"start": 244.76, "end": 251.9, "text": " networks, they run into this problem of either gradient explosion or vanishing gradients."}, {"start": 251.9, "end": 257.08, "text": " Because usually this here, if you are into neural networks, you know this, this is a"}, {"start": 257.08, "end": 260.86, "text": " weight matrix multiplied by the previous hidden state."}, {"start": 260.86, "end": 266.48, "text": " And if you just multiply the same weight matrix over and over and over again, it pretty much"}, {"start": 266.48, "end": 271.72, "text": " depends on the singular value of that weight matrix, if the top singular value is higher"}, {"start": 271.72, "end": 274.92, "text": " than one, then the signal is going to explode."}, {"start": 274.92, "end": 278.94, "text": " And if it's lower than one, the signal is going to fade over time."}, {"start": 278.94, "end": 281.66, "text": " And there's pretty much nothing you can do."}, {"start": 281.66, "end": 288.16, "text": " So classic RNNs have been looked have looked like this right here."}, {"start": 288.16, "end": 293.88, "text": " So the next hidden state is a nonlinear function g."}, {"start": 293.88, "end": 301.7, "text": " And g can be some non linearity like a sigmoid or a hyperbolic tangent."}, {"start": 301.7, "end": 308.04, "text": " But it's a non it's a function of the current input and the last hidden state by simply"}, {"start": 308.04, "end": 314.58, "text": " matrix multiplying these two things by some weight matrices, and then adding them up."}, {"start": 314.58, "end": 316.68, "text": " So that's what we've just looked at."}, {"start": 316.68, "end": 323.92, "text": " Now this is problematic, as I said, because of the vanishing or exploding gradients."}, {"start": 323.92, "end": 327.32, "text": " And therefore, people have come up with methods to solve this."}, {"start": 327.32, "end": 333.94, "text": " And you might know things like LSTMs and GRUs that are used to solve this."}, {"start": 333.94, "end": 341.18, "text": " Now these cells here are much more complicated than the standard cell that we saw here."}, {"start": 341.18, "end": 346.44, "text": " But they also are much more effective, because they don't have this vanishing or exploding"}, {"start": 346.44, "end": 347.8, "text": " gradient problems."}, {"start": 347.8, "end": 353.94, "text": " Their promise is that they can remember things for longer, because they allow the gradient"}, {"start": 353.94, "end": 358.98, "text": " to flow without these problems during back propagation."}, {"start": 358.98, "end": 360.92, "text": " Now how does one of these look?"}, {"start": 360.92, "end": 366.18, "text": " In this paper, they mainly look at the GRU, the gated recurrent unit, which is a simpler"}, {"start": 366.18, "end": 368.18, "text": " version of the LSTM."}, {"start": 368.18, "end": 372.3, "text": " The LSTM is slightly more complex."}, {"start": 372.3, "end": 375.32, "text": " But the principles are the same."}, {"start": 375.32, "end": 377.44, "text": " So they look at the GRU right here."}, {"start": 377.44, "end": 378.44, "text": " What does the GRU do?"}, {"start": 378.44, "end": 381.59999999999997, "text": " These are the formulas for the GI GRU."}, {"start": 381.59999999999997, "end": 385.76, "text": " And we're going to try to deconstruct these formulas."}, {"start": 385.76, "end": 391.64, "text": " So as you can see, the inputs are the same inputs are going to be this points input,"}, {"start": 391.64, "end": 394.96, "text": " this time steps input, and the last hidden state."}, {"start": 394.96, "end": 397.86, "text": " Okay, those are all the quantities that we need."}, {"start": 397.86, "end": 402.76, "text": " And we need to output somehow the next hidden state, okay, the last hidden state is then"}, {"start": 402.76, "end": 407.24, "text": " used to predict the y, by the way, in all of these cases."}, {"start": 407.24, "end": 413.56, "text": " So first, we need to calculate two things called a Z and R. And both of them are the"}, {"start": 413.56, "end": 418.76, "text": " same, they're multiplying these two things by weight matrices, and then running them"}, {"start": 418.76, "end": 420.36, "text": " through a sigmoid non linearity."}, {"start": 420.36, "end": 421.92, "text": " Okay, let's do that."}, {"start": 421.92, "end": 426.71999999999997, "text": " Let's say we have x, sorry, the last hidden state here."}, {"start": 426.71999999999997, "end": 428.52, "text": " And we have xt here."}, {"start": 428.52, "end": 438.79999999999995, "text": " So first, we're going to calculate the Zt and the RT from that."}, {"start": 438.79999999999995, "end": 443.91999999999996, "text": " Now every one of these arrows right here is a multiplication by a weight matrix."}, {"start": 443.91999999999996, "end": 449.52, "text": " So every one of these arrows is transforming the input."}, {"start": 449.52, "end": 456.14, "text": " And let's also let's join this into a sigmoid node."}, {"start": 456.14, "end": 458.44, "text": " And that gives you Zt."}, {"start": 458.44, "end": 464.12, "text": " And let's join these into a sigmoid that gives you RT."}, {"start": 464.12, "end": 467.52, "text": " Okay, so far, so good."}, {"start": 467.52, "end": 471.03999999999996, "text": " Now we need to combine all of this in this last line right here."}, {"start": 471.03999999999996, "end": 477.5, "text": " So you can see that the Z thing here sort of acts as a switch."}, {"start": 477.5, "end": 479.91999999999996, "text": " So Z is the result of a sigmoid."}, {"start": 479.91999999999996, "end": 482.56, "text": " And therefore it's between zero and one."}, {"start": 482.56, "end": 491.56, "text": " And here this is the Hadamard product, this is the element wise product between vectors,"}, {"start": 491.56, "end": 495.74, "text": " which sort of mean this is like a gating, this is like a switch."}, {"start": 495.74, "end": 498.74, "text": " If it's one, it selects this quantity."}, {"start": 498.74, "end": 502.18, "text": " And if it's zero, it selects the quantity over here."}, {"start": 502.18, "end": 504.2, "text": " And of course, it can be between zero and one."}, {"start": 504.2, "end": 507.9, "text": " But those are the ends of the spectrum."}, {"start": 507.9, "end": 511.84000000000003, "text": " So Z is a switch that selects between the last hidden state."}, {"start": 511.84, "end": 514.28, "text": " So let's draw that right here."}, {"start": 514.28, "end": 524.78, "text": " So the last hidden state goes here and is one of the options of the output, right?"}, {"start": 524.78, "end": 526.48, "text": " And the option is given by Z."}, {"start": 526.48, "end": 530.3199999999999, "text": " So Zt, how do we draw a switch?"}, {"start": 530.3199999999999, "end": 532.42, "text": " Like this, maybe?"}, {"start": 532.42, "end": 537.52, "text": " So Zt is responsible for modulating this switch right here."}, {"start": 537.52, "end": 541.68, "text": " Okay, this gives you the next hidden state."}, {"start": 541.68, "end": 544.26, "text": " You see Zt modulates that switch."}, {"start": 544.26, "end": 548.06, "text": " So Ht is a one possibility that the switch can select."}, {"start": 548.06, "end": 550.78, "text": " What's the other possibility?"}, {"start": 550.78, "end": 557.9599999999999, "text": " The other possibility is this quantity right here, which is a hyperbolic tangent of whatever"}, {"start": 557.9599999999999, "end": 559.2399999999999, "text": " that is."}, {"start": 559.2399999999999, "end": 564.92, "text": " So that is combined of X."}, {"start": 564.92, "end": 571.4599999999999, "text": " So let's go from the back right here, tanh."}, {"start": 571.46, "end": 574.5400000000001, "text": " What's the input to the tanh?"}, {"start": 574.5400000000001, "end": 575.5400000000001, "text": " It's two things."}, {"start": 575.5400000000001, "end": 578.9200000000001, "text": " First of all, the X is an input to the tanh."}, {"start": 578.9200000000001, "end": 581.88, "text": " So we can draw directly a line from here."}, {"start": 581.88, "end": 588.64, "text": " The X modulated every arrow, as you might remember, can be a function."}, {"start": 588.64, "end": 590.0400000000001, "text": " Not all arrows are functions."}, {"start": 590.0400000000001, "end": 592.62, "text": " Like this arrow right here is not a function."}, {"start": 592.62, "end": 594.5400000000001, "text": " It's just an arrow."}, {"start": 594.5400000000001, "end": 595.6600000000001, "text": " Maybe that's confusing."}, {"start": 595.6600000000001, "end": 599.62, "text": " You get what I mean."}, {"start": 599.62, "end": 608.74, "text": " And the next thing is R times the hidden, the last hidden state or the last hidden state"}, {"start": 608.74, "end": 610.3, "text": " modulated by this matrix."}, {"start": 610.3, "end": 616.04, "text": " So R is an R is acting as another gate, R can be again between zero and one because"}, {"start": 616.04, "end": 617.92, "text": " it's the result of a sigmoid."}, {"start": 617.92, "end": 625.28, "text": " So this hidden state will also go here, it will be modulated running out of colors here,"}, {"start": 625.28, "end": 631.48, "text": " it will be modulated by R here as a sort of gate."}, {"start": 631.48, "end": 635.72, "text": " So R can either close or open this gate right here."}, {"start": 635.72, "end": 638.36, "text": " And then that's fed into the tanh."}, {"start": 638.36, "end": 644.22, "text": " So it's rather complicated setup, as you can see right here."}, {"start": 644.22, "end": 646.26, "text": " So let's analyze this."}, {"start": 646.26, "end": 654.48, "text": " First of all, the hidden state is either the last hidden state, or it is something new."}, {"start": 654.48, "end": 657.12, "text": " And that's modulated by this Z right here."}, {"start": 657.12, "end": 661.8000000000001, "text": " And Z is calculated from the hidden state and the current input."}, {"start": 661.8000000000001, "end": 668.88, "text": " Okay, so this allows the cell to basically look at the hidden state is sort of the information"}, {"start": 668.88, "end": 670.9200000000001, "text": " of what happened so far."}, {"start": 670.9200000000001, "end": 676.0, "text": " And the current input is the new information that it gets from the sequence."}, {"start": 676.0, "end": 681.24, "text": " And it sort of gets to look at these two things and decides, do I even want to update my hidden"}, {"start": 681.24, "end": 682.24, "text": " state?"}, {"start": 682.24, "end": 686.5600000000001, "text": " If not, I can just select this path right here, and then nothing happens to the hidden"}, {"start": 686.5600000000001, "end": 691.92, "text": " state, the next hidden state will be exactly the same as the last hidden state."}, {"start": 691.92, "end": 697.04, "text": " If it decides if it thinks, wow, this new thing in the sequence, that's actually important,"}, {"start": 697.04, "end": 699.16, "text": " I should remember that, right?"}, {"start": 699.16, "end": 706.72, "text": " Because remember, these, the task of the network sometimes is to remember things from the sequence."}, {"start": 706.72, "end": 708.4, "text": " I think we drew this over here."}, {"start": 708.4, "end": 714.56, "text": " So if this is an email, and we want to detect whether it's spam, then this word in the sequence"}, {"start": 714.56, "end": 719.0, "text": " right here might be really important, because it would say something like gold, like buy"}, {"start": 719.0, "end": 722.48, "text": " gold, these two things might be buy gold."}, {"start": 722.48, "end": 728.04, "text": " And you need to remember that in the hidden state, because the only way that information"}, {"start": 728.04, "end": 731.86, "text": " from x is going to flow to y is through the hidden states."}, {"start": 731.86, "end": 736.0, "text": " So you would want at this point, you would want to remember this input in the hidden"}, {"start": 736.0, "end": 738.68, "text": " state, so you'd actually want to update the hidden state."}, {"start": 738.68, "end": 740.74, "text": " And then this here might be not as important."}, {"start": 740.74, "end": 745.04, "text": " So you might want to say, I don't want to, I don't want to, I still want my hidden state"}, {"start": 745.04, "end": 746.76, "text": " to be the old hidden state."}, {"start": 746.76, "end": 753.12, "text": " Okay, so Z is that gate that allows us to do this."}, {"start": 753.12, "end": 757.24, "text": " If we decide to update the hidden state, then what do we do?"}, {"start": 757.24, "end": 766.52, "text": " Again, if we decide to update the hidden state, we can, we can, we will incorporate the new"}, {"start": 766.52, "end": 769.16, "text": " input."}, {"start": 769.16, "end": 775.52, "text": " But we will, we can also decide to mix that how to mix that new input with the old hidden"}, {"start": 775.52, "end": 776.52, "text": " state."}, {"start": 776.52, "end": 777.52, "text": " Okay."}, {"start": 777.52, "end": 781.72, "text": " So if we decide to update the hidden state, we don't simply discard the old hidden state,"}, {"start": 781.72, "end": 788.44, "text": " because the old hidden state will still have a path to the to, to be sort of still there"}, {"start": 788.44, "end": 791.0, "text": " to be remembered."}, {"start": 791.0, "end": 792.72, "text": " But it's a longer path."}, {"start": 792.72, "end": 798.12, "text": " And it needs to go through this thing here and through this thing here."}, {"start": 798.12, "end": 804.12, "text": " So this thing here decides which of the old hidden state pass through."}, {"start": 804.12, "end": 808.88, "text": " So at each you can see right here, this is an element wise product, this R is going to"}, {"start": 808.88, "end": 812.24, "text": " be between zero and one at each point in the vector."}, {"start": 812.24, "end": 818.36, "text": " So at each point in the vector, the R decides, is this worth remembering or not?"}, {"start": 818.36, "end": 819.48, "text": " Okay."}, {"start": 819.48, "end": 823.48, "text": " And if it's not worth remembering, then this is going to be zero and that that position"}, {"start": 823.48, "end": 827.02, "text": " of the old hidden state is going to be zero."}, {"start": 827.02, "end": 829.28, "text": " And then that's going to be forgotten."}, {"start": 829.28, "end": 835.22, "text": " And that's the opportunity for for the hidden state to incorporate new information because"}, {"start": 835.22, "end": 842.74, "text": " then there's a, it can delete this old information, and then it can incorporate the new input."}, {"start": 842.74, "end": 846.24, "text": " And that will result then on this path on the new hidden state."}, {"start": 846.24, "end": 848.12, "text": " Okay, so there's two major things."}, {"start": 848.12, "end": 852.9200000000001, "text": " First, we can decide whether or not to even incorporate new information that's achieved"}, {"start": 852.9200000000001, "end": 854.82, "text": " by the Z gate."}, {"start": 854.82, "end": 859.8000000000001, "text": " And then we can decide which parts of the old hidden state if we want to update it,"}, {"start": 859.8000000000001, "end": 862.98, "text": " which parts to forget, that's the R gate."}, {"start": 862.98, "end": 868.8000000000001, "text": " And how to update it is then basically a result of the weight matrix that's associated with"}, {"start": 868.8000000000001, "end": 871.44, "text": " this function right here."}, {"start": 871.44, "end": 876.32, "text": " Alright, so that's the gated recurrent unit."}, {"start": 876.32, "end": 880.6800000000001, "text": " And it works a lot better than the classic RNNs."}, {"start": 880.6800000000001, "end": 887.2, "text": " So having said that, they now turn to this property of neuronal bi stability that happens"}, {"start": 887.2, "end": 889.0, "text": " in actual neurons."}, {"start": 889.0, "end": 893.82, "text": " So this here is sort of a model of a neuron with this property."}, {"start": 893.82, "end": 898.48, "text": " Now forget everything we said about GRUs, we're just going to look at this right now."}, {"start": 898.48, "end": 906.6, "text": " What happens in a neuron usually is you have, this is a single neuron, you have input synapses"}, {"start": 906.6, "end": 907.78, "text": " from other neurons."}, {"start": 907.78, "end": 914.38, "text": " So these are connections coming from other neurons in into you, they are accumulated"}, {"start": 914.38, "end": 916.08, "text": " right here."}, {"start": 916.08, "end": 920.76, "text": " Usually they are just in a classic model of a neuron, they're just summed up, you would"}, {"start": 920.76, "end": 924.5600000000001, "text": " sum up all these all these input signals."}, {"start": 924.5600000000001, "end": 928.84, "text": " And then you decide, you'd run it through like a step function."}, {"start": 928.84, "end": 937.5600000000001, "text": " So if the sum of all the things is smaller than a particular threshold, the output would"}, {"start": 937.5600000000001, "end": 939.1800000000001, "text": " be just nothing."}, {"start": 939.1800000000001, "end": 943.7, "text": " And if it's higher than a particular threshold, then the output of the neuron would be sort"}, {"start": 943.7, "end": 946.88, "text": " of a firing of the neuron."}, {"start": 946.88, "end": 948.5, "text": " This can be weighted and whatnot."}, {"start": 948.5, "end": 953.6, "text": " But in this case, it's just a function of the inputs, and that gives you your input"}, {"start": 953.6, "end": 954.6, "text": " signal."}, {"start": 954.6, "end": 960.32, "text": " So this is like, this is this is your input signal to the neuron."}, {"start": 960.32, "end": 964.0, "text": " Now there is this property right here that makes it interesting."}, {"start": 964.0, "end": 969.76, "text": " The signal goes out here and is integrated."}, {"start": 969.76, "end": 974.12, "text": " This is an integrator and that's going to be in the output signal."}, {"start": 974.12, "end": 978.54, "text": " But there's this this connection, this back connection right here."}, {"start": 978.54, "end": 985.04, "text": " And that means that the signal that comes out at time step t is going to be fed back"}, {"start": 985.04, "end": 991.04, "text": " into the signal and actually added to the signal before itself."}, {"start": 991.04, "end": 999.72, "text": " And sort of self modulating, right, the signal comes out is sent back is added to this input."}, {"start": 999.72, "end": 1004.8000000000001, "text": " And then sent through again, and this here is just an integrator that's integrating everything"}, {"start": 1004.8000000000001, "end": 1006.74, "text": " that's happening."}, {"start": 1006.74, "end": 1014.0600000000001, "text": " So if you if you look a bit closer, you'll see that there is a minus here."}, {"start": 1014.0600000000001, "end": 1016.82, "text": " So it's actually not added, it's subtracted."}, {"start": 1016.82, "end": 1021.44, "text": " And there is an F here, which means that this is a nonlinear function."}, {"start": 1021.44, "end": 1026.64, "text": " Now if this weren't a nonlinear function, we can just sort of try, or let's say this"}, {"start": 1026.64, "end": 1028.02, "text": " is a monotonic function."}, {"start": 1028.02, "end": 1034.54, "text": " We can just sort of try to estimate what happens if all of this right here is very high."}, {"start": 1034.54, "end": 1036.86, "text": " It's a high number, big number."}, {"start": 1036.86, "end": 1041.6, "text": " This will be a big number, then this sum will be a big number, this output will be a big"}, {"start": 1041.6, "end": 1043.28, "text": " number."}, {"start": 1043.28, "end": 1046.34, "text": " What happens is this here will be a big number."}, {"start": 1046.34, "end": 1049.04, "text": " This is monotonic, so it will also be a big number."}, {"start": 1049.04, "end": 1052.98, "text": " And that means it will subtract that big number."}, {"start": 1052.98, "end": 1060.14, "text": " So that means when whenever the neuron is going to, to be very excited, this feedback"}, {"start": 1060.14, "end": 1062.42, "text": " would actually push it back."}, {"start": 1062.42, "end": 1068.48, "text": " Now when it is not very excited, so when it's a very low number, very negatively excited,"}, {"start": 1068.48, "end": 1072.96, "text": " then the feedback would work in the exact opposite direction, this will be very negative,"}, {"start": 1072.96, "end": 1074.64, "text": " this will be very negative."}, {"start": 1074.64, "end": 1077.3, "text": " And this here would push it towards the positive."}, {"start": 1077.3, "end": 1085.8, "text": " So this neuron somehow self stabilizes over time to this to the zero point right here."}, {"start": 1085.8, "end": 1093.4199999999998, "text": " And that's simply if this f is a is the identity function right now."}, {"start": 1093.4199999999998, "end": 1096.94, "text": " So you can sort of see how this property works."}, {"start": 1096.94, "end": 1103.46, "text": " Now we'll make it a bit more complicated in that we'll assume that this f here is not"}, {"start": 1103.46, "end": 1110.02, "text": " the identity function, but let's say they have it somewhere."}, {"start": 1110.02, "end": 1124.58, "text": " But this right here, so the f of v post is this here, it's v post minus alpha tan h of"}, {"start": 1124.58, "end": 1126.38, "text": " v post."}, {"start": 1126.38, "end": 1128.54, "text": " Or is this the entire f?"}, {"start": 1128.54, "end": 1134.1399999999999, "text": " Yes, that's this, this thing right here."}, {"start": 1134.1399999999999, "end": 1141.74, "text": " If this is the case, if this is that this, if this is the signal minus the tan h, then"}, {"start": 1141.74, "end": 1145.74, "text": " something very, very, very interesting happens."}, {"start": 1145.74, "end": 1152.94, "text": " And that that's depending on this alpha right here, in that if this alpha is between if"}, {"start": 1152.94, "end": 1158.66, "text": " the alpha is between zero and one, then we simply have our monotonic function."}, {"start": 1158.66, "end": 1162.06, "text": " So here, you can see how big v post is."}, {"start": 1162.06, "end": 1165.7, "text": " So how big the output signal is here, that's the experiment we made before."}, {"start": 1165.7, "end": 1170.8600000000001, "text": " And here you can see what the feedback signal is, okay."}, {"start": 1170.8600000000001, "end": 1175.3, "text": " Or the integrator, the integrated signal, maybe this is in the wrong place."}, {"start": 1175.3, "end": 1179.56, "text": " And maybe f is just minus the tan h, I'm not sure."}, {"start": 1179.56, "end": 1183.58, "text": " But in any case, the way they build it after in the GRU, it's pretty explicit."}, {"start": 1183.58, "end": 1194.1399999999999, "text": " So this is the thing we said before, namely, if if the signal is very high, then this signal"}, {"start": 1194.1399999999999, "end": 1197.02, "text": " here will be high as well."}, {"start": 1197.02, "end": 1204.94, "text": " And because it's subtracted right here, it's going to push the signal back towards zero."}, {"start": 1204.94, "end": 1211.26, "text": " Again, if this is lower than zero, then this thing here will also be lower than zero."}, {"start": 1211.26, "end": 1214.8600000000001, "text": " And because it's subtracted, it's going to push the signal towards zero."}, {"start": 1214.8600000000001, "end": 1221.06, "text": " So this thing here is the stable point, it always push it back towards zero."}, {"start": 1221.06, "end": 1229.7, "text": " However, if we change the function, and we change just the parameter alpha to be 1.5,"}, {"start": 1229.7, "end": 1234.26, "text": " a very different thing happens that you can see right here."}, {"start": 1234.26, "end": 1240.86, "text": " Then it turns out, if your output signal is very, is very high, the same thing happens"}, {"start": 1240.86, "end": 1242.58, "text": " is going to be pushed back."}, {"start": 1242.58, "end": 1248.74, "text": " But if your output signal is between zero and this point right here, there is a regime"}, {"start": 1248.74, "end": 1256.62, "text": " where actually, even though the output signal is positive, you will be pushed towards this"}, {"start": 1256.62, "end": 1258.14, "text": " point right here."}, {"start": 1258.14, "end": 1262.76, "text": " And therefore, there is there are these two stable points right now."}, {"start": 1262.76, "end": 1266.66, "text": " And the stable point basically means if you deviate, if the signal deviates from it, it's"}, {"start": 1266.66, "end": 1269.06, "text": " going to be pushed back towards that point."}, {"start": 1269.06, "end": 1274.02, "text": " And you can see these two stable points, they're not at zero, they're actually at these two"}, {"start": 1274.02, "end": 1275.62, "text": " points here."}, {"start": 1275.62, "end": 1283.48, "text": " And that's pretty interesting, because that means you can potentially remember things"}, {"start": 1283.48, "end": 1288.06, "text": " with the cell, right, an output signal of zero is basically not informative."}, {"start": 1288.06, "end": 1294.82, "text": " But here, you can be in either the state here, or in the state here."}, {"start": 1294.82, "end": 1298.7, "text": " And the little little perturbations will still keep you in that state."}, {"start": 1298.7, "end": 1303.62, "text": " So you could potentially be in this state right here as an output, and the cell will"}, {"start": 1303.62, "end": 1310.62, "text": " just keep updating itself, and be stable and always output that signal right here."}, {"start": 1310.62, "end": 1318.2199999999998, "text": " And then you could go ahead and if you can provide some huge input signal right here,"}, {"start": 1318.2199999999998, "end": 1323.6999999999998, "text": " you could potentially throw this over to the other side over this hill, and then it would"}, {"start": 1323.6999999999998, "end": 1325.5, "text": " stabilize at this point."}, {"start": 1325.5, "end": 1330.3, "text": " So this is sort of a way to remember things within these biological cells."}, {"start": 1330.3, "end": 1331.3, "text": " Pretty cool."}, {"start": 1331.3, "end": 1337.2199999999998, "text": " Now, this here is a non filled out circle, that means it's an unstable point, it's technically"}, {"start": 1337.22, "end": 1342.58, "text": " stable in the sense that if you're exactly at zero, you will remain at zero."}, {"start": 1342.58, "end": 1347.38, "text": " But if you perturb even a little bit, you will go if you perturb a bit, you will go"}, {"start": 1347.38, "end": 1349.54, "text": " away from it."}, {"start": 1349.54, "end": 1356.66, "text": " Okay, I hope this sort of property is right is clear and why this is so fascinating, because"}, {"start": 1356.66, "end": 1362.42, "text": " we can use this these this fact that the stable points are not at zero and are more than just"}, {"start": 1362.42, "end": 1366.22, "text": " one stable point for remembering things."}, {"start": 1366.22, "end": 1372.78, "text": " And they're now trying to fill this into the gated recurrent unit."}, {"start": 1372.78, "end": 1377.8600000000001, "text": " So they call this the bi stable recurrent cell."}, {"start": 1377.8600000000001, "end": 1380.6000000000001, "text": " BRC."}, {"start": 1380.6000000000001, "end": 1383.18, "text": " And the formulas are these right here."}, {"start": 1383.18, "end": 1389.14, "text": " A little smaller, come on, can't zoom anymore."}, {"start": 1389.14, "end": 1392.1200000000001, "text": " Okay."}, {"start": 1392.1200000000001, "end": 1394.38, "text": " It looks almost the same as the GRU."}, {"start": 1394.38, "end": 1400.5, "text": " So the formulas are these, this, and this."}, {"start": 1400.5, "end": 1403.5400000000002, "text": " So let's analyze the differences to the GRU."}, {"start": 1403.5400000000002, "end": 1408.8600000000001, "text": " The first most striking difference is that a lot of weight matrices here have become"}, {"start": 1408.8600000000001, "end": 1410.3000000000002, "text": " single numbers."}, {"start": 1410.3000000000002, "end": 1415.1000000000001, "text": " So are single vectors, this here used to be a weight matrix."}, {"start": 1415.1000000000001, "end": 1417.42, "text": " And this used to be a matrix multiplication."}, {"start": 1417.42, "end": 1422.3600000000001, "text": " And you'll see this sort of throughout whenever the last hidden state is incorporated into"}, {"start": 1422.36, "end": 1431.26, "text": " these things, then you'll see that it is no longer a weight matrix, but is in fact a in"}, {"start": 1431.26, "end": 1435.74, "text": " a product with a vector a element wise product."}, {"start": 1435.74, "end": 1440.54, "text": " And that has a reason, namely what they want to model is individual neurons."}, {"start": 1440.54, "end": 1446.9399999999998, "text": " So on a biological level, a neuron can only feed back onto itself."}, {"start": 1446.94, "end": 1453.6200000000001, "text": " If there is a layer of neurons right here, they can only each feed back onto themselves."}, {"start": 1453.6200000000001, "end": 1462.14, "text": " Whereas in a recurrent neural network, my hidden vector, my hidden state is a vector."}, {"start": 1462.14, "end": 1466.78, "text": " And if I transform this into the next hidden state or any quantity, let's say I transform"}, {"start": 1466.78, "end": 1473.54, "text": " this H into this R right here, and this R is a vector too."}, {"start": 1473.54, "end": 1476.3400000000001, "text": " Then any interaction is possible."}, {"start": 1476.34, "end": 1481.34, "text": " So any cell, any entry in the vector here can influence any other vector because there's"}, {"start": 1481.34, "end": 1484.22, "text": " a big weight matrix in the middle."}, {"start": 1484.22, "end": 1488.3999999999999, "text": " They want to leave this away, they want to model this as close as possible to actual"}, {"start": 1488.3999999999999, "end": 1490.04, "text": " layers of neurons."}, {"start": 1490.04, "end": 1495.6399999999999, "text": " And therefore they say, okay, the input x can, you know, be distributed to all the neurons"}, {"start": 1495.6399999999999, "end": 1500.36, "text": " because technically the input comes from some other neurons down here, and they can all"}, {"start": 1500.36, "end": 1502.4599999999998, "text": " have connections to these neurons."}, {"start": 1502.46, "end": 1509.42, "text": " But these feedbacks, we only really observe them in individual neuron, this feedback cycle."}, {"start": 1509.42, "end": 1516.06, "text": " So that's why they model these recurrent weight products by just element wise products with"}, {"start": 1516.06, "end": 1517.4, "text": " vectors."}, {"start": 1517.4, "end": 1522.5, "text": " And then the second difference, you again see that there is this switch right here,"}, {"start": 1522.5, "end": 1524.44, "text": " this C switch."}, {"start": 1524.44, "end": 1534.42, "text": " And the C switch is like before, it's a sigmoid with where combine the output and the previous"}, {"start": 1534.42, "end": 1536.42, "text": " hidden state, there's nothing new here."}, {"start": 1536.42, "end": 1542.02, "text": " So this switch is the same, the cell has the possibility of letting in new information,"}, {"start": 1542.02, "end": 1547.5, "text": " or just ignoring the new current information, the xt."}, {"start": 1547.5, "end": 1550.2, "text": " The second thing is here."}, {"start": 1550.2, "end": 1551.98, "text": " And this is the same as well, right?"}, {"start": 1551.98, "end": 1557.06, "text": " The tanh, this is a combination of the new information, it's in case we want to let in"}, {"start": 1557.06, "end": 1562.74, "text": " the new information of the new information, and you need to decide what things of the"}, {"start": 1562.74, "end": 1567.66, "text": " old information to forget or remember."}, {"start": 1567.66, "end": 1570.34, "text": " Now the difference here is in this a."}, {"start": 1570.34, "end": 1578.3, "text": " So this a used to be again, this sigmoid of the combination, and now it's just slightly"}, {"start": 1578.3, "end": 1579.3, "text": " different."}, {"start": 1579.3, "end": 1581.5, "text": " It used to be sigmoid."}, {"start": 1581.5, "end": 1584.86, "text": " Now it's one plus tanh."}, {"start": 1584.86, "end": 1588.66, "text": " This is a very, very slight modification."}, {"start": 1588.66, "end": 1595.62, "text": " It's tanh, because tanh is between minus one and one instead of zero and one like the sigmoid,"}, {"start": 1595.62, "end": 1601.32, "text": " and the one plus makes it such that this is between zero and two."}, {"start": 1601.32, "end": 1605.66, "text": " And we've seen before that this critical behavior, there's two regimes to these functions, when"}, {"start": 1605.66, "end": 1612.74, "text": " it's between zero and one, this behaves like a classic gated recurrent unit, like a classic"}, {"start": 1612.74, "end": 1614.0600000000002, "text": " GRU."}, {"start": 1614.0600000000002, "end": 1619.38, "text": " But when it's between one and two, then you have that exact behavior that we saw before"}, {"start": 1619.38, "end": 1620.38, "text": " of the bi-stability."}, {"start": 1620.38, "end": 1627.74, "text": " Okay, so depending on what the a is, if the a is zero to one, it's a classic cell."}, {"start": 1627.74, "end": 1632.22, "text": " And if the a is one to two, it's a bi-stable cell."}, {"start": 1632.22, "end": 1636.82, "text": " And the network can decide by itself what it wants to do, because here it has, it can"}, {"start": 1636.82, "end": 1640.06, "text": " actually learn how to do that."}, {"start": 1640.06, "end": 1646.06, "text": " Alright, so this is the only change, the only change really, apart from it only being individual"}, {"start": 1646.06, "end": 1651.74, "text": " neurons feeding back on themselves, is that now this is no longer between zero and one"}, {"start": 1651.74, "end": 1658.34, "text": " with the sigmoid, this is now between zero and two, because it's one plus the tanh."}, {"start": 1658.34, "end": 1665.26, "text": " Very simple change, but the effect of this is pretty, pretty cool."}, {"start": 1665.26, "end": 1670.48, "text": " So they do some, here is like a schematic drawing of this."}, {"start": 1670.48, "end": 1676.3799999999999, "text": " If this a is between zero and one, again, you have this stable state that's at zero."}, {"start": 1676.3799999999999, "end": 1684.62, "text": " But if it's between one and two, you have two stable states at two non-zero points."}, {"start": 1684.62, "end": 1691.36, "text": " And again, this, we already saw this, but now this is for, I believe, this recurrent"}, {"start": 1691.36, "end": 1697.2199999999998, "text": " cell, this bimodal recurrent cell, not for the neuron itself."}, {"start": 1697.2199999999998, "end": 1702.4599999999998, "text": " And here they give an example of what happens when you run this particular signal, this"}, {"start": 1702.4599999999998, "end": 1709.08, "text": " particular time series, through a cell like this, while fixing the c and the a parameters."}, {"start": 1709.08, "end": 1715.22, "text": " So now the c and a parameters are learned, they're just fixed, and you see what happens."}, {"start": 1715.22, "end": 1724.08, "text": " Now, as you can see, the blue should be a classic, the classic behavior."}, {"start": 1724.08, "end": 1732.3, "text": " So in this blue case, what happens, you see right here, this c is moderately low."}, {"start": 1732.3, "end": 1738.74, "text": " So we saw the c is the switch of whether to leave in old information or take up new information."}, {"start": 1738.74, "end": 1742.22, "text": " If it's low, it means we want to take up new information."}, {"start": 1742.22, "end": 1743.22, "text": " This is reasonably low."}, {"start": 1743.22, "end": 1749.1, "text": " And that's why when the signal goes up here, the blue line goes up as well."}, {"start": 1749.1, "end": 1752.98, "text": " And when the signal goes down, the blue line goes down again, and so on."}, {"start": 1752.98, "end": 1757.9, "text": " So the blue line pretty straightforwardly follows the signal right here."}, {"start": 1757.9, "end": 1763.5, "text": " Okay, now in contrast to this, the red line is over this threshold."}, {"start": 1763.5, "end": 1767.9, "text": " So a is fixed at 1.5, c is still at 0.2."}, {"start": 1767.9, "end": 1772.7800000000002, "text": " So again, when this line goes up, then this line goes up."}, {"start": 1772.7800000000002, "end": 1780.26, "text": " But because this is near a this stable point, if it goes down again, it doesn't appear to"}, {"start": 1780.26, "end": 1786.26, "text": " go down enough, it sort of remembers that state it was in, it doesn't go down with the"}, {"start": 1786.26, "end": 1792.3000000000002, "text": " signal, only now that it goes down even further, it's over this threshold."}, {"start": 1792.3, "end": 1798.34, "text": " So we were in this situation now, and the first bump down was only like to here, and"}, {"start": 1798.34, "end": 1800.6, "text": " that pushed it up again."}, {"start": 1800.6, "end": 1804.98, "text": " But now it jumps over here because the signal is even lower."}, {"start": 1804.98, "end": 1808.94, "text": " And then the cell sort of switches to another state."}, {"start": 1808.94, "end": 1811.74, "text": " As you can see here, it goes down."}, {"start": 1811.74, "end": 1815.06, "text": " But then this bump here is not enough to bring it up again."}, {"start": 1815.06, "end": 1816.78, "text": " So it kind of remains in the state."}, {"start": 1816.78, "end": 1825.98, "text": " So you can see the, it sort of remembers the input and small deviations or small changes"}, {"start": 1825.98, "end": 1833.22, "text": " in signal don't manage to throw it away from that only larger things only it needs to go"}, {"start": 1833.22, "end": 1838.26, "text": " very the signal needs to go very much down in order for it to change state."}, {"start": 1838.26, "end": 1841.22, "text": " So that's pretty cool that there's this remembering behavior."}, {"start": 1841.22, "end": 1848.1000000000001, "text": " And now remember, in the actual implementation, these C and A parameters, this C and this"}, {"start": 1848.1000000000001, "end": 1854.58, "text": " A right here, aren't fixed, they are also determined by the cell itself."}, {"start": 1854.58, "end": 1859.46, "text": " And therefore the cell can decide by itself, when it wants to remember things, how hard"}, {"start": 1859.46, "end": 1862.08, "text": " it wants to remember things, and so on."}, {"start": 1862.08, "end": 1867.68, "text": " So we're going to check this out in an actual implementation."}, {"start": 1867.68, "end": 1872.74, "text": " So there's this one last modification they make, where they say, okay, they tried this,"}, {"start": 1872.74, "end": 1876.9, "text": " and it doesn't really work, because it works sometimes."}, {"start": 1876.9, "end": 1884.18, "text": " But there is this issue of these neurons connecting only back on themselves, which really makes"}, {"start": 1884.18, "end": 1888.3400000000001, "text": " the model much less powerful than a classic recurrent cell."}, {"start": 1888.3400000000001, "end": 1892.26, "text": " It's closer to biology, but it's much less powerful."}, {"start": 1892.26, "end": 1900.34, "text": " And there is this property they say of neural modulation, where technically, in real neurons,"}, {"start": 1900.34, "end": 1908.54, "text": " the one neuron here could influence another neuron by modulating these A and C parameters."}, {"start": 1908.54, "end": 1913.74, "text": " Okay, these A and C parameters, this is called neural modulation."}, {"start": 1913.74, "end": 1918.48, "text": " So there are interconnections between the neurons that influence how much other neurons"}, {"start": 1918.48, "end": 1920.36, "text": " remember and forget things."}, {"start": 1920.36, "end": 1926.9599999999998, "text": " So they decide, let's model that and lo and behold, we're now back to having weight matrices"}, {"start": 1926.9599999999998, "end": 1928.1, "text": " right here."}, {"start": 1928.1, "end": 1936.54, "text": " So this, this is sort of, they say, this is a not really a super biologically plausible"}, {"start": 1936.54, "end": 1939.34, "text": " way of implementing neural modulation."}, {"start": 1939.34, "end": 1942.1999999999998, "text": " But it sort of, it's an easier way."}, {"start": 1942.1999999999998, "end": 1947.02, "text": " And it brings us closer to the G back to the GRU."}, {"start": 1947.02, "end": 1952.58, "text": " And yeah, so now the only difference to the GRU is that the fact that here, there was"}, {"start": 1952.58, "end": 1956.26, "text": " a sigmoid, now it's a one plus tanh."}, {"start": 1956.26, "end": 1958.26, "text": " Okay."}, {"start": 1958.26, "end": 1961.36, "text": " I find this this pretty cool."}, {"start": 1961.36, "end": 1968.02, "text": " So now also, the only difference here is this property of bi stability, this is the only"}, {"start": 1968.02, "end": 1969.3, "text": " difference."}, {"start": 1969.3, "end": 1970.98, "text": " And now we can actually compare."}, {"start": 1970.98, "end": 1973.9, "text": " So let's compare."}, {"start": 1973.9, "end": 1981.7800000000002, "text": " They first give they do these sort of benchmarks, which are, they're pretty, pretty neat."}, {"start": 1981.7800000000002, "end": 1985.66, "text": " So they have this first benchmark where it's the copy first input benchmark, I'm having"}, {"start": 1985.66, "end": 1991.3200000000002, "text": " some trouble here moving this paper around with my fingers."}, {"start": 1991.3200000000002, "end": 1995.74, "text": " So the copy first input benchmark is simply a time series."}, {"start": 1995.74, "end": 2000.38, "text": " In this benchmark, the network is presented with a one dimensional time series of t time"}, {"start": 2000.38, "end": 2006.18, "text": " steps and the each entry is a is a random number."}, {"start": 2006.18, "end": 2011.98, "text": " After receiving the last time step, the network output value should approximate the very,"}, {"start": 2011.98, "end": 2014.1000000000001, "text": " very first input step."}, {"start": 2014.1000000000001, "end": 2019.18, "text": " Okay, so all the network needs to do is remember the first thing it sees."}, {"start": 2019.18, "end": 2021.5400000000002, "text": " And that's that should be learnable, right?"}, {"start": 2021.5400000000002, "end": 2028.18, "text": " That should be learnable because you can so you can, it's not specified whether the zero"}, {"start": 2028.18, "end": 2032.66, "text": " with hidden state, the initial hidden state is given into the network."}, {"start": 2032.66, "end": 2038.46, "text": " But technically, it doesn't matter, because it can just learn whatever that is, I can"}, {"start": 2038.46, "end": 2043.5, "text": " learn to have a designated bit in this hidden state."}, {"start": 2043.5, "end": 2050.06, "text": " So this hidden state is of size 100, I believe, one designated bit in the hidden state of"}, {"start": 2050.06, "end": 2056.62, "text": " whether it has already encountered the first thing, or not, if it has not encountered,"}, {"start": 2056.62, "end": 2060.8599999999997, "text": " it means that it's at the first time step, therefore, it should incorporate the new information"}, {"start": 2060.8599999999997, "end": 2062.62, "text": " into the hidden state."}, {"start": 2062.62, "end": 2068.06, "text": " And if and also set this bit, and then for each subsequent step, it can see I've already"}, {"start": 2068.06, "end": 2073.38, "text": " set this bit and it can simply close that gate that makes it incorporate new information."}, {"start": 2073.38, "end": 2079.8599999999997, "text": " So it should be able to carry this information all the way to the end by simply always closing"}, {"start": 2079.8599999999997, "end": 2083.68, "text": " that gate after the first step."}, {"start": 2083.68, "end": 2086.3199999999997, "text": " And what happens in this?"}, {"start": 2086.32, "end": 2096.82, "text": " So as you can see, when the result is all the results up here."}, {"start": 2096.82, "end": 2102.1000000000004, "text": " So this is after three, so they train it for 300,000 gradient descent iterations."}, {"start": 2102.1000000000004, "end": 2107.26, "text": " And you can see that when these time steps when the series are pretty small, the LSTM"}, {"start": 2107.26, "end": 2110.46, "text": " or the GRUs tend to perform well."}, {"start": 2110.46, "end": 2116.1800000000003, "text": " But you can see that these BRCs, they don't tend to perform poorly, they're just performing"}, {"start": 2116.18, "end": 2117.18, "text": " worse, right?"}, {"start": 2117.18, "end": 2122.98, "text": " It's zero, it's still the 0.01 regime or something like this of error."}, {"start": 2122.98, "end": 2128.8199999999997, "text": " However, when you go up to like 300 steps, then you can see the GRUs and the LSTMs, they"}, {"start": 2128.8199999999997, "end": 2135.5, "text": " start to fail, because they are not made explicitly to remember for that long, they don't have"}, {"start": 2135.5, "end": 2138.66, "text": " this by stability property."}, {"start": 2138.66, "end": 2143.52, "text": " Whereas now these things excel, you can see they're still pretty low."}, {"start": 2143.52, "end": 2148.5, "text": " And at 600 steps, these things completely fail, they completely forget the input."}, {"start": 2148.5, "end": 2159.06, "text": " So and the NBRC at least is still able to remember the first thing pretty, pretty well."}, {"start": 2159.06, "end": 2164.34, "text": " And yeah, so the second one is no, this is the first experiment, still the copy input"}, {"start": 2164.34, "end": 2170.78, "text": " benchmark, you can see right here that even at this three at this 100 thing, where the"}, {"start": 2170.78, "end": 2176.6600000000003, "text": " GRU still learns it, it learns it much, much later than the BRC, which learns it pretty"}, {"start": 2176.6600000000003, "end": 2177.9, "text": " fast."}, {"start": 2177.9, "end": 2184.6600000000003, "text": " Only here, when the when it's only five, when the series are only five steps long, does"}, {"start": 2184.6600000000003, "end": 2188.0600000000004, "text": " the GRU slightly outperform the BRC."}, {"start": 2188.0600000000004, "end": 2198.9, "text": " So the general notion here is that these classic cells are more powerful in like classic tasks,"}, {"start": 2198.9, "end": 2205.14, "text": " whereas these things are shining whenever these things fail, because they can't remember"}, {"start": 2205.14, "end": 2206.6600000000003, "text": " things for very long."}, {"start": 2206.6600000000003, "end": 2211.12, "text": " So they're not these new cells are not state of the art yet."}, {"start": 2211.12, "end": 2214.82, "text": " Possibly there are still some modifications to be made."}, {"start": 2214.82, "end": 2220.7400000000002, "text": " We've had a pretty long history of optimizing GRUs and LSTMs, they haven't always worked"}, {"start": 2220.7400000000002, "end": 2225.08, "text": " so well as they do now, because we kind of know how to handle them."}, {"start": 2225.08, "end": 2233.38, "text": " And I expect if these cells here take off, especially these NBRC, then with time will"}, {"start": 2233.38, "end": 2240.18, "text": " be as proficient at handling them, and they will probably become on par, or even outperform"}, {"start": 2240.18, "end": 2246.54, "text": " the LSTMs or GRUs on every day, like on all the tasks and then be especially good on tasks"}, {"start": 2246.54, "end": 2248.7, "text": " where you have to remember things."}, {"start": 2248.7, "end": 2252.86, "text": " But for now, they're outperformed by LSTMs and GRUs."}, {"start": 2252.86, "end": 2258.3, "text": " Okay, so the second thing is a more interesting experiment, the denoising benchmark, where"}, {"start": 2258.3, "end": 2266.2200000000003, "text": " they say the copy input benchmark is interesting, as a means to highlight the memorization capacity"}, {"start": 2266.2200000000003, "end": 2270.94, "text": " of the recurrent neural network, but it does not tackle its ability to successfully exploit"}, {"start": 2270.94, "end": 2275.98, "text": " complex relationships between different elements of the input signal to predict the output."}, {"start": 2275.98, "end": 2278.94, "text": " They have a new benchmark."}, {"start": 2278.94, "end": 2283.46, "text": " In the denoising benchmark, the network is presented with a two dimensional time series"}, {"start": 2283.46, "end": 2291.54, "text": " of t time steps, five different time steps are sampled uniformly with, okay, and are"}, {"start": 2291.54, "end": 2293.18, "text": " communicated to the network."}, {"start": 2293.18, "end": 2295.86, "text": " Okay, I'll just tell you what's going on."}, {"start": 2295.86, "end": 2299.02, "text": " So this new time series is two dimensional."}, {"start": 2299.02, "end": 2303.18, "text": " In the lower dimension, you simply have a bunch of random numbers like 5829."}, {"start": 2303.18, "end": 2310.2599999999998, "text": " Actually, these are numbers sampled from a uniform Gaussian or so."}, {"start": 2310.2599999999998, "end": 2312.4199999999996, "text": " So they're not actually 5829."}, {"start": 2312.4199999999996, "end": 2320.1, "text": " But you can imagine it like this 58293402, and so on."}, {"start": 2320.1, "end": 2326.5, "text": " And in the second dimension, you have a negative one, I believe, almost anywhere."}, {"start": 2326.5, "end": 2329.94, "text": " And then at some points, you have a one, so you have a negative one again, and then you"}, {"start": 2329.94, "end": 2334.82, "text": " have a one and a negative one again, and that last point of the sequence, you'll have a"}, {"start": 2334.82, "end": 2337.34, "text": " zero."}, {"start": 2337.34, "end": 2342.52, "text": " And so the zero is simply a marker that it's the end of the sequence."}, {"start": 2342.52, "end": 2347.48, "text": " What the network needs to do is it needs to output all the elements."}, {"start": 2347.48, "end": 2353.52, "text": " So the output of the network should be in this case, should be nine, four."}, {"start": 2353.52, "end": 2358.2200000000003, "text": " So all the elements where there was a one in order, okay."}, {"start": 2358.22, "end": 2364.66, "text": " So it remember what it needs to learn, it needs to learn to every time it sees a one"}, {"start": 2364.66, "end": 2370.58, "text": " in the second dimension, it needs to take the first dimension, put it somehow into the"}, {"start": 2370.58, "end": 2375.5, "text": " hidden state, and then carry that hidden state forward."}, {"start": 2375.5, "end": 2380.58, "text": " And sees a one again, it needs to take the second thing, also put it into the hidden"}, {"start": 2380.58, "end": 2384.3599999999997, "text": " state, but not override the first thing it put into the hidden state."}, {"start": 2384.36, "end": 2389.58, "text": " Like if it were to just realize, I need to put this into the hidden state, then it would"}, {"start": 2389.58, "end": 2392.44, "text": " almost surely override the previous information."}, {"start": 2392.44, "end": 2399.06, "text": " So it needs to be able to say, I've already kind of in my h is going to be a vector of"}, {"start": 2399.06, "end": 2405.6, "text": " 100 dimensions, it needs to be able to say, well, I've already stored a bunch of stuff"}, {"start": 2405.6, "end": 2408.54, "text": " in that part of the vector."}, {"start": 2408.54, "end": 2411.78, "text": " Maybe I should store that thing here over here."}, {"start": 2411.78, "end": 2414.5, "text": " So this is fairly complex things to remember."}, {"start": 2414.5, "end": 2418.1000000000004, "text": " And technically, GRUs and LSTMs are able to do it."}, {"start": 2418.1000000000004, "end": 2422.2000000000003, "text": " But as we'll see, they're not as much."}, {"start": 2422.2000000000003, "end": 2432.6200000000003, "text": " The results are in this table, where you can clearly see that whenever the n so the n,"}, {"start": 2432.6200000000003, "end": 2439.86, "text": " the n is a parameter, that is how far how far in this direction are these ones."}, {"start": 2439.86, "end": 2443.7400000000002, "text": " So when n is zero, the ones can be anywhere."}, {"start": 2443.7400000000002, "end": 2449.26, "text": " But when n here is like five, that means that the last five ones surely don't contain a"}, {"start": 2449.26, "end": 2450.26, "text": " one."}, {"start": 2450.26, "end": 2456.6600000000003, "text": " That means only the first whatever, l minus l minus five contain the one."}, {"start": 2456.6600000000003, "end": 2462.02, "text": " So the higher this number n is, the harder the task because your learning signal is way,"}, {"start": 2462.02, "end": 2469.34, "text": " way farther away from the from what's when you get the output."}, {"start": 2469.34, "end": 2475.48, "text": " So you can see when the n is low, then the GRUs and the LSTMs they perform pretty well,"}, {"start": 2475.48, "end": 2478.2200000000003, "text": " but also these cells perform pretty well."}, {"start": 2478.2200000000003, "end": 2480.78, "text": " They're just not performing as well."}, {"start": 2480.78, "end": 2486.82, "text": " However, when the task gets harder, and you actually need to learn a sparse signal over"}, {"start": 2486.82, "end": 2492.7000000000003, "text": " a long period of time where in between you don't get any signal, the GRUs and the LSTMs"}, {"start": 2492.7000000000003, "end": 2499.28, "text": " fail while the BRCs would still be able to learn these kinds of things."}, {"start": 2499.28, "end": 2500.6600000000003, "text": " So that's, that's fairly cool."}, {"start": 2500.6600000000003, "end": 2506.3, "text": " Now it's if from a researcher's perspective, I wonder if they just first tried this task,"}, {"start": 2506.3, "end": 2510.36, "text": " you know, as I described it, and then they discovered like, ah, crap, they can still"}, {"start": 2510.36, "end": 2514.9, "text": " do it and like, okay, how can we make it such that there is a difference?"}, {"start": 2514.9, "end": 2517.6200000000003, "text": " Okay, let's actually make the task harder like this."}, {"start": 2517.6200000000003, "end": 2518.82, "text": " And then they did that."}, {"start": 2518.82, "end": 2524.7000000000003, "text": " I wonder if they always had the idea with the n here, or just introduced this after"}, {"start": 2524.7, "end": 2530.74, "text": " after it, they failed to produce a difference in the first place."}, {"start": 2530.74, "end": 2532.5, "text": " I'm not sure."}, {"start": 2532.5, "end": 2536.3799999999997, "text": " But they have they have another benchmark, but they basically show that these cells are"}, {"start": 2536.3799999999997, "end": 2541.8799999999997, "text": " actually good, can incorporate this information, can reason about what they need to remember"}, {"start": 2541.8799999999997, "end": 2543.14, "text": " and whatnot."}, {"start": 2543.14, "end": 2548.8999999999996, "text": " And in the end, they also have this sequential MNIST, where they just feed an MNIST digit,"}, {"start": 2548.9, "end": 2554.82, "text": " digit by digit, and at the end, I think the the output of the neural network needs to"}, {"start": 2554.82, "end": 2559.1, "text": " be the class of the of the MNIST digit."}, {"start": 2559.1, "end": 2564.82, "text": " And again, here, they have a parameter called n black, which means that so they have an"}, {"start": 2564.82, "end": 2571.3, "text": " MNIST digit, it's like a three, they unroll it to a single vector, right?"}, {"start": 2571.3, "end": 2575.04, "text": " They feed this one by one into the recurrent network."}, {"start": 2575.04, "end": 2580.22, "text": " And then after that, they attach a certain number of just empty pixels, black pixel."}, {"start": 2580.22, "end": 2583.98, "text": " And after that, the network needs to predict the y."}, {"start": 2583.98, "end": 2590.14, "text": " You can see, if they asked the network the class of the digit, immediately after it's"}, {"start": 2590.14, "end": 2596.7799999999997, "text": " done, then the GRUs and the LSTM perform fairly well, as do the BRCs."}, {"start": 2596.7799999999997, "end": 2602.38, "text": " But if you attach a whole bunch of these black pixels, remember, an MNIST digit has some"}, {"start": 2602.38, "end": 2609.52, "text": " seven sorry, 784, maybe entries."}, {"start": 2609.52, "end": 2616.54, "text": " So attaching 300 black pixels is quite significant in in terms of the length of the sequences."}, {"start": 2616.54, "end": 2623.2200000000003, "text": " And then the GRUs and the LSTMs, they can't learn, they can't learn to ignore these things"}, {"start": 2623.2200000000003, "end": 2628.8, "text": " because the learning signal is just too far away right here."}, {"start": 2628.8, "end": 2634.86, "text": " But these things, they can because they can exploit this by stability property and remember"}, {"start": 2634.86, "end": 2636.34, "text": " things."}, {"start": 2636.34, "end": 2639.82, "text": " Again, I wonder how this came to be."}, {"start": 2639.82, "end": 2641.5800000000004, "text": " It seems pretty funny."}, {"start": 2641.5800000000004, "end": 2645.7400000000002, "text": " But the last thing they do is they investigate what happens in their cells."}, {"start": 2645.7400000000002, "end": 2649.46, "text": " And this, I feel is the most interesting part."}, {"start": 2649.46, "end": 2651.54, "text": " And they do this on this denoising benchmark."}, {"start": 2651.54, "end": 2656.98, "text": " So the task we've looked at before where you need to remember five randomly selected numbers"}, {"start": 2656.98, "end": 2660.66, "text": " that are indicated by the second dimension."}, {"start": 2660.66, "end": 2669.42, "text": " Here they show a sequence where the five numbers occur at 3100, 246, at 300, and at 376."}, {"start": 2669.42, "end": 2674.16, "text": " So these are the five positions where the sequence indicates that the network should"}, {"start": 2674.16, "end": 2679.78, "text": " remember the thing in the first dimension and then output."}, {"start": 2679.78, "end": 2681.9, "text": " They analyze two things."}, {"start": 2681.9, "end": 2684.58, "text": " They analyze the proportion of bistable neurons."}, {"start": 2684.58, "end": 2688.58, "text": " So basically, they analyze these A quantities."}, {"start": 2688.58, "end": 2694.8199999999997, "text": " And they analyze how many of the neurons in the layer have an A that's higher than one,"}, {"start": 2694.8199999999997, "end": 2698.2799999999997, "text": " which means that they are in this bistable mode."}, {"start": 2698.2799999999997, "end": 2704.8199999999997, "text": " And also they analyze what's the average value of C. So C, if you remember, if this is high,"}, {"start": 2704.8199999999997, "end": 2707.62, "text": " it means it doesn't let in new information."}, {"start": 2707.62, "end": 2711.54, "text": " And if this is low, it means it lets in new information."}, {"start": 2711.54, "end": 2716.3, "text": " If you first look at the C, you can see that every single time when the second dimension"}, {"start": 2716.3, "end": 2722.82, "text": " indicates that this is one of the inputs to remember, the network immediately drops the"}, {"start": 2722.82, "end": 2724.2599999999998, "text": " C values."}, {"start": 2724.2599999999998, "end": 2726.1, "text": " The different colors here are different layers."}, {"start": 2726.1, "end": 2733.02, "text": " The recurrent network has multiple layers of these cells, as is usual in the recurrent"}, {"start": 2733.02, "end": 2735.06, "text": " neural networks."}, {"start": 2735.06, "end": 2739.18, "text": " So this C, as you can see, it goes up pretty quickly."}, {"start": 2739.18, "end": 2744.8999999999996, "text": " And then as soon as one of these inputs appear, the C drops, which basically means that the"}, {"start": 2744.8999999999996, "end": 2749.62, "text": " network realizes it now must let in the new information."}, {"start": 2749.62, "end": 2756.06, "text": " And then it immediately shoots back up, makes it seem like so the network says, okay, as"}, {"start": 2756.06, "end": 2760.66, "text": " long as so all of these inputs here, they have the negative one in the second dimension,"}, {"start": 2760.66, "end": 2761.66, "text": " right?"}, {"start": 2761.66, "end": 2765.46, "text": " So it recognizes it says there's no reason for me to incorporate that information."}, {"start": 2765.46, "end": 2766.68, "text": " It's not important."}, {"start": 2766.68, "end": 2772.14, "text": " And as soon as the second input comes, it immediately shoots down again."}, {"start": 2772.14, "end": 2776.66, "text": " Now you can see this here is the last layer of the network, the highest layer, so sort"}, {"start": 2776.66, "end": 2781.02, "text": " of the highest abstractive information."}, {"start": 2781.02, "end": 2787.18, "text": " And you can see that from input to input, this value of C gets higher and higher."}, {"start": 2787.18, "end": 2794.44, "text": " And these spikes as they go down, but they go down to a higher and higher point, which,"}, {"start": 2794.44, "end": 2800.2200000000003, "text": " you know, is is the fact that it recognizes it needs to let in new information."}, {"start": 2800.2200000000003, "end": 2806.18, "text": " But it lets in less and less new information, the more things it needs to remember."}, {"start": 2806.18, "end": 2810.18, "text": " So not only does it recognize, wait, I need to remember this, it also recognizes, but"}, {"start": 2810.18, "end": 2817.46, "text": " I probably shouldn't, shouldn't, you know, completely forget what I had previously."}, {"start": 2817.46, "end": 2821.32, "text": " Because I it is important for me to remember these previous things."}, {"start": 2821.32, "end": 2826.02, "text": " So that's a pretty cool demonstration, the fact that these go down at the input and the"}, {"start": 2826.02, "end": 2832.06, "text": " fact that generally they go up every time after a new input is incorporated into the"}, {"start": 2832.06, "end": 2834.06, "text": " hidden state."}, {"start": 2834.06, "end": 2840.98, "text": " This basically, this shows that the or this is a pretty good indication that what they're"}, {"start": 2840.98, "end": 2844.34, "text": " saying is really happening, right?"}, {"start": 2844.34, "end": 2849.94, "text": " Okay, the second thing shows almost the same, it shows how many of these neurons are actually"}, {"start": 2849.94, "end": 2852.1, "text": " in their bi stable mode."}, {"start": 2852.1, "end": 2860.3, "text": " And you can also see right here that especially in the last layer, you can see that the number"}, {"start": 2860.3, "end": 2867.42, "text": " of neurons in the bi stable mode goes up and up and up and up after each of these steps."}, {"start": 2867.42, "end": 2874.3, "text": " And these spikes here correspond to always the points where they have to let in new information."}, {"start": 2874.3, "end": 2878.32, "text": " Okay, cool."}, {"start": 2878.32, "end": 2881.5800000000004, "text": " So I find that I find this to be pretty cool."}, {"start": 2881.5800000000004, "end": 2886.46, "text": " And I find this last experiment to be the coolest where they can actually show look"}, {"start": 2886.46, "end": 2892.6600000000003, "text": " here, there's a pretty good indication that the thing we we built does what we say it"}, {"start": 2892.6600000000003, "end": 2895.28, "text": " does."}, {"start": 2895.28, "end": 2900.02, "text": " They also actually have a proof here of the bi stability."}, {"start": 2900.02, "end": 2904.26, "text": " When this a is higher than one, I won't go through this right here."}, {"start": 2904.26, "end": 2907.46, "text": " But if you want, you can look at that."}, {"start": 2907.46, "end": 2912.54, "text": " I'm excited to see what happens with these kinds of architectures in the future, because"}, {"start": 2912.54, "end": 2915.5, "text": " it seems to be a pretty minor modification."}, {"start": 2915.5, "end": 2921.34, "text": " And maybe with a little bit of more modification, or if we sort of just tune this a little bit"}, {"start": 2921.34, "end": 2925.7, "text": " and kind of figure out what we have to do to make these things actually compete with"}, {"start": 2925.7, "end": 2932.26, "text": " the classic GRUs and LSTMs in regimes where long memory isn't necessary."}, {"start": 2932.26, "end": 2937.82, "text": " I feel this could be a you know, kind of a standard building block in the recurrent neural"}, {"start": 2937.82, "end": 2943.2200000000003, "text": " network toolkit, even though it's been sort of outperformed by transformers in previous"}, {"start": 2943.2200000000003, "end": 2944.2200000000003, "text": " years."}, {"start": 2944.2200000000003, "end": 2946.7400000000002, "text": " All right, that was it for me."}, {"start": 2946.7400000000002, "end": 2951.46, "text": " And I hope you had fun with this paper, I invite you to check it out."}, {"start": 2951.46, "end": 2962.98, "text": " And bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=8l-TDqpoUQs
SynFlow: Pruning neural networks without any data by iteratively conserving synaptic flow
The Lottery Ticket Hypothesis has shown that it's theoretically possible to prune a neural network at the beginning of training and still achieve good performance, if we only knew which weights to prune away. This paper does not only explain where other attempts at pruning fail, but provides an algorithm that provably reaches maximum compression capacity, all without looking at any data! OUTLINE: 0:00 - Intro & Overview 1:00 - Pruning Neural Networks 3:40 - Lottery Ticket Hypothesis 6:00 - Paper Story Overview 9:45 - Layer Collapse 18:15 - Synaptic Saliency Conservation 23:25 - Connecting Layer Collapse & Saliency Conservation 28:30 - Iterative Pruning avoids Layer Collapse 33:20 - The SynFlow Algorithm 40:45 - Experiments 43:35 - Conclusion & Comments Paper: https://arxiv.org/abs/2006.05467 Code: https://github.com/ganguli-lab/Synaptic-Flow My Video on the Lottery Ticket Hypothesis: https://youtu.be/ZVVnvZdUMUk Street Talk about LTH: https://youtu.be/SfjJoevBbjU Abstract: Pruning the parameters of deep neural networks has generated intense interest due to potential savings in time, memory and energy both during training and at test time. Recent works have identified, through an expensive sequence of training and pruning cycles, the existence of winning lottery tickets or sparse trainable subnetworks at initialization. This raises a foundational question: can we identify highly sparse trainable subnetworks at initialization, without ever training, or indeed without ever looking at the data? We provide an affirmative answer to this question through theory driven algorithm design. We first mathematically formulate and experimentally verify a conservation law that explains why existing gradient-based pruning algorithms at initialization suffer from layer-collapse, the premature pruning of an entire layer rendering a network untrainable. This theory also elucidates how layer-collapse can be entirely avoided, motivating a novel pruning algorithm Iterative Synaptic Flow Pruning (SynFlow). This algorithm can be interpreted as preserving the total flow of synaptic strengths through the network at initialization subject to a sparsity constraint. Notably, this algorithm makes no reference to the training data and consistently outperforms existing state-of-the-art pruning algorithms at initialization over a range of models (VGG and ResNet), datasets (CIFAR-10/100 and Tiny ImageNet), and sparsity constraints (up to 99.9 percent). Thus our data-agnostic pruning algorithm challenges the existing paradigm that data must be used to quantify which synapses are important. Authors: Hidenori Tanaka, Daniel Kunin, Daniel L. K. Yamins, Surya Ganguli Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we're looking at pruning neural networks without any data by iteratively conserving synaptic flow by Hidenori Tanaka, Daniel Kunin, Daniel L.K. Yamins and Surya Ganguly. So this paper on a high level does what the lottery ticket hypothesis does, but does so without any data, it prunes a neural network at the beginning. And it does so, it's able to do that, because it claims that its algorithm avoids this problem called layer collapse, and then is based on conserving a quantity they call the, the synaptic flow. And we're going to look at this. And it's pretty cool algorithm, it seems to work pretty well. As always, if you want to help out, you can share this video. And let me know in the comments what you think of it. I do read the comments. And I would love to hear from you. Alright, let's dive in. So they're saying pruning the parameters of deep neural networks has generated intense interest due to potential savings in time, memory and energy, both during training and at test time. Recent works have identified through an expensive sequence of training and pruning cycles, the existence of winning lottery tickets or sparse trainable sub networks at initialization. So what is this paper talking about? If you if you don't know much about pruning, here is kind of a basic overview. So if you have a neural network that consists of many, many layers of neurons, what you can do that one way of pruning that what what the goal is, is to end up with a small neural network that performs well. But for now, we have a big neural network that doesn't perform well, it hasn't been trained yet, right. So what you can do is you can first train the neural network. And then you have a big neural network that performs well, and then you can prune it. Now a lot of times, a lot of the time this this has been seen as sort of the pruning way, you would train the big neural network, and then you would prune it, because the other way was not feasible. First pruning, and then training was not feasible. You might you might ask, okay, we might just want to start with a small one. And yeah, that's correct. So what does this first way by you, this first way is buys you mainly two things. So imagine this network right here is much smaller than the original network. So it is less, it uses less storage. So you can potentially if you want to ship it to like a customer over the internet, you maybe instead of a gigabyte, you only have to transfer a few megabytes. And that's pretty cool. The second thing if you prune in the correct way, you can also make it faster because now there's less weights to multiply with, you can actually make it go faster. So pruning is a now this this combines with techniques called distillation and so on is our ways to make the networks smaller and faster. So if your customers are for example, on on mobile phones, then you can ship you can train a big network to a good performance on your big GPU server, and then ship it out to a mobile phone once it's small, and it will perform fairly well on that mobile phone without GPU. So what about this other way? Now, in order to do the other way, we would sort of have to have an idea which one of these big networks which sub parts of these layers are the good ones right in order for us to do this first prune and then train. The interesting thing is that the paper the lottery ticket hypothesis, I've done a video on this and we've also interviewed the author on our ML street talk podcast. This paper has shown that this is in fact possible. A long time people have thought we need the big network in order to train right we sort of the bigness of the network, the full connectedness of the network is required for the training dynamics. But this paper has shown this is not possible, you can prune at the very beginning. Now what does it do? It first trains in neural network, like in the in the olden days, then it prunes the neural network, and then it remembers which connections of the train neural network it has pruned. And then it simply goes back to the beginning of training right here, up here, and says, I now know which connections are important. And I'm simply going to prune all the other connections other than these ones. And then interestingly, if you prune first, and then train, that works just as well and can actually work even better. The interesting thing here is that I mean, this is a big, big cycle. But the interesting thing that the paper demonstrates is that this is even possible, right? People thought it wasn't possible. And this paper demonstrates if you only knew if you only knew which ones you must retain, you can prune at the beginning of training. The lottery ticket hypothesis paper, though still requires to actually train the full network and then do the pruning, like in a classic way in order to find out which ones you need to prune and which ones you don't. This paper right here takes that idea and says, can we find? Can we find a pruning algorithm that prunes at the beginning of training, yet does not have to train the full network, in fact, doesn't look at any of the data? Okay, and this is going to be our starting point. So their story is going to be, it's quite an involved story. And I think the overview is important as we go through the paper. So first, they named this problem called layer collapse. Now layer collapse is going to be whenever a pruning algorithm removes the entirety of a neural network layer, which means that no information can flow anymore, and therefore the network can't train. And they claim that this is the main problem why these current pruning algorithms cannot achieve very high pruning ratios. So can like very high compression ratios is because they do premature layer collapse. They then formulate this maximal critical compression axiom that has sort of a guiding principle to build pruning algorithms. Second, they show that this quantity called synaptic saliency, a general class of gradient based scores for pruning is conserved at every hidden unit layer of a neural network. So they show that these are conserved. And they show this because this is their their argument is going to be first the argument is layer collapse is a problem. The second argument is these things are conserved and these the conservation of the synaptic saliency leads to the layer collapse. And we're going to see how that happens. And then third, they say the solution to that is iterative pruning. So they show this at the at the example of iterative magnitude pruning, which we know avoids layer collapse. So iterative magnitude pruning is something that happens in this lottery ticket way of of doing it. This lottery ticket way, you can actually do it not in one step, but it tends to work better when you want to go from 100% of your weights to just 5% of your weights, it tends to work better if you do it in stages. So first you go to 90% to 80 to 70 and so on, down to your desired thing. And this iterative procedure, they claim is what is what circumvents this problem of layer collapse. And then at last, they say we proved that a pruning algorithm avoids layer collapse entirely and satisfies blah, blah, blah, if it uses iterative positive synaptic saliency scores. So they bring it all together and say, if an algorithm satisfies our axiom, and if the algorithm is an algorithm that uses these saliency scores, like this one here, and if the algorithm is iterative, then it is not going to be subject to layer collapse, and therefore, it is going to be able to compress to a very high compression ratio. And then they actually do suggest an algorithm, this synaptic, sorry, iterative synaptic flow pruning SynFlow, that does all of this and never looks at any data. Alright, this is quite a story. But remember what we're doing first, layer collapses a problem. Second, why is layer collapse a problem? It's because of this synaptic saliency conservation. Third, we can avoid it by doing iterative pruning and lastly, this algorithm does it without looking at data. Okay, so layer, layer collapse, layer collapse is a pretty simple phenomenon. I've already said it, if you have a neural network, and it has a bunch of layers, and let's draw a couple of neurons here, and the neurons are connected to each other via connections, connections, connections, connections. And you have a pruning algorithm. Now the prunings algorithms they consider here are so called single shot pruning algorithms. What they do is they look at the neural network and this can be before training or after training. But they at some point, they look at the neural network, and they each they assign a score to each of these weights, like they'll say, you're one, you're a five, you're a nine, and so on. And then they simply prune away the lowest scores. Okay. And you tell the network what compression ratio you want to you tell the network, for example, please prune away 90% of the connections. So these algorithms would look would assign the scores once and then remove the bottom 90% of weights. Okay, like this. So those are the single shot pruning algorithms. Now what is layer collapse? Layer collapse is whenever an algorithm removes all of one layer, because maybe so here was a nine, maybe you have like 11, 12, 13 here, okay, so and then you're in you're in this situation right here. And the algorithm is pretty, it's pretty dumb. It's simply removing the bottom 90% of the connections. And here it figures I need to remove one more to meet that goal. I remove the one with the lowest score, I'm going to remove this one. And it's pretty obvious that now no more information can flow from the beginning to the end of the network, because, well, what's, where is it going to float to? It's a bit more complex than that, like, you can just retain a layer like a connection. For example, if this were a connection, there would also be no information flow because you'd have no outgoing connection here. But ultimately, layer collapse is whenever an entire layer is removed. Okay. And they they do say somewhere that that's the case. I think layer collapse here, layer collapse occurs when an algorithm prunes all parameters in a single weight layer, even when prunable parameters remain elsewhere in the network. So I'm not as such, I'm not sure that this is like a giant problem. It gets to be a problem, but it could be circumvented fairly easily, right by simply saying, if you're about to prune a connection, that's integral to the information flow from the start to the end, don't prune that connection, prune some other connection, right. And then you could simply avoid that. And I'd be interested in how that works out. So but in this case, for purposes of this paper, they simply consider algorithms that assign a score and then prune the bottom couple of percent, okay, for so we don't want any like handcrafted rules in here or something. So they look at this quantity called the max compression. The max compression is a quantity that's basically the maximum achievable compression whilst still avoiding layer collapse. And they say, for example, for a network with l layers and n parameters, the max compression is n over l, which is basically means every layer only has one parameter remaining and therefore, if it's the correct one, therefore, information can flow from start to the end. All right, so this is the maximum achievable compression, anything beyond that would automatically induce layer collapse. Now, anything before that could induce layer collapse, but there is a way to compress the network to the same level without inducing layer collapse. And their point is basically that these other compression algorithms that they compare with, they always they always induce layer collapse before they actually have to because they cut off a connection that leads to layer collapse before they like there would be another connection that they could cut off that would not lead to layer collapse. And of course, if you are layer, if you have done a layer collapse, then you accuracy immediately drops to zero or two random, because no more information flow. So they look at these things here, random pruning is where you simply assign a random score to each connection. Magnitude pruning is what the lottery ticket hypothesis does, but just they look here at a single shot. So you simply look at the magnitude of the weights, and this can be before after training, I think they do it after training here, which is classically done, you look at the magnitude of the weights and you prune the bottom 90% away. There are also two more advanced methods, these SNIP and the GRASP, so SNIP and GRASP, which look at the gradient of the training loss in the network, and they decide according to that gradient, which which things to cut and which things not to cut away. The GRASP even involves the Hessian right here. So they're fairly, you know, complex method that have some thoughts behind them about why they do what they do, yet they all induce layer collapse before they actually have to. So they define this thing here called the critical compression. The critic the critical compression is the maximal compression ratio a given algorithm can achieve without inducing layer collapse. So the critical compression here is basically whenever that algorithm goes to zero, that's the critical compression, that's kind of the farthest you can push the algorithm without him without sorry, German speaker, without it induced without it inducing layer collapse. Okay, so you can see that for these baseline algorithms, the layer collapse occurs way below the theoretically possible max compression. And we're going to see that in their algorithm, this sin flow, that this max compression is achieved, and it's actually achieved without any of these handcrafted rules that I mentioned, it is the algorithm by design already achieves this maximum compression ratio. So they formulate this here as a guiding principle. They formulate is an axiom, I would, I would rather say it's like this kind of a, it's kind of a guiding principle of building these algorithms that any algorithm you build should have. So the critical compression ratio of a pruning algorithm applied to a network should always equal the max compression of that network. It basically means when you build a pruning algorithm, if you push that pruning algorithm to its limits, it should not do layer collapse unless it absolutely needs to. Okay. Again, the extent of this problem, I don't, I don't know, but they do demonstrate that that they can push their algorithm a fair bit further. Now without inducing layer collapse, you already see that these other algorithms like in this regime, apparently layer collapse hasn't happened yet, because they still have sizable accuracy. But there's still a, you know, there is a reasonable difference here between those and the sin flow algorithm. So I'm not too convinced yet that layer collapse as such is the problem, because they have a difference before their layer collapsing, as you can see, right here. And I have a feeling that this difference here is due to this iterative procedure and not actually due to the phenomenon of layer collapse. But yeah, so if it were only layer collapse, what you'll see is that they do the same, the same, the same, and then at some point is like, boom, now I have layer collapse. Okay. Yeah, so the layer collapse story, I'm not sure, but it's part of the story. So let's, let's go with that. The second part, which is kind of disconnected. So they established two things, they established a layer collapse problem. And now they establish the synaptic saliency, which then later they're going to connect to the layer collapse. So the synaptic saliency, they say, is a score, is any score metric that can be expressed as the Hadamard product of this thing with the parameters. Okay. So each parameter is going to be multiplied by the gradient of some function with respect to that parameter. They say where R is a scalar loss function of the output of a feed forward neural network parameterized by theta. Okay, so many of these pruning algorithms can be formulated in this framework right here. And their, their algorithm can also be formulated in this framework. So you can see the score that the algorithm assigns to a weight can be defined as such. And as I said, many fall into this category or are similar to this, especially, for example, they say when R is the training loss L, so this is the simplest case, you take you put data through the network, and then you take the training loss of that data and you sort of back propagate it. And now you're going to prune these connections according to how big the gradient is. If you say the gradient is very big, that must mean the connection is very important. Because there's lots of information flowing through it. So if it's the training loss L, the resulting synaptic saliency metric is equivalent to the score metric used in skeletonization, one of the first network pruning algorithms. The resulting metrics metric is also closely related to this right here. Now this you can see it's not exactly the same, but it's closely related to the one used in this snip baseline, and also closely related to this thing right here used in grasp, where it's not just the gradient, it's actually the gradient multiplied by the hessian to account for curvature. Okay, so they're going to investigate this synaptic saliency in neural networks. They formulate two theorems right here about the conservation of synaptic saliency. Remember synaptic saliency is any score that respects this, that is built like this, any score s. The conservation of synaptic saliency, all synaptic saliency metrics respect two surprising conservation laws that hold at any initialization and step in training. So these are not usually like in distribution or something like this with high probability. These things hold at any point in the neural network. First is the neuron wise conservation of synaptic saliency. For a feed forward neural network with homogeneous activation functions, and a homogeneous activation function is an activation function that is can be expressed like this, for example, ReLUs fall into that category, the sum of the synaptic saliency for the incoming parameters is to a hidden neuron is equal to the sum of the synaptic saliency for the outgoing parameters from the hidden neuron. So what does it mean? It's actually pretty simple. If you have a hidden neuron, and you look at all the incoming weights, and you look at their synaptic saliency, which is this s score of each of these weights, like what would the pruning algorithm assign to that, and you look at the outgoing ones, then the sum of all the incoming ones is going to be equal to the sum of all the outgoing ones. So that's pretty interesting. And they extend that to layer to the entire network. So an extension of that network wise conservation of synaptic saliency, the sum of the synaptic saliency across any set of parameters that exactly separates the input neurons from the output neurons of a feed forward neural network with homogeneous activation functions equals that. So it basically says it remains equal. So what does it mean? It doesn't mean to exactly separate the input from the output. That's basically the definition of a layer in a neural network. So what they're saying is that you have a bunch of layers. And if you look at a particular layer, like this one here, and you look at the incoming connections, and you sum up all of their synaptic saliencies, that's going to be equal to the sum of all the synaptic saliencies of the outgoing connections of that layer. And it can also apply to like a group of layers and so on. But the synaptic saliency is conserved in that way. Now why is that important? And here is where we make the connection with the layer was it later drop layer, whatever, okay, the fact that the fact that these algorithms tend to drop entire layers before they have to, if you have in your network layers that are of different sizes, so you have large layers, and then smaller layers and smaller layers, what will happen is that since the synaptic saliency is conserved, the sum is conserved, if you have more connections in one layer, so lots of connections, lots of connections, and in the small layers, you don't have as many connections, the sum is equal. So that means each individual one here is much, much smaller. So the S is very small for each individual one here, and the S is very large in there. That means the pruning algorithm is going to really, really kill off this these connections in the big layers, right. And it's actually going to kill them off to a point where it probably is going to eliminate that layer before it even prunes many of the connections of the small layer, just because of that conservation fact. And they do experiments like this. I think there's an experiment up here, where I like this one down here better, where they basically show that you have inverse layer size on the bottom, and you have the average score that the pruning algorithm assigns to any connection. Now these, as we've seen, they're not exactly assigning the scores of this saliency, but they're very close to it. The Synflow algorithm does exactly assign the synaptic saliency as the score for the pruning. Now, we've basically seen that this leads to a bad result, but the synaptic flow is going to compensate for that. But in essence, as you can see, as the layers get, so inverse layer size grows, which means that layer size shrinks, as the layer size gets smaller, the average score of the connections in the layer is higher and higher, which basically means that the pruning algorithm, if you just let it go by itself, it's going to kill off the smaller, sorry, the larger layers first, because they have the smaller scores. And you can see that even though the other algorithms don't conform exactly to that, they conform to this approximately. So these here, because their score is closely related to what the Synflow does, and the magnitude pruning, because mostly because now I'm not sure if that's at the end of the training at the beginning of the training, if you just initialize, then the score is going to be proportional to, it's going to be proportional to their magnitude and their magnitude is determined by the initialization scheme. And the initialization scheme is most of the time like modern initialization schemes compensate for the fact that you have different number of incoming and outgoing connections, and therefore, they would automatically assign higher number, sorry, a higher initialization constant to layers that have the lower number of parameters. So even the magnitude pruning will conform to this. Now it might be absolutely reasonable to say that that's also the case at the end of training, because most parameters aren't going to move super much during training. So this still approximately holds as you can see here. Of course, the random one doesn't do that. Yet, because you prune randomly, you're still absolutely subject to this layer collapse. In fact, in the random one, the smallest layers would be the ones to go away first because it's just more probable. Okay. So we've discovered that if you do something like saliency scoring, or something that's correlated to it, then you're going to remove the biggest layers first. And that's a problem. And that's what they say, this con, this fact of this conservation laws, and the single shot nature of these algorithms that they only assign scores once, and then they prune away whatever the bottom such and such percent are, leads to layer collapse. Right? That's, I think we've established this now that the combination of the two things leads to layer collapse. Now they make a little bit of an excursion. And they say, there is actually something that doesn't run into layer collapse. And that's iterative pruning algorithms. So specifically, they look at magnitude pruning. They say magnitude pruning, which remember is also, if you do it single shot, it also runs into layer collapse, magnitude pruning avoids layer collapse with conservation and iteration. So because it iterates, it avoids that. And that's what these lottery ticket hypothesis paper does. It does it iteratively removes a couple of connections, then it retrain the network basically recomputes the magnitudes and therefore recomputes the scores, and then it prunes again, and then it recomputes and compend prunes again. And by recomputing, you can basically these some of the connections that weren't important before, but just survive the pruning, they can now be like, wait, I have now way more responsibility as a connection, and they will shoot up in importance to avoid being pruned. So you can see if you push your network to a sorry to a high compression ratio, then if you just do this single shot pruning, you run into this layer collapse at some compression ratio, you simply crash to random performance or zero performance. Yet, if you do multiple iterations, you can see here already two iterations, then it's much longer before you run right here into layer collapse. And if you do three iterations, you do much more. Now this, the three iterations doesn't mean you prune more like at this, at this point right here to tend to the one. All of these things prune nine out of every 10 connections. It's just the thing that has three iterations prunes, maybe first three, and then again, three out of the 10. Whereas the one iteration would prune all of the nine at in one go. And they give a reason for this they give they say that it's the fact that gradient descent encourages conservation. So they give a little toy example here they say to better understand the dynamics of the IMP algorithm during training, a little smaller, we will consider the a differentiable score, this one. So this is not exactly magnitude pruning, but it is very close, right? The squared, it's just the square of the parameter instead of the absolute value of the parameter. They say it's algorithmically equivalent to magnitude score. Consider these scores throughout training with gradient descent on a loss function using an infinitesimal step. In this setting, the temporal derivative of the parameters is equivalent to that and thus the temporal derivative of the score is this. So now they're going to look at how does the score evolve when they train the network. And the score evolves exactly as the negative to the saliency. Surprisingly, this is a form of synaptic saliency, and thus the neuron wise and layer wise conservation laws from section four apply. In particular, this implies that for any two layers of a simple fully connected network, then this quantity holds. So that this is not new. But what it basically says is that through training, these connections equalize the saliency again. So if you have a very big layer, and here a very, very small layer, and because it's a big layer, these scores are very much lower, right? It's just little s and here it's big S per layer. But then if you prune away, and you run gradient descent on this, these scores will tend to become bigger. And in this case, these weights will tend to grow in magnitude, because you've pruned away the others, they now have more signal, probably flowing to them and more gradient flowing to them. And therefore, they're going to grow in size. And therefore, their score is going to be bigger. So this gradient descent of this iterative procedure makes the scores better for that. So basically counteracts the layer collapse. So they put all of this together and say, theorem three, iterative positive conservative scoring achieves maximal critical compression. If a pruning algorithm with global masking, and global masking means that you rank all of the connections and then prune from all of the connections, it's a difference to layerwise masking where you say I want to remove 90% of each layer, which sounds like it would avoid layer collapse, but also it works a lot worse than the global one, the global strategy, assigns positive scores that respect layerwise conservation. And if the algorithm so respecting layerwise conservation, it basically means you your score should be or if your score is a saliency score, then that's the case. And if the algorithm reevaluates the scores every time a parameter is pruned, then the algorithm satisfies the maximal critical compression axiom. So that's basically saying that if you have any algorithm that prunes with a saliency score, like theirs is going to do, is going to be able to be pushed to the limit until the maximal capacity is reached, if you reevaluate the scores every time a parameter is pruned. So this is basically saying that whatever the lottery ticket hypothesis paper did with magnitude pruning, if you do it with saliency based pruning, you're guaranteed to achieve the maximum possible compression if you if you push it. But of course, we know that whatever the whatever the lottery ticket hypothesis paper did is impractical because it needs to retrain the network every single time it wants to prune, right? If we're going to do this after every parameter, that's going to be a long time, it's going to be impractical. We ideally want to prune the network before we even look at any data. And they're going to do exactly that with the Synflow algorithm. They say theorem three directly motivates the design of our novel pruning algorithm Synflow that provably reaches maximal critical scores. Oh, no. Okay, this was bad. Malarial critical compression. First the necessity for iterative sorry, first the necessity for iterative score evaluation discourages algorithms that involve backpropagation on batches of data and instead motivates the development of an efficient data independent scoring procedure. Second, positivity and conservation motive motives probably motivates the construction of a loss function that yields positive synaptic saliency scores. We combine these insights and introduce a new loss function where the one is the all one vectors. Okay, so this is the loss function of their saliency scores. And this might seem like so what do we have? We have the parameters of layer L, the absolute product, sorry, the absolute value of those parameters. And then you simply multiply all of the layers together. And you have this product here with the ones on the side. So this is a quadratic form sort of. Okay, this might seem a bit weird. But but in practice, and this is also what happens in their code, you can do something pretty easy. So first, you have to transform all your weights to their absolute values. Now in their code, you can look at it, they they do remember the signs for later. So but first, you convert all of them to their absolute values, then second, you simply take a data point that is filled with ones that literally the number one. So if your if your input is an image, you just put a one at each pixel, you feed it through the network with all of these positive weights, and you get out some output, you get some output vector, okay, then you simply you need to do this. This inner product with the one vector, which is simply a sum, right? I don't, I don't get why they, it's a bit of a funky way of writing a sum, right? You simply sum that up to get a to get a single number. And this single number now is your is your pseudo loss function. It's simply the loss function that an all one data point gets when the when the loss function is just the sum of the outputs. That's that's that's it. And then you back propagate that loss to you back propagate that loss to the layers. Right? So this is our remember, this is not the score itself, but our score is going to be the derivative of our with respect to a weight times that weight. Okay, so you want to back propagate, and then you multiply each of these weights by the back propagated signal. And that's going to be your score for each parameter. Now this doesn't seem too hard, right? You just need you don't even need a batch, you need a single data point, one back propagation, and then you get your scores. Okay, you don't need expensive training, or anything like this. This seems pretty cool. And they give an example here. For example, for a simple, come on for a simple, fully connected network, ie, this, so they consider here a linear network, right, just so we can look at exactly what happens for linear networks, you can often compute quantities exactly. So if we look at just a linear network, without non linearities, we can factor the synaptic flow score for for any parameter as such. So the score, this is now not the R, this is going to be the score is going to be this thing right here. So you can see that the parameter is multiplied by this thing, and by this thing. And other than for example, magnitude pruning, this actually takes into account all the input flow because it goes from this one, sorry, goes from this, goes from this one, it goes through all the network, right, every path that arrives at this particular weight is going to be considered. And every path that goes out from this particular weight is going to be considered. And the saliency score is going to depend on all of these paths, all of these, all of the information flow from input to output that goes through that weight. And if you do this, then you get a really good pruning algorithm. So yeah, the algorithm is is I've already described it. And in their experiments, as you can see, right now, they have a bunch of networks, these VGG networks, or like wide ResNet, they have a bunch of data sets like tiny image net or c410, where they experiment with these different baselines. And you can see that the baselines often run into this layer collapse problem. Sorry, often run into this where all of a sudden, let's actually look at let's look at this ResNet 18, right here. Maybe you can find a connection between maybe there's differently sized layers in ResNet 18. And that's why the collapse happens even earlier. But you can see right here, there's a collapse if you do magnitude pruning, even also if you do random pruning, it falls down pretty hard after a while, the baselines, they hold up better, but you can see in different models and different data sets, that the baselines crash at some point as well. Now I've already said the comparison here, it seems a little bit unfair, I might, I might have over read something, but I'm pretty sure that the baselines remain single shot. While the sin flow algorithm here is now of course, no longer a single shot, it's actually multi shot and they've made the exact argument that the single shot is the problem. And therefore their algorithm is multi, multi shot. And it seems like they should give the other algorithms the opportunity to also do multi shot, just to compare them fairly. As I said, maybe they're doing that, but I'm, I haven't read any anything. So it, you know, it just seems like the comparison is a bit unfair. If you identify the problem and then just leave the other algorithms with the problem, sin flow is still different from these other algorithms, even if they had the multiple steps. Now the counter argument to this, of course, is that these other algorithms all require the training data, they require actually passing the data or training the network in the case of magnitude pruning and so on. So that's pretty expensive, whereas sin flow, you simply pass forward one data point and that's it. That's a good argument, but it seems like the effect of the synaptic saliency scores and the effect of the multiple steps aren't really disentangled in these experiments right here. It simply shows that it consistently outperforms other pruning methods. And what I'd like to see is really where that outperforming comes from. Okay, so that's what I think of this. And that was the paper, basically. I'm even, even if I'm not convinced quite yet, this is pretty cool, right? And I think this will, if not be, if it's not used itself, it will inspire kind of a line of work into pruning at the beginning of training without looking at data. And maybe, you know, maybe we can even think of building networks, like, instead of just pruning them, we can think of constructively building networks that observe these properties. And therefore, we can just construct initialized networks already with good properties such that we don't even have to go to a bigger network and then prune it down. It seems wasteful. It seems like we should just be able to derive principles of what we want in the how the weights are structured, and then construct networks that are according to that. And I guess that's what's going to happen in a few papers that are coming. Alright, again, if you liked this video, consider subscribing, giving it a like, commenting, and let me know what you think. And until next time, bye bye.
[{"start": 0.0, "end": 6.32, "text": " Hi there, today we're looking at pruning neural networks without any data by iteratively conserving"}, {"start": 6.32, "end": 14.64, "text": " synaptic flow by Hidenori Tanaka, Daniel Kunin, Daniel L.K. Yamins and Surya Ganguly."}, {"start": 14.64, "end": 20.04, "text": " So this paper on a high level does what the lottery ticket hypothesis does, but does so"}, {"start": 20.04, "end": 24.12, "text": " without any data, it prunes a neural network at the beginning."}, {"start": 24.12, "end": 30.94, "text": " And it does so, it's able to do that, because it claims that its algorithm avoids this problem"}, {"start": 30.94, "end": 37.94, "text": " called layer collapse, and then is based on conserving a quantity they call the, the synaptic"}, {"start": 37.94, "end": 39.52, "text": " flow."}, {"start": 39.52, "end": 41.760000000000005, "text": " And we're going to look at this."}, {"start": 41.760000000000005, "end": 45.22, "text": " And it's pretty cool algorithm, it seems to work pretty well."}, {"start": 45.22, "end": 50.68000000000001, "text": " As always, if you want to help out, you can share this video."}, {"start": 50.68000000000001, "end": 53.040000000000006, "text": " And let me know in the comments what you think of it."}, {"start": 53.04, "end": 56.36, "text": " I do read the comments."}, {"start": 56.36, "end": 58.6, "text": " And I would love to hear from you."}, {"start": 58.6, "end": 60.64, "text": " Alright, let's dive in."}, {"start": 60.64, "end": 65.8, "text": " So they're saying pruning the parameters of deep neural networks has generated intense"}, {"start": 65.8, "end": 72.16, "text": " interest due to potential savings in time, memory and energy, both during training and"}, {"start": 72.16, "end": 73.75999999999999, "text": " at test time."}, {"start": 73.75999999999999, "end": 79.14, "text": " Recent works have identified through an expensive sequence of training and pruning cycles, the"}, {"start": 79.14, "end": 85.48, "text": " existence of winning lottery tickets or sparse trainable sub networks at initialization."}, {"start": 85.48, "end": 87.16, "text": " So what is this paper talking about?"}, {"start": 87.16, "end": 92.68, "text": " If you if you don't know much about pruning, here is kind of a basic overview."}, {"start": 92.68, "end": 98.4, "text": " So if you have a neural network that consists of many, many layers of neurons, what you"}, {"start": 98.4, "end": 105.92, "text": " can do that one way of pruning that what what the goal is, is to end up with a small neural"}, {"start": 105.92, "end": 109.02, "text": " network that performs well."}, {"start": 109.02, "end": 113.66, "text": " But for now, we have a big neural network that doesn't perform well, it hasn't been"}, {"start": 113.66, "end": 115.06, "text": " trained yet, right."}, {"start": 115.06, "end": 119.92, "text": " So what you can do is you can first train the neural network."}, {"start": 119.92, "end": 125.58, "text": " And then you have a big neural network that performs well, and then you can prune it."}, {"start": 125.58, "end": 131.32, "text": " Now a lot of times, a lot of the time this this has been seen as sort of the pruning"}, {"start": 131.32, "end": 135.68, "text": " way, you would train the big neural network, and then you would prune it, because the other"}, {"start": 135.68, "end": 138.0, "text": " way was not feasible."}, {"start": 138.0, "end": 143.72, "text": " First pruning, and then training was not feasible."}, {"start": 143.72, "end": 147.56, "text": " You might you might ask, okay, we might just want to start with a small one."}, {"start": 147.56, "end": 149.36, "text": " And yeah, that's correct."}, {"start": 149.36, "end": 155.98, "text": " So what does this first way by you, this first way is buys you mainly two things."}, {"start": 155.98, "end": 161.1, "text": " So imagine this network right here is much smaller than the original network."}, {"start": 161.1, "end": 165.08, "text": " So it is less, it uses less storage."}, {"start": 165.08, "end": 170.36, "text": " So you can potentially if you want to ship it to like a customer over the internet, you"}, {"start": 170.36, "end": 175.20000000000002, "text": " maybe instead of a gigabyte, you only have to transfer a few megabytes."}, {"start": 175.20000000000002, "end": 177.02, "text": " And that's pretty cool."}, {"start": 177.02, "end": 182.36, "text": " The second thing if you prune in the correct way, you can also make it faster because now"}, {"start": 182.36, "end": 188.44, "text": " there's less weights to multiply with, you can actually make it go faster."}, {"start": 188.44, "end": 195.0, "text": " So pruning is a now this this combines with techniques called distillation and so on is"}, {"start": 195.0, "end": 198.28, "text": " our ways to make the networks smaller and faster."}, {"start": 198.28, "end": 205.1, "text": " So if your customers are for example, on on mobile phones, then you can ship you can train"}, {"start": 205.1, "end": 210.28, "text": " a big network to a good performance on your big GPU server, and then ship it out to a"}, {"start": 210.28, "end": 216.7, "text": " mobile phone once it's small, and it will perform fairly well on that mobile phone without"}, {"start": 216.7, "end": 218.7, "text": " GPU."}, {"start": 218.7, "end": 221.56, "text": " So what about this other way?"}, {"start": 221.56, "end": 227.88, "text": " Now, in order to do the other way, we would sort of have to have an idea which one of"}, {"start": 227.88, "end": 234.04, "text": " these big networks which sub parts of these layers are the good ones right in order for"}, {"start": 234.04, "end": 237.48, "text": " us to do this first prune and then train."}, {"start": 237.48, "end": 241.78, "text": " The interesting thing is that the paper the lottery ticket hypothesis, I've done a video"}, {"start": 241.78, "end": 247.84, "text": " on this and we've also interviewed the author on our ML street talk podcast."}, {"start": 247.84, "end": 250.6, "text": " This paper has shown that this is in fact possible."}, {"start": 250.6, "end": 256.08, "text": " A long time people have thought we need the big network in order to train right we sort"}, {"start": 256.08, "end": 262.08, "text": " of the bigness of the network, the full connectedness of the network is required for the training"}, {"start": 262.08, "end": 263.08, "text": " dynamics."}, {"start": 263.08, "end": 267.32, "text": " But this paper has shown this is not possible, you can prune at the very beginning."}, {"start": 267.32, "end": 268.68, "text": " Now what does it do?"}, {"start": 268.68, "end": 275.28, "text": " It first trains in neural network, like in the in the olden days, then it prunes the"}, {"start": 275.28, "end": 280.55999999999995, "text": " neural network, and then it remembers which connections of the train neural network it"}, {"start": 280.55999999999995, "end": 281.71999999999997, "text": " has pruned."}, {"start": 281.71999999999997, "end": 287.0, "text": " And then it simply goes back to the beginning of training right here, up here, and says,"}, {"start": 287.0, "end": 289.61999999999995, "text": " I now know which connections are important."}, {"start": 289.61999999999995, "end": 294.55999999999995, "text": " And I'm simply going to prune all the other connections other than these ones."}, {"start": 294.55999999999995, "end": 301.23999999999995, "text": " And then interestingly, if you prune first, and then train, that works just as well and"}, {"start": 301.23999999999995, "end": 303.84, "text": " can actually work even better."}, {"start": 303.84, "end": 308.15999999999997, "text": " The interesting thing here is that I mean, this is a big, big cycle."}, {"start": 308.15999999999997, "end": 315.14, "text": " But the interesting thing that the paper demonstrates is that this is even possible, right?"}, {"start": 315.14, "end": 317.03999999999996, "text": " People thought it wasn't possible."}, {"start": 317.03999999999996, "end": 324.32, "text": " And this paper demonstrates if you only knew if you only knew which ones you must retain,"}, {"start": 324.32, "end": 327.05999999999995, "text": " you can prune at the beginning of training."}, {"start": 327.05999999999995, "end": 331.73999999999995, "text": " The lottery ticket hypothesis paper, though still requires to actually train the full"}, {"start": 331.74, "end": 337.8, "text": " network and then do the pruning, like in a classic way in order to find out which ones"}, {"start": 337.8, "end": 341.0, "text": " you need to prune and which ones you don't."}, {"start": 341.0, "end": 347.0, "text": " This paper right here takes that idea and says, can we find?"}, {"start": 347.0, "end": 352.88, "text": " Can we find a pruning algorithm that prunes at the beginning of training, yet does not"}, {"start": 352.88, "end": 357.56, "text": " have to train the full network, in fact, doesn't look at any of the data?"}, {"start": 357.56, "end": 360.96000000000004, "text": " Okay, and this is going to be our starting point."}, {"start": 360.96, "end": 365.44, "text": " So their story is going to be, it's quite an involved story."}, {"start": 365.44, "end": 371.46, "text": " And I think the overview is important as we go through the paper."}, {"start": 371.46, "end": 377.12, "text": " So first, they named this problem called layer collapse."}, {"start": 377.12, "end": 383.12, "text": " Now layer collapse is going to be whenever a pruning algorithm removes the entirety of"}, {"start": 383.12, "end": 388.09999999999997, "text": " a neural network layer, which means that no information can flow anymore, and therefore"}, {"start": 388.09999999999997, "end": 389.85999999999996, "text": " the network can't train."}, {"start": 389.86, "end": 396.52000000000004, "text": " And they claim that this is the main problem why these current pruning algorithms cannot"}, {"start": 396.52000000000004, "end": 399.32, "text": " achieve very high pruning ratios."}, {"start": 399.32, "end": 405.42, "text": " So can like very high compression ratios is because they do premature layer collapse."}, {"start": 405.42, "end": 413.2, "text": " They then formulate this maximal critical compression axiom that has sort of a guiding"}, {"start": 413.2, "end": 415.92, "text": " principle to build pruning algorithms."}, {"start": 415.92, "end": 423.16, "text": " Second, they show that this quantity called synaptic saliency, a general class of gradient"}, {"start": 423.16, "end": 429.46000000000004, "text": " based scores for pruning is conserved at every hidden unit layer of a neural network."}, {"start": 429.46000000000004, "end": 431.72, "text": " So they show that these are conserved."}, {"start": 431.72, "end": 437.8, "text": " And they show this because this is their their argument is going to be first the argument"}, {"start": 437.8, "end": 440.28000000000003, "text": " is layer collapse is a problem."}, {"start": 440.28, "end": 446.84, "text": " The second argument is these things are conserved and these the conservation of the synaptic"}, {"start": 446.84, "end": 450.84, "text": " saliency leads to the layer collapse."}, {"start": 450.84, "end": 453.9, "text": " And we're going to see how that happens."}, {"start": 453.9, "end": 460.4, "text": " And then third, they say the solution to that is iterative pruning."}, {"start": 460.4, "end": 466.59999999999997, "text": " So they show this at the at the example of iterative magnitude pruning, which we know"}, {"start": 466.59999999999997, "end": 468.47999999999996, "text": " avoids layer collapse."}, {"start": 468.48, "end": 473.84000000000003, "text": " So iterative magnitude pruning is something that happens in this lottery ticket way of"}, {"start": 473.84000000000003, "end": 475.08000000000004, "text": " of doing it."}, {"start": 475.08000000000004, "end": 481.84000000000003, "text": " This lottery ticket way, you can actually do it not in one step, but it tends to work"}, {"start": 481.84000000000003, "end": 487.32, "text": " better when you want to go from 100% of your weights to just 5% of your weights, it tends"}, {"start": 487.32, "end": 489.78000000000003, "text": " to work better if you do it in stages."}, {"start": 489.78000000000003, "end": 497.12, "text": " So first you go to 90% to 80 to 70 and so on, down to your desired thing."}, {"start": 497.12, "end": 506.12, "text": " And this iterative procedure, they claim is what is what circumvents this problem of layer"}, {"start": 506.12, "end": 508.48, "text": " collapse."}, {"start": 508.48, "end": 515.24, "text": " And then at last, they say we proved that a pruning algorithm avoids layer collapse"}, {"start": 515.24, "end": 522.04, "text": " entirely and satisfies blah, blah, blah, if it uses iterative positive synaptic saliency"}, {"start": 522.04, "end": 523.3, "text": " scores."}, {"start": 523.3, "end": 531.76, "text": " So they bring it all together and say, if an algorithm satisfies our axiom, and if the"}, {"start": 531.76, "end": 538.8, "text": " algorithm is an algorithm that uses these saliency scores, like this one here, and if"}, {"start": 538.8, "end": 544.76, "text": " the algorithm is iterative, then it is not going to be subject to layer collapse, and"}, {"start": 544.76, "end": 550.9599999999999, "text": " therefore, it is going to be able to compress to a very high compression ratio."}, {"start": 550.96, "end": 557.48, "text": " And then they actually do suggest an algorithm, this synaptic, sorry, iterative synaptic flow"}, {"start": 557.48, "end": 562.72, "text": " pruning SynFlow, that does all of this and never looks at any data."}, {"start": 562.72, "end": 565.84, "text": " Alright, this is quite a story."}, {"start": 565.84, "end": 569.9200000000001, "text": " But remember what we're doing first, layer collapses a problem."}, {"start": 569.9200000000001, "end": 572.0600000000001, "text": " Second, why is layer collapse a problem?"}, {"start": 572.0600000000001, "end": 575.1600000000001, "text": " It's because of this synaptic saliency conservation."}, {"start": 575.16, "end": 581.76, "text": " Third, we can avoid it by doing iterative pruning and lastly, this algorithm does it"}, {"start": 581.76, "end": 584.1999999999999, "text": " without looking at data."}, {"start": 584.1999999999999, "end": 592.8399999999999, "text": " Okay, so layer, layer collapse, layer collapse is a pretty simple phenomenon."}, {"start": 592.8399999999999, "end": 598.4399999999999, "text": " I've already said it, if you have a neural network, and it has a bunch of layers, and"}, {"start": 598.44, "end": 606.2, "text": " let's draw a couple of neurons here, and the neurons are connected to each other via connections,"}, {"start": 606.2, "end": 609.4000000000001, "text": " connections, connections, connections."}, {"start": 609.4000000000001, "end": 611.4000000000001, "text": " And you have a pruning algorithm."}, {"start": 611.4000000000001, "end": 616.36, "text": " Now the prunings algorithms they consider here are so called single shot pruning algorithms."}, {"start": 616.36, "end": 621.8800000000001, "text": " What they do is they look at the neural network and this can be before training or after training."}, {"start": 621.8800000000001, "end": 627.3800000000001, "text": " But they at some point, they look at the neural network, and they each they assign a score"}, {"start": 627.38, "end": 633.84, "text": " to each of these weights, like they'll say, you're one, you're a five, you're a nine,"}, {"start": 633.84, "end": 635.0, "text": " and so on."}, {"start": 635.0, "end": 638.52, "text": " And then they simply prune away the lowest scores."}, {"start": 638.52, "end": 639.52, "text": " Okay."}, {"start": 639.52, "end": 643.6, "text": " And you tell the network what compression ratio you want to you tell the network, for"}, {"start": 643.6, "end": 647.24, "text": " example, please prune away 90% of the connections."}, {"start": 647.24, "end": 652.92, "text": " So these algorithms would look would assign the scores once and then remove the bottom"}, {"start": 652.92, "end": 655.44, "text": " 90% of weights."}, {"start": 655.44, "end": 658.6400000000001, "text": " Okay, like this."}, {"start": 658.6400000000001, "end": 662.7600000000001, "text": " So those are the single shot pruning algorithms."}, {"start": 662.7600000000001, "end": 664.2800000000001, "text": " Now what is layer collapse?"}, {"start": 664.2800000000001, "end": 671.08, "text": " Layer collapse is whenever an algorithm removes all of one layer, because maybe so here was"}, {"start": 671.08, "end": 679.3000000000001, "text": " a nine, maybe you have like 11, 12, 13 here, okay, so and then you're in you're in this"}, {"start": 679.3000000000001, "end": 680.58, "text": " situation right here."}, {"start": 680.58, "end": 683.0, "text": " And the algorithm is pretty, it's pretty dumb."}, {"start": 683.0, "end": 687.0, "text": " It's simply removing the bottom 90% of the connections."}, {"start": 687.0, "end": 690.24, "text": " And here it figures I need to remove one more to meet that goal."}, {"start": 690.24, "end": 693.56, "text": " I remove the one with the lowest score, I'm going to remove this one."}, {"start": 693.56, "end": 698.52, "text": " And it's pretty obvious that now no more information can flow from the beginning to the end of"}, {"start": 698.52, "end": 704.46, "text": " the network, because, well, what's, where is it going to float to?"}, {"start": 704.46, "end": 709.44, "text": " It's a bit more complex than that, like, you can just retain a layer like a connection."}, {"start": 709.44, "end": 713.24, "text": " For example, if this were a connection, there would also be no information flow because"}, {"start": 713.24, "end": 715.5600000000001, "text": " you'd have no outgoing connection here."}, {"start": 715.5600000000001, "end": 721.48, "text": " But ultimately, layer collapse is whenever an entire layer is removed."}, {"start": 721.48, "end": 723.5600000000001, "text": " Okay."}, {"start": 723.5600000000001, "end": 730.44, "text": " And they they do say somewhere that that's the case."}, {"start": 730.44, "end": 738.0400000000001, "text": " I think layer collapse here, layer collapse occurs when an algorithm prunes all parameters"}, {"start": 738.04, "end": 744.3199999999999, "text": " in a single weight layer, even when prunable parameters remain elsewhere in the network."}, {"start": 744.3199999999999, "end": 749.92, "text": " So I'm not as such, I'm not sure that this is like a giant problem."}, {"start": 749.92, "end": 756.0799999999999, "text": " It gets to be a problem, but it could be circumvented fairly easily, right by simply saying, if"}, {"start": 756.0799999999999, "end": 761.12, "text": " you're about to prune a connection, that's integral to the information flow from the"}, {"start": 761.12, "end": 765.66, "text": " start to the end, don't prune that connection, prune some other connection, right."}, {"start": 765.66, "end": 767.7199999999999, "text": " And then you could simply avoid that."}, {"start": 767.72, "end": 770.4, "text": " And I'd be interested in how that works out."}, {"start": 770.4, "end": 777.9200000000001, "text": " So but in this case, for purposes of this paper, they simply consider algorithms that"}, {"start": 777.9200000000001, "end": 783.1, "text": " assign a score and then prune the bottom couple of percent, okay, for so we don't want any"}, {"start": 783.1, "end": 787.6800000000001, "text": " like handcrafted rules in here or something."}, {"start": 787.6800000000001, "end": 791.5600000000001, "text": " So they look at this quantity called the max compression."}, {"start": 791.5600000000001, "end": 797.6, "text": " The max compression is a quantity that's basically the maximum achievable compression whilst"}, {"start": 797.6, "end": 799.9200000000001, "text": " still avoiding layer collapse."}, {"start": 799.9200000000001, "end": 804.0, "text": " And they say, for example, for a network with l layers and n parameters, the max compression"}, {"start": 804.0, "end": 810.5400000000001, "text": " is n over l, which is basically means every layer only has one parameter remaining and"}, {"start": 810.5400000000001, "end": 818.6800000000001, "text": " therefore, if it's the correct one, therefore, information can flow from start to the end."}, {"start": 818.6800000000001, "end": 824.6, "text": " All right, so this is the maximum achievable compression, anything beyond that would automatically"}, {"start": 824.6, "end": 826.0400000000001, "text": " induce layer collapse."}, {"start": 826.04, "end": 832.8399999999999, "text": " Now, anything before that could induce layer collapse, but there is a way to compress the"}, {"start": 832.8399999999999, "end": 836.54, "text": " network to the same level without inducing layer collapse."}, {"start": 836.54, "end": 840.52, "text": " And their point is basically that these other compression algorithms that they compare with,"}, {"start": 840.52, "end": 846.5999999999999, "text": " they always they always induce layer collapse before they actually have to because they"}, {"start": 846.5999999999999, "end": 853.28, "text": " cut off a connection that leads to layer collapse before they like there would be another connection"}, {"start": 853.28, "end": 856.52, "text": " that they could cut off that would not lead to layer collapse."}, {"start": 856.52, "end": 863.02, "text": " And of course, if you are layer, if you have done a layer collapse, then you accuracy immediately"}, {"start": 863.02, "end": 868.16, "text": " drops to zero or two random, because no more information flow."}, {"start": 868.16, "end": 872.72, "text": " So they look at these things here, random pruning is where you simply assign a random"}, {"start": 872.72, "end": 876.12, "text": " score to each connection."}, {"start": 876.12, "end": 880.92, "text": " Magnitude pruning is what the lottery ticket hypothesis does, but just they look here at"}, {"start": 880.92, "end": 883.8, "text": " a single shot."}, {"start": 883.8, "end": 889.0, "text": " So you simply look at the magnitude of the weights, and this can be before after training,"}, {"start": 889.0, "end": 893.28, "text": " I think they do it after training here, which is classically done, you look at the magnitude"}, {"start": 893.28, "end": 899.0, "text": " of the weights and you prune the bottom 90% away."}, {"start": 899.0, "end": 906.0, "text": " There are also two more advanced methods, these SNIP and the GRASP, so SNIP and GRASP,"}, {"start": 906.0, "end": 912.84, "text": " which look at the gradient of the training loss in the network, and they decide according"}, {"start": 912.84, "end": 919.0, "text": " to that gradient, which which things to cut and which things not to cut away."}, {"start": 919.0, "end": 922.14, "text": " The GRASP even involves the Hessian right here."}, {"start": 922.14, "end": 927.8, "text": " So they're fairly, you know, complex method that have some thoughts behind them about"}, {"start": 927.8, "end": 934.12, "text": " why they do what they do, yet they all induce layer collapse before they actually have to."}, {"start": 934.12, "end": 938.64, "text": " So they define this thing here called the critical compression."}, {"start": 938.64, "end": 943.76, "text": " The critic the critical compression is the maximal compression ratio a given algorithm"}, {"start": 943.76, "end": 946.62, "text": " can achieve without inducing layer collapse."}, {"start": 946.62, "end": 950.96, "text": " So the critical compression here is basically whenever that algorithm goes to zero, that's"}, {"start": 950.96, "end": 956.34, "text": " the critical compression, that's kind of the farthest you can push the algorithm without"}, {"start": 956.34, "end": 963.92, "text": " him without sorry, German speaker, without it induced without it inducing layer collapse."}, {"start": 963.92, "end": 970.56, "text": " Okay, so you can see that for these baseline algorithms, the layer collapse occurs way"}, {"start": 970.56, "end": 974.28, "text": " below the theoretically possible max compression."}, {"start": 974.28, "end": 979.36, "text": " And we're going to see that in their algorithm, this sin flow, that this max compression is"}, {"start": 979.36, "end": 984.74, "text": " achieved, and it's actually achieved without any of these handcrafted rules that I mentioned,"}, {"start": 984.74, "end": 990.4599999999999, "text": " it is the algorithm by design already achieves this maximum compression ratio."}, {"start": 990.4599999999999, "end": 992.66, "text": " So they formulate this here as a guiding principle."}, {"start": 992.66, "end": 997.28, "text": " They formulate is an axiom, I would, I would rather say it's like this kind of a, it's"}, {"start": 997.28, "end": 1004.16, "text": " kind of a guiding principle of building these algorithms that any algorithm you build should"}, {"start": 1004.16, "end": 1005.62, "text": " have."}, {"start": 1005.62, "end": 1010.3199999999999, "text": " So the critical compression ratio of a pruning algorithm applied to a network should always"}, {"start": 1010.3199999999999, "end": 1013.0799999999999, "text": " equal the max compression of that network."}, {"start": 1013.0799999999999, "end": 1018.3199999999999, "text": " It basically means when you build a pruning algorithm, if you push that pruning algorithm"}, {"start": 1018.32, "end": 1025.1200000000001, "text": " to its limits, it should not do layer collapse unless it absolutely needs to."}, {"start": 1025.1200000000001, "end": 1026.64, "text": " Okay."}, {"start": 1026.64, "end": 1033.48, "text": " Again, the extent of this problem, I don't, I don't know, but they do demonstrate that"}, {"start": 1033.48, "end": 1036.68, "text": " that they can push their algorithm a fair bit further."}, {"start": 1036.68, "end": 1042.2, "text": " Now without inducing layer collapse, you already see that these other algorithms like in this"}, {"start": 1042.2, "end": 1047.76, "text": " regime, apparently layer collapse hasn't happened yet, because they still have sizable accuracy."}, {"start": 1047.76, "end": 1052.52, "text": " But there's still a, you know, there is a reasonable difference here between those and"}, {"start": 1052.52, "end": 1054.24, "text": " the sin flow algorithm."}, {"start": 1054.24, "end": 1061.52, "text": " So I'm not too convinced yet that layer collapse as such is the problem, because they have"}, {"start": 1061.52, "end": 1066.26, "text": " a difference before their layer collapsing, as you can see, right here."}, {"start": 1066.26, "end": 1072.44, "text": " And I have a feeling that this difference here is due to this iterative procedure and"}, {"start": 1072.44, "end": 1077.42, "text": " not actually due to the phenomenon of layer collapse."}, {"start": 1077.42, "end": 1082.0, "text": " But yeah, so if it were only layer collapse, what you'll see is that they do the same,"}, {"start": 1082.0, "end": 1087.16, "text": " the same, the same, and then at some point is like, boom, now I have layer collapse."}, {"start": 1087.16, "end": 1088.16, "text": " Okay."}, {"start": 1088.16, "end": 1094.8000000000002, "text": " Yeah, so the layer collapse story, I'm not sure, but it's part of the story."}, {"start": 1094.8000000000002, "end": 1097.68, "text": " So let's, let's go with that."}, {"start": 1097.68, "end": 1100.6200000000001, "text": " The second part, which is kind of disconnected."}, {"start": 1100.6200000000001, "end": 1103.8000000000002, "text": " So they established two things, they established a layer collapse problem."}, {"start": 1103.8, "end": 1108.8, "text": " And now they establish the synaptic saliency, which then later they're going to connect"}, {"start": 1108.8, "end": 1111.56, "text": " to the layer collapse."}, {"start": 1111.56, "end": 1120.2, "text": " So the synaptic saliency, they say, is a score, is any score metric that can be expressed"}, {"start": 1120.2, "end": 1126.36, "text": " as the Hadamard product of this thing with the parameters."}, {"start": 1126.36, "end": 1127.36, "text": " Okay."}, {"start": 1127.36, "end": 1134.56, "text": " So each parameter is going to be multiplied by the gradient of some function with respect"}, {"start": 1134.56, "end": 1135.56, "text": " to that parameter."}, {"start": 1135.56, "end": 1142.4799999999998, "text": " They say where R is a scalar loss function of the output of a feed forward neural network"}, {"start": 1142.4799999999998, "end": 1144.76, "text": " parameterized by theta."}, {"start": 1144.76, "end": 1150.6, "text": " Okay, so many of these pruning algorithms can be formulated in this framework right"}, {"start": 1150.6, "end": 1152.08, "text": " here."}, {"start": 1152.08, "end": 1156.08, "text": " And their, their algorithm can also be formulated in this framework."}, {"start": 1156.08, "end": 1162.3999999999999, "text": " So you can see the score that the algorithm assigns to a weight can be defined as such."}, {"start": 1162.3999999999999, "end": 1171.6799999999998, "text": " And as I said, many fall into this category or are similar to this, especially, for example,"}, {"start": 1171.6799999999998, "end": 1178.6399999999999, "text": " they say when R is the training loss L, so this is the simplest case, you take you put"}, {"start": 1178.6399999999999, "end": 1183.4399999999998, "text": " data through the network, and then you take the training loss of that data and you sort"}, {"start": 1183.4399999999998, "end": 1185.08, "text": " of back propagate it."}, {"start": 1185.08, "end": 1189.28, "text": " And now you're going to prune these connections according to how big the gradient is."}, {"start": 1189.28, "end": 1196.3999999999999, "text": " If you say the gradient is very big, that must mean the connection is very important."}, {"start": 1196.3999999999999, "end": 1198.84, "text": " Because there's lots of information flowing through it."}, {"start": 1198.84, "end": 1204.02, "text": " So if it's the training loss L, the resulting synaptic saliency metric is equivalent to"}, {"start": 1204.02, "end": 1210.22, "text": " the score metric used in skeletonization, one of the first network pruning algorithms."}, {"start": 1210.22, "end": 1216.04, "text": " The resulting metrics metric is also closely related to this right here."}, {"start": 1216.04, "end": 1220.8, "text": " Now this you can see it's not exactly the same, but it's closely related to the one"}, {"start": 1220.8, "end": 1228.96, "text": " used in this snip baseline, and also closely related to this thing right here used in grasp,"}, {"start": 1228.96, "end": 1234.52, "text": " where it's not just the gradient, it's actually the gradient multiplied by the hessian to"}, {"start": 1234.52, "end": 1237.56, "text": " account for curvature."}, {"start": 1237.56, "end": 1246.44, "text": " Okay, so they're going to investigate this synaptic saliency in neural networks."}, {"start": 1246.44, "end": 1252.36, "text": " They formulate two theorems right here about the conservation of synaptic saliency."}, {"start": 1252.36, "end": 1259.6399999999999, "text": " Remember synaptic saliency is any score that respects this, that is built like this, any"}, {"start": 1259.6399999999999, "end": 1261.84, "text": " score s."}, {"start": 1261.84, "end": 1266.6399999999999, "text": " The conservation of synaptic saliency, all synaptic saliency metrics respect two surprising"}, {"start": 1266.64, "end": 1271.5, "text": " conservation laws that hold at any initialization and step in training."}, {"start": 1271.5, "end": 1277.0200000000002, "text": " So these are not usually like in distribution or something like this with high probability."}, {"start": 1277.0200000000002, "end": 1282.38, "text": " These things hold at any point in the neural network."}, {"start": 1282.38, "end": 1286.14, "text": " First is the neuron wise conservation of synaptic saliency."}, {"start": 1286.14, "end": 1291.44, "text": " For a feed forward neural network with homogeneous activation functions, and a homogeneous activation"}, {"start": 1291.44, "end": 1298.1200000000001, "text": " function is an activation function that is can be expressed like this, for example, ReLUs"}, {"start": 1298.1200000000001, "end": 1305.88, "text": " fall into that category, the sum of the synaptic saliency for the incoming parameters is to"}, {"start": 1305.88, "end": 1311.3600000000001, "text": " a hidden neuron is equal to the sum of the synaptic saliency for the outgoing parameters"}, {"start": 1311.3600000000001, "end": 1313.64, "text": " from the hidden neuron."}, {"start": 1313.64, "end": 1314.64, "text": " So what does it mean?"}, {"start": 1314.64, "end": 1315.64, "text": " It's actually pretty simple."}, {"start": 1315.64, "end": 1321.5600000000002, "text": " If you have a hidden neuron, and you look at all the incoming weights, and you look"}, {"start": 1321.5600000000002, "end": 1327.44, "text": " at their synaptic saliency, which is this s score of each of these weights, like what"}, {"start": 1327.44, "end": 1333.2800000000002, "text": " would the pruning algorithm assign to that, and you look at the outgoing ones, then the"}, {"start": 1333.2800000000002, "end": 1340.3200000000002, "text": " sum of all the incoming ones is going to be equal to the sum of all the outgoing ones."}, {"start": 1340.3200000000002, "end": 1343.0800000000002, "text": " So that's pretty interesting."}, {"start": 1343.08, "end": 1350.04, "text": " And they extend that to layer to the entire network."}, {"start": 1350.04, "end": 1355.78, "text": " So an extension of that network wise conservation of synaptic saliency, the sum of the synaptic"}, {"start": 1355.78, "end": 1360.28, "text": " saliency across any set of parameters that exactly separates the input neurons from the"}, {"start": 1360.28, "end": 1365.0, "text": " output neurons of a feed forward neural network with homogeneous activation functions equals"}, {"start": 1365.0, "end": 1366.1599999999999, "text": " that."}, {"start": 1366.1599999999999, "end": 1369.6999999999998, "text": " So it basically says it remains equal."}, {"start": 1369.6999999999998, "end": 1370.6999999999998, "text": " So what does it mean?"}, {"start": 1370.7, "end": 1373.6000000000001, "text": " It doesn't mean to exactly separate the input from the output."}, {"start": 1373.6000000000001, "end": 1376.72, "text": " That's basically the definition of a layer in a neural network."}, {"start": 1376.72, "end": 1381.72, "text": " So what they're saying is that you have a bunch of layers."}, {"start": 1381.72, "end": 1386.24, "text": " And if you look at a particular layer, like this one here, and you look at the incoming"}, {"start": 1386.24, "end": 1394.52, "text": " connections, and you sum up all of their synaptic saliencies, that's going to be equal to the"}, {"start": 1394.52, "end": 1400.68, "text": " sum of all the synaptic saliencies of the outgoing connections of that layer."}, {"start": 1400.68, "end": 1403.72, "text": " And it can also apply to like a group of layers and so on."}, {"start": 1403.72, "end": 1407.76, "text": " But the synaptic saliency is conserved in that way."}, {"start": 1407.76, "end": 1409.62, "text": " Now why is that important?"}, {"start": 1409.62, "end": 1418.0, "text": " And here is where we make the connection with the layer was it later drop layer, whatever,"}, {"start": 1418.0, "end": 1424.72, "text": " okay, the fact that the fact that these algorithms tend to drop entire layers before they have"}, {"start": 1424.72, "end": 1431.92, "text": " to, if you have in your network layers that are of different sizes, so you have large"}, {"start": 1431.92, "end": 1438.12, "text": " layers, and then smaller layers and smaller layers, what will happen is that since the"}, {"start": 1438.12, "end": 1444.28, "text": " synaptic saliency is conserved, the sum is conserved, if you have more connections in"}, {"start": 1444.28, "end": 1449.16, "text": " one layer, so lots of connections, lots of connections, and in the small layers, you"}, {"start": 1449.16, "end": 1452.76, "text": " don't have as many connections, the sum is equal."}, {"start": 1452.76, "end": 1457.04, "text": " So that means each individual one here is much, much smaller."}, {"start": 1457.04, "end": 1463.1399999999999, "text": " So the S is very small for each individual one here, and the S is very large in there."}, {"start": 1463.1399999999999, "end": 1470.24, "text": " That means the pruning algorithm is going to really, really kill off this these connections"}, {"start": 1470.24, "end": 1472.3799999999999, "text": " in the big layers, right."}, {"start": 1472.38, "end": 1477.68, "text": " And it's actually going to kill them off to a point where it probably is going to eliminate"}, {"start": 1477.68, "end": 1484.48, "text": " that layer before it even prunes many of the connections of the small layer, just because"}, {"start": 1484.48, "end": 1487.8400000000001, "text": " of that conservation fact."}, {"start": 1487.8400000000001, "end": 1493.24, "text": " And they do experiments like this."}, {"start": 1493.24, "end": 1502.3200000000002, "text": " I think there's an experiment up here, where I like this one down here better, where they"}, {"start": 1502.32, "end": 1510.8799999999999, "text": " basically show that you have inverse layer size on the bottom, and you have the average"}, {"start": 1510.8799999999999, "end": 1518.4399999999998, "text": " score that the pruning algorithm assigns to any connection."}, {"start": 1518.4399999999998, "end": 1524.3999999999999, "text": " Now these, as we've seen, they're not exactly assigning the scores of this saliency, but"}, {"start": 1524.3999999999999, "end": 1526.1, "text": " they're very close to it."}, {"start": 1526.1, "end": 1533.04, "text": " The Synflow algorithm does exactly assign the synaptic saliency as the score for the"}, {"start": 1533.04, "end": 1534.04, "text": " pruning."}, {"start": 1534.04, "end": 1538.56, "text": " Now, we've basically seen that this leads to a bad result, but the synaptic flow is"}, {"start": 1538.56, "end": 1540.32, "text": " going to compensate for that."}, {"start": 1540.32, "end": 1546.8, "text": " But in essence, as you can see, as the layers get, so inverse layer size grows, which means"}, {"start": 1546.8, "end": 1555.1399999999999, "text": " that layer size shrinks, as the layer size gets smaller, the average score of the connections"}, {"start": 1555.14, "end": 1560.6000000000001, "text": " in the layer is higher and higher, which basically means that the pruning algorithm, if you just"}, {"start": 1560.6000000000001, "end": 1566.68, "text": " let it go by itself, it's going to kill off the smaller, sorry, the larger layers first,"}, {"start": 1566.68, "end": 1568.64, "text": " because they have the smaller scores."}, {"start": 1568.64, "end": 1574.0800000000002, "text": " And you can see that even though the other algorithms don't conform exactly to that,"}, {"start": 1574.0800000000002, "end": 1576.64, "text": " they conform to this approximately."}, {"start": 1576.64, "end": 1583.44, "text": " So these here, because their score is closely related to what the Synflow does, and the"}, {"start": 1583.44, "end": 1591.68, "text": " magnitude pruning, because mostly because now I'm not sure if that's at the end of the"}, {"start": 1591.68, "end": 1596.48, "text": " training at the beginning of the training, if you just initialize, then the score is"}, {"start": 1596.48, "end": 1602.78, "text": " going to be proportional to, it's going to be proportional to their magnitude and their"}, {"start": 1602.78, "end": 1605.66, "text": " magnitude is determined by the initialization scheme."}, {"start": 1605.66, "end": 1612.72, "text": " And the initialization scheme is most of the time like modern initialization schemes compensate"}, {"start": 1612.72, "end": 1617.48, "text": " for the fact that you have different number of incoming and outgoing connections, and"}, {"start": 1617.48, "end": 1625.24, "text": " therefore, they would automatically assign higher number, sorry, a higher initialization"}, {"start": 1625.24, "end": 1629.8600000000001, "text": " constant to layers that have the lower number of parameters."}, {"start": 1629.8600000000001, "end": 1633.84, "text": " So even the magnitude pruning will conform to this."}, {"start": 1633.84, "end": 1640.3600000000001, "text": " Now it might be absolutely reasonable to say that that's also the case at the end of training,"}, {"start": 1640.36, "end": 1645.78, "text": " because most parameters aren't going to move super much during training."}, {"start": 1645.78, "end": 1648.24, "text": " So this still approximately holds as you can see here."}, {"start": 1648.24, "end": 1652.4799999999998, "text": " Of course, the random one doesn't do that."}, {"start": 1652.4799999999998, "end": 1657.32, "text": " Yet, because you prune randomly, you're still absolutely subject to this layer collapse."}, {"start": 1657.32, "end": 1664.0, "text": " In fact, in the random one, the smallest layers would be the ones to go away first because"}, {"start": 1664.0, "end": 1667.28, "text": " it's just more probable."}, {"start": 1667.28, "end": 1669.8, "text": " Okay."}, {"start": 1669.8, "end": 1675.56, "text": " So we've discovered that if you do something like saliency scoring, or something that's"}, {"start": 1675.56, "end": 1682.8, "text": " correlated to it, then you're going to remove the biggest layers first."}, {"start": 1682.8, "end": 1684.9199999999998, "text": " And that's a problem."}, {"start": 1684.9199999999998, "end": 1690.9199999999998, "text": " And that's what they say, this con, this fact of this conservation laws, and the single"}, {"start": 1690.9199999999998, "end": 1696.08, "text": " shot nature of these algorithms that they only assign scores once, and then they prune"}, {"start": 1696.08, "end": 1702.24, "text": " away whatever the bottom such and such percent are, leads to layer collapse."}, {"start": 1702.24, "end": 1703.24, "text": " Right?"}, {"start": 1703.24, "end": 1707.6, "text": " That's, I think we've established this now that the combination of the two things leads"}, {"start": 1707.6, "end": 1709.6, "text": " to layer collapse."}, {"start": 1709.6, "end": 1712.1999999999998, "text": " Now they make a little bit of an excursion."}, {"start": 1712.1999999999998, "end": 1718.1599999999999, "text": " And they say, there is actually something that doesn't run into layer collapse."}, {"start": 1718.1599999999999, "end": 1722.32, "text": " And that's iterative pruning algorithms."}, {"start": 1722.32, "end": 1725.4399999999998, "text": " So specifically, they look at magnitude pruning."}, {"start": 1725.44, "end": 1732.92, "text": " They say magnitude pruning, which remember is also, if you do it single shot, it also"}, {"start": 1732.92, "end": 1738.1000000000001, "text": " runs into layer collapse, magnitude pruning avoids layer collapse with conservation and"}, {"start": 1738.1000000000001, "end": 1739.64, "text": " iteration."}, {"start": 1739.64, "end": 1744.52, "text": " So because it iterates, it avoids that."}, {"start": 1744.52, "end": 1747.8400000000001, "text": " And that's what these lottery ticket hypothesis paper does."}, {"start": 1747.8400000000001, "end": 1753.72, "text": " It does it iteratively removes a couple of connections, then it retrain the network basically"}, {"start": 1753.72, "end": 1759.48, "text": " recomputes the magnitudes and therefore recomputes the scores, and then it prunes again, and"}, {"start": 1759.48, "end": 1762.44, "text": " then it recomputes and compend prunes again."}, {"start": 1762.44, "end": 1768.6000000000001, "text": " And by recomputing, you can basically these some of the connections that weren't important"}, {"start": 1768.6000000000001, "end": 1773.8, "text": " before, but just survive the pruning, they can now be like, wait, I have now way more"}, {"start": 1773.8, "end": 1781.42, "text": " responsibility as a connection, and they will shoot up in importance to avoid being pruned."}, {"start": 1781.42, "end": 1790.28, "text": " So you can see if you push your network to a sorry to a high compression ratio, then"}, {"start": 1790.28, "end": 1795.42, "text": " if you just do this single shot pruning, you run into this layer collapse at some compression"}, {"start": 1795.42, "end": 1801.6000000000001, "text": " ratio, you simply crash to random performance or zero performance."}, {"start": 1801.6000000000001, "end": 1808.6200000000001, "text": " Yet, if you do multiple iterations, you can see here already two iterations, then it's"}, {"start": 1808.62, "end": 1813.32, "text": " much longer before you run right here into layer collapse."}, {"start": 1813.32, "end": 1817.28, "text": " And if you do three iterations, you do much more."}, {"start": 1817.28, "end": 1822.52, "text": " Now this, the three iterations doesn't mean you prune more like at this, at this point"}, {"start": 1822.52, "end": 1826.08, "text": " right here to tend to the one."}, {"start": 1826.08, "end": 1830.1999999999998, "text": " All of these things prune nine out of every 10 connections."}, {"start": 1830.1999999999998, "end": 1836.28, "text": " It's just the thing that has three iterations prunes, maybe first three, and then again,"}, {"start": 1836.28, "end": 1839.52, "text": " three out of the 10."}, {"start": 1839.52, "end": 1848.76, "text": " Whereas the one iteration would prune all of the nine at in one go."}, {"start": 1848.76, "end": 1855.32, "text": " And they give a reason for this they give they say that it's the fact that gradient"}, {"start": 1855.32, "end": 1858.68, "text": " descent encourages conservation."}, {"start": 1858.68, "end": 1863.8999999999999, "text": " So they give a little toy example here they say to better understand the dynamics of the"}, {"start": 1863.9, "end": 1874.02, "text": " IMP algorithm during training, a little smaller, we will consider the a differentiable score,"}, {"start": 1874.02, "end": 1875.02, "text": " this one."}, {"start": 1875.02, "end": 1879.0800000000002, "text": " So this is not exactly magnitude pruning, but it is very close, right?"}, {"start": 1879.0800000000002, "end": 1884.68, "text": " The squared, it's just the square of the parameter instead of the absolute value of the parameter."}, {"start": 1884.68, "end": 1889.4, "text": " They say it's algorithmically equivalent to magnitude score."}, {"start": 1889.4, "end": 1892.88, "text": " Consider these scores throughout training with gradient descent on a loss function using"}, {"start": 1892.88, "end": 1895.38, "text": " an infinitesimal step."}, {"start": 1895.38, "end": 1899.7600000000002, "text": " In this setting, the temporal derivative of the parameters is equivalent to that and thus"}, {"start": 1899.7600000000002, "end": 1902.5, "text": " the temporal derivative of the score is this."}, {"start": 1902.5, "end": 1909.92, "text": " So now they're going to look at how does the score evolve when they train the network."}, {"start": 1909.92, "end": 1916.0400000000002, "text": " And the score evolves exactly as the negative to the saliency."}, {"start": 1916.04, "end": 1924.22, "text": " Surprisingly, this is a form of synaptic saliency, and thus the neuron wise and layer wise conservation"}, {"start": 1924.22, "end": 1926.54, "text": " laws from section four apply."}, {"start": 1926.54, "end": 1932.24, "text": " In particular, this implies that for any two layers of a simple fully connected network,"}, {"start": 1932.24, "end": 1935.0, "text": " then this quantity holds."}, {"start": 1935.0, "end": 1937.04, "text": " So that this is not new."}, {"start": 1937.04, "end": 1943.62, "text": " But what it basically says is that through training, these connections equalize the saliency"}, {"start": 1943.62, "end": 1944.62, "text": " again."}, {"start": 1944.62, "end": 1953.56, "text": " So if you have a very big layer, and here a very, very small layer, and because it's"}, {"start": 1953.56, "end": 1957.1999999999998, "text": " a big layer, these scores are very much lower, right?"}, {"start": 1957.1999999999998, "end": 1960.6999999999998, "text": " It's just little s and here it's big S per layer."}, {"start": 1960.6999999999998, "end": 1967.52, "text": " But then if you prune away, and you run gradient descent on this, these scores will tend to"}, {"start": 1967.52, "end": 1968.6399999999999, "text": " become bigger."}, {"start": 1968.64, "end": 1974.98, "text": " And in this case, these weights will tend to grow in magnitude, because you've pruned"}, {"start": 1974.98, "end": 1980.74, "text": " away the others, they now have more signal, probably flowing to them and more gradient"}, {"start": 1980.74, "end": 1981.74, "text": " flowing to them."}, {"start": 1981.74, "end": 1984.1200000000001, "text": " And therefore, they're going to grow in size."}, {"start": 1984.1200000000001, "end": 1987.0, "text": " And therefore, their score is going to be bigger."}, {"start": 1987.0, "end": 1997.9, "text": " So this gradient descent of this iterative procedure makes the scores better for that."}, {"start": 1997.9, "end": 2005.3600000000001, "text": " So basically counteracts the layer collapse."}, {"start": 2005.3600000000001, "end": 2014.5800000000002, "text": " So they put all of this together and say, theorem three, iterative positive conservative"}, {"start": 2014.5800000000002, "end": 2017.7800000000002, "text": " scoring achieves maximal critical compression."}, {"start": 2017.7800000000002, "end": 2025.5, "text": " If a pruning algorithm with global masking, and global masking means that you rank all"}, {"start": 2025.5, "end": 2031.46, "text": " of the connections and then prune from all of the connections, it's a difference to layerwise"}, {"start": 2031.46, "end": 2036.56, "text": " masking where you say I want to remove 90% of each layer, which sounds like it would"}, {"start": 2036.56, "end": 2041.74, "text": " avoid layer collapse, but also it works a lot worse than the global one, the global"}, {"start": 2041.74, "end": 2047.48, "text": " strategy, assigns positive scores that respect layerwise conservation."}, {"start": 2047.48, "end": 2054.62, "text": " And if the algorithm so respecting layerwise conservation, it basically means you your"}, {"start": 2054.62, "end": 2061.48, "text": " score should be or if your score is a saliency score, then that's the case."}, {"start": 2061.48, "end": 2066.9, "text": " And if the algorithm reevaluates the scores every time a parameter is pruned, then the"}, {"start": 2066.9, "end": 2072.88, "text": " algorithm satisfies the maximal critical compression axiom."}, {"start": 2072.88, "end": 2079.14, "text": " So that's basically saying that if you have any algorithm that prunes with a saliency"}, {"start": 2079.14, "end": 2087.94, "text": " score, like theirs is going to do, is going to be able to be pushed to the limit until"}, {"start": 2087.94, "end": 2098.22, "text": " the maximal capacity is reached, if you reevaluate the scores every time a parameter is pruned."}, {"start": 2098.22, "end": 2104.58, "text": " So this is basically saying that whatever the lottery ticket hypothesis paper did with"}, {"start": 2104.58, "end": 2111.8199999999997, "text": " magnitude pruning, if you do it with saliency based pruning, you're guaranteed to achieve"}, {"start": 2111.8199999999997, "end": 2118.74, "text": " the maximum possible compression if you if you push it."}, {"start": 2118.74, "end": 2125.4, "text": " But of course, we know that whatever the whatever the lottery ticket hypothesis paper did is"}, {"start": 2125.4, "end": 2130.94, "text": " impractical because it needs to retrain the network every single time it wants to prune,"}, {"start": 2130.94, "end": 2131.94, "text": " right?"}, {"start": 2131.94, "end": 2135.14, "text": " If we're going to do this after every parameter, that's going to be a long time, it's going"}, {"start": 2135.14, "end": 2136.62, "text": " to be impractical."}, {"start": 2136.62, "end": 2142.38, "text": " We ideally want to prune the network before we even look at any data."}, {"start": 2142.38, "end": 2149.06, "text": " And they're going to do exactly that with the Synflow algorithm."}, {"start": 2149.06, "end": 2153.36, "text": " They say theorem three directly motivates the design of our novel pruning algorithm"}, {"start": 2153.36, "end": 2156.78, "text": " Synflow that provably reaches maximal critical scores."}, {"start": 2156.78, "end": 2157.78, "text": " Oh, no."}, {"start": 2157.78, "end": 2160.38, "text": " Okay, this was bad."}, {"start": 2160.38, "end": 2162.9, "text": " Malarial critical compression."}, {"start": 2162.9, "end": 2168.38, "text": " First the necessity for iterative sorry, first the necessity for iterative score evaluation"}, {"start": 2168.38, "end": 2173.2400000000002, "text": " discourages algorithms that involve backpropagation on batches of data and instead motivates the"}, {"start": 2173.2400000000002, "end": 2176.7400000000002, "text": " development of an efficient data independent scoring procedure."}, {"start": 2176.7400000000002, "end": 2183.62, "text": " Second, positivity and conservation motive motives probably motivates the construction"}, {"start": 2183.62, "end": 2189.56, "text": " of a loss function that yields positive synaptic saliency scores."}, {"start": 2189.56, "end": 2193.5, "text": " We combine these insights and introduce a new loss function where the one is the all"}, {"start": 2193.5, "end": 2194.5, "text": " one vectors."}, {"start": 2194.5, "end": 2200.36, "text": " Okay, so this is the loss function of their saliency scores."}, {"start": 2200.36, "end": 2204.0, "text": " And this might seem like so what do we have?"}, {"start": 2204.0, "end": 2209.56, "text": " We have the parameters of layer L, the absolute product, sorry, the absolute value of those"}, {"start": 2209.56, "end": 2211.14, "text": " parameters."}, {"start": 2211.14, "end": 2215.5, "text": " And then you simply multiply all of the layers together."}, {"start": 2215.5, "end": 2218.96, "text": " And you have this product here with the ones on the side."}, {"start": 2218.96, "end": 2222.58, "text": " So this is a quadratic form sort of."}, {"start": 2222.58, "end": 2226.7, "text": " Okay, this might seem a bit weird."}, {"start": 2226.7, "end": 2233.62, "text": " But but in practice, and this is also what happens in their code, you can do something"}, {"start": 2233.62, "end": 2234.62, "text": " pretty easy."}, {"start": 2234.62, "end": 2239.9, "text": " So first, you have to transform all your weights to their absolute values."}, {"start": 2239.9, "end": 2244.14, "text": " Now in their code, you can look at it, they they do remember the signs for later."}, {"start": 2244.14, "end": 2251.1, "text": " So but first, you convert all of them to their absolute values, then second, you simply take"}, {"start": 2251.1, "end": 2256.74, "text": " a data point that is filled with ones that literally the number one."}, {"start": 2256.74, "end": 2263.5, "text": " So if your if your input is an image, you just put a one at each pixel, you feed it"}, {"start": 2263.5, "end": 2269.3799999999997, "text": " through the network with all of these positive weights, and you get out some output, you"}, {"start": 2269.3799999999997, "end": 2274.1, "text": " get some output vector, okay, then you simply you need to do this."}, {"start": 2274.1, "end": 2277.98, "text": " This inner product with the one vector, which is simply a sum, right?"}, {"start": 2277.98, "end": 2282.62, "text": " I don't, I don't get why they, it's a bit of a funky way of writing a sum, right?"}, {"start": 2282.62, "end": 2288.1, "text": " You simply sum that up to get a to get a single number."}, {"start": 2288.1, "end": 2292.98, "text": " And this single number now is your is your pseudo loss function."}, {"start": 2292.98, "end": 2300.7, "text": " It's simply the loss function that an all one data point gets when the when the loss"}, {"start": 2300.7, "end": 2303.3399999999997, "text": " function is just the sum of the outputs."}, {"start": 2303.34, "end": 2305.78, "text": " That's that's that's it."}, {"start": 2305.78, "end": 2311.9, "text": " And then you back propagate that loss to you back propagate that loss to the layers."}, {"start": 2311.9, "end": 2312.9, "text": " Right?"}, {"start": 2312.9, "end": 2318.34, "text": " So this is our remember, this is not the score itself, but our score is going to be the derivative"}, {"start": 2318.34, "end": 2323.78, "text": " of our with respect to a weight times that weight."}, {"start": 2323.78, "end": 2331.94, "text": " Okay, so you want to back propagate, and then you multiply each of these weights by the"}, {"start": 2331.94, "end": 2335.2200000000003, "text": " back propagated signal."}, {"start": 2335.2200000000003, "end": 2338.88, "text": " And that's going to be your score for each parameter."}, {"start": 2338.88, "end": 2340.58, "text": " Now this doesn't seem too hard, right?"}, {"start": 2340.58, "end": 2347.06, "text": " You just need you don't even need a batch, you need a single data point, one back propagation,"}, {"start": 2347.06, "end": 2349.1, "text": " and then you get your scores."}, {"start": 2349.1, "end": 2354.12, "text": " Okay, you don't need expensive training, or anything like this."}, {"start": 2354.12, "end": 2356.38, "text": " This seems pretty cool."}, {"start": 2356.38, "end": 2361.78, "text": " And they give an example here."}, {"start": 2361.78, "end": 2369.6600000000003, "text": " For example, for a simple, come on for a simple, fully connected network, ie, this, so they"}, {"start": 2369.6600000000003, "end": 2375.1400000000003, "text": " consider here a linear network, right, just so we can look at exactly what happens for"}, {"start": 2375.1400000000003, "end": 2378.04, "text": " linear networks, you can often compute quantities exactly."}, {"start": 2378.04, "end": 2383.06, "text": " So if we look at just a linear network, without non linearities, we can factor the synaptic"}, {"start": 2383.06, "end": 2386.1400000000003, "text": " flow score for for any parameter as such."}, {"start": 2386.14, "end": 2393.06, "text": " So the score, this is now not the R, this is going to be the score is going to be this"}, {"start": 2393.06, "end": 2394.06, "text": " thing right here."}, {"start": 2394.06, "end": 2399.94, "text": " So you can see that the parameter is multiplied by this thing, and by this thing."}, {"start": 2399.94, "end": 2407.2999999999997, "text": " And other than for example, magnitude pruning, this actually takes into account all the input"}, {"start": 2407.2999999999997, "end": 2414.18, "text": " flow because it goes from this one, sorry, goes from this, goes from this one, it goes"}, {"start": 2414.18, "end": 2419.08, "text": " through all the network, right, every path that arrives at this particular weight is"}, {"start": 2419.08, "end": 2420.8199999999997, "text": " going to be considered."}, {"start": 2420.8199999999997, "end": 2427.7799999999997, "text": " And every path that goes out from this particular weight is going to be considered."}, {"start": 2427.7799999999997, "end": 2432.5, "text": " And the saliency score is going to depend on all of these paths, all of these, all of"}, {"start": 2432.5, "end": 2439.06, "text": " the information flow from input to output that goes through that weight."}, {"start": 2439.06, "end": 2443.24, "text": " And if you do this, then you get a really good pruning algorithm."}, {"start": 2443.24, "end": 2448.7, "text": " So yeah, the algorithm is is I've already described it."}, {"start": 2448.7, "end": 2454.3399999999997, "text": " And in their experiments, as you can see, right now, they have a bunch of networks,"}, {"start": 2454.3399999999997, "end": 2458.64, "text": " these VGG networks, or like wide ResNet, they have a bunch of data sets like tiny image"}, {"start": 2458.64, "end": 2464.06, "text": " net or c410, where they experiment with these different baselines."}, {"start": 2464.06, "end": 2469.2599999999998, "text": " And you can see that the baselines often run into this layer collapse problem."}, {"start": 2469.26, "end": 2474.7000000000003, "text": " Sorry, often run into this where all of a sudden, let's actually look at let's look"}, {"start": 2474.7000000000003, "end": 2479.5200000000004, "text": " at this ResNet 18, right here."}, {"start": 2479.5200000000004, "end": 2484.26, "text": " Maybe you can find a connection between maybe there's differently sized layers in ResNet"}, {"start": 2484.26, "end": 2485.26, "text": " 18."}, {"start": 2485.26, "end": 2486.86, "text": " And that's why the collapse happens even earlier."}, {"start": 2486.86, "end": 2491.1400000000003, "text": " But you can see right here, there's a collapse if you do magnitude pruning, even also if"}, {"start": 2491.1400000000003, "end": 2495.86, "text": " you do random pruning, it falls down pretty hard after a while, the baselines, they hold"}, {"start": 2495.86, "end": 2501.6, "text": " up better, but you can see in different models and different data sets, that the baselines"}, {"start": 2501.6, "end": 2503.7000000000003, "text": " crash at some point as well."}, {"start": 2503.7000000000003, "end": 2511.5, "text": " Now I've already said the comparison here, it seems a little bit unfair, I might, I might"}, {"start": 2511.5, "end": 2517.54, "text": " have over read something, but I'm pretty sure that the baselines remain single shot."}, {"start": 2517.54, "end": 2523.04, "text": " While the sin flow algorithm here is now of course, no longer a single shot, it's actually"}, {"start": 2523.04, "end": 2529.4, "text": " multi shot and they've made the exact argument that the single shot is the problem."}, {"start": 2529.4, "end": 2534.42, "text": " And therefore their algorithm is multi, multi shot."}, {"start": 2534.42, "end": 2540.2599999999998, "text": " And it seems like they should give the other algorithms the opportunity to also do multi"}, {"start": 2540.2599999999998, "end": 2545.12, "text": " shot, just to compare them fairly."}, {"start": 2545.12, "end": 2550.94, "text": " As I said, maybe they're doing that, but I'm, I haven't read any anything."}, {"start": 2550.94, "end": 2555.7000000000003, "text": " So it, you know, it just seems like the comparison is a bit unfair."}, {"start": 2555.7000000000003, "end": 2561.46, "text": " If you identify the problem and then just leave the other algorithms with the problem,"}, {"start": 2561.46, "end": 2567.2400000000002, "text": " sin flow is still different from these other algorithms, even if they had the multiple"}, {"start": 2567.2400000000002, "end": 2569.14, "text": " steps."}, {"start": 2569.14, "end": 2573.5, "text": " Now the counter argument to this, of course, is that these other algorithms all require"}, {"start": 2573.5, "end": 2578.7400000000002, "text": " the training data, they require actually passing the data or training the network in the case"}, {"start": 2578.7400000000002, "end": 2580.92, "text": " of magnitude pruning and so on."}, {"start": 2580.92, "end": 2585.3, "text": " So that's pretty expensive, whereas sin flow, you simply pass forward one data point and"}, {"start": 2585.3, "end": 2586.8, "text": " that's it."}, {"start": 2586.8, "end": 2594.94, "text": " That's a good argument, but it seems like the effect of the synaptic saliency scores"}, {"start": 2594.94, "end": 2602.7400000000002, "text": " and the effect of the multiple steps aren't really disentangled in these experiments right"}, {"start": 2602.7400000000002, "end": 2603.7400000000002, "text": " here."}, {"start": 2603.7400000000002, "end": 2608.2200000000003, "text": " It simply shows that it consistently outperforms other pruning methods."}, {"start": 2608.22, "end": 2613.62, "text": " And what I'd like to see is really where that outperforming comes from."}, {"start": 2613.62, "end": 2617.98, "text": " Okay, so that's what I think of this."}, {"start": 2617.98, "end": 2620.06, "text": " And that was the paper, basically."}, {"start": 2620.06, "end": 2627.4599999999996, "text": " I'm even, even if I'm not convinced quite yet, this is pretty cool, right?"}, {"start": 2627.4599999999996, "end": 2634.3799999999997, "text": " And I think this will, if not be, if it's not used itself, it will inspire kind of a"}, {"start": 2634.38, "end": 2640.34, "text": " line of work into pruning at the beginning of training without looking at data."}, {"start": 2640.34, "end": 2648.1, "text": " And maybe, you know, maybe we can even think of building networks, like, instead of just"}, {"start": 2648.1, "end": 2654.7000000000003, "text": " pruning them, we can think of constructively building networks that observe these properties."}, {"start": 2654.7000000000003, "end": 2662.54, "text": " And therefore, we can just construct initialized networks already with good properties such"}, {"start": 2662.54, "end": 2666.06, "text": " that we don't even have to go to a bigger network and then prune it down."}, {"start": 2666.06, "end": 2667.22, "text": " It seems wasteful."}, {"start": 2667.22, "end": 2672.3, "text": " It seems like we should just be able to derive principles of what we want in the how the"}, {"start": 2672.3, "end": 2677.74, "text": " weights are structured, and then construct networks that are according to that."}, {"start": 2677.74, "end": 2682.5, "text": " And I guess that's what's going to happen in a few papers that are coming."}, {"start": 2682.5, "end": 2688.9, "text": " Alright, again, if you liked this video, consider subscribing, giving it a like, commenting,"}, {"start": 2688.9, "end": 2690.62, "text": " and let me know what you think."}, {"start": 2690.62, "end": 2692.62, "text": " And until next time, bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=l12GXD0t_RE
Deep Differential System Stability - Learning advanced computations from examples (Paper Explained)
Determining the stability properties of differential systems is a challenging task that involves very advanced symbolic and numeric mathematical manipulations. This paper shows that given enough training data, a simple language model with no underlying knowledge of mathematics can learn to solve these problems with remarkably high accuracy. OUTLINE: 0:00 - Intro & Overview 3:15 - Differential System Tasks 11:30 - Datasets & Models 15:15 - Experiments 21:00 - Discussion & My Comments Paper: https://arxiv.org/abs/2006.06462 My Video on Deep Learning for Symbolic Mathematics: https://youtu.be/p3sAF3gVMMA Abstract: Can advanced mathematical computations be learned from examples? Using transformers over large generated datasets, we train models to learn properties of differential systems, such as local stability, behavior at infinity and controllability. We achieve near perfect estimates of qualitative characteristics of the systems, and good approximations of numerical quantities, demonstrating that neural networks can learn advanced theorems and complex computations without built-in mathematical knowledge. Authors: François Charton, Amaury Hayat, Guillaume Lample Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi, here's a question for the whiz kids among you. Is this system here controllable at a point xe with asymptotic control ue? I'll give you 10 seconds. Okay, 10 seconds are over. So to solve this, it's actually pretty easy. All you need to do is first differentiate the system with respect to its internal variables, which are the x's, to obtain the Jacobian A. Second step, differentiate the system with respect to its control variables, which are the u variables to obtain the matrix B. Look, this is a zero, like this is not hard. Then evaluate A and B at the point that you want and the control point that you want. Pretty easy. Calculate the controllability matrix. Come on, that's nothing. Another zero. And at the end, you calculate the rank of the controllability matrix. Now if the if n minus D is zero, the system is controllable. And optionally, if you want, if you feel like it, you can output the control feedback matrix as an equation three, which gives you this here. Now what's equation three? Equation three is super duper simple. It's just this little sort of integral thing, inverse matrix trace transposed exponential function, outer product thing. Come on, what's the matter with you? Okay, so if you found you can't do this just on the spot, then you are in the same category as most people. But interestingly, apparently, according to this paper, a deep learning system can. So today we're going to look at deep differential system stability, learning advanced computations from examples by Francois Charton, Amaury Hayat and Guillaume Lempel of Facebook AI Research and École de Pont Paris Tech and Rutgers University. So at this, in this paper, these authors basically propose that you can learn these complex mathematics with a model that has no clue about mathematics. In fact, it is a language model. And it can output the solutions, for example, whether or not a system is controllable, which are sort of binary solutions, but it can also output actual solutions as in numbers or as in the matrices that you would need to obtain from these problems. So that's pretty cool. And it is built upon this other paper called, I think, some deep learning for symbolic mathematics or something, I have made a video on it, if you search for it, and I'll also link it in in the description. And you can go check that out, because that's sort of the basis. So in this previous paper, I think it was from partially the same authors, they have investigated language models into integrating functions. So you have some sort of function, you're trying to find the integral, and they've tried to do that. Now they go a lot further. So they look at these differential systems, which are characterized by these differential equations. So if you've never seen differential equations, it's basically an equation where the derivation of some variable is characterized by the variable itself. So the the, the gradient, if you will, or the coban, the derivation, according to some input variable here, it's most often it's time and physical systems is a function of that variable itself, and partially also other variables. So you can have systems of differential equations that all depend on each other. And there are a number of questions about these systems, these are very relevant in like physics or engineering, control theory, and so on. So they investigate different problems that you can solve with these. They investigate specifically problems where we already know the solutions, but the solutions require very complex mathematical manipulation, such as, as you've seen, calculate the integral of something, take the trace, calculate the rank, invert some matrix. So all of these mathematical steps are required to solve these problems, if we were to teach them to math students or engineering students. And this paper basically says, if we just input the problem into a big language model, and, and ask it to output the solution, it can do it. So basically can learn to do all of these things. So that's pretty, pretty surprising, because you don't program it to do any math. So the first problem they look at is this local stability problem. So, in, I don't, I don't really want to go into, into much of the actual mathematical problems, but we'll look at the first one to just give you an idea of what these sort of problems are. So, x e is an, if x is an equilibrium point, it means that all solutions, if all solutions converge to x e when their initial positions are close enough, the equilibrium point is said to be locally stable. Okay, this problem is well known if f is differentiable in x e, and answers provided by the spectral mapping theorem. So, in that case, you'd have a system, maybe we can draw one where you try to find local points of stability. So this point here would be maybe a local point of stability. If you consider this as sort of an optimization landscape, because if you go from here, if you go a little bit away from it, you're always sort of pushed back. If this, if this is a, if the system is gravity, sort of, sort of. So if these differential equations sort of describe that the height here is the force which with which you're pulled down, then this thing here would be a local point of stability. The question is, if I give you a system that's described by these differential equations, can you tell me whether or not it is stable at some point? Okay, and there is a spectral mapping theorem, which says, if you have the Jacobian matrix of f at this point, the matrix of its partial derivatives relative to its variable. And if you take lambda to be the largest real part of its complex eigenvalues, if lambda is positive, then this is an unstable equilibrium. If lambda is negative, then it's a locally stable equilibrium. So an unstable equilibrium, likewise, would be the point here on top, which means that if you're exactly at the point, then you stay there. But as soon as you're a little bit off, you drift away from it. That would be an unstable equilibrium. Okay, so there are complex steps involved in deriving the solution, then they list them out here, just to show you how complex this is, this is not meant to teach you. You don't have to like understand or be able to apply this, this is simply meant to tell you how complicated it is to arrive at a solution. So first, you need to differentiate each function with respect to each variable and obtain the formal Jacobian. So they do this here for this example system, which is this system right here. This is a system of two equations, two differential equations in two variables. Okay, so if you drive the Jacobian, that will give you a four entry Jacobian. So each one of these is one of the equations derived with respect to one of the variables. You can do that, right? But it requires fairly complex mathematical knowledge, like knowing that the derivative of the sine here is the cosine and knowing that this cosine doesn't matter for this particular entry, because it's in x two, and here we drive by x one. So that's already very challenging. Second, you need to evaluate the Jacobian at that point. So first, you've done it symbolically. Now you actually need to put in the numbers at the point you're interested in, which will give you this thing right here, which is a numerical matrix, whereas this was a symbolical matrix. Then you need to calculate the eigenvalues, which is mean, you have several methods of that. You have several methods of computing the largest eigenvalue, you could do power method, you could do decomposition, there, there are numerous ways, but none of these is like particularly easily, right. And then lastly, you need to return the minus max of the real part, which is the speed of convergence of the system. So not only do you need to be able to tell whether it is stable, which is if this is negative, you also need to be able to say, or if this is negative, sorry, you need to be able to say whether it is locally stable or locally unstable. And since this is large is larger than zero, it's locally stable. And this would be the decay rate 0.441. This is what you're asking this model to output, right? Now we'll quickly go over the other things, but not as as in depth. But this is in control theory, where you're trying, you have almost the same thing, you have a differential equation. But now, in addition to these variables, you have these control variables, which you have power over and you trying to decide, can I control the system with the appropriate function. And in order to do that, that's kind of the problem that we had at the beginning, I know it's not. Oh, yeah, it is. So what you need to do is, again, differentiate the system with respect to its internal variables, differentiate the system with respect to its control variables, evaluate A and B, calculate the controllability matrix with the with one of the functions above, calculate the rank, and optionally, evaluate this equation number three that we saw before. Now, the last task is equally complicated. It relates to the stability of partial differential equations using the Fourier transform. And again, to obtain this, it is a five step, intricate process, where that is a mix of symbolic, complex manipulation, and numerical evaluation of that symbolic things. And here, you need to simply output two bits, one bit says whether there exists a solution, and the other bit says whether it vanishes at t to infinity. So what are they expecting here? What they're doing is they're going to build a data set that is composed of these things. And I think they do it one by one. So they take one of the tasks, and they're going to build a giant data set of these things, since they all have solutions, right? You can build a data set with labels, because you can actually build a you can build software that does these steps, because you program mathematical knowledge into the software, but it's custom made for that particular problem. And they're simply trying to, they're not trying to beat that program, they're simply trying to investigate, can a language model that knows nothing of math, do this simply by learning from data. So they're going to try to build a data set, or they are building a data set. And they do it in the same way as this previous paper, which say we generate random functions by sampling unary binary trees and randomly selecting operators, variables and integers for their internal nodes and leaves. So they use any combination of plus minus times divide x blog, and so on. So all these functions can appear in these things. And they basically they build a tree where they say, Okay, we go from plus, and then here is five, and then here maybe is minus sin of x, and here over is x of y. So that would be five plus sign of x minus x of y. So they build trees like this by randomly sampling. And then they simply feed this to their mathematical program to obtain a solution, y. And then they feed all of this into that's now a training data point. This here is x, and here you have y. And they generate a giant bunch of these things. And they feed them into the into the model. They say, here is a seek to seek models, not even sure what kind of models they use. I think they just they use transformers as well. So they use standard transformers, I believe. So yes, in all experiment, we use the transformer architecture with eight attention heads, we train our models with the atom optimizer learning rate, blah, blah, blah, we vary the dimension, and the number of layers. So that's going to be interesting to see how the size of this language model influences how well this model can solve these things. So as you can see here, they build these data sets for local stability, they include systems with two to six equations, which is already fairly, fairly complicated, and would take a human quite a while to do this. They say we generate a data set with over 50 million systems. So it's a pretty dense sampling of this space. And I feel this is one of the important components here. They do make sure that none of their tests, so they do a train test split, and they do make sure that none of their test examples is in the training data set, though they claim that they never actually have to remove anything, they just check and the search space, the space of these trees here is so large, that it never happens that the that a test sample or almost never happens that a test sample is in the training data set. Alright, so they generate these things. And here are the results. So for local stability, it is trained to predict this lambda that we saw at the beginning, the largest part of the eigenvalue of the Jacobian, corresponding to the convergence speed of equilibrium, we consider that predictions are correct when they fall within 10% of the ground truth. And here you can see that their best model achieves 96% if the degree of if it's two equations. So if the degree of the system is two, it achieves in 96% accuracy. So in 96% of the time, the convergence speed is within 10% of the true convergence speed. That's fairly crazy, right? That's pretty good. And here, the exact prediction of local convergence speed to a given precision. So how many digits actually match of that conversion speed, so it's not only 10% off, they also measure how many digits match. And here, you can see that as you up the degree of equation, sorry, here, the performance drops off, as you can see, less and less and less. And also as you lower the number of layers in your model, or lower the dimensionality, the performance drops quite significantly. So that means the language model sort of is doing real work here. And here you also see that if it's degree two, the convergence speed has pretty even goes to two, three or four digits often. But as you now increase the degree, this accuracy drops off fairly quickly. All right, let's keep that in mind. So the surprising thing is that it actually works. And it works in surprisingly big amount of the time. Now, I don't know, you could bicker about this 10% and how bad or how easy this is, and so on. But it is fairly, it is fairly complicated problem. And to be within 10% of the solution seems quite remarkable. And the same things here happen with the other tasks. So here they say, they predict controllability in the autonomous case. So in the control theory, they predict these two things, whether it's controllable, and then they output this K matrix that we saw before. Yeah. So here, you can see that if they have high enough dimensions and high enough layers with sample systems with three to six equations, they achieve again a 97% in the prediction of whether the system is controllable or not. Now remember, this is a binary prediction, but still, it requires a good understanding of math for a human to solve this. Again, we see this drop off with dimension and layers. But you know, the these, this, this number here is pretty good compared to the 50% you'd have for you to compare to the 50% you'd have from random guessing. Also interesting is when they look at is this correct, this correct, sorry, is the feedback matrix correct. So this matrix that you optionally have to output, they find that if they analyze whether or not that's within 10% of the true one, they see that pretty, pretty quickly this accuracy drops when they up the degree. Of course, the matrix, as I understand it has more entries at degree six than at degree three. So maybe that's understandable. But it drops off pretty quickly. But what is true is whether they call this correct feedback matrix. So from the feedback matrix from the entries in that you can read out whether it's the system is controllable or not, if all of the eigenvalues, I believe, are negative or positive, or all the values are negative or positive. So basically, by saying whether or not these things are positive or negative, you can read out the controllability. And if they check whether that property holds, then that is, is fairly well. So they argue here that this shows that it doesn't, it doesn't predict the the matrix they want. But the matrix that it predicts has the appropriate properties to solve this other task right here. Okay, that's experiment two. Experiment three, as you can imagine, is quite different, sorry, quite similar in that they investigate these partial differential equations. In the Fourier transform, the model is given differential operator and an initial condition is trying to predict if a solution exists, and if so, whether it converges to zero when t goes to infinity. The space, the dimensions between two and six. So the random guessing here would be I guess 25%. Because it's two bits, you need to output and this model performs extremely well, even up to this dimension six, there is a drop off with dimension, but it still does perform very, very well. Now they go into the discussion a bit. And they and this, this is the part that in this paper, interests me, like how do you interpret these results, apparently, you give these mathematical things to a language model that has no clue of math. And just by looking at examples, it learns to produce correct solutions. And if you want to teach that to a human, the human would have to go through all these steps, right? So something is happening here. And we'll want to find out what and the discussion is maybe they try to explain a bit why they think this happens. They say, we studied five problems of advanced mathematics from widely researched about it. In three of them, we predict qualitative and theoretical features. In two, we perform numerical computations. According to mathematical theory, solving these problems requires a combination of advanced techniques, symbolic and numerical that seem unlikely to be learnable from examples. Yet our model achieves more than 95% accuracy on all qualitative tasks, and between 65 and 85 on numerical computations, such high performances over difficult mathematical tasks may come as a surprise. One way to generate data set of problems with their solutions consists in sampling the solution first, and deriving an associated problem. For instance, pairs of functions with their integrals can be generated by sampling and differentiating from random functions. So here they hedge against there's this criticism. And this was mainly a criticism of their other paper, which they already addressed in their other paper was if you want to find out if you want to create a data set where you have the function, and then the label is the integral of the function, then there is no common solution to derive these integrals. Sorry, the derive is a, there is no common solution to integrate functions. I mean, you can do it numerically, but there is no common symbolic solution to integrate any function. And that's why what you can do if you want to produce a data set is you start with the integral already. And then you differentiate that to get to get a thing. And then you know that if you integrate this, you should get back your original function. But this biases the data set because the sampling is now not over these functions, but the sampling is over these functions. And that might lead to this distribution here being biased. So they hedge against that, which I don't care because it clearly in this paper, and they say in this paper, data sets for all considered tasks are generated using a forward approach by directly sampling as a result, potential bias caused by backward generative model do not apply here. And they studied problems from three to so they hedge against this argument that they could have a biased data set, which I don't think anyone reading this paper would leverage against them. Yeah, so in. So here, they basically say how good they are how surprising this is all of this requires math. This part is irrelevant because it hedges against an argument that I don't think is reasonable against the paper. And then the last thing in their discussion is an objection traditionally raised is that the model might memorize a very large number of cases and interpolate between them, which I think we know in language model happens often. Right. Oh, by the way, have I shown you how they encode this into the language model? I have not. This is the I guess this is the craziest part. They don't even put the numbers there. Wait, wait, they don't even put the numbers there. They actually put the as I understand it, they put the string tokens here. Right. So they put the string tokens of the math, and then even like compose. So that number 142, they would put as now there's an integer and then the token one, the token four and the token two. Okay. And the decimal point representation is the sequence float three dot one, four E in negative one. So this is it's really just a string, there is no, like the model would even have to learn the decimal representation of numbers to get that this four here is actually not not just a different token than two, but it's 20 times larger because it is in the position one in front of two. So it's not two times larger, like four is the two. But because four is, you know, one digit away from two, it's 20 times larger. And then this here is actually 50 times larger than this. So it seems like a quite inconvenient way to input data into the model. And yet the model is super accurate, right. And we already know that these language models, what they tend to do is they tend to memorize the training data or abstracted in a way that they can sort of interpolate between fuzzy versions of the training data. Here they say this is unlikely, sorry, this is unlikely because first because the size of our problem space is too large to be memorized. So say for all considered problems, we did not get a single duplicate over 50 million generated examples. Second, because in some of our problems, such as non autonomous control, even a model with a one layer and 64 dimensions obtains a high accuracy and such a small model would never be able to memorize that many examples, which is true, right? So this is, this is a fair defense against you're just interpolating training data. But I think the kind of broader, the broader scope of this criticism would be something like your model is just kind of learning the pattern regularities of the textual data that you feed in. It's not actually learning math, it's just learning sort of, okay, there is like a cosine. And if there's a cosine here, followed by an exponential function, that often leads to like a very low number of this lambda, right. And then if a very similar thing comes, if it comes across a very similar thing in the test sample, even though it's not exactly the same thing, it will map it to like a similar place in the label space. I mean, this is literally machine learning. This is literally regression. But I think the more the broader scope of this criticism is that what your model might be doing might simply be sort of a very simple regression on these tokens or on the these context dependent tokens, rather than this internal mathematical reasoning. And I don't, while it is true that it's probably not memorizing any examples, this still doesn't. And while it is also true that they did not get a single exact duplicate, what would be interesting to know is how many, like approximate duplicates. So can you basically solve the problem with a nearest neighbor approach? That would be my question. Can you solve the problem with a nearest neighbor approach over their training data set? Because that means you basically don't need the mathematical knowledge. They say third, because for some of our problems, we know from mathematical theory that solutions, i.g. the real value of eigenvalues cannot be obtained by simple interpolation. And I mean, that is also a valid defense. But I think the argument goes further than just simple interpolation. What we mean by interpolation is not we interpolate the real values of the eigenvalues. What we mean by interpolation is sort of interpolation in the regression space of these tokens. Like we know that if we go from a sine to a cosine, maybe the sine of the output flips at the end. And that's what we mean by interpolation. Like when we see two equations that are very similar, like x squared plus 4x minus the sine of x, and then we see x squared plus 5x minus twice the sine of x. What we mean by interpolation is that we now get a test example that says x squared plus, let's say, 4x minus 3 times the sine of x. Then what we would interpolate is sort of these things. Or yeah, I'm making a bad example right here. Maybe I should go with x squared and this is x third. I know these things aren't exactly equal. But this in the middle would be sort of an interpolation in token space. And if you train the language model, it will recognize that maybe I can interpolate whenever the coefficient here is just different or I can interpolate when there's just, you know, if there's like a log x here, that doesn't really change anything. So I can interpolate between the two, but I might not be able to interpolate when the exponent here is different. So if you give a training data set, you teach the model where it can interpolate and where it can't. Now, again, it's not able to remember the training data, but it will be able to sort of abstract it and store it fuzzily and abstract the patterns from it, which is good, right? That's machine learning. But there's no evidence here that this does any mathematical reasoning. So up until now, all that has built up is sort of if you read the abstract, can advanced mathematical computations be learned from examples? Neural networks can learn advanced theorems, complex computation without built in mathematical knowledge. All of the story here, all of this, this showing of, hey, look at what all what steps is required to solve these problems. And even this discussion here basically says, hey, you need mathematical complex reasoning to arrive at the solutions. And then in the conclusion, in the conclusion, they say, it seems that our models have learned to solve these problems. But that does not mean they learn these techniques we use to compute their solutions. Problems such as non autonomous control involve long and complex chain of computations, yet even small models. So means one layer transformers with 64 dimensions achieve high accuracy. Most probably our models learn shortcuts that allow them to solve specific problems without having to learn or understand their theoretical background. Such a situation is common in everyday life. Yada, yada, yada. So here in this in this paragraph here, they sort of counter their whole narrative of the paper. And that's I guess that's sort of to it's fair, right? They criticize their own work, which is good for research. It's also to hedge against criticism. And it's to be a bit real. This it's a it's a good paper, right? Because it's a nice and interesting story. And then at the end, you also say, look, this might actually not be all that what it's made up or what it seems like to be. And I, I agree with this statement right here. It's that probably the model learns shortcuts, and the shortcuts might be just in a way of pattern matching the pattern matching of whatever patterns you extract from the training data, you pattern match that and you relatively simply interpolate between those matched patterns, not between the training data itself, but between the match patterns. And therefore, you can arrive at approximately good solution. So what I would have liked to see from such a paper, right? They say that we leave that to future research after making really kind of big claims in the introduction and the abstract. They have taken three different problems here, right? There's this local, this local stability, then there is this, this control theory. And then there is this stability, they have three different problems. And okay, they try to show that they can apply this to a diverse range. But what I would have expected from a paper like this is they even they even spell out, here are four things that you need to do to solve this if we were to teach this to a human, right? Now, if you have trained a model, and you evaluated it, it is really good at this task for which you thought you need, you know, to do these four steps. What would be really interesting is to now introspect your model and see can, can I somehow show that my model has in somewhere in the intermediate layers has this quantity right here, and is not just nearest neighboring in some learned pattern space. That would be an actually interesting research question, right? So rather, in my mind, rather than having three different things where they all, you know, they demonstrate the same thing over and over and over again, that this actually works. It would be a much more interesting question to introspect the model and parse out can cannot, for example, you can see, can I reconstruct this quantity from the inside of the model, when the model isn't specifically trained to give me back this quantity, because I know this quantity would be a step on these on the path of the solution, right? If I want to get the solution, I almost have to calculate this quantity. Can I parse this out from the middle of the model somewhere, when the model isn't explicitly trained to give me this, if I can, then I can really make the point that the model does something like this and learn something like this from data. Whereas if I can't, that will be more of an evidence that the model is simply sort of pattern matching close enough seen examples in the training data. So that's a bit of my of my criticism right here is that they they show it works, which is pretty cool. But then they, they don't do the sort of interesting experiments of these of this introspection right here, which is a bit sad, but you know, they leave it for future research, which I guess is going to be themselves. And that's how you make two papers. So no, I don't want to be too critical. It's a very cool paper. And I invite you to check it out and leave a like and subscribe and leave a comment of what you think of this kind of research of this paper, and whether or not you think I'm totally wrong. That's entirely possible. Okay, I'll see you next time. Bye bye.
[{"start": 0.0, "end": 11.0, "text": " Hi, here's a question for the whiz kids among you. Is this system here controllable at a point xe with asymptotic control ue?"}, {"start": 11.0, "end": 17.0, "text": " I'll give you 10 seconds. Okay, 10 seconds are over. So to solve this, it's actually pretty easy."}, {"start": 17.0, "end": 25.0, "text": " All you need to do is first differentiate the system with respect to its internal variables, which are the x's, to obtain the Jacobian A."}, {"start": 25.0, "end": 32.0, "text": " Second step, differentiate the system with respect to its control variables, which are the u variables to obtain the matrix B."}, {"start": 32.0, "end": 41.0, "text": " Look, this is a zero, like this is not hard. Then evaluate A and B at the point that you want and the control point that you want. Pretty easy."}, {"start": 41.0, "end": 47.0, "text": " Calculate the controllability matrix. Come on, that's nothing. Another zero."}, {"start": 47.0, "end": 57.0, "text": " And at the end, you calculate the rank of the controllability matrix. Now if the if n minus D is zero, the system is controllable."}, {"start": 57.0, "end": 65.0, "text": " And optionally, if you want, if you feel like it, you can output the control feedback matrix as an equation three, which gives you this here."}, {"start": 65.0, "end": 72.0, "text": " Now what's equation three? Equation three is super duper simple."}, {"start": 72.0, "end": 84.0, "text": " It's just this little sort of integral thing, inverse matrix trace transposed exponential function, outer product thing."}, {"start": 84.0, "end": 88.0, "text": " Come on, what's the matter with you?"}, {"start": 88.0, "end": 104.0, "text": " Okay, so if you found you can't do this just on the spot, then you are in the same category as most people. But interestingly, apparently, according to this paper, a deep learning system can."}, {"start": 104.0, "end": 122.0, "text": " So today we're going to look at deep differential system stability, learning advanced computations from examples by Francois Charton, Amaury Hayat and Guillaume Lempel of Facebook AI Research and \u00c9cole de Pont Paris Tech and Rutgers University."}, {"start": 122.0, "end": 136.0, "text": " So at this, in this paper, these authors basically propose that you can learn these complex mathematics with a model that has no clue about mathematics. In fact, it is a language model."}, {"start": 136.0, "end": 155.0, "text": " And it can output the solutions, for example, whether or not a system is controllable, which are sort of binary solutions, but it can also output actual solutions as in numbers or as in the matrices that you would need to obtain from these problems."}, {"start": 155.0, "end": 173.0, "text": " So that's pretty cool. And it is built upon this other paper called, I think, some deep learning for symbolic mathematics or something, I have made a video on it, if you search for it, and I'll also link it in in the description."}, {"start": 173.0, "end": 186.0, "text": " And you can go check that out, because that's sort of the basis. So in this previous paper, I think it was from partially the same authors, they have investigated language models into integrating functions."}, {"start": 186.0, "end": 194.0, "text": " So you have some sort of function, you're trying to find the integral, and they've tried to do that. Now they go a lot further."}, {"start": 194.0, "end": 215.0, "text": " So they look at these differential systems, which are characterized by these differential equations. So if you've never seen differential equations, it's basically an equation where the derivation of some variable is characterized by the variable itself."}, {"start": 215.0, "end": 231.0, "text": " So the the, the gradient, if you will, or the coban, the derivation, according to some input variable here, it's most often it's time and physical systems is a function of that variable itself, and partially also other variables."}, {"start": 231.0, "end": 245.0, "text": " So you can have systems of differential equations that all depend on each other. And there are a number of questions about these systems, these are very relevant in like physics or engineering, control theory, and so on."}, {"start": 245.0, "end": 270.0, "text": " So they investigate different problems that you can solve with these. They investigate specifically problems where we already know the solutions, but the solutions require very complex mathematical manipulation, such as, as you've seen, calculate the integral of something, take the trace, calculate the rank, invert some matrix."}, {"start": 270.0, "end": 290.0, "text": " So all of these mathematical steps are required to solve these problems, if we were to teach them to math students or engineering students. And this paper basically says, if we just input the problem into a big language model, and, and ask it to output the solution, it can do it."}, {"start": 290.0, "end": 304.0, "text": " So basically can learn to do all of these things. So that's pretty, pretty surprising, because you don't program it to do any math. So the first problem they look at is this local stability problem."}, {"start": 304.0, "end": 317.0, "text": " So, in, I don't, I don't really want to go into, into much of the actual mathematical problems, but we'll look at the first one to just give you an idea of what these sort of problems are."}, {"start": 317.0, "end": 335.0, "text": " So, x e is an, if x is an equilibrium point, it means that all solutions, if all solutions converge to x e when their initial positions are close enough, the equilibrium point is said to be locally stable."}, {"start": 335.0, "end": 343.0, "text": " Okay, this problem is well known if f is differentiable in x e, and answers provided by the spectral mapping theorem."}, {"start": 343.0, "end": 357.0, "text": " So, in that case, you'd have a system, maybe we can draw one where you try to find local points of stability. So this point here would be maybe a local point of stability."}, {"start": 357.0, "end": 374.0, "text": " If you consider this as sort of an optimization landscape, because if you go from here, if you go a little bit away from it, you're always sort of pushed back. If this, if this is a, if the system is gravity, sort of, sort of."}, {"start": 374.0, "end": 388.0, "text": " So if these differential equations sort of describe that the height here is the force which with which you're pulled down, then this thing here would be a local point of stability."}, {"start": 388.0, "end": 399.0, "text": " The question is, if I give you a system that's described by these differential equations, can you tell me whether or not it is stable at some point?"}, {"start": 399.0, "end": 411.0, "text": " Okay, and there is a spectral mapping theorem, which says, if you have the Jacobian matrix of f at this point, the matrix of its partial derivatives relative to its variable."}, {"start": 411.0, "end": 423.0, "text": " And if you take lambda to be the largest real part of its complex eigenvalues, if lambda is positive, then this is an unstable equilibrium."}, {"start": 423.0, "end": 437.0, "text": " If lambda is negative, then it's a locally stable equilibrium. So an unstable equilibrium, likewise, would be the point here on top, which means that if you're exactly at the point, then you stay there."}, {"start": 437.0, "end": 444.0, "text": " But as soon as you're a little bit off, you drift away from it. That would be an unstable equilibrium."}, {"start": 444.0, "end": 455.0, "text": " Okay, so there are complex steps involved in deriving the solution, then they list them out here, just to show you how complex this is, this is not meant to teach you."}, {"start": 455.0, "end": 463.0, "text": " You don't have to like understand or be able to apply this, this is simply meant to tell you how complicated it is to arrive at a solution."}, {"start": 463.0, "end": 470.0, "text": " So first, you need to differentiate each function with respect to each variable and obtain the formal Jacobian."}, {"start": 470.0, "end": 482.0, "text": " So they do this here for this example system, which is this system right here. This is a system of two equations, two differential equations in two variables."}, {"start": 482.0, "end": 494.0, "text": " Okay, so if you drive the Jacobian, that will give you a four entry Jacobian. So each one of these is one of the equations derived with respect to one of the variables."}, {"start": 494.0, "end": 512.0, "text": " You can do that, right? But it requires fairly complex mathematical knowledge, like knowing that the derivative of the sine here is the cosine and knowing that this cosine doesn't matter for this particular entry, because it's in x two, and here we drive by x one."}, {"start": 512.0, "end": 516.0, "text": " So that's already very challenging."}, {"start": 516.0, "end": 535.0, "text": " Second, you need to evaluate the Jacobian at that point. So first, you've done it symbolically. Now you actually need to put in the numbers at the point you're interested in, which will give you this thing right here, which is a numerical matrix, whereas this was a symbolical matrix."}, {"start": 535.0, "end": 558.0, "text": " Then you need to calculate the eigenvalues, which is mean, you have several methods of that. You have several methods of computing the largest eigenvalue, you could do power method, you could do decomposition, there, there are numerous ways, but none of these is like particularly easily, right."}, {"start": 558.0, "end": 587.0, "text": " And then lastly, you need to return the minus max of the real part, which is the speed of convergence of the system. So not only do you need to be able to tell whether it is stable, which is if this is negative, you also need to be able to say, or if this is negative, sorry, you need to be able to say whether it is locally stable or locally unstable."}, {"start": 587.0, "end": 606.0, "text": " And since this is large is larger than zero, it's locally stable. And this would be the decay rate 0.441. This is what you're asking this model to output, right? Now we'll quickly go over the other things, but not as as in depth."}, {"start": 606.0, "end": 624.0, "text": " But this is in control theory, where you're trying, you have almost the same thing, you have a differential equation. But now, in addition to these variables, you have these control variables, which you have power over and you trying to decide, can I control the system with the appropriate function."}, {"start": 624.0, "end": 631.0, "text": " And in order to do that, that's kind of the problem that we had at the beginning, I know it's not."}, {"start": 631.0, "end": 656.0, "text": " Oh, yeah, it is. So what you need to do is, again, differentiate the system with respect to its internal variables, differentiate the system with respect to its control variables, evaluate A and B, calculate the controllability matrix with the with one of the functions above, calculate the rank, and optionally, evaluate this equation number three that we saw before."}, {"start": 656.0, "end": 680.0, "text": " Now, the last task is equally complicated. It relates to the stability of partial differential equations using the Fourier transform. And again, to obtain this, it is a five step, intricate process, where that is a mix of symbolic, complex manipulation, and numerical evaluation of that symbolic things."}, {"start": 680.0, "end": 694.0, "text": " And here, you need to simply output two bits, one bit says whether there exists a solution, and the other bit says whether it vanishes at t to infinity."}, {"start": 694.0, "end": 704.0, "text": " So what are they expecting here? What they're doing is they're going to build a data set that is composed of these things. And I think they do it one by one."}, {"start": 704.0, "end": 726.0, "text": " So they take one of the tasks, and they're going to build a giant data set of these things, since they all have solutions, right? You can build a data set with labels, because you can actually build a you can build software that does these steps, because you program mathematical knowledge into the software, but it's custom made for that particular problem."}, {"start": 726.0, "end": 740.0, "text": " And they're simply trying to, they're not trying to beat that program, they're simply trying to investigate, can a language model that knows nothing of math, do this simply by learning from data."}, {"start": 740.0, "end": 760.0, "text": " So they're going to try to build a data set, or they are building a data set. And they do it in the same way as this previous paper, which say we generate random functions by sampling unary binary trees and randomly selecting operators, variables and integers for their internal nodes and leaves."}, {"start": 760.0, "end": 784.0, "text": " So they use any combination of plus minus times divide x blog, and so on. So all these functions can appear in these things. And they basically they build a tree where they say, Okay, we go from plus, and then here is five, and then here maybe is minus sin of x, and here over is x of y."}, {"start": 784.0, "end": 803.0, "text": " So that would be five plus sign of x minus x of y. So they build trees like this by randomly sampling. And then they simply feed this to their mathematical program to obtain a solution, y."}, {"start": 803.0, "end": 819.0, "text": " And then they feed all of this into that's now a training data point. This here is x, and here you have y. And they generate a giant bunch of these things. And they feed them into the into the model."}, {"start": 819.0, "end": 844.0, "text": " They say, here is a seek to seek models, not even sure what kind of models they use. I think they just they use transformers as well. So they use standard transformers, I believe. So yes, in all experiment, we use the transformer architecture with eight attention heads, we train our models with the atom optimizer learning rate, blah, blah, blah, we vary the dimension, and the number of layers."}, {"start": 844.0, "end": 868.0, "text": " So that's going to be interesting to see how the size of this language model influences how well this model can solve these things. So as you can see here, they build these data sets for local stability, they include systems with two to six equations, which is already fairly, fairly complicated, and would take a human quite a while to do this."}, {"start": 868.0, "end": 880.0, "text": " They say we generate a data set with over 50 million systems. So it's a pretty dense sampling of this space. And I feel this is one of the important components here."}, {"start": 880.0, "end": 908.0, "text": " They do make sure that none of their tests, so they do a train test split, and they do make sure that none of their test examples is in the training data set, though they claim that they never actually have to remove anything, they just check and the search space, the space of these trees here is so large, that it never happens that the that a test sample or almost never happens that a test sample is in the training data set."}, {"start": 908.0, "end": 934.0, "text": " Alright, so they generate these things. And here are the results. So for local stability, it is trained to predict this lambda that we saw at the beginning, the largest part of the eigenvalue of the Jacobian, corresponding to the convergence speed of equilibrium, we consider that predictions are correct when they fall within 10% of the ground truth."}, {"start": 934.0, "end": 956.0, "text": " And here you can see that their best model achieves 96% if the degree of if it's two equations. So if the degree of the system is two, it achieves in 96% accuracy. So in 96% of the time, the convergence speed is within 10% of the true convergence speed."}, {"start": 956.0, "end": 976.0, "text": " That's fairly crazy, right? That's pretty good. And here, the exact prediction of local convergence speed to a given precision. So how many digits actually match of that conversion speed, so it's not only 10% off, they also measure how many digits match."}, {"start": 976.0, "end": 1000.0, "text": " And here, you can see that as you up the degree of equation, sorry, here, the performance drops off, as you can see, less and less and less. And also as you lower the number of layers in your model, or lower the dimensionality, the performance drops quite significantly."}, {"start": 1000.0, "end": 1017.0, "text": " So that means the language model sort of is doing real work here. And here you also see that if it's degree two, the convergence speed has pretty even goes to two, three or four digits often."}, {"start": 1017.0, "end": 1035.0, "text": " But as you now increase the degree, this accuracy drops off fairly quickly. All right, let's keep that in mind. So the surprising thing is that it actually works. And it works in surprisingly big amount of the time."}, {"start": 1035.0, "end": 1051.0, "text": " Now, I don't know, you could bicker about this 10% and how bad or how easy this is, and so on. But it is fairly, it is fairly complicated problem. And to be within 10% of the solution seems quite remarkable."}, {"start": 1051.0, "end": 1073.0, "text": " And the same things here happen with the other tasks. So here they say, they predict controllability in the autonomous case. So in the control theory, they predict these two things, whether it's controllable, and then they output this K matrix that we saw before."}, {"start": 1073.0, "end": 1094.0, "text": " Yeah. So here, you can see that if they have high enough dimensions and high enough layers with sample systems with three to six equations, they achieve again a 97% in the prediction of whether the system is controllable or not."}, {"start": 1094.0, "end": 1111.0, "text": " Now remember, this is a binary prediction, but still, it requires a good understanding of math for a human to solve this. Again, we see this drop off with dimension and layers."}, {"start": 1111.0, "end": 1126.0, "text": " But you know, the these, this, this number here is pretty good compared to the 50% you'd have for you to compare to the 50% you'd have from random guessing."}, {"start": 1126.0, "end": 1150.0, "text": " Also interesting is when they look at is this correct, this correct, sorry, is the feedback matrix correct. So this matrix that you optionally have to output, they find that if they analyze whether or not that's within 10% of the true one, they see that pretty, pretty quickly this accuracy drops when they up the degree."}, {"start": 1150.0, "end": 1163.0, "text": " Of course, the matrix, as I understand it has more entries at degree six than at degree three. So maybe that's understandable. But it drops off pretty quickly."}, {"start": 1163.0, "end": 1184.0, "text": " But what is true is whether they call this correct feedback matrix. So from the feedback matrix from the entries in that you can read out whether it's the system is controllable or not, if all of the eigenvalues, I believe, are negative or positive, or all the values are negative or positive."}, {"start": 1184.0, "end": 1197.0, "text": " So basically, by saying whether or not these things are positive or negative, you can read out the controllability. And if they check whether that property holds, then that is, is fairly well."}, {"start": 1197.0, "end": 1213.0, "text": " So they argue here that this shows that it doesn't, it doesn't predict the the matrix they want. But the matrix that it predicts has the appropriate properties to solve this other task right here."}, {"start": 1213.0, "end": 1226.0, "text": " Okay, that's experiment two. Experiment three, as you can imagine, is quite different, sorry, quite similar in that they investigate these partial differential equations."}, {"start": 1226.0, "end": 1240.0, "text": " In the Fourier transform, the model is given differential operator and an initial condition is trying to predict if a solution exists, and if so, whether it converges to zero when t goes to infinity."}, {"start": 1240.0, "end": 1261.0, "text": " The space, the dimensions between two and six. So the random guessing here would be I guess 25%. Because it's two bits, you need to output and this model performs extremely well, even up to this dimension six, there is a drop off with dimension, but it still does perform very, very well."}, {"start": 1261.0, "end": 1278.0, "text": " Now they go into the discussion a bit. And they and this, this is the part that in this paper, interests me, like how do you interpret these results, apparently, you give these mathematical things to a language model that has no clue of math."}, {"start": 1278.0, "end": 1300.0, "text": " And just by looking at examples, it learns to produce correct solutions. And if you want to teach that to a human, the human would have to go through all these steps, right? So something is happening here. And we'll want to find out what and the discussion is maybe they try to explain a bit why they think this happens."}, {"start": 1300.0, "end": 1323.0, "text": " They say, we studied five problems of advanced mathematics from widely researched about it. In three of them, we predict qualitative and theoretical features. In two, we perform numerical computations. According to mathematical theory, solving these problems requires a combination of advanced techniques, symbolic and numerical that seem unlikely to be learnable from examples."}, {"start": 1323.0, "end": 1339.0, "text": " Yet our model achieves more than 95% accuracy on all qualitative tasks, and between 65 and 85 on numerical computations, such high performances over difficult mathematical tasks may come as a surprise."}, {"start": 1339.0, "end": 1356.0, "text": " One way to generate data set of problems with their solutions consists in sampling the solution first, and deriving an associated problem. For instance, pairs of functions with their integrals can be generated by sampling and differentiating from random functions."}, {"start": 1356.0, "end": 1380.0, "text": " So here they hedge against there's this criticism. And this was mainly a criticism of their other paper, which they already addressed in their other paper was if you want to find out if you want to create a data set where you have the function, and then the label is the integral of the function, then there is no common solution to derive these integrals."}, {"start": 1380.0, "end": 1398.0, "text": " Sorry, the derive is a, there is no common solution to integrate functions. I mean, you can do it numerically, but there is no common symbolic solution to integrate any function. And that's why what you can do if you want to produce a data set is you start with the integral already."}, {"start": 1398.0, "end": 1419.0, "text": " And then you differentiate that to get to get a thing. And then you know that if you integrate this, you should get back your original function. But this biases the data set because the sampling is now not over these functions, but the sampling is over these functions."}, {"start": 1419.0, "end": 1441.0, "text": " And that might lead to this distribution here being biased. So they hedge against that, which I don't care because it clearly in this paper, and they say in this paper, data sets for all considered tasks are generated using a forward approach by directly sampling as a result, potential bias caused by backward generative model do not apply here."}, {"start": 1441.0, "end": 1452.0, "text": " And they studied problems from three to so they hedge against this argument that they could have a biased data set, which I don't think anyone reading this paper would leverage against them."}, {"start": 1452.0, "end": 1455.0, "text": " Yeah, so"}, {"start": 1455.0, "end": 1456.0, "text": " in."}, {"start": 1456.0, "end": 1482.0, "text": " So here, they basically say how good they are how surprising this is all of this requires math. This part is irrelevant because it hedges against an argument that I don't think is reasonable against the paper. And then the last thing in their discussion is an objection traditionally raised is that the model might memorize a very large number of cases and interpolate between them, which I think we know in language model happens often."}, {"start": 1482.0, "end": 1488.0, "text": " Right. Oh, by the way, have I shown you how they encode this into the language model? I have not."}, {"start": 1488.0, "end": 1495.0, "text": " This is the I guess this is the craziest part. They don't even put the numbers there."}, {"start": 1495.0, "end": 1511.0, "text": " Wait, wait, they don't even put the numbers there. They actually put the as I understand it, they put the string tokens here. Right. So they put the string tokens of the math, and then even like compose."}, {"start": 1511.0, "end": 1522.0, "text": " So that number 142, they would put as now there's an integer and then the token one, the token four and the token two. Okay."}, {"start": 1522.0, "end": 1546.0, "text": " And the decimal point representation is the sequence float three dot one, four E in negative one. So this is it's really just a string, there is no, like the model would even have to learn the decimal representation of numbers to get that this four here is actually"}, {"start": 1546.0, "end": 1557.0, "text": " not not just a different token than two, but it's 20 times larger because it is in the position one in front of two. So it's not two times larger, like four is the two."}, {"start": 1557.0, "end": 1573.0, "text": " But because four is, you know, one digit away from two, it's 20 times larger. And then this here is actually 50 times larger than this. So it seems like a quite inconvenient way to input data into the model. And yet the model is super accurate, right."}, {"start": 1573.0, "end": 1587.0, "text": " And we already know that these language models, what they tend to do is they tend to memorize the training data or abstracted in a way that they can sort of interpolate between fuzzy versions of the training data."}, {"start": 1587.0, "end": 1597.0, "text": " Here they say this is unlikely, sorry, this is unlikely because first because the size of our problem space is too large to be memorized."}, {"start": 1597.0, "end": 1620.0, "text": " So say for all considered problems, we did not get a single duplicate over 50 million generated examples. Second, because in some of our problems, such as non autonomous control, even a model with a one layer and 64 dimensions obtains a high accuracy and such a small model would never be able to memorize that many examples, which is true, right?"}, {"start": 1620.0, "end": 1640.0, "text": " So this is, this is a fair defense against you're just interpolating training data. But I think the kind of broader, the broader scope of this criticism would be something like your model is just kind of learning the pattern regularities of the textual data that you feed in."}, {"start": 1640.0, "end": 1655.0, "text": " It's not actually learning math, it's just learning sort of, okay, there is like a cosine. And if there's a cosine here, followed by an exponential function, that often leads to like a very low number of this lambda, right."}, {"start": 1655.0, "end": 1671.0, "text": " And then if a very similar thing comes, if it comes across a very similar thing in the test sample, even though it's not exactly the same thing, it will map it to like a similar place in the label space. I mean, this is literally machine learning. This is literally regression."}, {"start": 1671.0, "end": 1693.0, "text": " But I think the more the broader scope of this criticism is that what your model might be doing might simply be sort of a very simple regression on these tokens or on the these context dependent tokens, rather than this internal mathematical reasoning."}, {"start": 1693.0, "end": 1714.0, "text": " And I don't, while it is true that it's probably not memorizing any examples, this still doesn't. And while it is also true that they did not get a single exact duplicate, what would be interesting to know is how many, like approximate duplicates."}, {"start": 1714.0, "end": 1725.0, "text": " So can you basically solve the problem with a nearest neighbor approach? That would be my question. Can you solve the problem with a nearest neighbor approach over their training data set?"}, {"start": 1725.0, "end": 1730.0, "text": " Because that means you basically don't need the mathematical knowledge."}, {"start": 1730.0, "end": 1746.0, "text": " They say third, because for some of our problems, we know from mathematical theory that solutions, i.g. the real value of eigenvalues cannot be obtained by simple interpolation. And I mean, that is also a valid defense."}, {"start": 1746.0, "end": 1763.0, "text": " But I think the argument goes further than just simple interpolation. What we mean by interpolation is not we interpolate the real values of the eigenvalues. What we mean by interpolation is sort of interpolation in the regression space of these tokens."}, {"start": 1763.0, "end": 1776.0, "text": " Like we know that if we go from a sine to a cosine, maybe the sine of the output flips at the end. And that's what we mean by interpolation."}, {"start": 1776.0, "end": 1796.0, "text": " Like when we see two equations that are very similar, like x squared plus 4x minus the sine of x, and then we see x squared plus 5x minus twice the sine of x."}, {"start": 1796.0, "end": 1810.0, "text": " What we mean by interpolation is that we now get a test example that says x squared plus, let's say, 4x minus 3 times the sine of x."}, {"start": 1810.0, "end": 1819.0, "text": " Then what we would interpolate is sort of these things. Or yeah, I'm making a bad example right here."}, {"start": 1819.0, "end": 1834.0, "text": " Maybe I should go with x squared and this is x third. I know these things aren't exactly equal. But this in the middle would be sort of an interpolation in token space."}, {"start": 1834.0, "end": 1848.0, "text": " And if you train the language model, it will recognize that maybe I can interpolate whenever the coefficient here is just different or I can interpolate when there's just, you know, if there's like a log x here, that doesn't really change anything."}, {"start": 1848.0, "end": 1854.0, "text": " So I can interpolate between the two, but I might not be able to interpolate when the exponent here is different."}, {"start": 1854.0, "end": 1860.0, "text": " So if you give a training data set, you teach the model where it can interpolate and where it can't."}, {"start": 1860.0, "end": 1871.0, "text": " Now, again, it's not able to remember the training data, but it will be able to sort of abstract it and store it fuzzily and abstract the patterns from it, which is good, right?"}, {"start": 1871.0, "end": 1876.0, "text": " That's machine learning. But there's no evidence here that this does any mathematical reasoning."}, {"start": 1876.0, "end": 1890.0, "text": " So up until now, all that has built up is sort of if you read the abstract, can advanced mathematical computations be learned from examples?"}, {"start": 1890.0, "end": 1897.0, "text": " Neural networks can learn advanced theorems, complex computation without built in mathematical knowledge."}, {"start": 1897.0, "end": 1907.0, "text": " All of the story here, all of this, this showing of, hey, look at what all what steps is required to solve these problems."}, {"start": 1907.0, "end": 1917.0, "text": " And even this discussion here basically says, hey, you need mathematical complex reasoning to arrive at the solutions."}, {"start": 1917.0, "end": 1929.0, "text": " And then in the conclusion, in the conclusion, they say, it seems that our models have learned to solve these problems."}, {"start": 1929.0, "end": 1934.0, "text": " But that does not mean they learn these techniques we use to compute their solutions."}, {"start": 1934.0, "end": 1940.0, "text": " Problems such as non autonomous control involve long and complex chain of computations, yet even small models."}, {"start": 1940.0, "end": 1944.0, "text": " So means one layer transformers with 64 dimensions achieve high accuracy."}, {"start": 1944.0, "end": 1954.0, "text": " Most probably our models learn shortcuts that allow them to solve specific problems without having to learn or understand their theoretical background."}, {"start": 1954.0, "end": 1958.0, "text": " Such a situation is common in everyday life."}, {"start": 1958.0, "end": 1968.0, "text": " Yada, yada, yada. So here in this in this paragraph here, they sort of counter their whole narrative of the paper."}, {"start": 1968.0, "end": 1971.0, "text": " And that's I guess that's sort of to it's fair, right?"}, {"start": 1971.0, "end": 1976.0, "text": " They criticize their own work, which is good for research. It's also to hedge against criticism."}, {"start": 1976.0, "end": 1981.0, "text": " And it's to be a bit real. This it's a it's a good paper, right?"}, {"start": 1981.0, "end": 1992.0, "text": " Because it's a nice and interesting story. And then at the end, you also say, look, this might actually not be all that what it's made up or what it seems like to be."}, {"start": 1992.0, "end": 1996.0, "text": " And I, I agree with this statement right here."}, {"start": 1996.0, "end": 2017.0, "text": " It's that probably the model learns shortcuts, and the shortcuts might be just in a way of pattern matching the pattern matching of whatever patterns you extract from the training data, you pattern match that and you relatively simply interpolate between those matched patterns, not between the training data itself, but between the match patterns."}, {"start": 2017.0, "end": 2021.0, "text": " And therefore, you can arrive at approximately good solution."}, {"start": 2021.0, "end": 2025.0, "text": " So what I would have liked to see from such a paper, right?"}, {"start": 2025.0, "end": 2033.0, "text": " They say that we leave that to future research after making really kind of big claims in the introduction and the abstract."}, {"start": 2033.0, "end": 2036.0, "text": " They have taken three different problems here, right?"}, {"start": 2036.0, "end": 2044.0, "text": " There's this local, this local stability, then there is this, this control theory."}, {"start": 2044.0, "end": 2048.0, "text": " And then there is this stability, they have three different problems."}, {"start": 2048.0, "end": 2052.0, "text": " And okay, they try to show that they can apply this to a diverse range."}, {"start": 2052.0, "end": 2067.0, "text": " But what I would have expected from a paper like this is they even they even spell out, here are four things that you need to do to solve this if we were to teach this to a human, right?"}, {"start": 2067.0, "end": 2077.0, "text": " Now, if you have trained a model, and you evaluated it, it is really good at this task for which you thought you need, you know, to do these four steps."}, {"start": 2077.0, "end": 2096.0, "text": " What would be really interesting is to now introspect your model and see can, can I somehow show that my model has in somewhere in the intermediate layers has this quantity right here, and is not just nearest neighboring in some learned pattern space."}, {"start": 2096.0, "end": 2100.0, "text": " That would be an actually interesting research question, right?"}, {"start": 2100.0, "end": 2110.0, "text": " So rather, in my mind, rather than having three different things where they all, you know, they demonstrate the same thing over and over and over again, that this actually works."}, {"start": 2110.0, "end": 2125.0, "text": " It would be a much more interesting question to introspect the model and parse out can cannot, for example, you can see, can I reconstruct this quantity from the inside of the model, when the model isn't specifically trained to give me back this quantity,"}, {"start": 2125.0, "end": 2131.0, "text": " because I know this quantity would be a step on these on the path of the solution, right?"}, {"start": 2131.0, "end": 2136.0, "text": " If I want to get the solution, I almost have to calculate this quantity."}, {"start": 2136.0, "end": 2151.0, "text": " Can I parse this out from the middle of the model somewhere, when the model isn't explicitly trained to give me this, if I can, then I can really make the point that the model does something like this and learn something like this from data."}, {"start": 2151.0, "end": 2161.0, "text": " Whereas if I can't, that will be more of an evidence that the model is simply sort of pattern matching close enough seen examples in the training data."}, {"start": 2161.0, "end": 2169.0, "text": " So that's a bit of my of my criticism right here is that they they show it works, which is pretty cool."}, {"start": 2169.0, "end": 2185.0, "text": " But then they, they don't do the sort of interesting experiments of these of this introspection right here, which is a bit sad, but you know, they leave it for future research, which I guess is going to be themselves."}, {"start": 2185.0, "end": 2189.0, "text": " And that's how you make two papers."}, {"start": 2189.0, "end": 2192.0, "text": " So no, I don't want to be too critical. It's a very cool paper."}, {"start": 2192.0, "end": 2205.0, "text": " And I invite you to check it out and leave a like and subscribe and leave a comment of what you think of this kind of research of this paper, and whether or not you think I'm totally wrong."}, {"start": 2205.0, "end": 2223.0, "text": " That's entirely possible. Okay, I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=ZfDZRX3WiJg
VirTex: Learning Visual Representations from Textual Annotations (Paper Explained)
Pre-training a CNN backbone for visual transfer learning has recently seen a big push into the direction of incorporating more data, at the cost of less supervision. This paper investigates the opposite: Visual transfer learning by pre-training from very few, but very high-quality samples on an image captioning task. OUTLINE: 0:00 - Intro & Overview 1:00 - Pre-Training for Visual Tasks 3:40 - Quality-Quantity Tradeoff 5:50 - Image Captioning 8:35 - VirTex Method 14:30 - Linear Classification 20:30 - Ablations 22:05 - Fine-Tuning 25:45 - Attention Visualization 27:30 - Conclusion & Remarks Paper: https://arxiv.org/abs/2006.06666 Code: https://github.com/kdexd/virtex Abstract: The de-facto approach to many vision tasks is to start from pretrained visual representations, typically learned via supervised training on ImageNet. Recent methods have explored unsupervised pretraining to scale to vast quantities of unlabeled images. In contrast, we aim to learn high-quality visual representations from fewer images. To this end, we revisit supervised pretraining, and seek data-efficient alternatives to classification-based pretraining. We propose VirTex -- a pretraining approach using semantically dense captions to learn visual representations. We train convolutional networks from scratch on COCO Captions, and transfer them to downstream recognition tasks including image classification, object detection, and instance segmentation. On all tasks, VirTex yields features that match or exceed those learned on ImageNet -- supervised or unsupervised -- despite using up to ten times fewer images. Authors: Karan Desai, Justin Johnson Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we're looking at vertex learning visual representations from textual annotations by Karen Desai and Justin Johnson of the University of Michigan. So this paper at its core is pretty simple. On a high level, it proposes to take the task of image captioning, which is where you're given an image and you're asked to produce a caption for the image, and basically train a model to do this, and then just take the visual part of it as a baseline to transfer learn on other visual tasks. And that appears to work surprisingly well if you don't have much data. So if you if you don't have much data to pre train on, this appears to work very well. Alright, as always, if you like content like this, then consider sharing it out, subscribing to the channel, or tell me what you think in the comments. So as I already said, the the idea here is pretty simple. So people have been looking for pre training tasks for visual tasks. So a visual task is anything where the input is an image. And then you usually have some sort of neural network that processes the image. And then at the end, you can have many things. So you could have a classifier that classifies the image into one of many classes, if you know ImageNet, that's a thing. So if there's a cat here, then the the ImageNet classifier here would say cat, or you could have something like a object detector that tries to predict on the image where the cat is like with a bounding box, you could have a you could have a semantic segmentation where it's like, all of these pixels here are cat. And maybe all of these pixels here are sky. And so it labels every pixel, there's many visual tasks that you can formulate. And they all sort of share the same architecture. And specifically, they all share this part right here, the if you will, this is the visual encoder, it's usually a convolutional neural network. And what's really different between the tasks is mostly this last part here that does the actual task. But this and is often called the backbone. So this is the backbone. And the idea now is, if I have a bunch of these tasks, sometimes I don't have money labels for these tasks, I don't have many labeled images, so that I could train this big architecture from scratch, like in medical images, or just in domains where you don't have many images. So couldn't I somehow come up with a method to create this backbone beforehand. So to create backbone given another data set. And the simplest variant here is you take a big image data set, such as image net, and then you train a classifier, like we said, to predict some classes on it. And then because an image net has a lot of images, then this is your backbone. And then whenever you have a different task, you simply take the backbone, transfer it over and then train the other basically, you continue training on the other tasks that's called transfer learning. The question is, how do you get a good backbone. So if you train on something like image net, then this is of course a supervised tasks, you'll have a very good learning signal. But even image net has like 1 million images. But for example, the internet has many more images. So what you could do is you could train on this much bigger data set that you collected from the internet, let's just call it internet. But there you don't have labels, right. So what you'll have to resort to is instead of supervised learning is self supervised learning where you have an image and maybe you rotate it to the right. So here is our cat, he rotated to the right. And then you have a classifier that predicts that these this image was rotated to the right. And then that will become your backbone. These self supervised methods, they work very well. There is a different number of them. For example, Moco, things like this. And there's also a number of techniques that do supervised pre training, and then transfer learning, you can maybe watch my video on big transfer, which is a very large attempt to do to pre train a backbone for visual tasks. All right, now, you can see right here that the sort of direction is that the more data, the better. So that's sort of the idea here that image net is a big data set, we can train a really good backbone. But you know, the internet is an even bigger data set, we don't have labels. So there's a trade off. But we potentially can train an even better visual backbone to then transfer learn with this paper goes into a different direction. They say, Look, if you go in this direction, right here, you get more images, but you get less information per image. So with image net, at least you have the label, right per image. But if you simply take a photo of the internet, you don't even have to label you have to resort to self supervised. What if we go into the other direction, and we look for images that have very high quality annotations? But maybe we don't have as many. Can we can we do the same thing? Can we learn good backbones by trading off quality for quantity in this case, and their quantity and quality trade off is they go for descriptions. So they'll go for something like this, where you'll have an image, and you'll have a caption for the image. And so they show these on a line here, semantically dense, semantically sparse, but their task is going to be caption generation. So they're back there more their task is, given an image, I want to produce a caption. And there are data sets that you can train this from in a supervised fashion, which of course, these are very expensive to create. I mean, if you want to create an image net data set, then you have to label each image. But if you want to create a caption data set, that's even harder because human really needs to sit down, look at the image and in image net, everything is like one class. But here you need to look at the image. And then you'll have to come up with like an adequate description. Here the adequate description is an orange, sorry, an orange and white, an orange and white cat near a plate, and the white cake. Okay. So that's, that's the caption right here. And of course, the caption is ambiguous. So you'll have to collect multiple captions per image. And you'll have to make sure that the humans that do this do a good job and so on. So this, these are very, very expensive data sets, but they are very high quality. If you think of what does what does a single label, let's just take image net image net has a single label per class. Let's say this is cat or cake for that matter. It just sort of gives you very few bits of information. But if you consider the text here, an orange cat and a white cat, an orange and white cat, you know that there is a cat, right? You know that it's one cat, you know what its color is orange and white, then you know that there is a white cake, right? So do you know the other object? And you know the relation, they are near each other. Okay, same for here. A brown and white puppy. So this is one object and the description of the object. There is a there are apples, there is a green lawn, and you the relations between them are also clear, the puppy is lying on the green lawn, and looking at the apples. So the information in captions is so much more dense than just labels. And that's the that's the backdrop here to say, hey, can't we can't we do? Can't we pre train a backbone from maybe a small data set, but that has so much information, like a caption date, image caption data set. Okay, so their method is nothing more, they train image captioning, and then they use the visual backbone for transfer learning. So this is the model. There's an image. The image goes into this visual backbone right here, which is a resonant 50. So this is a very, very standard convolutional neural network. And that gives you these features. So these features are seven by seven by 2048. This is the standard output of a resonant 50. And then, from this part on, they do a linear projection, such that they can now input it into a language model. So they have visual features. And now they feed those into the language model. And the language model is just a transformer, actually two transformers. So one transformer, they're both auto regressive, one transformer tries to predict the caption in a forward way. And the other transformer tries to predict the caption in a backward way. That's down here. Now, in this direction is backward because the caption has been reversed. If you don't know what a transformer is, I've made several videos on transformers. The first one is attention is all you need. And that's sort of the same, the same kind of transformer they use here. So as you can see right here, you have this multi head attention, the layer normalization attention from the decoder. Now the difference between the original Waswani attention is all you need transformer and this one is that in the original transformer you had, for example, if you had a machine translation task, you would have the French, maybe a French sentence over here. And then you would have the beginnings of German sentence here, right? This is what you have already produced. And now you're asking, what should the next word be? And the architecture was such that there is a decoder transformer right here, and that there is an encoder transformer that encodes whatever you already had. And then at some point, there is this cross attention, right? There is the signal from the decoder going into the encoder, and the encoder incorporating that. And then at the end, right here, the encoder would predict or the entire transformer would predict what the next word will be. The only difference right here is that the decode this, sorry, I mix this up. This is the decoder, this is the encoder. The only difference right here is that this encoder is no longer a transformer. But is this resnet? This resnet 50? Okay, because now you don't have an image as a you can think of it like a translation task, you want to translate from images to text. Okay. So your input is going to be an image. And the signal is going like it would go in the original transformer into the decoder, it would come from the image. So from these visual features goes here. So in this drawing, this thing is going in here. And then you simply predict the next word, and you do it in both directions. And the reason you can do it in both directions here, this wasn't is not the case, of course, if you have a a decoder, like a standard transformer test, because you don't need to do inference at this, you just need to do training and training you can do using teacher forcing. And so you can do this in a bi directional way, you don't need you don't need this at inference time. So at inference time, you simply cut off this part right here. That's your visual backbone. Okay. So these features here, those are going to be the features that you then train your task on. And sometimes you fine tune this or sometimes you keep it frozen, you can choose that. Alright, so red convolutional network to encode the images that gives you features, visual features, those visual features go into two transformers, both try to predict the caption of the image one in a forward motion, one in a backward motion. And you train it to predict as accurately as possible the gold standard captions that you have in your data set. That's it. If you train this model, well, that means the model can produce accurate captions for these images, which means that it has learned something meaningful about the image to the degree, of course, that the original caption that was in your data set was a good descriptive caption. But we're just we're going to assume that the in these data sets, this is the case. Alright, that's what they do. Now, interesting thing here is that in their standard in their standard, in their standard setup, they only have one of these transformer layers. So of these things right here, they only have one. And that's like, I think it's like 2000 units wide, but or sorry, the hidden dimension is 2000 units or 2048, but they only have one layer. So what that means is that this transformer is not very powerful. So most that you force most of the power to come from the visual encoder, the visual encoder had basically has to do most of the work. And then the transformer is going to simply be a very shallow language model on top of that. And that of course, makes your visual backbone even better. Alright, we can pretty much skip the rest. That's the idea. Like that there's nothing more to it. You train this from the beginning, you don't use any pre trained, whatever you train this from scratch. And then you use this. And in the first experiment, they simply train a linear classifier on top of that representation. So they freeze the backbone. And then they use a linear classifier. And they compare this to baselines. So one of the baseline is image net supervised, where you use the same backbone. But you train it on image net in a supervised fashion. Okay, and then you use that backbone to transfer out of the text. It's kind of like what big transfers us but just on the regular 1000 class image net baseline. Then you have the sort of the unsupervised pre training ones. So Moco so Perlis, Perlis, I want to go into Perl, but Moco is this momentum contrast, which is one of these supervised methods that has been shown to work really, really well. And this is also Moco EN is trained on image net, but now without the labels, because Moco is unsupervised. And Moco Coco is trained on the cocoa data set. And the cocoa data set is what this paper here, the vertex paper uses cocoa is this image captioning data set. Now what's important to note is that cocoa has about 10% only of the images of image net, so it's considerably smaller. Now let's see how these things fare. Right here, you can see on the x axis, the number of images, okay, the number of images that the data set or that the pre training method trains on. Now of course, some of these are going to be capped because for some data sets, there are just not more images available, right? So they're going to be capped here, the ones that are training on cocoa and the ones that are training on image net are going to be capped here. You can already see that the vertex outperforms the image net supervised baseline by pretty much when you only give it this many images. Okay, so the way you do it is, in this case, you simply train these models. Now the brown one is when you take one caption per image, but the data set actually has more than one caption per image. So when you use more than one, you can still boost your performance a bit. And that works way better than when you do this supervised pre training on image net, which would get you here with about the same amount of images. Now when you use all of image net, you can see here, you can get to a similar performance right here, but you have to use a 10 times bigger data set to get there. Right, so this already shows you sort of the advantage here. Now also consider the difference to the unsupervised ones. So if you look at the same amount of images, the unsupervised, self supervised baselines are even lower. But if you go to more images, they sort of get closer to image net. And in their own papers, there are there are some evidence that if you self supervised train for long enough, you can actually surpass image net supervised pre training, but I'm not so sure that that's really the case. But you can see here the trade off between higher quality information, but smaller data sets, versus lower quality information, but more data per data set. And yeah, if I guess if you were to, if you were to pre train these self supervised methods with lots more data, in a self supervised manner, they would maybe end up even higher than image net. Now this graph here is sort of the same thing where they also train a linear classifier. And you can see right here that now the image net supervised baseline is outperforming vertex by a lot. So what's happening here? Now this here is actually this is on image net. So the task here that you transfer learn is image net. Here it was like a neutral task Pascal VOC, none of these methods have trained on Pascal. They simply have trained on their own data set. These have trained on Coco, this has trained on image net, and then they have transfer learned to Pascal. Now the task is actually the transfer learning task is image net. So naturally, the the thing that was pre trained in a supervised fashion on image net is going to have a huge advantage in this task because it basically has already learned the task beforehand. Whereas the vertex, it has pre trained on Coco, not on image net. And you can see, if you give it the same amount of images for pre training, it can actually it's it's fairly close to the image net baseline. So that's pretty respectable right there. Now, again, of course, if you use more images on the same data set that you then train for, then of course, the the image net baseline is going to outperform it. But so pretty cool to see here that in this smaller image regime, and also consider this down here, if you go even an order of magnitude lower, it's really shining that if you have higher quality information, and you make use of it, you don't need as many images. And now we knew this for a long time. But this now is showing the same for transfer learning for visual transfer learning. So this was when we froze the backbone, and then we trained a linear classifier on top. They go, they make a short excursion here and show how different parts of their model affect their final performance. And they find that for example, the by captioning, which I believe is the is forward and backward captioning significantly helps for example, compared to only forward captioning. And they also find that it significantly outperforms other pre training tasks that they could do. And they also investigate whether how big their models should be. So here, this is their baseline model. Oh, I was I was wrong, actually. They the it's one layer of width 1024. You can see as you make the layer bigger and bigger, that generally helps. But I guess they decided against it because the gains are too little to, to afford to make it worth. And also if you make the network deeper here, you make the transformer have more layers, the performance goes up, but again, the gains are marginal. So I guess they're going to leave it away. So their baseline, as you can see, is these resonant 50 with the one layer of 1024 size. So this is now the last task, it's the fine tuning task. So this is what most people would do is they would train a backbone, and then they would fine tune it on a different data set on or on a different task where they don't have much labels. And here the situation looks a bit different. So if you look at, for example, a task on cocoa, so there are several tasks on cocoa, one of them is image captioning, which they use for pre trade for pre training. If you do other tasks on cocoa, you can see right here, that compared to the supervised baseline, this vertex, it performs about the same, or maybe a bit worse. But what you can see is it performs significantly better than, for example, Moco that was only trained on cocoa. So again, this shows that if you have the same data set, higher quality information makes it worth it. And it's even better, as you can see, on Moco that was trained on ImageNet. It's just not quite as good as the supervised baseline. But all of them, of course, are better than just a randomly initialized network that is trained from scratch. I mean, that's the entire point of transfer learning, that you are better than simply learning from scratch. And this shows throughout this experiment, except in this LVIS masking task, where they do outperform the other things, the other methods significantly. Now the lower numbers on this task also means that the task is harder than these tasks right here. And therefore, there are more gains to be made. And therefore, you could hypothesize that the bigger, the more quality information that you input can be used in a better way. So maybe more complex also, the more complex a task is, might also have an influence on how well the transfer learning works, if you come from a high quality transfer learning task versus a low quality transfer learning task. Yeah, so lastly, compare here with the, again, with Pascal VOC object detection, and these iNaturalist classification, where I believe this is also a transfer learning task with fine tuning. And as you can see, they can also hold up against the supervised baseline, or even outperform it at some times the green triangles mean that they outperform it by a significant margin. But then on this task right here, they again lag behind. So I think the point of the paper isn't really to show that that this is the best thing ever. But the point of the paper is to show that you can go about pre trainings, basically, the common assumption is that you need more and more and more and more data for your model to learn about the data set. And they conclude here, no, actually, you can do with with very few data points, as long as they have high quality annotations. Okay, so I think that's the point of the of the paper that and they don't always outperform the other baselines and whatnot. But they keep they keep the performance the same, which basically means that this is an option. Here is a pretty cool result where they visualize the attention of their image captioning model because they train an image captioning model. And you can really see that the image captioning model learns something meaningful about the image. So when it's a bird flying, the attention is mainly on the bird, as you can see, then over the the attention widens out over the image, air. So over the air, the attention is here in the sky and on the on the ocean. And then it goes near the ocean. And then the attention is on the ocean itself. As you can see, so they have a bunch of these images and they're they're pretty cool here a dog so focused on the dog riding on and then you can see the attention going down because on is riding on means probably there's something below the dog. A surfboard. Now the attention is fully on the surfboard in. So as soon as you say in the attention as you can see it widens out. So I think that's, that's fairly cool, fairly cool demonstration that the model understands sort of the the in relation, namely, if it is focused on something, and that something is in something else, then it widens the attention out to see what it is in, okay, the ocean, and then it focuses the attention on the ocean. So that's, that's a pretty, that's a pretty cool result. I guess we already knew this because we could train image captioning models before, it's just to show that it actually makes sense to use them as a pre training task for backbones. Now, what's the future of this, the authors here in their introduction, they make a claim that this has a good future because they here they only train on this small data set, right? It's smaller than ImageNet, as you can see here, and they already get the same performance as if you train on the whole ImageNet data set in a supervised fashion. Of course, they're also supervised, but they have 10 times less images. And they they say something to the effect of you do you know, it would be pretty easy to collect more data for this task because the internet is full of images. And mostly these images have like some text with them. They you know, they have these descriptions or they have text around it, people write something about the images, you could like mind Twitter and then the responses when someone posts an image might tell you something about the image. But this definitely counteracts their, this definitely counteracts their notion that these are very high quality labels, right? Their entire point here was that the annotations these, these data sets with these these image captioning data sets like Cocoa, they have very, very high quality annotations. So this this text here is very high quality is really a descriptive text of the image that tries to capture what a human can see visually in the image. And as soon as you go out to the internet and collect a text around images, that's not going to be the case that information is again going to be quite low quality. And so I doubt that the performance here would hold up or that the claim you can easily, you know, you can easily create more data for this task holds up. So that's a bit my worry about the future of this, but it's definitely cool. And definitely shows these quality quantity trade off very well. All right, that was my two cents to the paper. I invite you to read it and tell me in the comments what you think about it. And I'll see you next time.
[{"start": 0.0, "end": 6.2, "text": " Hi there, today we're looking at vertex learning visual representations from textual annotations"}, {"start": 6.2, "end": 10.82, "text": " by Karen Desai and Justin Johnson of the University of Michigan."}, {"start": 10.82, "end": 14.06, "text": " So this paper at its core is pretty simple."}, {"start": 14.06, "end": 19.18, "text": " On a high level, it proposes to take the task of image captioning, which is where you're"}, {"start": 19.18, "end": 24.2, "text": " given an image and you're asked to produce a caption for the image, and basically train"}, {"start": 24.2, "end": 31.08, "text": " a model to do this, and then just take the visual part of it as a baseline to transfer"}, {"start": 31.08, "end": 33.64, "text": " learn on other visual tasks."}, {"start": 33.64, "end": 40.76, "text": " And that appears to work surprisingly well if you don't have much data."}, {"start": 40.76, "end": 46.84, "text": " So if you if you don't have much data to pre train on, this appears to work very well."}, {"start": 46.84, "end": 53.78, "text": " Alright, as always, if you like content like this, then consider sharing it out, subscribing"}, {"start": 53.78, "end": 58.46, "text": " to the channel, or tell me what you think in the comments."}, {"start": 58.46, "end": 64.24000000000001, "text": " So as I already said, the the idea here is pretty simple."}, {"start": 64.24000000000001, "end": 69.68, "text": " So people have been looking for pre training tasks for visual tasks."}, {"start": 69.68, "end": 74.76, "text": " So a visual task is anything where the input is an image."}, {"start": 74.76, "end": 79.1, "text": " And then you usually have some sort of neural network that processes the image."}, {"start": 79.1, "end": 81.24000000000001, "text": " And then at the end, you can have many things."}, {"start": 81.24, "end": 86.19999999999999, "text": " So you could have a classifier that classifies the image into one of many classes, if you"}, {"start": 86.19999999999999, "end": 89.8, "text": " know ImageNet, that's a thing."}, {"start": 89.8, "end": 97.19999999999999, "text": " So if there's a cat here, then the the ImageNet classifier here would say cat, or you could"}, {"start": 97.19999999999999, "end": 103.96, "text": " have something like a object detector that tries to predict on the image where the cat"}, {"start": 103.96, "end": 111.0, "text": " is like with a bounding box, you could have a you could have a semantic segmentation where"}, {"start": 111.0, "end": 114.92, "text": " it's like, all of these pixels here are cat."}, {"start": 114.92, "end": 118.08, "text": " And maybe all of these pixels here are sky."}, {"start": 118.08, "end": 124.48, "text": " And so it labels every pixel, there's many visual tasks that you can formulate."}, {"start": 124.48, "end": 127.48, "text": " And they all sort of share the same architecture."}, {"start": 127.48, "end": 133.48, "text": " And specifically, they all share this part right here, the if you will, this is the visual"}, {"start": 133.48, "end": 137.42000000000002, "text": " encoder, it's usually a convolutional neural network."}, {"start": 137.42, "end": 142.2, "text": " And what's really different between the tasks is mostly this last part here that does the"}, {"start": 142.2, "end": 143.72, "text": " actual task."}, {"start": 143.72, "end": 146.67999999999998, "text": " But this and is often called the backbone."}, {"start": 146.67999999999998, "end": 148.64, "text": " So this is the backbone."}, {"start": 148.64, "end": 155.1, "text": " And the idea now is, if I have a bunch of these tasks, sometimes I don't have money"}, {"start": 155.1, "end": 159.2, "text": " labels for these tasks, I don't have many labeled images, so that I could train this"}, {"start": 159.2, "end": 165.95999999999998, "text": " big architecture from scratch, like in medical images, or just in domains where you don't"}, {"start": 165.95999999999998, "end": 166.95999999999998, "text": " have many images."}, {"start": 166.96, "end": 173.36, "text": " So couldn't I somehow come up with a method to create this backbone beforehand."}, {"start": 173.36, "end": 177.20000000000002, "text": " So to create backbone given another data set."}, {"start": 177.20000000000002, "end": 183.0, "text": " And the simplest variant here is you take a big image data set, such as image net, and"}, {"start": 183.0, "end": 188.44, "text": " then you train a classifier, like we said, to predict some classes on it."}, {"start": 188.44, "end": 192.92000000000002, "text": " And then because an image net has a lot of images, then this is your backbone."}, {"start": 192.92, "end": 196.79999999999998, "text": " And then whenever you have a different task, you simply take the backbone, transfer it"}, {"start": 196.79999999999998, "end": 203.01999999999998, "text": " over and then train the other basically, you continue training on the other tasks that's"}, {"start": 203.01999999999998, "end": 205.42, "text": " called transfer learning."}, {"start": 205.42, "end": 209.39999999999998, "text": " The question is, how do you get a good backbone."}, {"start": 209.39999999999998, "end": 214.92, "text": " So if you train on something like image net, then this is of course a supervised tasks,"}, {"start": 214.92, "end": 216.32, "text": " you'll have a very good learning signal."}, {"start": 216.32, "end": 220.1, "text": " But even image net has like 1 million images."}, {"start": 220.1, "end": 222.88, "text": " But for example, the internet has many more images."}, {"start": 222.88, "end": 228.04, "text": " So what you could do is you could train on this much bigger data set that you collected"}, {"start": 228.04, "end": 231.74, "text": " from the internet, let's just call it internet."}, {"start": 231.74, "end": 233.62, "text": " But there you don't have labels, right."}, {"start": 233.62, "end": 237.92, "text": " So what you'll have to resort to is instead of supervised learning is self supervised"}, {"start": 237.92, "end": 242.0, "text": " learning where you have an image and maybe you rotate it to the right."}, {"start": 242.0, "end": 245.48, "text": " So here is our cat, he rotated to the right."}, {"start": 245.48, "end": 252.24, "text": " And then you have a classifier that predicts that these this image was rotated to the right."}, {"start": 252.24, "end": 254.48000000000002, "text": " And then that will become your backbone."}, {"start": 254.48000000000002, "end": 259.3, "text": " These self supervised methods, they work very well."}, {"start": 259.3, "end": 260.94, "text": " There is a different number of them."}, {"start": 260.94, "end": 264.08, "text": " For example, Moco, things like this."}, {"start": 264.08, "end": 268.74, "text": " And there's also a number of techniques that do supervised pre training, and then transfer"}, {"start": 268.74, "end": 274.76, "text": " learning, you can maybe watch my video on big transfer, which is a very large attempt"}, {"start": 274.76, "end": 279.32, "text": " to do to pre train a backbone for visual tasks."}, {"start": 279.32, "end": 286.71999999999997, "text": " All right, now, you can see right here that the sort of direction is that the more data,"}, {"start": 286.71999999999997, "end": 287.71999999999997, "text": " the better."}, {"start": 287.71999999999997, "end": 291.58, "text": " So that's sort of the idea here that image net is a big data set, we can train a really"}, {"start": 291.58, "end": 292.58, "text": " good backbone."}, {"start": 292.58, "end": 296.5, "text": " But you know, the internet is an even bigger data set, we don't have labels."}, {"start": 296.5, "end": 297.82, "text": " So there's a trade off."}, {"start": 297.82, "end": 303.03999999999996, "text": " But we potentially can train an even better visual backbone to then transfer learn with"}, {"start": 303.03999999999996, "end": 306.21999999999997, "text": " this paper goes into a different direction."}, {"start": 306.22, "end": 312.04, "text": " They say, Look, if you go in this direction, right here, you get more images, but you get"}, {"start": 312.04, "end": 314.18, "text": " less information per image."}, {"start": 314.18, "end": 318.3, "text": " So with image net, at least you have the label, right per image."}, {"start": 318.3, "end": 322.88000000000005, "text": " But if you simply take a photo of the internet, you don't even have to label you have to resort"}, {"start": 322.88000000000005, "end": 324.88000000000005, "text": " to self supervised."}, {"start": 324.88000000000005, "end": 331.08000000000004, "text": " What if we go into the other direction, and we look for images that have very high quality"}, {"start": 331.08000000000004, "end": 333.28000000000003, "text": " annotations?"}, {"start": 333.28000000000003, "end": 335.32000000000005, "text": " But maybe we don't have as many."}, {"start": 335.32, "end": 337.2, "text": " Can we can we do the same thing?"}, {"start": 337.2, "end": 344.2, "text": " Can we learn good backbones by trading off quality for quantity in this case, and their"}, {"start": 344.2, "end": 349.52, "text": " quantity and quality trade off is they go for descriptions."}, {"start": 349.52, "end": 357.84, "text": " So they'll go for something like this, where you'll have an image, and you'll have a caption"}, {"start": 357.84, "end": 359.76, "text": " for the image."}, {"start": 359.76, "end": 366.15999999999997, "text": " And so they show these on a line here, semantically dense, semantically sparse, but their task"}, {"start": 366.15999999999997, "end": 368.56, "text": " is going to be caption generation."}, {"start": 368.56, "end": 375.64, "text": " So they're back there more their task is, given an image, I want to produce a caption."}, {"start": 375.64, "end": 380.76, "text": " And there are data sets that you can train this from in a supervised fashion, which of"}, {"start": 380.76, "end": 383.15999999999997, "text": " course, these are very expensive to create."}, {"start": 383.15999999999997, "end": 388.84, "text": " I mean, if you want to create an image net data set, then you have to label each image."}, {"start": 388.84, "end": 393.59999999999997, "text": " But if you want to create a caption data set, that's even harder because human really needs"}, {"start": 393.59999999999997, "end": 399.76, "text": " to sit down, look at the image and in image net, everything is like one class."}, {"start": 399.76, "end": 401.59999999999997, "text": " But here you need to look at the image."}, {"start": 401.59999999999997, "end": 404.47999999999996, "text": " And then you'll have to come up with like an adequate description."}, {"start": 404.47999999999996, "end": 410.52, "text": " Here the adequate description is an orange, sorry, an orange and white, an orange and"}, {"start": 410.52, "end": 414.32, "text": " white cat near a plate, and the white cake."}, {"start": 414.32, "end": 415.59999999999997, "text": " Okay."}, {"start": 415.59999999999997, "end": 417.91999999999996, "text": " So that's, that's the caption right here."}, {"start": 417.92, "end": 419.84000000000003, "text": " And of course, the caption is ambiguous."}, {"start": 419.84000000000003, "end": 423.6, "text": " So you'll have to collect multiple captions per image."}, {"start": 423.6, "end": 427.32, "text": " And you'll have to make sure that the humans that do this do a good job and so on."}, {"start": 427.32, "end": 432.0, "text": " So this, these are very, very expensive data sets, but they are very high quality."}, {"start": 432.0, "end": 437.40000000000003, "text": " If you think of what does what does a single label, let's just take image net image net"}, {"start": 437.40000000000003, "end": 440.64, "text": " has a single label per class."}, {"start": 440.64, "end": 443.62, "text": " Let's say this is cat or cake for that matter."}, {"start": 443.62, "end": 447.86, "text": " It just sort of gives you very few bits of information."}, {"start": 447.86, "end": 454.06, "text": " But if you consider the text here, an orange cat and a white cat, an orange and white cat,"}, {"start": 454.06, "end": 457.44, "text": " you know that there is a cat, right?"}, {"start": 457.44, "end": 463.32, "text": " You know that it's one cat, you know what its color is orange and white, then you know"}, {"start": 463.32, "end": 465.58, "text": " that there is a white cake, right?"}, {"start": 465.58, "end": 467.76, "text": " So do you know the other object?"}, {"start": 467.76, "end": 471.4, "text": " And you know the relation, they are near each other."}, {"start": 471.4, "end": 473.28000000000003, "text": " Okay, same for here."}, {"start": 473.28, "end": 475.28, "text": " A brown and white puppy."}, {"start": 475.28, "end": 479.14, "text": " So this is one object and the description of the object."}, {"start": 479.14, "end": 484.84, "text": " There is a there are apples, there is a green lawn, and you the relations between them are"}, {"start": 484.84, "end": 490.47999999999996, "text": " also clear, the puppy is lying on the green lawn, and looking at the apples."}, {"start": 490.47999999999996, "end": 496.4, "text": " So the information in captions is so much more dense than just labels."}, {"start": 496.4, "end": 503.84, "text": " And that's the that's the backdrop here to say, hey, can't we can't we do?"}, {"start": 503.84, "end": 510.15999999999997, "text": " Can't we pre train a backbone from maybe a small data set, but that has so much information,"}, {"start": 510.15999999999997, "end": 513.4399999999999, "text": " like a caption date, image caption data set."}, {"start": 513.4399999999999, "end": 520.0, "text": " Okay, so their method is nothing more, they train image captioning, and then they use"}, {"start": 520.0, "end": 522.16, "text": " the visual backbone for transfer learning."}, {"start": 522.16, "end": 523.54, "text": " So this is the model."}, {"start": 523.54, "end": 524.68, "text": " There's an image."}, {"start": 524.68, "end": 529.42, "text": " The image goes into this visual backbone right here, which is a resonant 50."}, {"start": 529.42, "end": 534.68, "text": " So this is a very, very standard convolutional neural network."}, {"start": 534.68, "end": 536.4399999999999, "text": " And that gives you these features."}, {"start": 536.4399999999999, "end": 540.88, "text": " So these features are seven by seven by 2048."}, {"start": 540.88, "end": 544.9599999999999, "text": " This is the standard output of a resonant 50."}, {"start": 544.9599999999999, "end": 550.8, "text": " And then, from this part on, they do a linear projection, such that they can now input it"}, {"start": 550.8, "end": 552.76, "text": " into a language model."}, {"start": 552.76, "end": 554.84, "text": " So they have visual features."}, {"start": 554.84, "end": 557.96, "text": " And now they feed those into the language model."}, {"start": 557.96, "end": 564.4399999999999, "text": " And the language model is just a transformer, actually two transformers."}, {"start": 564.4399999999999, "end": 571.26, "text": " So one transformer, they're both auto regressive, one transformer tries to predict the caption"}, {"start": 571.26, "end": 572.8, "text": " in a forward way."}, {"start": 572.8, "end": 576.92, "text": " And the other transformer tries to predict the caption in a backward way."}, {"start": 576.92, "end": 577.92, "text": " That's down here."}, {"start": 577.92, "end": 582.8399999999999, "text": " Now, in this direction is backward because the caption has been reversed."}, {"start": 582.8399999999999, "end": 586.5799999999999, "text": " If you don't know what a transformer is, I've made several videos on transformers."}, {"start": 586.5799999999999, "end": 589.24, "text": " The first one is attention is all you need."}, {"start": 589.24, "end": 594.24, "text": " And that's sort of the same, the same kind of transformer they use here."}, {"start": 594.24, "end": 602.12, "text": " So as you can see right here, you have this multi head attention, the layer normalization"}, {"start": 602.12, "end": 604.0, "text": " attention from the decoder."}, {"start": 604.0, "end": 609.8, "text": " Now the difference between the original Waswani attention is all you need transformer and"}, {"start": 609.8, "end": 616.48, "text": " this one is that in the original transformer you had, for example, if you had a machine"}, {"start": 616.48, "end": 621.6, "text": " translation task, you would have the French, maybe a French sentence over here."}, {"start": 621.6, "end": 627.36, "text": " And then you would have the beginnings of German sentence here, right?"}, {"start": 627.36, "end": 629.0, "text": " This is what you have already produced."}, {"start": 629.0, "end": 632.68, "text": " And now you're asking, what should the next word be?"}, {"start": 632.68, "end": 638.3599999999999, "text": " And the architecture was such that there is a decoder transformer right here, and that"}, {"start": 638.3599999999999, "end": 644.5999999999999, "text": " there is an encoder transformer that encodes whatever you already had."}, {"start": 644.5999999999999, "end": 648.0799999999999, "text": " And then at some point, there is this cross attention, right?"}, {"start": 648.0799999999999, "end": 654.16, "text": " There is the signal from the decoder going into the encoder, and the encoder incorporating"}, {"start": 654.16, "end": 655.16, "text": " that."}, {"start": 655.16, "end": 659.8399999999999, "text": " And then at the end, right here, the encoder would predict or the entire transformer would"}, {"start": 659.8399999999999, "end": 662.12, "text": " predict what the next word will be."}, {"start": 662.12, "end": 668.5600000000001, "text": " The only difference right here is that the decode this, sorry, I mix this up."}, {"start": 668.5600000000001, "end": 671.58, "text": " This is the decoder, this is the encoder."}, {"start": 671.58, "end": 677.3, "text": " The only difference right here is that this encoder is no longer a transformer."}, {"start": 677.3, "end": 680.58, "text": " But is this resnet?"}, {"start": 680.58, "end": 681.72, "text": " This resnet 50?"}, {"start": 681.72, "end": 686.66, "text": " Okay, because now you don't have an image as a you can think of it like a translation"}, {"start": 686.66, "end": 690.8, "text": " task, you want to translate from images to text."}, {"start": 690.8, "end": 691.8, "text": " Okay."}, {"start": 691.8, "end": 694.0799999999999, "text": " So your input is going to be an image."}, {"start": 694.0799999999999, "end": 699.4, "text": " And the signal is going like it would go in the original transformer into the decoder,"}, {"start": 699.4, "end": 701.5999999999999, "text": " it would come from the image."}, {"start": 701.5999999999999, "end": 704.4599999999999, "text": " So from these visual features goes here."}, {"start": 704.4599999999999, "end": 711.56, "text": " So in this drawing, this thing is going in here."}, {"start": 711.56, "end": 715.28, "text": " And then you simply predict the next word, and you do it in both directions."}, {"start": 715.28, "end": 721.1999999999999, "text": " And the reason you can do it in both directions here, this wasn't is not the case, of course,"}, {"start": 721.2, "end": 728.1400000000001, "text": " if you have a a decoder, like a standard transformer test, because you don't need to do inference"}, {"start": 728.1400000000001, "end": 733.34, "text": " at this, you just need to do training and training you can do using teacher forcing."}, {"start": 733.34, "end": 739.32, "text": " And so you can do this in a bi directional way, you don't need you don't need this at"}, {"start": 739.32, "end": 740.4200000000001, "text": " inference time."}, {"start": 740.4200000000001, "end": 746.5400000000001, "text": " So at inference time, you simply cut off this part right here."}, {"start": 746.5400000000001, "end": 748.2, "text": " That's your visual backbone."}, {"start": 748.2, "end": 749.2, "text": " Okay."}, {"start": 749.2, "end": 754.2800000000001, "text": " So these features here, those are going to be the features that you then train your task"}, {"start": 754.2800000000001, "end": 755.2800000000001, "text": " on."}, {"start": 755.2800000000001, "end": 759.6800000000001, "text": " And sometimes you fine tune this or sometimes you keep it frozen, you can choose that."}, {"start": 759.6800000000001, "end": 766.2, "text": " Alright, so red convolutional network to encode the images that gives you features, visual"}, {"start": 766.2, "end": 772.4000000000001, "text": " features, those visual features go into two transformers, both try to predict the caption"}, {"start": 772.4000000000001, "end": 778.0, "text": " of the image one in a forward motion, one in a backward motion."}, {"start": 778.0, "end": 784.44, "text": " And you train it to predict as accurately as possible the gold standard captions that"}, {"start": 784.44, "end": 786.52, "text": " you have in your data set."}, {"start": 786.52, "end": 787.52, "text": " That's it."}, {"start": 787.52, "end": 792.4, "text": " If you train this model, well, that means the model can produce accurate captions for"}, {"start": 792.4, "end": 797.76, "text": " these images, which means that it has learned something meaningful about the image to the"}, {"start": 797.76, "end": 804.12, "text": " degree, of course, that the original caption that was in your data set was a good descriptive"}, {"start": 804.12, "end": 805.12, "text": " caption."}, {"start": 805.12, "end": 809.24, "text": " But we're just we're going to assume that the in these data sets, this is the case."}, {"start": 809.24, "end": 811.96, "text": " Alright, that's what they do."}, {"start": 811.96, "end": 818.88, "text": " Now, interesting thing here is that in their standard in their standard, in their standard"}, {"start": 818.88, "end": 822.42, "text": " setup, they only have one of these transformer layers."}, {"start": 822.42, "end": 825.86, "text": " So of these things right here, they only have one."}, {"start": 825.86, "end": 832.16, "text": " And that's like, I think it's like 2000 units wide, but or sorry, the hidden dimension is"}, {"start": 832.16, "end": 836.3399999999999, "text": " 2000 units or 2048, but they only have one layer."}, {"start": 836.3399999999999, "end": 841.38, "text": " So what that means is that this transformer is not very powerful."}, {"start": 841.38, "end": 848.24, "text": " So most that you force most of the power to come from the visual encoder, the visual encoder"}, {"start": 848.24, "end": 851.12, "text": " had basically has to do most of the work."}, {"start": 851.12, "end": 857.9599999999999, "text": " And then the transformer is going to simply be a very shallow language model on top of"}, {"start": 857.9599999999999, "end": 860.5, "text": " that."}, {"start": 860.5, "end": 864.24, "text": " And that of course, makes your visual backbone even better."}, {"start": 864.24, "end": 867.78, "text": " Alright, we can pretty much skip the rest."}, {"start": 867.78, "end": 868.78, "text": " That's the idea."}, {"start": 868.78, "end": 870.08, "text": " Like that there's nothing more to it."}, {"start": 870.08, "end": 873.98, "text": " You train this from the beginning, you don't use any pre trained, whatever you train this"}, {"start": 873.98, "end": 875.3, "text": " from scratch."}, {"start": 875.3, "end": 877.08, "text": " And then you use this."}, {"start": 877.08, "end": 883.06, "text": " And in the first experiment, they simply train a linear classifier on top of that representation."}, {"start": 883.06, "end": 885.04, "text": " So they freeze the backbone."}, {"start": 885.04, "end": 887.44, "text": " And then they use a linear classifier."}, {"start": 887.44, "end": 890.12, "text": " And they compare this to baselines."}, {"start": 890.12, "end": 895.88, "text": " So one of the baseline is image net supervised, where you use the same backbone."}, {"start": 895.88, "end": 899.36, "text": " But you train it on image net in a supervised fashion."}, {"start": 899.36, "end": 902.22, "text": " Okay, and then you use that backbone to transfer out of the text."}, {"start": 902.22, "end": 911.5600000000001, "text": " It's kind of like what big transfers us but just on the regular 1000 class image net baseline."}, {"start": 911.5600000000001, "end": 915.72, "text": " Then you have the sort of the unsupervised pre training ones."}, {"start": 915.72, "end": 924.64, "text": " So Moco so Perlis, Perlis, I want to go into Perl, but Moco is this momentum contrast,"}, {"start": 924.64, "end": 929.76, "text": " which is one of these supervised methods that has been shown to work really, really well."}, {"start": 929.76, "end": 937.0400000000001, "text": " And this is also Moco EN is trained on image net, but now without the labels, because Moco"}, {"start": 937.0400000000001, "end": 938.6800000000001, "text": " is unsupervised."}, {"start": 938.6800000000001, "end": 942.38, "text": " And Moco Coco is trained on the cocoa data set."}, {"start": 942.38, "end": 949.18, "text": " And the cocoa data set is what this paper here, the vertex paper uses cocoa is this"}, {"start": 949.18, "end": 951.3, "text": " image captioning data set."}, {"start": 951.3, "end": 959.06, "text": " Now what's important to note is that cocoa has about 10% only of the images of image"}, {"start": 959.06, "end": 963.34, "text": " net, so it's considerably smaller."}, {"start": 963.34, "end": 968.24, "text": " Now let's see how these things fare."}, {"start": 968.24, "end": 974.8, "text": " Right here, you can see on the x axis, the number of images, okay, the number of images"}, {"start": 974.8, "end": 979.46, "text": " that the data set or that the pre training method trains on."}, {"start": 979.46, "end": 983.8, "text": " Now of course, some of these are going to be capped because for some data sets, there"}, {"start": 983.8, "end": 988.2, "text": " are just not more images available, right?"}, {"start": 988.2, "end": 991.44, "text": " So they're going to be capped here, the ones that are training on cocoa and the ones that"}, {"start": 991.44, "end": 994.2, "text": " are training on image net are going to be capped here."}, {"start": 994.2, "end": 1003.84, "text": " You can already see that the vertex outperforms the image net supervised baseline by pretty"}, {"start": 1003.84, "end": 1006.4000000000001, "text": " much when you only give it this many images."}, {"start": 1006.4000000000001, "end": 1011.6, "text": " Okay, so the way you do it is, in this case, you simply train these models."}, {"start": 1011.6, "end": 1018.6800000000001, "text": " Now the brown one is when you take one caption per image, but the data set actually has more"}, {"start": 1018.6800000000001, "end": 1020.58, "text": " than one caption per image."}, {"start": 1020.58, "end": 1026.1200000000001, "text": " So when you use more than one, you can still boost your performance a bit."}, {"start": 1026.1200000000001, "end": 1033.68, "text": " And that works way better than when you do this supervised pre training on image net,"}, {"start": 1033.68, "end": 1037.52, "text": " which would get you here with about the same amount of images."}, {"start": 1037.52, "end": 1042.88, "text": " Now when you use all of image net, you can see here, you can get to a similar performance"}, {"start": 1042.88, "end": 1048.0, "text": " right here, but you have to use a 10 times bigger data set to get there."}, {"start": 1048.0, "end": 1053.6, "text": " Right, so this already shows you sort of the advantage here."}, {"start": 1053.6, "end": 1058.12, "text": " Now also consider the difference to the unsupervised ones."}, {"start": 1058.12, "end": 1063.04, "text": " So if you look at the same amount of images, the unsupervised, self supervised baselines"}, {"start": 1063.04, "end": 1065.54, "text": " are even lower."}, {"start": 1065.54, "end": 1071.68, "text": " But if you go to more images, they sort of get closer to image net."}, {"start": 1071.68, "end": 1077.92, "text": " And in their own papers, there are there are some evidence that if you self supervised train"}, {"start": 1077.92, "end": 1084.6000000000001, "text": " for long enough, you can actually surpass image net supervised pre training, but I'm"}, {"start": 1084.6000000000001, "end": 1089.1000000000001, "text": " not so sure that that's really the case."}, {"start": 1089.1000000000001, "end": 1097.8400000000001, "text": " But you can see here the trade off between higher quality information, but smaller data"}, {"start": 1097.84, "end": 1107.9199999999998, "text": " sets, versus lower quality information, but more data per data set."}, {"start": 1107.9199999999998, "end": 1112.08, "text": " And yeah, if I guess if you were to, if you were to pre train these self supervised methods"}, {"start": 1112.08, "end": 1118.8799999999999, "text": " with lots more data, in a self supervised manner, they would maybe end up even higher"}, {"start": 1118.8799999999999, "end": 1122.32, "text": " than image net."}, {"start": 1122.32, "end": 1126.9199999999998, "text": " Now this graph here is sort of the same thing where they also train a linear classifier."}, {"start": 1126.92, "end": 1132.3200000000002, "text": " And you can see right here that now the image net supervised baseline is outperforming vertex"}, {"start": 1132.3200000000002, "end": 1133.3200000000002, "text": " by a lot."}, {"start": 1133.3200000000002, "end": 1134.3200000000002, "text": " So what's happening here?"}, {"start": 1134.3200000000002, "end": 1137.28, "text": " Now this here is actually this is on image net."}, {"start": 1137.28, "end": 1141.44, "text": " So the task here that you transfer learn is image net."}, {"start": 1141.44, "end": 1148.3200000000002, "text": " Here it was like a neutral task Pascal VOC, none of these methods have trained on Pascal."}, {"start": 1148.3200000000002, "end": 1150.72, "text": " They simply have trained on their own data set."}, {"start": 1150.72, "end": 1154.52, "text": " These have trained on Coco, this has trained on image net, and then they have transfer"}, {"start": 1154.52, "end": 1156.7, "text": " learned to Pascal."}, {"start": 1156.7, "end": 1161.32, "text": " Now the task is actually the transfer learning task is image net."}, {"start": 1161.32, "end": 1168.96, "text": " So naturally, the the thing that was pre trained in a supervised fashion on image net is going"}, {"start": 1168.96, "end": 1173.92, "text": " to have a huge advantage in this task because it basically has already learned the task"}, {"start": 1173.92, "end": 1175.1200000000001, "text": " beforehand."}, {"start": 1175.1200000000001, "end": 1181.6000000000001, "text": " Whereas the vertex, it has pre trained on Coco, not on image net."}, {"start": 1181.6, "end": 1186.84, "text": " And you can see, if you give it the same amount of images for pre training, it can actually"}, {"start": 1186.84, "end": 1190.24, "text": " it's it's fairly close to the image net baseline."}, {"start": 1190.24, "end": 1192.76, "text": " So that's pretty respectable right there."}, {"start": 1192.76, "end": 1198.8799999999999, "text": " Now, again, of course, if you use more images on the same data set that you then train for,"}, {"start": 1198.8799999999999, "end": 1203.56, "text": " then of course, the the image net baseline is going to outperform it."}, {"start": 1203.56, "end": 1210.4599999999998, "text": " But so pretty cool to see here that in this smaller image regime, and also consider this"}, {"start": 1210.46, "end": 1216.56, "text": " down here, if you go even an order of magnitude lower, it's really shining that if you have"}, {"start": 1216.56, "end": 1223.32, "text": " higher quality information, and you make use of it, you don't need as many images."}, {"start": 1223.32, "end": 1225.28, "text": " And now we knew this for a long time."}, {"start": 1225.28, "end": 1234.88, "text": " But this now is showing the same for transfer learning for visual transfer learning."}, {"start": 1234.88, "end": 1243.3600000000001, "text": " So this was when we froze the backbone, and then we trained a linear classifier on top."}, {"start": 1243.3600000000001, "end": 1249.48, "text": " They go, they make a short excursion here and show how different parts of their model"}, {"start": 1249.48, "end": 1252.2, "text": " affect their final performance."}, {"start": 1252.2, "end": 1260.6000000000001, "text": " And they find that for example, the by captioning, which I believe is the is forward and backward"}, {"start": 1260.6, "end": 1267.08, "text": " captioning significantly helps for example, compared to only forward captioning."}, {"start": 1267.08, "end": 1274.6399999999999, "text": " And they also find that it significantly outperforms other pre training tasks that they could do."}, {"start": 1274.6399999999999, "end": 1278.48, "text": " And they also investigate whether how big their models should be."}, {"start": 1278.48, "end": 1280.6799999999998, "text": " So here, this is their baseline model."}, {"start": 1280.6799999999998, "end": 1282.9599999999998, "text": " Oh, I was I was wrong, actually."}, {"start": 1282.96, "end": 1291.28, "text": " They the it's one layer of width 1024."}, {"start": 1291.28, "end": 1296.8, "text": " You can see as you make the layer bigger and bigger, that generally helps."}, {"start": 1296.8, "end": 1303.2, "text": " But I guess they decided against it because the gains are too little to, to afford to"}, {"start": 1303.2, "end": 1304.54, "text": " make it worth."}, {"start": 1304.54, "end": 1310.4, "text": " And also if you make the network deeper here, you make the transformer have more layers,"}, {"start": 1310.4, "end": 1313.68, "text": " the performance goes up, but again, the gains are marginal."}, {"start": 1313.68, "end": 1315.3200000000002, "text": " So I guess they're going to leave it away."}, {"start": 1315.3200000000002, "end": 1325.5600000000002, "text": " So their baseline, as you can see, is these resonant 50 with the one layer of 1024 size."}, {"start": 1325.5600000000002, "end": 1330.98, "text": " So this is now the last task, it's the fine tuning task."}, {"start": 1330.98, "end": 1336.4, "text": " So this is what most people would do is they would train a backbone, and then they would"}, {"start": 1336.4, "end": 1341.52, "text": " fine tune it on a different data set on or on a different task where they don't have"}, {"start": 1341.52, "end": 1343.0800000000002, "text": " much labels."}, {"start": 1343.0800000000002, "end": 1346.24, "text": " And here the situation looks a bit different."}, {"start": 1346.24, "end": 1353.0400000000002, "text": " So if you look at, for example, a task on cocoa, so there are several tasks on cocoa,"}, {"start": 1353.0400000000002, "end": 1358.22, "text": " one of them is image captioning, which they use for pre trade for pre training."}, {"start": 1358.22, "end": 1366.0, "text": " If you do other tasks on cocoa, you can see right here, that compared to the supervised"}, {"start": 1366.0, "end": 1374.1, "text": " baseline, this vertex, it performs about the same, or maybe a bit worse."}, {"start": 1374.1, "end": 1382.2, "text": " But what you can see is it performs significantly better than, for example, Moco that was only"}, {"start": 1382.2, "end": 1383.92, "text": " trained on cocoa."}, {"start": 1383.92, "end": 1388.52, "text": " So again, this shows that if you have the same data set, higher quality information"}, {"start": 1388.52, "end": 1389.96, "text": " makes it worth it."}, {"start": 1389.96, "end": 1395.08, "text": " And it's even better, as you can see, on Moco that was trained on ImageNet."}, {"start": 1395.08, "end": 1399.4399999999998, "text": " It's just not quite as good as the supervised baseline."}, {"start": 1399.4399999999998, "end": 1403.86, "text": " But all of them, of course, are better than just a randomly initialized network that is"}, {"start": 1403.86, "end": 1404.86, "text": " trained from scratch."}, {"start": 1404.86, "end": 1409.96, "text": " I mean, that's the entire point of transfer learning, that you are better than simply"}, {"start": 1409.96, "end": 1411.4199999999998, "text": " learning from scratch."}, {"start": 1411.4199999999998, "end": 1419.46, "text": " And this shows throughout this experiment, except in this LVIS masking task, where they"}, {"start": 1419.46, "end": 1426.76, "text": " do outperform the other things, the other methods significantly."}, {"start": 1426.76, "end": 1433.64, "text": " Now the lower numbers on this task also means that the task is harder than these tasks right"}, {"start": 1433.64, "end": 1435.3, "text": " here."}, {"start": 1435.3, "end": 1437.24, "text": " And therefore, there are more gains to be made."}, {"start": 1437.24, "end": 1442.78, "text": " And therefore, you could hypothesize that the bigger, the more quality information that"}, {"start": 1442.78, "end": 1446.2, "text": " you input can be used in a better way."}, {"start": 1446.2, "end": 1451.82, "text": " So maybe more complex also, the more complex a task is, might also have an influence on"}, {"start": 1451.82, "end": 1457.68, "text": " how well the transfer learning works, if you come from a high quality transfer learning"}, {"start": 1457.68, "end": 1462.2, "text": " task versus a low quality transfer learning task."}, {"start": 1462.2, "end": 1473.66, "text": " Yeah, so lastly, compare here with the, again, with Pascal VOC object detection, and these"}, {"start": 1473.66, "end": 1479.7, "text": " iNaturalist classification, where I believe this is also a transfer learning task with"}, {"start": 1479.7, "end": 1481.7, "text": " fine tuning."}, {"start": 1481.7, "end": 1488.8200000000002, "text": " And as you can see, they can also hold up against the supervised baseline, or even outperform"}, {"start": 1488.8200000000002, "end": 1494.8600000000001, "text": " it at some times the green triangles mean that they outperform it by a significant margin."}, {"start": 1494.8600000000001, "end": 1498.94, "text": " But then on this task right here, they again lag behind."}, {"start": 1498.94, "end": 1507.3600000000001, "text": " So I think the point of the paper isn't really to show that that this is the best thing ever."}, {"start": 1507.3600000000001, "end": 1513.42, "text": " But the point of the paper is to show that you can go about pre trainings, basically,"}, {"start": 1513.42, "end": 1518.48, "text": " the common assumption is that you need more and more and more and more data for your model"}, {"start": 1518.48, "end": 1521.56, "text": " to learn about the data set."}, {"start": 1521.56, "end": 1527.3, "text": " And they conclude here, no, actually, you can do with with very few data points, as"}, {"start": 1527.3, "end": 1530.58, "text": " long as they have high quality annotations."}, {"start": 1530.58, "end": 1536.6599999999999, "text": " Okay, so I think that's the point of the of the paper that and they don't always outperform"}, {"start": 1536.6599999999999, "end": 1539.84, "text": " the other baselines and whatnot."}, {"start": 1539.84, "end": 1544.82, "text": " But they keep they keep the performance the same, which basically means that this is an"}, {"start": 1544.82, "end": 1545.82, "text": " option."}, {"start": 1545.82, "end": 1552.3999999999999, "text": " Here is a pretty cool result where they visualize the attention of their image captioning model"}, {"start": 1552.3999999999999, "end": 1554.86, "text": " because they train an image captioning model."}, {"start": 1554.86, "end": 1559.1799999999998, "text": " And you can really see that the image captioning model learns something meaningful about the"}, {"start": 1559.1799999999998, "end": 1560.1799999999998, "text": " image."}, {"start": 1560.1799999999998, "end": 1566.8, "text": " So when it's a bird flying, the attention is mainly on the bird, as you can see, then"}, {"start": 1566.8, "end": 1572.12, "text": " over the the attention widens out over the image, air."}, {"start": 1572.12, "end": 1576.54, "text": " So over the air, the attention is here in the sky and on the on the ocean."}, {"start": 1576.54, "end": 1579.82, "text": " And then it goes near the ocean."}, {"start": 1579.82, "end": 1584.26, "text": " And then the attention is on the ocean itself."}, {"start": 1584.26, "end": 1588.22, "text": " As you can see, so they have a bunch of these images and they're they're pretty cool here"}, {"start": 1588.22, "end": 1594.94, "text": " a dog so focused on the dog riding on and then you can see the attention going down"}, {"start": 1594.94, "end": 1602.66, "text": " because on is riding on means probably there's something below the dog."}, {"start": 1602.66, "end": 1604.36, "text": " A surfboard."}, {"start": 1604.36, "end": 1607.66, "text": " Now the attention is fully on the surfboard in."}, {"start": 1607.66, "end": 1611.94, "text": " So as soon as you say in the attention as you can see it widens out."}, {"start": 1611.94, "end": 1617.42, "text": " So I think that's, that's fairly cool, fairly cool demonstration that the model understands"}, {"start": 1617.42, "end": 1624.22, "text": " sort of the the in relation, namely, if it is focused on something, and that something"}, {"start": 1624.22, "end": 1631.3, "text": " is in something else, then it widens the attention out to see what it is in, okay, the ocean,"}, {"start": 1631.3, "end": 1634.42, "text": " and then it focuses the attention on the ocean."}, {"start": 1634.42, "end": 1637.74, "text": " So that's, that's a pretty, that's a pretty cool result."}, {"start": 1637.74, "end": 1642.6200000000001, "text": " I guess we already knew this because we could train image captioning models before, it's"}, {"start": 1642.6200000000001, "end": 1650.06, "text": " just to show that it actually makes sense to use them as a pre training task for backbones."}, {"start": 1650.06, "end": 1655.98, "text": " Now, what's the future of this, the authors here in their introduction, they make a claim"}, {"start": 1655.98, "end": 1663.04, "text": " that this has a good future because they here they only train on this small data set, right?"}, {"start": 1663.04, "end": 1668.1399999999999, "text": " It's smaller than ImageNet, as you can see here, and they already get the same performance"}, {"start": 1668.1399999999999, "end": 1672.22, "text": " as if you train on the whole ImageNet data set in a supervised fashion."}, {"start": 1672.22, "end": 1677.8999999999999, "text": " Of course, they're also supervised, but they have 10 times less images."}, {"start": 1677.8999999999999, "end": 1683.34, "text": " And they they say something to the effect of you do you know, it would be pretty easy"}, {"start": 1683.34, "end": 1688.06, "text": " to collect more data for this task because the internet is full of images."}, {"start": 1688.06, "end": 1693.3799999999999, "text": " And mostly these images have like some text with them."}, {"start": 1693.3799999999999, "end": 1697.58, "text": " They you know, they have these descriptions or they have text around it, people write"}, {"start": 1697.58, "end": 1702.26, "text": " something about the images, you could like mind Twitter and then the responses when someone"}, {"start": 1702.26, "end": 1705.54, "text": " posts an image might tell you something about the image."}, {"start": 1705.54, "end": 1712.06, "text": " But this definitely counteracts their, this definitely counteracts their notion that these"}, {"start": 1712.06, "end": 1715.22, "text": " are very high quality labels, right?"}, {"start": 1715.22, "end": 1721.8600000000001, "text": " Their entire point here was that the annotations these, these data sets with these these image"}, {"start": 1721.8600000000001, "end": 1726.78, "text": " captioning data sets like Cocoa, they have very, very high quality annotations."}, {"start": 1726.78, "end": 1733.06, "text": " So this this text here is very high quality is really a descriptive text of the image"}, {"start": 1733.06, "end": 1739.14, "text": " that tries to capture what a human can see visually in the image."}, {"start": 1739.14, "end": 1744.72, "text": " And as soon as you go out to the internet and collect a text around images, that's not"}, {"start": 1744.72, "end": 1749.8600000000001, "text": " going to be the case that information is again going to be quite low quality."}, {"start": 1749.8600000000001, "end": 1754.98, "text": " And so I doubt that the performance here would hold up or that the claim you can easily,"}, {"start": 1754.98, "end": 1761.2, "text": " you know, you can easily create more data for this task holds up."}, {"start": 1761.2, "end": 1765.6200000000001, "text": " So that's a bit my worry about the future of this, but it's definitely cool."}, {"start": 1765.6200000000001, "end": 1770.6200000000001, "text": " And definitely shows these quality quantity trade off very well."}, {"start": 1770.6200000000001, "end": 1773.5, "text": " All right, that was my two cents to the paper."}, {"start": 1773.5, "end": 1779.5, "text": " I invite you to read it and tell me in the comments what you think about it."}, {"start": 1779.5, "end": 1806.1, "text": " And I'll see you next time."}]
Yannic Kilchner
https://www.youtube.com/watch?v=-_2AF9Lhweo
Linformer: Self-Attention with Linear Complexity (Paper Explained)
Transformers are notoriously resource-intensive because their self-attention mechanism requires a squared number of memory and computations in the length of the input sequence. The Linformer Model gets around that by using the fact that often, the actual information in the attention matrix is of lower rank and can be approximated. OUTLINE: 0:00 - Intro & Overview 1:40 - The Complexity of Self-Attention 4:50 - Embedding Dimension & Multiple Heads 8:45 - Formal Attention 10:30 - Empirical Investigation into RoBERTa 20:00 - Theorem: Self-Attention is Low Rank 28:10 - Linear Self-Attention Method 36:15 - Theorem: Linear Self-Attention 44:10 - Language Modeling 46:40 - NLP Benchmarks 47:50 - Compute Time & Memory Gains 48:20 - Broader Impact Statement 49:55 - Conclusion Paper: https://arxiv.org/abs/2006.04768 Abstract: Large transformer models have shown extraordinary success in achieving state-of-the-art results in many natural language processing applications. However, training and deploying these models can be prohibitively costly for long sequences, as the standard self-attention mechanism of the Transformer uses O(n2) time and space with respect to sequence length. In this paper, we demonstrate that the self-attention mechanism can be approximated by a low-rank matrix. We further exploit this finding to propose a new self-attention mechanism, which reduces the overall self-attention complexity from O(n2) to O(n) in both time and space. The resulting linear transformer, the \textit{Linformer}, performs on par with standard Transformer models, while being much more memory- and time-efficient. Authors: Sinong Wang, Belinda Z. Li, Madian Khabsa, Han Fang, Hao Ma Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today we're going to look at Linformer self attention with linear complexity by Sinan Wang, Belinda Li, Madian Kapsa, Han Feng and Hao Ma of Facebook AI. So on a high level, this paper observes that often the way we build transformers, the self attention matrix is low rank and can be approximated by first projecting the signal to a lower dimensional space, and then performing these inner products that are responsible for attention in there. And thereby, you save a lot of the complexity of multiplying full sequence length, full sequence length by full sequence length matrices, but instead do these operations in the lower dimensional space. And they achieve a linear scaling of the transformer attention. And we'll figure out how that is. As always, if you like content like this, consider subscribing, sharing, liking, and commenting if you feel like it. Okay, let's dive in. They say large transformer models have shown extraordinary success in achieving state of the art results in many natural language processing applications. Okay, so these, if you don't know what a transformer model is, you can watch my video on the paper attention is all you need. That was sort of the beginning of these transformers. And it introduces the attention mechanism that we're going to look at today. If you don't know what an attention mechanism is, you're not going to have a fun time in this paper. They say, however, training and deploying these models can be prohibitively costly for long sequences, as the standard self attention mechanism of the transformer uses n squared time and space with respect to the sequence length. Now, why is that? So really shortly to recap, recap this, the attention mechanism, the this attention, these transformers, they transform for basics, let's say they transform one sequence into another. So here we have five tokens, and the next layer will output five tokens, okay, for five tokens in five tokens out. And the question is, how do you route information between these five tokens from the first layer to produce the next layer? In a feed forward network, you would simply connect everything to everything and sort of learn the weights of these of these connections. That's not what we do here. In a convolutional network, you would simply connect each node to its immediate neighbors like this. But this is also not what we do here. What we do here is we route the information according to the information itself. So according to the incoming information right here, we route the information that goes out. And we do that by expressing key queries and keys. So these incoming information is transformed, first of all, into what are called keys. Now keys are simply vectors. So each node is going to expose a vector right here. And each node in the higher layer. Now, these are produced by the same from the same information down here, but I'm going to draw it conceptually on the higher layer. So each node here is going to expose a query, which is sort of like calling the query is calling for what kind of information do you want from the lower layer. And the key is sort of exposing what type of information this node contains right now. Now, the information is simply routed by looking at the inner products of these of the keys and the queries. So this information right here would probably be routed to this node right here, whereas this one would probably be routed here, this one would be routed here. In fact, this is a soft assignment. So it's not like a hard routing, it's a soft routing, everything is routed to everything with different weights, but the majority goes to the place where the inner product is high. And this one is again routed here. So you can see this is the attention mechanism. In order to do this, we need to compute the inner product of every single one of these queries with every single one of these keys. Okay, and this if our sequence length here is of length n is going to require n squared operations. Okay. Now, here is another parameter we need to pay attention. These vectors here, they have a certain dimension and the certain dimension we're going to call D, the inner the embedding dimension of the vectors. Now, in modern transformers, you can think of n as something like maybe 512 tokens go into a transformer like this. And the hidden dimension here also is in the same order of magnitude. So you can also imagine this to be something like 512. Now, if you think of these matrices, if you multiply the keys by the queries, however you want to let's do it like this, then you have the keys are n by D and the queries are D by n. Okay. Now, since n and D, in this case are the same dimension, this matrix is of rank, that of rank 512 doesn't have to be but it's a pretty good bet that it's of rank 512. Maybe it's approximately lower rank, but now, this isn't actually the modern way of transformers as such because usually what we have is multi head attention, which means that we're going to split this inner dimension right here, we're going to split these vectors into many, many lower dimensional vectors and then have attention mechanism on these lower dimensional vectors. And that's such that you don't only have one attention mechanism, you have multiple attention mechanisms. So you can route different kinds of information with these multiple attention heads. Now, sometimes you would split this, you could split this in a modern transformer up to like 16 different heads. But here we're going to let's say we're going to split this into four sub vectors, each of 128 dimensions. Okay, so we're going to split this up. And now if this in this product here is only computed on these lower dimensional vectors. So all of a sudden, you no longer have n by D, but you have like n by D over four. And now this is 512 still, but this now is 128. So the rank of this matrix is going to be 128. Mind it's still the thing that comes out is still a 512 by 512 matrix, but it is of rank 128. And that means even though this matrix contains vectors that are of size 512, they could be they could be represented accurately by a matrix that's just 128 dimensions. Okay, so these, these 512 dimensions actually only contain information that is 128 dimensional in nature. It's just distributed over 512 dimensions, but most of these are redundant. So, in fact, in these modern transformers, these thing here, this matrix here is low rank, and therefore, that's what this paper sort of exploits, we could we could approximate this by 128 dimensions. Okay, this is our starting point. They go on and they say, in this paper, we demonstrate that the self attention mechanism can be approximated by a low rank matrix. We further exploit this finding to propose a new self attention mechanism, which reduces the overall self attention complexity from n squared to n in both time and space. The resulting linear transformer, the linformer performs on par with standard transformer models while being much more memory and time efficient. Alright, so let's dive into their thing. This is how they formulate the attention mechanism. So right here, the attention has queries and keys, as you can see here. Now these W matrices you can largely ignore the W simply maps the queries to so this is these are simply D by D matrices that are a linear transformation of the queries, you can sort of overlook them for the arguments in this paper. So these are the keys and the queries we talked about the values here, this is the actual information that's being routed. So what we want to do is we want to compute this product between queries and keys right here and scale it appropriately. But ultimately, this is this product, then run this through a softmax operation. That means we we normalize it such that it sums to one the distribution sums to one. And then we want to route this information according to that distribution. Okay. So that's how they formulate an attention mechanism. Now notice something. This thing in here is what they call the matrix A. And this is what I've demonstrated to be low rank. Now, the actual thing that you would need to be low rank for their paper to hold is the matrix P, which is different because this is after the softmax, right? So if the matrix P is low rank, then you have a legitimate claim of approximating this routing via a low rank matrix. However, if P is not low rank, you don't, okay. Alright, now, the first thing they're going to show is that this is in fact a low rank. So self attention is low rank. And for that they make an empirical investigation into Roberta. So Roberta is a model that's based on BERT. And I have made videos of both BERT and Roberta, I believe, if sorry, if you want to go look those up. But it is one of these transformer models. And they take two data sets, wiki 103, and IMDB, and they run them through this model, and they look at this P matrix. So they look at how this this information routing matrix is built. And then they calculate the eigenvalues of that. So you calculate the eigenvalues. And by looking at the eigenvalues, you can look at the rank of a matrix, broadly speaking. So if you list the eigenvalues, in order of their size, then a matrix that is sort of high dimensional has a high rank would have sort of a slope like this. And that means as you go, as you go to the next and next and next eigenvalue, they drop. Like if you order a set of uniformly distributed numbers, if you order them, then it would look like this, right? So there is no particular dimension that's that's better than any or has much more information than any other. However, if the matrix is approximately low rank, you would look something like this. And that would mean that most of the information is concentrated in very few dimensions. And those are the ones with very high eigenvalues. And most of the dimensions have no information. The thing you see here is simply the cumulative sum of these things. So if you calculate the cumulative sum of this, you'll get that over here. So if this is very high rank, you would expect a curve that goes like this sort of slanted, but not very. If this is very low rank, you would expect a curve that goes very much into the corner right here. And they show that the general shape here is such that there is this kind of a kink to it, as you can see here. Now, also notice that the axis here starts at 0.4. So actually, this comes from down here somewhere and goes up and then goes like this. So they have a I feel they have a legitimate claim here that these matrices are approximately low rank. And here they look at I don't actually know at which layer this is, or if this is in all of the layers overall, or something like this. But they look at how this develops inside the layers. So they look at the always the 128th eigenvalue. And they did this, discover that as they go deeper and deeper into the network, this cumulative eigenvalue is higher and higher. That means that network puts more and more information into fewer and fewer dimension in this routing as you go up the layers. So it gets more and more skewed. As you go up the layers, it gets more and more into this corner right here. So their claim appears to be more and more true. Now, I have sort of thought about this a little, and I've tried it out a bit myself. And I invite you to just follow me here shortly. So right here, I have a matrix that is just a random Gaussian matrix of size 512 by 512. If we look at the eigen spectrum of that, so I have this function SVD, it simply gives me the eigen spectrum of that, then you can see that it sort of falls off uniformly. And that will result in a in this cumulative sum of of pretty much flat curve, or slowly ascending curve like this. Okay. Now, if we actually have a low rank matrix, this would look different, this would have this sort of typical kink in it. And we can demonstrate that by making a lower dimensional matrix. So let's just take, let's just go 512 by 128 of this lower dimensional m. And let's look at the mt. Now, this only goes to 128, because we only get back 128 singular values. So let's make a lower dimensional matrix that's actually 512 by 512. So if we do this, this is sort of what they're doing in the in this. This will construct a 512 by 512 matrix, but that is only of rank 128. Right. And you can see that at the 128th singular or eigen value, this snaps right at the at the one. So it's sort of like what they what they have. Okay, so we've seen the difference between a, let's say, high rank matrix and the low rank matrix in this cumulative sum plot. Now, I want to go back to the original matrix right here. Of course, they're the matrices they look at these routing matrices, they're not Gaussian, they're not sort of distributed with mean zero and the nice variance, they are the result of a softmax operation. And in particular, that means they're all positive. And that means that their mean is not zero. So if you look at a data set, and it's mean, it's not zero, and you calculate like the the eigenvalues, or in this case, the principal component, you will find that the first one will be very strong, because that must account for the fact that the mean is not at the center, the first few will be like this. So it is sort of, maybe we can replicate this right here. So let's say we'll put m through, let's first go with the absolute value of m. Okay, not much of a change, but you already see that this axis doesn't start at zero. So let's go, let's actually, how do we do this? Xlim, right? Xlim zero, none. So ha ha. Okay, so the first one, you simply have to imagine, or I can do even something, something more, we can just put a zero in front here. And that should do the trick. No, yes. Oh, that's X, I meant Y, calm and dumb. Nevermind, this will work as well. So you already get this sort of kink. And let's put it into the softmax. So we put a softmax. And that gives you also this kink. Now you might think that wait, this is that this kink looks a lot smaller than the other kink. So but if we simply modify, let's modify the standard deviation of this random matrix. And you can see that the spectrum immediately changes, right? Because of the interaction now between the softmax and the standard deviation, if I only were to change the standard deviation on the normal m matrix, and we can actually try this right here. That wouldn't do much, that would still look pretty much the same. It's just differently scaled. But in the interaction with the softmax, now, this changes the spectrum dramatically. And here, as you know, these these transformers have always sort of like layer normalization and so on. So probably the standard deviation if we if if these are sort of Gaussian, the standard deviation before the softmax would be a lot smaller. So let's go something like this. So smaller than one. And can we run this please? And you can see that this kink immediately appears. Now it's not it's it's not the same thing as this other as this here, because this is a lot smoother, as you can see right here. But still, I feel that this might not actually be a result of the you know, the fact that this is an attention mechanism, but it simply might be the result of that you apply a softmax. Now, still, that doesn't change the fact that it is approximately a low rank matrix. So everything they say, holds but yeah, maybe, maybe one should also look into why exactly that happens. But in fact, it is low rank, okay, it is approximately low rank, they've demonstrated this. And now they go to their first first theory below, we provide a theoretical answer, a theoretical analysis of the above spectrum results. Okay, so the theoretical analysis, theorem one is self attention is low rank. And we're going to go through this. Just glance at it for now. They say for any of these query key values and these matrices, which of course, you can ignore for now, for any column vector w of matrix v w and w here, that's the information that needs to be routed, there exists a low rank matrix p tilde. So this p tilde here is going to be their low rank approximation of the p matrix. You can see it's still n by n, but it's going to be low ranking. In fact, it's going to be of the order of the logarithm of the rank of the full matrix. Or, well, the full matrix of the rank that the full matrix could have, as we have already seen, the full matrix doesn't have full rank, but yeah, okay. So if you use and this is the type of guarantee you get. So what do we see here, it basically means that this distance here is smaller than this. And this year, this is just the norm of one of these vectors projected times this error coefficient epsilon. So all it says is that the distance on the left is smaller than something. And that occurs with high probability. Okay, so the entire guarantee here, the entire formula just basically means that this thing is small, this norm is small. What's this norm? This norm is the distance between these two things. Now, what are these two things, this is the information that we want to route. And this is the routing matrix. And that simply means that if I route my information using the p tilde, this approximation, then I won't be too far away as if I had routed my information using the original p matrix. Okay, that's, that's it. That's what the theorem says. The theorem says, if I route my information using this approximation, then I am not too far away as it had I routed my information using the original routing matrix. Now they don't say how they're going to construct, they simply say there exists a low rank matrix like this. And the proof of this, and it's sort of worth looking at the proof of it, it uses the Johnson Lindenstrauss lemma, this thing here, or the JL for short. And they're going to get this out of the JL. Now the Johnson Lindenstrauss lemma, in a classic sense, says something like this, if I have data in a high dimensional space here in a three dimensional space, okay, I've data distributed, and I use a certain kind of projection matrix. And there are a number so the JL gives conditions on what these projections can be. But for example, a randomly sampled matrix with zero mean Gaussian entries and one over k standard deviation where k is the dimension you project into can do the trick. So if I project my data in a certain way, into a lower dimension here dimension two, then the projected data is related to the original data by the fact that the distances between the points in the original space will not be distorted too much. So the distances between these points are approximately preserved through this projection. Okay, so that's, that's the that's the Johnson Lindenstrauss lemma. Now you'll notice here, there is no reference to the fact that this data is or isn't low rank, it's simply high dimensional data projected to lower dimension, and the distances are approximately preserved. And this theory here, and I've looked at it for a while now, they simply define, okay, they define this P matrix as this attention mechanism. And here you can see the A matrix we've discussed before, which is actually low rank, but we don't know yet if the softmax is, they write it as this form right here of the exponential of each entry of A divided by this diagonal right here. So in the softmax, of course, you have the exponential of each entry divided by the sum of the entries, and they write this simply as two matrices. But ultimately, this is a matrix right here. And all they do is they take this P matrix, and they apply the Johnson Lindenstrauss lemma by having this projection matrix R, and R is entries from this Gaussian, as I said, so this is the special type of projection that the JL addresses. And then it simply says, if you pull if you, this here is going to be your P tilde. So if you project R in this manner, and obtain P tilde, and then you use P tilde instead of P, then this, this is going to be very close. In fact, you can reformulate the JL into different variants such that it gives you things like this, things like saying that the distance between this projected version and this unprojected version is going to be a constant, smaller than a constant times the norms of the unprojected version, that is equivalent to saying that the distances are preserved. Now, you can see right here, nowhere in this theorem is the fact that this is self attention. And nowhere in the theorem appears the fact that this inner matrix A is low rank, or even that this matrix A exists, it's you can do this with any matrix P, right, the JL doesn't concern itself with the nature of this matrix P, it says any matrix, any sort of high dimensional data, you can project to low dimensional data. And this holds if you choose the projection correctly, which they do right here. So to claim that this theorem proves that self attention is low rank, to me is a bit, it's a bit of a statement that is not warranted. Like, that this here should read something like the Johnson Lindenstrauss lemma exists, or something like this. It, I'm not I'm not sure like, convince me otherwise. But yeah, so they go with this. So they say, given the low rank property of the context mapping matrix P, now, again, I disagree that this has been shown, except empirically, one straightforward idea is to use singular value decomposition to approximate P with a low rank matrix P low as follows. So what you could do is you could simply learn these low rank matrices and approximate P through it, or you can decompose P as such, and then have these easier inner products in dimension k. But they say, however, this approach requires performing an SVD decomposition in each self attention matrix, which adds additional complexity. Therefore, we propose another approach for a low rank approximation that avoids this added complexity. Okay, so they now come up with their model, and their model goes as follows. So here on the left, you see a classic attention mechanism with their projections built in, what they're proposing is they say, let's project the matrix K using one of these random projections. And then this attention routing, if you route if you now multiply, so you multiply k and q right here, k times q, and then you put it into the softmax, and then you use it to route this W. So they say, if we build in this projection matrix, that will project k to a lower dimension, and then we won't have as expensive of inner products. Now, the important part to see here is that if you think of this lower projection, the first thing you think is that you project this inner this hidden dimension D, right, to a lower dimension. And that's not the case here, you actually project the end. So in, in a conceptual framework, so you can see right here, forget about this, this is this W matrix. In a conceptual framework, you see here is this n by D matrix, which are the keys. So n is the sequence length, and D is the dimensions. And what you want to do is you want to project that by this matrix, which is k by n. So you want to reduce the sequence length. You can see in this matrix right here, why that might work because n is much larger than D. And that means this matrix can be at most rank D, right? So you should not lose too much, you should sort of be able to preserve the information. If you project this n to a k, where the k if the k is still larger than the D, or approximately in the same order of magnitude, you should be able to preserve that information if you do it in a smart way. So conceptually, if we have our five token sequence, like here, and the next layer produces five tokens, again, what we first do is we say, we know, we know that the information we want is not five dimensional, it's actually two dimensional. Because, okay, let's say the this inner dimension D is, is two as well. So we have two dimensional vectors, each thing exposes two dimensional vectors. So we first project the sequence of length five to a sequence of length two. And we simply do that in a random manner. So we have a random Gaussian matrix that assigns weights to mix these five into these two. And again, because the JL works for any sort of data. But in my argumentation, if you, you know, think that this here is low rank, it's of rank two, then you shouldn't lose too much information by projecting it to a sequence length two. And now we do this attention mechanism. So now we expose the keys. And now we expose the queries up here. And now you can see instead of routing five things with five things, you only have to route five things with two things. And so instead of having o n squared, you now have o n k, if k k is the number right here. Okay, so this is the idea, you project the sequence length. And it comes from the fact that the sequence length is much larger than the dimensionality. And therefore, you can sort of preserve the information if you project in a smart way. They build this in this fashion right here. So the attention mechanism now, before we saw it was between the queries and the keys, right here. They built now this projection matrix here that projects the keys into a lower dimensional sequence. And the now such that this will result in an n by k attention matrix we saw over here, you don't need to route n by n things, you need to route n by k. So this, this routing table in here is now n by k. Now the next layer, as you can see here, it actually needs to produce a sequence of length five again, right? So we always transform sequence of length five into sequence of length five. But now we have we have this n corresponds to the sort of corresponds to the next layer. And this k corresponds to the down projected sequence of the last layer. And in order for that to fit, we of course, also need to down project the information that we're routing. So if we down project the routing table, we also need to down project the information that we're routing. That's we do this by a similar matrix f that is also sampled in this way in this special way. And that gives us a k by d. So we have projected the sequence to size k. And if we multiply these two things, again, of course, we'll get out an n by d matrix, which is the signal for the next layer. Okay, so an n by d signal comes in down here, it's projected down to k sequence length, it's and it's routed up again to n sequence length. And you have again an n by d matrix here. Cool. So that's how they do it. And they build this into the transformer. Now, as I understand it, these projection matrices, again, they're not learned, they are do they are built up in this j l. conscribed way, they are not learned, they are fixed once. And then that's, that's that, at least that's how I understand it. So there are no more learnable parameters. Okay, so here they have a demonstration where they up the sequence length. And you can see the batch size decreases, but that's just to sort of keep the total amount of flops to be done the same, you up the sequence length and down the batch size. As the sequence length increases, the standard transformers requirement in inference time goes up. And this here, as you can see, this is not a linear scale, it's a log scale, log two. So this goes up with the sequence length, and it should go up quadratically, right. And you can also see that the linformer keeps fairly constant for the same k. Now, of course, as you increase the k of the linformer, the inference time will go up, because now it's dependent on n times k and not on n times n. Okay. So let's look a bit further of how you have to choose that k up here in the first theorem, we there was a already a hint to it. In the first theorem, you had to choose k by five log n. And this is a problem. So here you have log n, that means it's not so O of n k is equal to O of n log n. Now that's not linear. That's actually that's the same as the reformer. But they want to get to a linear place. And theorem two explains goes now to a linear shows how you can make self attention linear. Okay, they show again, blah, blah, blah, blah. Now you have to choose k at the minimum of these two things. And you can see right here, that one of them is independent of n. So that means as n grows, of course, the minimum is no longer going to be this here, the minimum is actually going to be the thing on the left. And that is dependent on just D. Okay, so you have D log D in here. And that makes sense. Because in the very beginning, we said, hey, D is actually much smaller than n. And that means the information that is contained in these matrices is at most rank D. So if we down project to k, we should adjust k to what D is, right? If we adjust k to about the same thing as D, we're guaranteed to not lose too much information. So now we choose k according to D instead of according to n and therefore, the computation is linear in n. And n times k is like n times D to log D. So it's linear in k and linear in D. How do we get there? So the first thing they do is they make the sort of Johnson Lindenstrauss statements again. But now instead of the general statement, they plug in their actual modified attention mechanism. So here they have a bound on the distance between if I route my this is the information to be routed, right? If I route my information using the original softmax, and this in here is the matrix A, if the original attention mechanism, I won't be too far away, as if I were to route my information using this modified attention mechanism. Now, the tricky part here, mathematically, I believe is that is exactly the softmax what what I alluded to, right? So this softmax is the tricky part, because if this weren't a softmax, so if the softmax weren't here, this would simply be a projection down and a projection up. And the dilemma would almost apply as it is written, right? You wouldn't have to actually do anything. But the question is, if this inside the softmax is is low rank, can you make a claim that the entire softmax then is also low rank? And it's not entirely clear, because because Oh, yes, we've done this. So you can see right here that the softmax we have actually done the softmax of a low rank matrix. So we have already seen the low rank matrix itself, and how it immediately snaps to the to the upper axis after 128. Now, if we do the same thing for the softmax of that, and we probably have to take away some of these dimensions, the first few, let's go with, let's go to dimension 100 and look from there. Okay, same thing. Okay, that's pretty good. I did not expect that. Hi, there. So this is Janek from the future. I've realized I've been an idiot in how I constructed these low rank matrices right here by multiplying MT by itself, of course, what's a better way to do it is to construct two independent 128 dimensional matrices like these two sub slices of M right here, and then multiplying those together and looking at the SVD. And you as you can see right here. So the softmax of this is now not of this super low rank anymore, it's still low rank, but it's not not very, it's not like hard low rank. So if I just look at the matrix without the softmax, then you can see it has a very peak that by at 128, which gives us the indication it's actually 128 rank, which we already knew. But if we now introduce the softmax, then you can see that this vanishes and it's no longer 128 dimensional. And it's only approximately low rank, as you can see. Alright, back to Janek in the past, who is wholly surprised that the two that if you multiply MT by itself, that that will give you back the the exact same thing. Alright, so did we try this before? Maybe we did. Okay, but the mathematical difficulty still remains and their main thing here is so they have a first first version, where they pretty much plug it into the JL again, and they they get out this k is the k needs to be by log n. But they say this result does not utilize the low rank property of matrix A. And the resultant k has a dependency on sequence like n. And then in the appendix, they finally go through the math to show that now if they choose E and F like this, they can actually pull out this and show that the k is where we where you have it, that the k is independent of n like this. And I think the main the main step in this proof is the step B here, where they say uses the fact that the exponential function is Lipschitz continuous in a compact region, then we can choose a small enough delta such that the as you can see here, this now directly relates to this projection matrix within the exponential function to the projection matrix out of the exponential function. So you can basically say that if I project first and then use the exponential function, that's not too different than if I first use the exponential function and then project. Okay, so that's the that's the sort of of of catch here. Now they only do this for the exponential function, not the actual softmax. As you can see here, throughout, they do it to the exponential function and also here in their statements. The softmax isn't the exponential function, the softmax is the exponential function divided by the sum of the exponential functions, but I believe that this generalizes straightforwardly. Alright, so for given choices of delta and K, they have shown that the linformer in fact, can do in a linear fashion what a transformer can do in a quadratic fashion, and they are not too far off. Okay, that's that's their point right here. Their results on these benchmarks, oh, sorry, let's first go to the perplexities in language modeling. So they show right here, that they pretty much can keep up with the standard transformer, as you can see here. So with the standard transformer, they can keep up here. Now think that this the the computation is n times k, okay, so something like this linformer with k equals 256 will only so instead of n by n, it's n times k, it won't save you too much in that case. But it's it's not too surprising that in fact, you have the same performance because probably the standard transformer is distributed over more heads than two. So the information necessarily has a lower dimensionality 10 to 56. One thing I want to draw attention to though here is that you can see that here, it's not really done learning yet. And as you can see, the standard transformer sort of surpasses all of these models towards the end. I wonder, I wonder what happens, I wouldn't be surprised if they end up sort of at the same place. But I wonder if these diverge even more, right here after that. They also compare with a higher sequence length. And the standard transformer outperforms the linformer. But of course, the point here is that the linformer is much, much, much faster, and can keep up. Now, also, the scale here of the perplexity. You see, these are percentage points in perplexity, but I can't actually tell if that matters or not. I think, I think the original transformer paper, the perplexities hovered between like three point something and five point something. So this might actually be sort of significant differences. And I'm not sure. They investigate different methods of sharing these weights of these of these projections. And they seems like they don't find real differences. But I don't want to go into that because this video is already really long. And then they look at what happens if they up the sequence length that they put into the linformer. And you can see that the linformer can deal with higher sequence lengths and arrive at the same perplexities. Though again, I don't know how much different that is. And the scale here is larger than before. But yeah. So how does this fare on these benchmarks where you first train a transformer with pre training with language modeling, and then you use it to do certain NLP tasks. And here you can see that the linformer is on par in some of these tasks with the original transformer. But also you can see like a pattern where you can see pretty wild results in that, you know, sometimes the the linformer here will be better than this, but then also variants of the linformer will be worse. And they'll even be worse than this. And sometimes they'll be better. Sometimes this linformer is good. And sometimes the original model is the best. So this sort of points to you can make the general claim that the linformer doesn't destroy your gains, but also it's not like a better model, it's simply a faster model that in some tasks can keep up with the original model. And they show that, of course, this is the real deal here, that as you go up in length, the performance gains, and also sorry, this this way, the performance gains, and the memory gains that you get by the linformer are dramatic. Of course, the longer and you go into the lower dimension you project, the more these gains are, but of course, the more performance you're going to lose potentially. Hello, again, Janek from the future. Just wanted to draw your attention on this beautiful, broader impact statement in this paper, saying our work focuses on making transformers more efficient, everything cool, potential positive inspect impacts of efficient transformers. That's pretty cool. It also has potential impact on training transformers on images, since we can support very long sequences, very cool. Furthermore, there are positive environmental benefits. Very cool. I mean, these are all very cool things. They say, as such, we see no immediate negative ethical or societal impacts of our work beyond what applies to the core building blocks of deep learning. Do better. Now this this, I honestly, I agree with them, right? I completely agree with them, that this is sort of a good thing you might trade off, you know, some accuracy, you might make some approximations, but you will get a much faster model. And this model, as any model can be used, you know, for things, and that they now have to pull out of their out of their butt some way in over five steps of intermediate layers. This this could be used for bad, it just seems ridiculous. So good on them for defying the, please also think about negative impacts right here. All right, back to back back to past Janek. All right, this was the linformer paper. I hope this somewhat make sense made sense to you. I had to read it multiple times for it to make sense to me. But ultimately, it's all about the fact that you have these multiple heads. And therefore, your information is probably lower dimensional, and you can abuse that to just calculate in this lower dimension. All right, I'll see you next time. Bye bye.
[{"start": 0.0, "end": 6.68, "text": " Hi there, today we're going to look at Linformer self attention with linear complexity by Sinan"}, {"start": 6.68, "end": 14.36, "text": " Wang, Belinda Li, Madian Kapsa, Han Feng and Hao Ma of Facebook AI. So on a high level,"}, {"start": 14.36, "end": 22.16, "text": " this paper observes that often the way we build transformers, the self attention matrix is low"}, {"start": 22.16, "end": 29.68, "text": " rank and can be approximated by first projecting the signal to a lower dimensional space, and then"}, {"start": 29.68, "end": 35.0, "text": " performing these inner products that are responsible for attention in there. And thereby,"}, {"start": 35.0, "end": 43.96, "text": " you save a lot of the complexity of multiplying full sequence length, full sequence length by"}, {"start": 43.96, "end": 49.8, "text": " full sequence length matrices, but instead do these operations in the lower dimensional space. And"}, {"start": 49.8, "end": 58.72, "text": " they achieve a linear scaling of the transformer attention. And we'll figure out how that is."}, {"start": 58.72, "end": 66.8, "text": " As always, if you like content like this, consider subscribing, sharing, liking, and commenting if"}, {"start": 66.8, "end": 75.44, "text": " you feel like it. Okay, let's dive in. They say large transformer models have shown extraordinary"}, {"start": 75.44, "end": 80.52, "text": " success in achieving state of the art results in many natural language processing applications."}, {"start": 80.52, "end": 86.72, "text": " Okay, so these, if you don't know what a transformer model is, you can watch my video"}, {"start": 86.72, "end": 93.48, "text": " on the paper attention is all you need. That was sort of the beginning of these transformers. And"}, {"start": 93.48, "end": 99.12, "text": " it introduces the attention mechanism that we're going to look at today. If you don't know what an"}, {"start": 99.12, "end": 105.12, "text": " attention mechanism is, you're not going to have a fun time in this paper. They say, however,"}, {"start": 105.12, "end": 110.2, "text": " training and deploying these models can be prohibitively costly for long sequences,"}, {"start": 110.2, "end": 117.2, "text": " as the standard self attention mechanism of the transformer uses n squared time and space with"}, {"start": 117.2, "end": 124.96000000000001, "text": " respect to the sequence length. Now, why is that? So really shortly to recap, recap this, the"}, {"start": 124.96000000000001, "end": 131.28, "text": " attention mechanism, the this attention, these transformers, they transform for basics, let's"}, {"start": 131.28, "end": 138.88, "text": " say they transform one sequence into another. So here we have five tokens, and the next layer will"}, {"start": 138.88, "end": 146.28, "text": " output five tokens, okay, for five tokens in five tokens out. And the question is, how do you route"}, {"start": 146.28, "end": 154.16, "text": " information between these five tokens from the first layer to produce the next layer? In a feed"}, {"start": 154.16, "end": 159.07999999999998, "text": " forward network, you would simply connect everything to everything and sort of learn the"}, {"start": 159.07999999999998, "end": 164.96, "text": " weights of these of these connections. That's not what we do here. In a convolutional network,"}, {"start": 164.96, "end": 171.4, "text": " you would simply connect each node to its immediate neighbors like this. But this is also"}, {"start": 171.4, "end": 177.08, "text": " not what we do here. What we do here is we route the information according to the information"}, {"start": 177.08, "end": 182.76000000000002, "text": " itself. So according to the incoming information right here, we route the information that goes out."}, {"start": 182.76000000000002, "end": 191.88, "text": " And we do that by expressing key queries and keys. So these incoming information is transformed,"}, {"start": 191.88, "end": 197.92, "text": " first of all, into what are called keys. Now keys are simply vectors. So each node is going to expose"}, {"start": 197.92, "end": 205.6, "text": " a vector right here. And each node in the higher layer. Now, these are produced by the same from the"}, {"start": 205.6, "end": 211.07999999999998, "text": " same information down here, but I'm going to draw it conceptually on the higher layer. So each node"}, {"start": 211.07999999999998, "end": 217.68, "text": " here is going to expose a query, which is sort of like calling the query is calling for what kind"}, {"start": 217.68, "end": 222.68, "text": " of information do you want from the lower layer. And the key is sort of exposing what type of"}, {"start": 222.68, "end": 230.76000000000002, "text": " information this node contains right now. Now, the information is simply routed by looking at"}, {"start": 230.76000000000002, "end": 237.04000000000002, "text": " the inner products of these of the keys and the queries. So this information right here would"}, {"start": 237.04000000000002, "end": 243.24, "text": " probably be routed to this node right here, whereas this one would probably be routed here,"}, {"start": 243.24, "end": 248.92000000000002, "text": " this one would be routed here. In fact, this is a soft assignment. So it's not like a hard routing,"}, {"start": 248.92000000000002, "end": 253.44, "text": " it's a soft routing, everything is routed to everything with different weights, but the"}, {"start": 253.44, "end": 261.08, "text": " majority goes to the place where the inner product is high. And this one is again routed here. So you"}, {"start": 261.08, "end": 267.0, "text": " can see this is the attention mechanism. In order to do this, we need to compute the inner product"}, {"start": 267.0, "end": 274.56, "text": " of every single one of these queries with every single one of these keys. Okay, and this if our"}, {"start": 274.56, "end": 286.48, "text": " sequence length here is of length n is going to require n squared operations. Okay. Now, here is"}, {"start": 286.48, "end": 292.6, "text": " another parameter we need to pay attention. These vectors here, they have a certain dimension and"}, {"start": 292.6, "end": 300.40000000000003, "text": " the certain dimension we're going to call D, the inner the embedding dimension of the vectors. Now,"}, {"start": 300.40000000000003, "end": 308.76000000000005, "text": " in modern transformers, you can think of n as something like maybe 512 tokens go into a"}, {"start": 308.76000000000005, "end": 315.08000000000004, "text": " transformer like this. And the hidden dimension here also is in the same order of magnitude. So"}, {"start": 315.08000000000004, "end": 321.68, "text": " you can also imagine this to be something like 512. Now, if you think of these matrices, if you"}, {"start": 321.68, "end": 328.84000000000003, "text": " multiply the keys by the queries, however you want to let's do it like this, then you have the keys"}, {"start": 328.84000000000003, "end": 337.28000000000003, "text": " are n by D and the queries are D by n. Okay. Now, since n and D, in this case are the same dimension,"}, {"start": 337.28000000000003, "end": 344.28000000000003, "text": " this matrix is of rank, that of rank 512 doesn't have to be but it's a pretty good bet that it's"}, {"start": 344.28, "end": 354.4, "text": " of rank 512. Maybe it's approximately lower rank, but now, this isn't actually the modern way of"}, {"start": 354.4, "end": 360.71999999999997, "text": " transformers as such because usually what we have is multi head attention, which means that we're"}, {"start": 360.71999999999997, "end": 366.2, "text": " going to split this inner dimension right here, we're going to split these vectors into many,"}, {"start": 366.2, "end": 371.79999999999995, "text": " many lower dimensional vectors and then have attention mechanism on these lower dimensional"}, {"start": 371.8, "end": 378.52000000000004, "text": " vectors. And that's such that you don't only have one attention mechanism, you have multiple"}, {"start": 378.52000000000004, "end": 384.12, "text": " attention mechanisms. So you can route different kinds of information with these multiple attention"}, {"start": 384.12, "end": 390.24, "text": " heads. Now, sometimes you would split this, you could split this in a modern transformer up to"}, {"start": 390.24, "end": 396.28000000000003, "text": " like 16 different heads. But here we're going to let's say we're going to split this into four"}, {"start": 396.28, "end": 405.28, "text": " sub vectors, each of 128 dimensions. Okay, so we're going to split this up. And now if this in"}, {"start": 405.28, "end": 411.11999999999995, "text": " this product here is only computed on these lower dimensional vectors. So all of a sudden, you no"}, {"start": 411.11999999999995, "end": 419.59999999999997, "text": " longer have n by D, but you have like n by D over four. And now this is 512 still, but this now is"}, {"start": 419.6, "end": 428.12, "text": " 128. So the rank of this matrix is going to be 128. Mind it's still the thing that comes out is"}, {"start": 428.12, "end": 438.44, "text": " still a 512 by 512 matrix, but it is of rank 128. And that means even though this matrix contains"}, {"start": 438.44, "end": 450.2, "text": " vectors that are of size 512, they could be they could be represented accurately by a matrix that's"}, {"start": 450.21999999999997, "end": 458.52, "text": " just 128 dimensions. Okay, so these, these 512 dimensions actually only contain information that"}, {"start": 458.52, "end": 466.84, "text": " is 128 dimensional in nature. It's just distributed over 512 dimensions, but most of these are"}, {"start": 466.84, "end": 475.61999999999995, "text": " redundant. So, in fact, in these modern transformers, these thing here, this matrix here is low rank,"}, {"start": 475.65999999999997, "end": 484.82, "text": " and therefore, that's what this paper sort of exploits, we could we could approximate this by"}, {"start": 484.84, "end": 494.65999999999997, "text": " 128 dimensions. Okay, this is our starting point. They go on and they say, in this paper, we"}, {"start": 494.66, "end": 502.14000000000004, "text": " demonstrate that the self attention mechanism can be approximated by a low rank matrix. We further"}, {"start": 502.14000000000004, "end": 507.78000000000003, "text": " exploit this finding to propose a new self attention mechanism, which reduces the overall self"}, {"start": 507.8, "end": 514.62, "text": " attention complexity from n squared to n in both time and space. The resulting linear transformer,"}, {"start": 514.64, "end": 521.14, "text": " the linformer performs on par with standard transformer models while being much more memory and"}, {"start": 521.14, "end": 530.02, "text": " time efficient. Alright, so let's dive into their thing. This is how they formulate the attention"}, {"start": 530.66, "end": 537.26, "text": " mechanism. So right here, the attention has queries and keys, as you can see here. Now these W"}, {"start": 537.26, "end": 544.6999999999999, "text": " matrices you can largely ignore the W simply maps the queries to so this is these are simply D by D"}, {"start": 544.7, "end": 551.5400000000001, "text": " matrices that are a linear transformation of the queries, you can sort of overlook them for the"}, {"start": 551.5400000000001, "end": 558.58, "text": " arguments in this paper. So these are the keys and the queries we talked about the values here, this"}, {"start": 558.58, "end": 563.5, "text": " is the actual information that's being routed. So what we want to do is we want to compute this"}, {"start": 563.5, "end": 570.1, "text": " product between queries and keys right here and scale it appropriately. But ultimately, this is"}, {"start": 570.1, "end": 578.62, "text": " this product, then run this through a softmax operation. That means we we normalize it such that"}, {"start": 578.62, "end": 586.34, "text": " it sums to one the distribution sums to one. And then we want to route this information according"}, {"start": 586.5, "end": 593.82, "text": " to that distribution. Okay. So that's how they formulate an attention mechanism. Now notice"}, {"start": 593.82, "end": 600.4200000000001, "text": " something. This thing in here is what they call the matrix A. And this is what I've demonstrated to"}, {"start": 600.4200000000001, "end": 609.1400000000001, "text": " be low rank. Now, the actual thing that you would need to be low rank for their paper to hold is the"}, {"start": 609.1400000000001, "end": 616.94, "text": " matrix P, which is different because this is after the softmax, right? So if the matrix P is low rank,"}, {"start": 616.94, "end": 624.9000000000001, "text": " then you have a legitimate claim of approximating this routing via a low rank matrix. However, if P"}, {"start": 624.9000000000001, "end": 634.62, "text": " is not low rank, you don't, okay. Alright, now, the first thing they're going to show is that this is"}, {"start": 634.62, "end": 641.1, "text": " in fact a low rank. So self attention is low rank. And for that they make an empirical investigation"}, {"start": 641.1, "end": 650.3000000000001, "text": " into Roberta. So Roberta is a model that's based on BERT. And I have made videos of both BERT and"}, {"start": 650.3000000000001, "end": 657.5400000000001, "text": " Roberta, I believe, if sorry, if you want to go look those up. But it is one of these transformer"}, {"start": 657.5400000000001, "end": 665.14, "text": " models. And they take two data sets, wiki 103, and IMDB, and they run them through this model, and"}, {"start": 665.14, "end": 672.78, "text": " they look at this P matrix. So they look at how this this information routing matrix is built. And"}, {"start": 672.78, "end": 681.6999999999999, "text": " then they calculate the eigenvalues of that. So you calculate the eigenvalues. And by looking at the"}, {"start": 681.6999999999999, "end": 689.78, "text": " eigenvalues, you can look at the rank of a matrix, broadly speaking. So if you list the eigenvalues,"}, {"start": 689.78, "end": 698.86, "text": " in order of their size, then a matrix that is sort of high dimensional has a high rank would have"}, {"start": 698.86, "end": 707.86, "text": " sort of a slope like this. And that means as you go, as you go to the next and next and next"}, {"start": 707.86, "end": 715.3399999999999, "text": " eigenvalue, they drop. Like if you order a set of uniformly distributed numbers, if you order them,"}, {"start": 715.34, "end": 721.58, "text": " then it would look like this, right? So there is no particular dimension that's that's better than"}, {"start": 721.58, "end": 727.82, "text": " any or has much more information than any other. However, if the matrix is approximately low rank,"}, {"start": 727.82, "end": 732.5, "text": " you would look something like this. And that would mean that most of the information is"}, {"start": 732.5, "end": 738.7, "text": " concentrated in very few dimensions. And those are the ones with very high eigenvalues. And most"}, {"start": 738.7, "end": 745.86, "text": " of the dimensions have no information. The thing you see here is simply the cumulative sum of these"}, {"start": 745.86, "end": 752.82, "text": " things. So if you calculate the cumulative sum of this, you'll get that over here. So if this is very"}, {"start": 752.82, "end": 761.6600000000001, "text": " high rank, you would expect a curve that goes like this sort of slanted, but not very. If this is very"}, {"start": 761.6600000000001, "end": 767.98, "text": " low rank, you would expect a curve that goes very much into the corner right here. And they show"}, {"start": 767.98, "end": 778.58, "text": " that the general shape here is such that there is this kind of a kink to it, as you can see here. Now,"}, {"start": 778.58, "end": 784.66, "text": " also notice that the axis here starts at 0.4. So actually, this comes from down here somewhere and"}, {"start": 784.66, "end": 790.54, "text": " goes up and then goes like this. So they have a I feel they have a legitimate claim here that these"}, {"start": 790.54, "end": 797.62, "text": " matrices are approximately low rank. And here they look at I don't actually know at which layer this"}, {"start": 797.62, "end": 804.26, "text": " is, or if this is in all of the layers overall, or something like this. But they look at how this"}, {"start": 804.26, "end": 812.0600000000001, "text": " develops inside the layers. So they look at the always the 128th eigenvalue. And they did this,"}, {"start": 812.0600000000001, "end": 819.3, "text": " discover that as they go deeper and deeper into the network, this cumulative eigenvalue is higher"}, {"start": 819.3, "end": 826.9, "text": " and higher. That means that network puts more and more information into fewer and fewer dimension"}, {"start": 826.9, "end": 832.6999999999999, "text": " in this routing as you go up the layers. So it gets more and more skewed. As you go up the layers,"}, {"start": 832.6999999999999, "end": 839.06, "text": " it gets more and more into this corner right here. So their claim appears to be more and more true."}, {"start": 839.06, "end": 846.8199999999999, "text": " Now, I have sort of thought about this a little, and I've tried it out a bit myself. And I invite"}, {"start": 846.8199999999999, "end": 856.5799999999999, "text": " you to just follow me here shortly. So right here, I have a matrix that is just a random Gaussian"}, {"start": 856.58, "end": 863.3000000000001, "text": " matrix of size 512 by 512. If we look at the eigen spectrum of that, so I have this function"}, {"start": 863.3000000000001, "end": 870.7800000000001, "text": " SVD, it simply gives me the eigen spectrum of that, then you can see that it sort of falls off"}, {"start": 870.7800000000001, "end": 881.6600000000001, "text": " uniformly. And that will result in a in this cumulative sum of of pretty much flat curve,"}, {"start": 881.66, "end": 890.14, "text": " or slowly ascending curve like this. Okay. Now, if we actually have a low rank matrix,"}, {"start": 890.14, "end": 895.54, "text": " this would look different, this would have this sort of typical kink in it. And we can demonstrate"}, {"start": 895.54, "end": 905.26, "text": " that by making a lower dimensional matrix. So let's just take, let's just go 512 by 128 of this"}, {"start": 905.26, "end": 915.22, "text": " lower dimensional m. And let's look at the mt. Now, this only goes to 128, because we only get"}, {"start": 915.22, "end": 922.9, "text": " back 128 singular values. So let's make a lower dimensional matrix that's actually 512 by 512. So"}, {"start": 922.9, "end": 933.86, "text": " if we do this, this is sort of what they're doing in the in this. This will construct a 512 by 512"}, {"start": 933.86, "end": 944.74, "text": " matrix, but that is only of rank 128. Right. And you can see that at the 128th singular or eigen"}, {"start": 944.74, "end": 953.42, "text": " value, this snaps right at the at the one. So it's sort of like what they what they have. Okay,"}, {"start": 953.42, "end": 959.86, "text": " so we've seen the difference between a, let's say, high rank matrix and the low rank matrix in this"}, {"start": 959.86, "end": 966.7, "text": " cumulative sum plot. Now, I want to go back to the original matrix right here. Of course,"}, {"start": 966.7, "end": 972.7, "text": " they're the matrices they look at these routing matrices, they're not Gaussian, they're not sort"}, {"start": 972.7, "end": 978.46, "text": " of distributed with mean zero and the nice variance, they are the result of a softmax"}, {"start": 978.46, "end": 984.3000000000001, "text": " operation. And in particular, that means they're all positive. And that means that their mean is"}, {"start": 984.3, "end": 990.9399999999999, "text": " not zero. So if you look at a data set, and it's mean, it's not zero, and you calculate like the"}, {"start": 990.9399999999999, "end": 998.38, "text": " the eigenvalues, or in this case, the principal component, you will find that the first one will"}, {"start": 998.38, "end": 1003.9399999999999, "text": " be very strong, because that must account for the fact that the mean is not at the center,"}, {"start": 1003.9399999999999, "end": 1014.14, "text": " the first few will be like this. So it is sort of, maybe we can replicate this right here. So"}, {"start": 1014.14, "end": 1025.54, "text": " let's say we'll put m through, let's first go with the absolute value of m. Okay, not much of a change,"}, {"start": 1025.54, "end": 1034.3799999999999, "text": " but you already see that this axis doesn't start at zero. So let's go, let's actually, how do we do"}, {"start": 1034.38, "end": 1050.22, "text": " this? Xlim, right? Xlim zero, none. So ha ha. Okay, so the first one, you simply have to imagine,"}, {"start": 1050.22, "end": 1057.0600000000002, "text": " or I can do even something, something more, we can just put a zero in front here. And that should do"}, {"start": 1057.06, "end": 1069.78, "text": " the trick. No, yes. Oh, that's X, I meant Y, calm and dumb. Nevermind, this will work as well. So you"}, {"start": 1069.78, "end": 1081.82, "text": " already get this sort of kink. And let's put it into the softmax. So we put a softmax. And that"}, {"start": 1081.82, "end": 1087.5, "text": " gives you also this kink. Now you might think that wait, this is that this kink looks a lot smaller"}, {"start": 1087.5, "end": 1095.1799999999998, "text": " than the other kink. So but if we simply modify, let's modify the standard deviation of this random"}, {"start": 1095.1799999999998, "end": 1100.3799999999999, "text": " matrix. And you can see that the spectrum immediately changes, right? Because of the"}, {"start": 1100.3799999999999, "end": 1105.9399999999998, "text": " interaction now between the softmax and the standard deviation, if I only were to change"}, {"start": 1105.94, "end": 1114.54, "text": " the standard deviation on the normal m matrix, and we can actually try this right here. That"}, {"start": 1114.54, "end": 1119.22, "text": " wouldn't do much, that would still look pretty much the same. It's just differently scaled. But"}, {"start": 1119.22, "end": 1126.1000000000001, "text": " in the interaction with the softmax, now, this changes the spectrum dramatically. And here,"}, {"start": 1126.1000000000001, "end": 1131.1000000000001, "text": " as you know, these these transformers have always sort of like layer normalization and so on. So"}, {"start": 1131.1, "end": 1138.6999999999998, "text": " probably the standard deviation if we if if these are sort of Gaussian, the standard deviation"}, {"start": 1138.6999999999998, "end": 1147.6599999999999, "text": " before the softmax would be a lot smaller. So let's go something like this. So smaller than one."}, {"start": 1147.6599999999999, "end": 1157.1399999999999, "text": " And can we run this please? And you can see that this kink immediately appears. Now it's not it's"}, {"start": 1157.14, "end": 1164.5400000000002, "text": " it's not the same thing as this other as this here, because this is a lot smoother, as you can"}, {"start": 1164.5400000000002, "end": 1172.7, "text": " see right here. But still, I feel that this might not actually be a result of the you know, the fact"}, {"start": 1172.7, "end": 1178.98, "text": " that this is an attention mechanism, but it simply might be the result of that you apply a softmax."}, {"start": 1178.98, "end": 1186.0200000000002, "text": " Now, still, that doesn't change the fact that it is approximately a low rank matrix. So everything"}, {"start": 1186.02, "end": 1196.58, "text": " they say, holds but yeah, maybe, maybe one should also look into why exactly that happens. But in"}, {"start": 1196.58, "end": 1201.9, "text": " fact, it is low rank, okay, it is approximately low rank, they've demonstrated this. And now they"}, {"start": 1201.9, "end": 1210.1, "text": " go to their first first theory below, we provide a theoretical answer, a theoretical analysis of"}, {"start": 1210.1, "end": 1218.6599999999999, "text": " the above spectrum results. Okay, so the theoretical analysis, theorem one is self attention is low"}, {"start": 1218.6599999999999, "end": 1226.74, "text": " rank. And we're going to go through this. Just glance at it for now. They say for any of these"}, {"start": 1226.74, "end": 1233.6599999999999, "text": " query key values and these matrices, which of course, you can ignore for now, for any column"}, {"start": 1233.66, "end": 1242.0600000000002, "text": " vector w of matrix v w and w here, that's the information that needs to be routed, there exists"}, {"start": 1242.0600000000002, "end": 1251.94, "text": " a low rank matrix p tilde. So this p tilde here is going to be their low rank approximation of the p"}, {"start": 1251.94, "end": 1258.1000000000001, "text": " matrix. You can see it's still n by n, but it's going to be low ranking. In fact, it's going to be"}, {"start": 1258.1, "end": 1266.9399999999998, "text": " of the order of the logarithm of the rank of the full matrix. Or, well, the full matrix of the rank"}, {"start": 1266.9399999999998, "end": 1272.2199999999998, "text": " that the full matrix could have, as we have already seen, the full matrix doesn't have full"}, {"start": 1272.2199999999998, "end": 1281.34, "text": " rank, but yeah, okay. So if you use and this is the type of guarantee you get. So what do we see"}, {"start": 1281.34, "end": 1289.34, "text": " here, it basically means that this distance here is smaller than this. And this year, this is just"}, {"start": 1289.34, "end": 1296.8999999999999, "text": " the norm of one of these vectors projected times this error coefficient epsilon. So all it says is"}, {"start": 1296.8999999999999, "end": 1303.26, "text": " that the distance on the left is smaller than something. And that occurs with high probability."}, {"start": 1303.26, "end": 1308.74, "text": " Okay, so the entire guarantee here, the entire formula just basically means that this thing is"}, {"start": 1308.74, "end": 1318.02, "text": " small, this norm is small. What's this norm? This norm is the distance between these two things. Now,"}, {"start": 1318.02, "end": 1323.74, "text": " what are these two things, this is the information that we want to route. And this is the routing"}, {"start": 1323.74, "end": 1332.18, "text": " matrix. And that simply means that if I route my information using the p tilde, this approximation,"}, {"start": 1332.18, "end": 1341.18, "text": " then I won't be too far away as if I had routed my information using the original p matrix. Okay,"}, {"start": 1341.18, "end": 1347.0600000000002, "text": " that's, that's it. That's what the theorem says. The theorem says, if I route my information using"}, {"start": 1347.0600000000002, "end": 1354.38, "text": " this approximation, then I am not too far away as it had I routed my information using the original"}, {"start": 1354.38, "end": 1360.14, "text": " routing matrix. Now they don't say how they're going to construct, they simply say there exists"}, {"start": 1360.14, "end": 1368.5, "text": " a low rank matrix like this. And the proof of this, and it's sort of worth looking at the proof"}, {"start": 1368.5, "end": 1377.8200000000002, "text": " of it, it uses the Johnson Lindenstrauss lemma, this thing here, or the JL for short. And they're"}, {"start": 1377.8200000000002, "end": 1385.26, "text": " going to get this out of the JL. Now the Johnson Lindenstrauss lemma, in a classic sense, says"}, {"start": 1385.26, "end": 1390.3, "text": " something like this, if I have data in a high dimensional space here in a three dimensional"}, {"start": 1390.3, "end": 1398.94, "text": " space, okay, I've data distributed, and I use a certain kind of projection matrix. And there are a"}, {"start": 1398.94, "end": 1407.26, "text": " number so the JL gives conditions on what these projections can be. But for example, a randomly"}, {"start": 1407.26, "end": 1414.66, "text": " sampled matrix with zero mean Gaussian entries and one over k standard deviation where k is the"}, {"start": 1414.66, "end": 1423.0600000000002, "text": " dimension you project into can do the trick. So if I project my data in a certain way, into a lower"}, {"start": 1423.0600000000002, "end": 1431.14, "text": " dimension here dimension two, then the projected data is related to the original data by the fact"}, {"start": 1431.14, "end": 1438.8200000000002, "text": " that the distances between the points in the original space will not be distorted too much."}, {"start": 1438.82, "end": 1445.8999999999999, "text": " So the distances between these points are approximately preserved through this projection."}, {"start": 1445.8999999999999, "end": 1453.34, "text": " Okay, so that's, that's the that's the Johnson Lindenstrauss lemma. Now you'll notice here,"}, {"start": 1453.34, "end": 1461.82, "text": " there is no reference to the fact that this data is or isn't low rank, it's simply high dimensional"}, {"start": 1461.82, "end": 1466.9399999999998, "text": " data projected to lower dimension, and the distances are approximately preserved. And"}, {"start": 1466.94, "end": 1474.26, "text": " this theory here, and I've looked at it for a while now, they simply define, okay, they define"}, {"start": 1474.26, "end": 1479.8600000000001, "text": " this P matrix as this attention mechanism. And here you can see the A matrix we've discussed"}, {"start": 1479.8600000000001, "end": 1486.3, "text": " before, which is actually low rank, but we don't know yet if the softmax is, they write it as this"}, {"start": 1486.3, "end": 1495.94, "text": " form right here of the exponential of each entry of A divided by this diagonal right here. So in"}, {"start": 1495.94, "end": 1500.5800000000002, "text": " the softmax, of course, you have the exponential of each entry divided by the sum of the entries,"}, {"start": 1500.5800000000002, "end": 1506.5, "text": " and they write this simply as two matrices. But ultimately, this is a matrix right here. And all"}, {"start": 1506.5, "end": 1514.98, "text": " they do is they take this P matrix, and they apply the Johnson Lindenstrauss lemma by having"}, {"start": 1514.98, "end": 1522.7, "text": " this projection matrix R, and R is entries from this Gaussian, as I said, so this is the special"}, {"start": 1522.7, "end": 1529.3400000000001, "text": " type of projection that the JL addresses. And then it simply says, if you pull if you, this here is"}, {"start": 1529.3400000000001, "end": 1537.18, "text": " going to be your P tilde. So if you project R in this manner, and obtain P tilde, and then you use"}, {"start": 1537.18, "end": 1546.26, "text": " P tilde instead of P, then this, this is going to be very close. In fact, you can reformulate the JL"}, {"start": 1546.26, "end": 1551.54, "text": " into different variants such that it gives you things like this, things like saying that the"}, {"start": 1551.54, "end": 1557.18, "text": " distance between this projected version and this unprojected version is going to be a constant,"}, {"start": 1557.18, "end": 1562.8999999999999, "text": " smaller than a constant times the norms of the unprojected version, that is equivalent to saying"}, {"start": 1562.8999999999999, "end": 1569.3799999999999, "text": " that the distances are preserved. Now, you can see right here, nowhere in this theorem is the fact"}, {"start": 1569.3799999999999, "end": 1577.82, "text": " that this is self attention. And nowhere in the theorem appears the fact that this inner matrix A"}, {"start": 1577.82, "end": 1584.22, "text": " is low rank, or even that this matrix A exists, it's you can do this with any matrix P, right,"}, {"start": 1584.22, "end": 1590.9399999999998, "text": " the JL doesn't concern itself with the nature of this matrix P, it says any matrix, any sort of"}, {"start": 1590.9399999999998, "end": 1595.86, "text": " high dimensional data, you can project to low dimensional data. And this holds if you choose"}, {"start": 1595.86, "end": 1603.1399999999999, "text": " the projection correctly, which they do right here. So to claim that this theorem proves that"}, {"start": 1603.14, "end": 1613.7, "text": " self attention is low rank, to me is a bit, it's a bit of a statement that is not warranted. Like,"}, {"start": 1613.7, "end": 1621.94, "text": " that this here should read something like the Johnson Lindenstrauss lemma exists, or something"}, {"start": 1621.94, "end": 1633.94, "text": " like this. It, I'm not I'm not sure like, convince me otherwise. But yeah, so they go with this. So"}, {"start": 1633.94, "end": 1640.14, "text": " they say, given the low rank property of the context mapping matrix P, now, again, I disagree"}, {"start": 1640.14, "end": 1646.98, "text": " that this has been shown, except empirically, one straightforward idea is to use singular"}, {"start": 1646.98, "end": 1652.1, "text": " value decomposition to approximate P with a low rank matrix P low as follows. So what you could"}, {"start": 1652.1, "end": 1657.42, "text": " do is you could simply learn these low rank matrices and approximate P through it, or you"}, {"start": 1657.42, "end": 1667.74, "text": " can decompose P as such, and then have these easier inner products in dimension k. But they"}, {"start": 1667.74, "end": 1674.94, "text": " say, however, this approach requires performing an SVD decomposition in each self attention matrix,"}, {"start": 1674.94, "end": 1679.98, "text": " which adds additional complexity. Therefore, we propose another approach for a low rank"}, {"start": 1679.98, "end": 1688.42, "text": " approximation that avoids this added complexity. Okay, so they now come up with their model,"}, {"start": 1688.42, "end": 1694.22, "text": " and their model goes as follows. So here on the left, you see a classic attention mechanism with"}, {"start": 1694.22, "end": 1703.66, "text": " their projections built in, what they're proposing is they say, let's project the matrix K using one"}, {"start": 1703.66, "end": 1710.66, "text": " of these random projections. And then this attention routing, if you route if you now"}, {"start": 1710.66, "end": 1718.14, "text": " multiply, so you multiply k and q right here, k times q, and then you put it into the softmax,"}, {"start": 1718.14, "end": 1723.8200000000002, "text": " and then you use it to route this W. So they say, if we build in this projection matrix,"}, {"start": 1723.8200000000002, "end": 1731.3000000000002, "text": " that will project k to a lower dimension, and then we won't have as expensive of inner products. Now,"}, {"start": 1731.3, "end": 1736.1, "text": " the important part to see here is that if you think of this lower projection, the first thing"}, {"start": 1736.1, "end": 1743.02, "text": " you think is that you project this inner this hidden dimension D, right, to a lower dimension."}, {"start": 1743.02, "end": 1750.86, "text": " And that's not the case here, you actually project the end. So in, in a conceptual framework,"}, {"start": 1750.86, "end": 1756.02, "text": " so you can see right here, forget about this, this is this W matrix. In a conceptual framework,"}, {"start": 1756.02, "end": 1762.78, "text": " you see here is this n by D matrix, which are the keys. So n is the sequence length, and D is the"}, {"start": 1762.78, "end": 1769.7, "text": " dimensions. And what you want to do is you want to project that by this matrix, which is k by n."}, {"start": 1769.7, "end": 1775.62, "text": " So you want to reduce the sequence length. You can see in this matrix right here, why that might"}, {"start": 1775.62, "end": 1783.22, "text": " work because n is much larger than D. And that means this matrix can be at most rank D, right?"}, {"start": 1783.22, "end": 1790.38, "text": " So you should not lose too much, you should sort of be able to preserve the information. If you"}, {"start": 1790.38, "end": 1797.14, "text": " project this n to a k, where the k if the k is still larger than the D, or approximately in the"}, {"start": 1797.14, "end": 1802.06, "text": " same order of magnitude, you should be able to preserve that information if you do it in a smart"}, {"start": 1802.06, "end": 1809.14, "text": " way. So conceptually, if we have our five token sequence, like here, and the next layer produces"}, {"start": 1809.14, "end": 1817.5400000000002, "text": " five tokens, again, what we first do is we say, we know, we know that the information we want is"}, {"start": 1817.5400000000002, "end": 1826.5400000000002, "text": " not five dimensional, it's actually two dimensional. Because, okay, let's say the this inner dimension"}, {"start": 1826.5400000000002, "end": 1834.42, "text": " D is, is two as well. So we have two dimensional vectors, each thing exposes two dimensional"}, {"start": 1834.42, "end": 1842.3000000000002, "text": " vectors. So we first project the sequence of length five to a sequence of length two. And we simply do"}, {"start": 1842.3000000000002, "end": 1849.3000000000002, "text": " that in a random manner. So we have a random Gaussian matrix that assigns weights to mix these"}, {"start": 1849.3000000000002, "end": 1857.46, "text": " five into these two. And again, because the JL works for any sort of data. But in my argumentation,"}, {"start": 1857.46, "end": 1864.74, "text": " if you, you know, think that this here is low rank, it's of rank two, then you shouldn't lose too much"}, {"start": 1864.74, "end": 1871.6200000000001, "text": " information by projecting it to a sequence length two. And now we do this attention mechanism. So now"}, {"start": 1871.6200000000001, "end": 1880.26, "text": " we expose the keys. And now we expose the queries up here. And now you can see instead of routing"}, {"start": 1880.26, "end": 1887.98, "text": " five things with five things, you only have to route five things with two things. And so instead"}, {"start": 1887.98, "end": 1898.22, "text": " of having o n squared, you now have o n k, if k k is the number right here. Okay, so this is the"}, {"start": 1898.22, "end": 1906.78, "text": " idea, you project the sequence length. And it comes from the fact that the sequence length is much"}, {"start": 1906.78, "end": 1913.1, "text": " larger than the dimensionality. And therefore, you can sort of preserve the information if you"}, {"start": 1913.1, "end": 1921.8999999999999, "text": " project in a smart way. They build this in this fashion right here. So the attention mechanism now,"}, {"start": 1921.8999999999999, "end": 1930.26, "text": " before we saw it was between the queries and the keys, right here. They built now this projection"}, {"start": 1930.26, "end": 1940.3, "text": " matrix here that projects the keys into a lower dimensional sequence. And the now such that this"}, {"start": 1940.3, "end": 1947.3, "text": " will result in an n by k attention matrix we saw over here, you don't need to route n by n things,"}, {"start": 1947.3, "end": 1956.66, "text": " you need to route n by k. So this, this routing table in here is now n by k. Now the next layer,"}, {"start": 1956.66, "end": 1962.42, "text": " as you can see here, it actually needs to produce a sequence of length five again, right? So we"}, {"start": 1962.42, "end": 1970.6200000000001, "text": " always transform sequence of length five into sequence of length five. But now we have we have"}, {"start": 1970.6200000000001, "end": 1976.8200000000002, "text": " this n corresponds to the sort of corresponds to the next layer. And this k corresponds to the"}, {"start": 1976.8200000000002, "end": 1984.42, "text": " down projected sequence of the last layer. And in order for that to fit, we of course, also need to"}, {"start": 1984.42, "end": 1989.8200000000002, "text": " down project the information that we're routing. So if we down project the routing table, we also"}, {"start": 1989.8200000000002, "end": 1996.3000000000002, "text": " need to down project the information that we're routing. That's we do this by a similar matrix f"}, {"start": 1996.3000000000002, "end": 2006.3000000000002, "text": " that is also sampled in this way in this special way. And that gives us a k by d. So we have"}, {"start": 2006.3000000000002, "end": 2011.98, "text": " projected the sequence to size k. And if we multiply these two things, again, of course,"}, {"start": 2011.98, "end": 2021.9, "text": " we'll get out an n by d matrix, which is the signal for the next layer. Okay, so an n by d signal"}, {"start": 2021.9, "end": 2029.8600000000001, "text": " comes in down here, it's projected down to k sequence length, it's and it's routed up again"}, {"start": 2029.8600000000001, "end": 2039.7, "text": " to n sequence length. And you have again an n by d matrix here. Cool. So that's how they do it. And"}, {"start": 2039.7, "end": 2045.38, "text": " they build this into the transformer. Now, as I understand it, these projection matrices, again,"}, {"start": 2045.38, "end": 2055.66, "text": " they're not learned, they are do they are built up in this j l. conscribed way, they are not learned,"}, {"start": 2055.66, "end": 2063.94, "text": " they are fixed once. And then that's, that's that, at least that's how I understand it. So there are"}, {"start": 2063.94, "end": 2074.02, "text": " no more learnable parameters. Okay, so here they have a demonstration where they up the sequence"}, {"start": 2074.02, "end": 2079.62, "text": " length. And you can see the batch size decreases, but that's just to sort of keep the total amount"}, {"start": 2079.62, "end": 2085.5, "text": " of flops to be done the same, you up the sequence length and down the batch size. As the sequence"}, {"start": 2085.5, "end": 2092.58, "text": " length increases, the standard transformers requirement in inference time goes up. And this"}, {"start": 2092.58, "end": 2100.98, "text": " here, as you can see, this is not a linear scale, it's a log scale, log two. So this goes up with"}, {"start": 2100.98, "end": 2106.58, "text": " the sequence length, and it should go up quadratically, right. And you can also see that"}, {"start": 2106.58, "end": 2114.1, "text": " the linformer keeps fairly constant for the same k. Now, of course, as you increase the k of the"}, {"start": 2114.1, "end": 2123.1, "text": " linformer, the inference time will go up, because now it's dependent on n times k and not on n times"}, {"start": 2123.1, "end": 2132.66, "text": " n. Okay. So let's look a bit further of how you have to choose that k up here in the first theorem,"}, {"start": 2132.66, "end": 2141.46, "text": " we there was a already a hint to it. In the first theorem, you had to choose k by five log n. And"}, {"start": 2141.46, "end": 2153.18, "text": " this is a problem. So here you have log n, that means it's not so O of n k is equal to O of n log"}, {"start": 2153.18, "end": 2160.06, "text": " n. Now that's not linear. That's actually that's the same as the reformer. But they want to get to"}, {"start": 2160.06, "end": 2171.94, "text": " a linear place. And theorem two explains goes now to a linear shows how you can make self attention"}, {"start": 2171.98, "end": 2181.66, "text": " linear. Okay, they show again, blah, blah, blah, blah. Now you have to choose k at the minimum of"}, {"start": 2181.66, "end": 2189.54, "text": " these two things. And you can see right here, that one of them is independent of n. So that means as"}, {"start": 2189.54, "end": 2194.62, "text": " n grows, of course, the minimum is no longer going to be this here, the minimum is actually going to"}, {"start": 2194.62, "end": 2203.94, "text": " be the thing on the left. And that is dependent on just D. Okay, so you have D log D in here. And"}, {"start": 2203.94, "end": 2212.22, "text": " that makes sense. Because in the very beginning, we said, hey, D is actually much smaller than n."}, {"start": 2212.22, "end": 2220.02, "text": " And that means the information that is contained in these matrices is at most rank D. So if we"}, {"start": 2220.02, "end": 2228.4599999999996, "text": " down project to k, we should adjust k to what D is, right? If we adjust k to about the same thing as"}, {"start": 2228.4599999999996, "end": 2238.18, "text": " D, we're guaranteed to not lose too much information. So now we choose k according to D instead of"}, {"start": 2238.18, "end": 2247.2599999999998, "text": " according to n and therefore, the computation is linear in n. And n times k is like n times D to"}, {"start": 2247.2599999999998, "end": 2257.3799999999997, "text": " log D. So it's linear in k and linear in D. How do we get there? So the first thing they do is they"}, {"start": 2257.3799999999997, "end": 2265.94, "text": " make the sort of Johnson Lindenstrauss statements again. But now instead of the general statement,"}, {"start": 2265.94, "end": 2271.58, "text": " they plug in their actual modified attention mechanism. So here they have a bound on the"}, {"start": 2271.58, "end": 2279.7400000000002, "text": " distance between if I route my this is the information to be routed, right? If I route my"}, {"start": 2279.7400000000002, "end": 2287.42, "text": " information using the original softmax, and this in here is the matrix A, if the original attention"}, {"start": 2287.42, "end": 2296.78, "text": " mechanism, I won't be too far away, as if I were to route my information using this modified"}, {"start": 2296.9, "end": 2307.62, "text": " attention mechanism. Now, the tricky part here, mathematically, I believe is that is exactly the"}, {"start": 2307.62, "end": 2315.58, "text": " softmax what what I alluded to, right? So this softmax is the tricky part, because if this weren't"}, {"start": 2315.58, "end": 2320.42, "text": " a softmax, so if the softmax weren't here, this would simply be a projection down and a projection"}, {"start": 2320.46, "end": 2327.22, "text": " up. And the dilemma would almost apply as it is written, right? You wouldn't have to actually do"}, {"start": 2327.22, "end": 2336.1, "text": " anything. But the question is, if this inside the softmax is is low rank, can you make a claim that"}, {"start": 2336.1, "end": 2346.3399999999997, "text": " the entire softmax then is also low rank? And it's not entirely clear, because because Oh, yes,"}, {"start": 2346.3399999999997, "end": 2353.38, "text": " we've done this. So you can see right here that the softmax we have actually done the softmax of a"}, {"start": 2353.38, "end": 2358.7799999999997, "text": " low rank matrix. So we have already seen the low rank matrix itself, and how it immediately snaps"}, {"start": 2358.78, "end": 2371.3, "text": " to the to the upper axis after 128. Now, if we do the same thing for the softmax of that, and we"}, {"start": 2371.3, "end": 2381.34, "text": " probably have to take away some of these dimensions, the first few, let's go with, let's go to"}, {"start": 2381.34, "end": 2390.82, "text": " dimension 100 and look from there. Okay, same thing. Okay, that's pretty good. I did not expect"}, {"start": 2390.82, "end": 2401.78, "text": " that. Hi, there. So this is Janek from the future. I've realized I've been an idiot in how I"}, {"start": 2401.78, "end": 2409.1400000000003, "text": " constructed these low rank matrices right here by multiplying MT by itself, of course, what's a"}, {"start": 2409.14, "end": 2417.3799999999997, "text": " better way to do it is to construct two independent 128 dimensional matrices like these two sub slices"}, {"start": 2417.3799999999997, "end": 2423.5, "text": " of M right here, and then multiplying those together and looking at the SVD. And you as you"}, {"start": 2423.5, "end": 2432.74, "text": " can see right here. So the softmax of this is now not of this super low rank anymore, it's still low"}, {"start": 2432.74, "end": 2440.8599999999997, "text": " rank, but it's not not very, it's not like hard low rank. So if I just look at the matrix without"}, {"start": 2441.3399999999997, "end": 2448.66, "text": " the softmax, then you can see it has a very peak that by at 128, which gives us the indication"}, {"start": 2448.66, "end": 2457.9399999999996, "text": " it's actually 128 rank, which we already knew. But if we now introduce the softmax, then you can"}, {"start": 2457.94, "end": 2466.1, "text": " see that this vanishes and it's no longer 128 dimensional. And it's only approximately low rank,"}, {"start": 2466.1, "end": 2474.1, "text": " as you can see. Alright, back to Janek in the past, who is wholly surprised that the two that if"}, {"start": 2474.1, "end": 2483.1, "text": " you multiply MT by itself, that that will give you back the the exact same thing. Alright, so did we"}, {"start": 2483.1, "end": 2490.58, "text": " try this before? Maybe we did. Okay, but the mathematical difficulty still remains and their"}, {"start": 2490.58, "end": 2496.94, "text": " main thing here is so they have a first first version, where they pretty much plug it into the"}, {"start": 2497.5, "end": 2505.54, "text": " JL again, and they they get out this k is the k needs to be by log n. But they say this result"}, {"start": 2505.54, "end": 2511.46, "text": " does not utilize the low rank property of matrix A. And the resultant k has a dependency on sequence"}, {"start": 2511.46, "end": 2523.3, "text": " like n. And then in the appendix, they finally go through the math to show that now if they choose"}, {"start": 2523.3, "end": 2538.34, "text": " E and F like this, they can actually pull out this and show that the k is where we where you have it,"}, {"start": 2538.34, "end": 2546.42, "text": " that the k is independent of n like this. And I think the main the main step in this proof is the"}, {"start": 2546.42, "end": 2555.7400000000002, "text": " step B here, where they say uses the fact that the exponential function is Lipschitz continuous in a"}, {"start": 2555.7400000000002, "end": 2563.7400000000002, "text": " compact region, then we can choose a small enough delta such that the as you can see here, this now"}, {"start": 2563.74, "end": 2570.58, "text": " directly relates to this projection matrix within the exponential function to the projection matrix"}, {"start": 2570.58, "end": 2576.5, "text": " out of the exponential function. So you can basically say that if I project first and then"}, {"start": 2576.5, "end": 2581.7, "text": " use the exponential function, that's not too different than if I first use the exponential"}, {"start": 2581.7, "end": 2591.3799999999997, "text": " function and then project. Okay, so that's the that's the sort of of of catch here. Now they"}, {"start": 2591.38, "end": 2597.06, "text": " only do this for the exponential function, not the actual softmax. As you can see here, throughout,"}, {"start": 2597.06, "end": 2605.1, "text": " they do it to the exponential function and also here in their statements. The softmax isn't the"}, {"start": 2605.1, "end": 2610.5, "text": " exponential function, the softmax is the exponential function divided by the sum of the exponential"}, {"start": 2610.5, "end": 2619.5, "text": " functions, but I believe that this generalizes straightforwardly. Alright, so for given choices"}, {"start": 2619.5, "end": 2628.1, "text": " of delta and K, they have shown that the linformer in fact, can do in a linear fashion what a"}, {"start": 2628.1, "end": 2635.22, "text": " transformer can do in a quadratic fashion, and they are not too far off. Okay, that's that's"}, {"start": 2635.22, "end": 2642.22, "text": " their point right here. Their results on these benchmarks, oh, sorry, let's first go to the"}, {"start": 2642.22, "end": 2648.38, "text": " perplexities in language modeling. So they show right here, that they pretty much can keep up with"}, {"start": 2648.38, "end": 2654.02, "text": " the standard transformer, as you can see here. So with the standard transformer, they can keep up"}, {"start": 2654.02, "end": 2663.62, "text": " here. Now think that this the the computation is n times k, okay, so something like this linformer"}, {"start": 2663.62, "end": 2672.94, "text": " with k equals 256 will only so instead of n by n, it's n times k, it won't save you too much in that"}, {"start": 2672.94, "end": 2682.3, "text": " case. But it's it's not too surprising that in fact, you have the same performance because probably"}, {"start": 2682.3, "end": 2688.34, "text": " the standard transformer is distributed over more heads than two. So the information necessarily has"}, {"start": 2688.34, "end": 2695.14, "text": " a lower dimensionality 10 to 56. One thing I want to draw attention to though here is that you can"}, {"start": 2695.14, "end": 2703.74, "text": " see that here, it's not really done learning yet. And as you can see, the standard transformer sort"}, {"start": 2703.74, "end": 2712.62, "text": " of surpasses all of these models towards the end. I wonder, I wonder what happens, I wouldn't be"}, {"start": 2712.62, "end": 2718.8599999999997, "text": " surprised if they end up sort of at the same place. But I wonder if these diverge even more, right"}, {"start": 2718.86, "end": 2728.1400000000003, "text": " here after that. They also compare with a higher sequence length. And the standard transformer"}, {"start": 2728.1400000000003, "end": 2732.58, "text": " outperforms the linformer. But of course, the point here is that the linformer is much, much,"}, {"start": 2732.58, "end": 2742.9, "text": " much faster, and can keep up. Now, also, the scale here of the perplexity. You see, these are"}, {"start": 2742.9, "end": 2750.6600000000003, "text": " percentage points in perplexity, but I can't actually tell if that matters or not. I think, I"}, {"start": 2750.6600000000003, "end": 2755.9, "text": " think the original transformer paper, the perplexities hovered between like three point"}, {"start": 2755.9, "end": 2765.14, "text": " something and five point something. So this might actually be sort of significant differences. And"}, {"start": 2765.14, "end": 2770.94, "text": " I'm not sure. They investigate different methods of sharing these weights of these of these"}, {"start": 2770.94, "end": 2775.82, "text": " projections. And they seems like they don't find real differences. But I don't want to go into that"}, {"start": 2775.82, "end": 2781.98, "text": " because this video is already really long. And then they look at what happens if they up the"}, {"start": 2781.98, "end": 2788.78, "text": " sequence length that they put into the linformer. And you can see that the linformer can deal with"}, {"start": 2788.8, "end": 2797.9, "text": " higher sequence lengths and arrive at the same perplexities. Though again, I don't know how much"}, {"start": 2797.9, "end": 2806.06, "text": " different that is. And the scale here is larger than before. But yeah. So how does this fare on"}, {"start": 2806.06, "end": 2813.1800000000003, "text": " these benchmarks where you first train a transformer with pre training with language modeling, and then"}, {"start": 2813.2000000000003, "end": 2820.94, "text": " you use it to do certain NLP tasks. And here you can see that the linformer is on par in some of"}, {"start": 2820.94, "end": 2828.66, "text": " these tasks with the original transformer. But also you can see like a pattern where you can see"}, {"start": 2828.66, "end": 2836.86, "text": " pretty wild results in that, you know, sometimes the the linformer here will be better than this,"}, {"start": 2836.86, "end": 2843.62, "text": " but then also variants of the linformer will be worse. And they'll even be worse than this. And"}, {"start": 2843.62, "end": 2849.7400000000002, "text": " sometimes they'll be better. Sometimes this linformer is good. And sometimes the original"}, {"start": 2849.74, "end": 2856.7799999999997, "text": " model is the best. So this sort of points to you can make the general claim that the linformer"}, {"start": 2857.02, "end": 2866.8999999999996, "text": " doesn't destroy your gains, but also it's not like a better model, it's simply a faster model that in"}, {"start": 2866.8999999999996, "end": 2873.8199999999997, "text": " some tasks can keep up with the original model. And they show that, of course, this is the real"}, {"start": 2873.82, "end": 2881.6600000000003, "text": " deal here, that as you go up in length, the performance gains, and also sorry, this this way,"}, {"start": 2881.6600000000003, "end": 2889.5, "text": " the performance gains, and the memory gains that you get by the linformer are dramatic. Of course,"}, {"start": 2889.5, "end": 2895.78, "text": " the longer and you go into the lower dimension you project, the more these gains are, but of"}, {"start": 2895.78, "end": 2901.6200000000003, "text": " course, the more performance you're going to lose potentially. Hello, again, Janek from the future."}, {"start": 2901.62, "end": 2906.9, "text": " Just wanted to draw your attention on this beautiful, broader impact statement in this paper,"}, {"start": 2906.94, "end": 2913.7, "text": " saying our work focuses on making transformers more efficient, everything cool, potential positive"}, {"start": 2913.74, "end": 2919.02, "text": " inspect impacts of efficient transformers. That's pretty cool. It also has potential impact on"}, {"start": 2919.02, "end": 2924.74, "text": " training transformers on images, since we can support very long sequences, very cool. Furthermore,"}, {"start": 2924.74, "end": 2931.54, "text": " there are positive environmental benefits. Very cool. I mean, these are all very cool things. They"}, {"start": 2931.54, "end": 2938.58, "text": " say, as such, we see no immediate negative ethical or societal impacts of our work beyond what"}, {"start": 2938.58, "end": 2946.8599999999997, "text": " applies to the core building blocks of deep learning. Do better. Now this this, I honestly, I"}, {"start": 2946.8599999999997, "end": 2953.3799999999997, "text": " agree with them, right? I completely agree with them, that this is sort of a good thing you might"}, {"start": 2953.38, "end": 2958.1, "text": " trade off, you know, some accuracy, you might make some approximations, but you will get a much"}, {"start": 2958.1, "end": 2966.58, "text": " faster model. And this model, as any model can be used, you know, for things, and that they now have"}, {"start": 2966.58, "end": 2978.58, "text": " to pull out of their out of their butt some way in over five steps of intermediate layers. This"}, {"start": 2978.58, "end": 2987.06, "text": " this could be used for bad, it just seems ridiculous. So good on them for defying the,"}, {"start": 2987.38, "end": 2994.62, "text": " please also think about negative impacts right here. All right, back to back back to past Janek."}, {"start": 2996.06, "end": 3003.54, "text": " All right, this was the linformer paper. I hope this somewhat make sense made sense to you. I had"}, {"start": 3003.54, "end": 3010.22, "text": " to read it multiple times for it to make sense to me. But ultimately, it's all about the fact that"}, {"start": 3010.22, "end": 3015.86, "text": " you have these multiple heads. And therefore, your information is probably lower dimensional, and you"}, {"start": 3015.86, "end": 3033.98, "text": " can abuse that to just calculate in this lower dimension. All right, I'll see you next time. Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=WTB2p4bqtXU
End-to-End Adversarial Text-to-Speech (Paper Explained)
Text-to-speech engines are usually multi-stage pipelines that transform the signal into many intermediate representations and require supervision at each step. When trying to train TTS end-to-end, the alignment problem arises: Which text corresponds to which piece of sound? This paper uses an alignment module to tackle this problem and produces astonishingly good sound. OUTLINE: 0:00 - Intro & Overview 1:55 - Problems with Text-to-Speech 3:55 - Adversarial Training 5:20 - End-to-End Training 7:20 - Discriminator Architecture 10:40 - Generator Architecture 12:20 - The Alignment Problem 14:40 - Aligner Architecture 24:00 - Spectrogram Prediction Loss 32:30 - Dynamic Time Warping 38:30 - Conclusion Paper: https://arxiv.org/abs/2006.03575 Website: https://deepmind.com/research/publications/End-to-End-Adversarial-Text-to-Speech Abstract: Modern text-to-speech synthesis pipelines typically involve multiple processing stages, each of which is designed or learnt independently from the rest. In this work, we take on the challenging task of learning to synthesise speech from normalised text or phonemes in an end-to-end manner, resulting in models which operate directly on character or phoneme input sequences and produce raw speech audio outputs. Our proposed generator is feed-forward and thus efficient for both training and inference, using a differentiable monotonic interpolation scheme to predict the duration of each input token. It learns to produce high fidelity audio through a combination of adversarial feedback and prediction losses constraining the generated audio to roughly match the ground truth in terms of its total duration and mel-spectrogram. To allow the model to capture temporal variation in the generated audio, we employ soft dynamic time warping in the spectrogram-based prediction loss. The resulting model achieves a mean opinion score exceeding 4 on a 5 point scale, which is comparable to the state-of-the-art models relying on multi-stage training and additional supervision. Authors: Jeff Donahue, Sander Dieleman, Mikołaj Bińkowski, Erich Elsen, Karen Simonyan Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
In this work we take on the challenging task of learning to synthesize speech from normalized text or phonemes in an end-to-end manner, resulting in models which operate directly on character or phoneme input sequences and produce raw speech audio outputs. Okay that wasn't the real model I just thought it sounded really funny. This is a text-to-speech model and it actually sounds like this. In this work we take on the challenging task of learning to synthesize speech from normalized text or phonemes in an end-to-end manner, resulting in models which operate directly on character or phoneme input sequences and produce raw speech audio outputs. Okay now you've probably if you have listened to the text and not just how the text sounds you have gotten what this paper is about. So the paper is called End-to-End Adversarial Text-to-Speech by Jeff Donaway, Sander Diehlmann, Mikolaj Binkowski, Erik Elson and Karen Simonian of I believe of mostly DeepMind. And this paper on a high level it produces speech so sound the sound waves of speech directly from text or from what they call normalized text or phoneme text and it does so without any intermediate supervised representations and that's a challenging task and the main problems here are the alignment problem that they have to solve and actually making this work in an adversarial manner. So we're going to look at this paper as always if you like work like this consider subscribing and sharing it out and if you have any comments leave them in the comment section. Okay so what's the problem with text-to-speech? Text-to-speech is basically you take a piece of text like this one modern text-to-speech synthesis pipelines typically involve blah blah blah and you want to make a model that takes this and outputs sound waves as if a human would say it right so you know modern text to speech and so on. Now I have multiple problems when doing this. First of all the text here is words let's say we can tokenize the text into words so you have modern text to speech those are four tokens however sound waves are of course much much densely sampled so the sound waves they are typically in the order of something like 24 kilohertz sampled so that's the ratio of one token to output samples is super high so one token will produce many many thousand samples in the speech. So that's the first problem. The second problem is that if you have training data so you have data that has a piece of text and you have the sound wave that a human you know the human read that particular piece of text you still don't know which word exactly corresponds to which portion of that text you simply know the entire text corresponds to the entire sound wave you don't know this word text right here you don't know you don't know where it starts and where it ends in this sound wave and the last problem you obviously have is that you want to make this in a way that it generalizes that it sounds like a human but also generalizes to some other text and this paper here solves all of these problems jointly by doing an adversarial approach to learning and it does it end to end now adversarial simply means that you have a generator that takes in the piece of text right here and generates this sound wave and then you have a discriminator that looks at this sound wave and it looks at the real sound wave so the real okay the real says let's say this over here is real and this is what the generator has produced the discriminator tries to discriminate between the two now this is not entirely the same thing as a as a supervised loss usually in a GAN you do not have the corresponding samples right you just you simply you simply input a real sample here and the generator produces a generated sample here you do not necessarily have in a classic GAN the corresponding sample here you assume that you have the corresponding real sample but it's still different than supervised learning in that both go through a discriminator and the discriminator tries to tell the discriminator is a neural network tries to tell which one is real and which one is generated in fact the discriminator is a set of neural networks that we're going to go into that shortly so it's adversarial in the sense that there is a generator and a discriminator and it is end to end in the sense that usually what these pipelines do is they take the text and we've looked at this for example in the video about this Facebook's text-to-speech system so they take the text and the first thing they do is they would produce a set of of of whatever they would call features like textual features call it textual features so these are these are sort of intermediate features for the text to be produced and then another model would take these and it would produce something like spectrograms spectrograms and then another model would take the spectrograms and finally produce sound or speech so you have usually in these systems you have intermediate representation and each of these models right here can be trained by itself so that's an advantage that you can train for example you can train a model that goes from a spectrogram to a sound wave by itself and you don't need you simply need sound for that the computation from sound to spectrogram is super easy so you can generate your own training data so you can go from spectrogram to sound you can train a model like this so in these pipelines usually there are multiple stages and each of these models has to be trained by itself this paper tries to do this end to end that means you input the text and you get out the you get out the sound wave and and there is nothing in between that the I mean of course there are latent representations but you train it ends to end in one go okay so let's look at the different systems they employ first of all let's look at the discriminators because that's the easiest so they have these discriminators and these are adopted from this Gantt TS paper now as we already said the discriminator try to to differentiate between real and fake sound and they do it in a sort of so if they were to just look at the entire sound wave then it would just basically reduce to comparing the two but instead the discriminators they operate on very small windows so in specific they have five different discriminators and each of the five different discriminators take a different size window length but all of these windows are super short so one discriminator might take this long windows another discriminator might take a bit longer windows and another discriminator might take a bit shorter windows and that of course from the real end from the fake and the discriminators simply try to discriminate only in these windows whether it's a real or fake and now we're a bit more into the Gantt setting where you know you simply have one data point of the real and one data point of the fake and you have to compare them and this here I believe is one of the keys why this model generalizes because the discriminators basically they try to assess whether a short sequence sounds like real or sounds like fake and whether the two samples sound alike in different scales of time and by only doing this on these short scales you can you can the loss sort of generalizes otherwise if you compare it on the entire sound wave you would just reduce to comparing point like point by point right here and if the generator produces something that's not exactly aligned then of course every point would be wrong and you you'd run into all sorts of questions so this is a set of five discriminators that all try to take each takes a different length of sub sound of this wave tries to discriminate real from fake that's the discriminator loss they have an additional discriminator loss where they compute spectrograms of these things so spectrograms and compute spectrogram of this and they have a discriminator another neural network here that it tries to distinguish which one is real and which one is fake note that this is not the same as down here where the spectrogram is an intermediate representation here the sound is the output and from the sound you compute the spectrogram and then you compare the two so this is simply a different spectrogram is a different feature space for the discriminator to compute the loss it is not an intermediate representation on the way to produce the sound itself so that the difference that's the difference here between the classic approach and this approach so it's end to end adversarial so we got the discriminator the discriminators simply try to differentiate the sound waves and short scales as well as the spectrograms now the second part is of course the generator how do we even produce sound and that's this diagram right here so you have this Gantt TS generator this is a generator that takes in a it takes in a hidden representation so it takes in tokens let's say token one token two let's go from the from the one before think of a sentence hello there okay so it takes these tokens and of course it takes like hidden representations of the tokens and it will output it will output for each one or for this joint sequence one hidden two it would output the sound wave okay and this has been a paper before the scan TTS and you also you condition it on the speaker and on latent variables like how you want the pitch to be and so on that's not really important for us right here the generator can simply take these token embeddings and produce sound the problem is in the original paper you had an alignment you knew which token corresponded to which piece of sound and therefore you sort of knew so after that you need to compare this to the generator thing and you knew which token corresponded to which piece of sound right here so the generator knew what it had to produce from each token how long it should be and so on so this is the generally the alignment problem or what I call the alignment problem so if you take a piece of text like this entire paragraph right here let's look at this paragraph this paragraph to read it out takes like 30 to 60 seconds you can't train really models that output this long of sound it it would be it would be too big of a sample you want to train ideally on segments they train segments that are I believe here two second windows from each examples so because they say if we train on 20 seconds that would just be wasteful and prohibitively expensive now the problem of course is if I simply take a window here like this one of two seconds and I have my human that has read this entire paragraph in one go I have no clue again which which part of the entire sound wave of this paragraph these this sub sequence corresponds to a good guess would be to go like well this is about 50% in so maybe here to here maybe who knows okay and even within that and that's what we discussed before you have no clue how long this word here is going to take up within this piece of sound and that's the general alignment problem right here so in this entire sound wave where is the piece and how do these words distribute across the wave of sound the original model had as I understand it such alignments and therefore this generator could work really well because you had these alignments without these alignments it doesn't work as well and you can on their website that I've shown you initially you can listen to samples where they disable each of these things so this generator is really good at producing sound when it has these alignments so the challenging task here is how do you compute these alignments how do you compute this thing if you don't have it if you're if you don't have it in your training data so it needs to be part of the loss so that's what this entire architecture down here is all right so the text is down here it goes in and the first thing they do is they normalize the text and they transform it into phonemes which is you can do this in a deterministic fashion there are scripts that do this this is the only pre-processing they do and they can also leave it away in the heaven ablation on their website so this is like phoneme text cat sat on the mat now this phoneme text goes through these big block of convolutions and of dilated convolutions and this outputs a 200 hertz representation length alignment okay I should specify this so for each token here it outputs a length so this thing predicts the length of each of the tokens these all of this all of this thing here is to to embed the tokens in hidden space and then predict its length you can see that right here okay so first we use F to to take X so F is a stack of dilated convolutions and it takes X and outputs a hidden representation so H so first X goes to H and then H is used to predict L and L is the length of that token so we embed this into a hidden representation with this right here and then we use this stack to predict the length of each token so this could be this could say something like this cat token right here is 20 milliseconds long or instead of milliseconds you would use something like frames or data points maybe this is 200 data points long and then sat is a bit shorter so this is 100 long and on is really short so this is 50 long so for each token it predicts the length all right so now if we have the length of each we can sort of calculate where the starting point is so if we want to know if we know that here is the beginning and the beginning of the sentence we we conservatively assume that there is um so they give some silence buffer here but roughly you can assume that the beginning of the speech corresponds to the first the first token right you can simply trace the waveform and whenever it goes up that's where the first token starts so then if since we know that's where the first token starts and if we could predict the length of each one correctly we could simply sum those up to figure out where our word starts so if we want to know where on starts we simply go from the beginning and go 200 plus 100 milliseconds so or data points 200 plus 100 here is where on starts okay and if we want to figure out the middle of on we simply add the the half of this number so plus 25 gets you to the middle so this is this here is the center of the token on so for each token we predict the length like this and thereby we can just calculate for each one by summing up from the beginning and then adding half of its own length where the center of that token in the entire sequence is okay now we do this we said we take random two second audio but we do this procedure for the entire um for the entire text okay for the for every single token in the text that we look at so in the 20 second text we do this because then for each token we'll get a token center and now the aligners job here is to align that to the actual sound so what we also give the generators here the offset so let's say we have this 20 second of speech and we randomly sample these two seconds and that's maybe five seconds from the beginning we also tell it this is five seconds right here so what we can now do is we can calculate back sort of and say okay here I have I first need to discard five seconds of my signal and I have a prediction how long each token is so I can just cross out tokens until I have basically wasted five seconds and then I know okay from here to wherever these things sum up to two seconds from here to that those are my two seconds that I want to look at now this is how I figure out where in the big sound wave my fragment is right because I have this offset where I sampled it and I simply add use this and the predicted lengths to figure it out now I still need to figure out these tokens that are actually in the span how do they distribute and that's what this aligner here does since we've already predicted the token centers we simply assume that if these are correct right then if this is let's say if this is one second long I assume that the middle is after point five seconds so this is one second the middle is point five seconds so I think that this token is aligned right here this is the center of the token now we want to be a little bit a little bit fuzzy with respect to that so what they do is they sort of use a Gaussian kernel right here so for each token as you can see here each token has a center which is here so the y-axis is the time in sound and the x-axis is the token and for each token we say well it doesn't have to be exactly there it can be so they put a Gaussian kernel like this okay if you imagine this kernel popping out of the frame they say this is about where the center is and for this token right for this token right here they say well it's it's probably here in the middle but it could also be here or here or here or here and we wait this like this so these are these are the weights and then you simply sum up the weights with these embeddings so for each token out of this dilated convolution block you get a hidden embedding and by using this alignment matrix that you computed by predicting the lengths and therefore predicting the centers of the tokens you can then sort of shift so first you assume that h1 h2 h3 if you were to do nothing these would just all take up like a third of the time and now by multiplying with this matrix you have the opportunity because you predicted a longer length for the first token you have the opportunity to shift that a bit to the right and maybe shorten the second token a bit and then the third token goes until the end okay that's what this aligner thing is this is not a model by itself all that this takes in is the computation right here of the token lengths this estimates these token lengths for each of the tokens and the rest is deterministic it's simply saying okay how much is the offset cool that's how we know where in the sound wave we are and then where is each of the centers and we simply do that by summing up the predicted token lengths and then we use a Gaussian kernel with like a set hyper parameter to be a little bit fuzzy with respect to these lengths right here so to be differentiable basically and that will that will ultimately train this loss this model right here that computes the token lengths right so we sum up in a weighted fashion these embeddings right here and that's what goes into the generator so now we have embeddings and we have the alignments for the embeddings which are these pieces of where in the sound wave these are and from that the generator can now produce the sound wave itself okay and that's basically that's just an up sampling here I think that's just an up convolution up sampling from 200 Hertz signal to a 24 kilohertz signal cool so that's that now they discover this doesn't work and why doesn't it work it's because at the beginning of training these token length predictions here are pretty crappy and so that means that I guess especially this part even where you say well where where in the sound wave of my 20 seconds do I even need to cut out to compare with the discriminator right if if you give if you sample this piece here and that's what you give to the discriminator but your length predictions are so far off that the generator is trying to produce this particular piece because it thinks it thinks oh instead of producing this tokens here which is what the discriminator looks at it produces these tokens here of course you have no no chance no matter how good your adversarial loss is remember the this is these length predictions are used to see basically to see which of these tokens the generator needs to produce the sound for and how they're aligned so they have an additional loss right here what they do is they produce from the again they go via the spectrograms within this spectrogram prediction loss so they say we discovered that adversarial feedback is insufficient to learn alignment at the start of training the aligner does not produce an accurate alignment so the information in the input tokens is incorrectly temporally distributed this encourages the decoder to ignore the aligner output the unconditional discriminators provide no useful signal to correct this oh yeah I should have mentioned this the discriminators here since you don't know you don't know which tokens you should produce the discriminators are unconditional they don't know which text is produced you don't give them the tokens you simply give them the sound waves that's something I find particularly interesting here now you of course this wouldn't work in a like a traditional GAN because you simply have a data sample here and a data sample right here but in this case you of course have the corresponding sound samples but still they are you know they are cut down to a subsequence so you don't know which text you're producing so you have to make the discriminators unconditional and therefore they are going to discriminate as we said between potentially between two completely non-overlapping pieces of the sound wave which of course doesn't help you and then the aligner can also not learn anything because there's no learning signal because everything just says this is not the same okay and that's what they say here we face a different problem we do not have aligned ground truth conditional discriminators which they don't have need an aligner module which cannot function correctly at the start of training effectively turning them into unconditional discriminators so even if they were to input the text it would still be the wrong text because their aligner is wrong at the beginning although it should be possible in theory to train the discriminators aligner module adversarially we find that this does not work in practice and training gets stuck so what do they do they say instead we propose to guide learning by using an explicit prediction loss in the spectrogram domain we minimize the l1 loss between the log-scaled male spectrograms of the generator output and the corresponding ground truth training window this helps learning to take off and renders conditional discriminators unnecessary simplifying the model so they take the they take the spectrogram of the generator output and the corresponding ground truth training window and they simply calculate the l1 difference of these spectrograms now this as I understand it this is different from this is different from because we said they also have a discriminator on the spectrograms now this is different from that this is even in addition to that so here somewhere we had yeah this this was the discriminator on the spectrograms and I think this is even different so what they're doing is they also the discriminator simply decides do the spectrograms look real or fake does the spectrogram look real or fake now they also take these spectrograms and compare them with the l1 loss so this is exactly what they said they wouldn't do right here now it's still the case right it's still the case that they don't use spectrograms as intermediate representations but they now do have a supervised loss on the spectrograms and one of the motivations to do this end to end is saying you know maybe these auxiliary losses and supervised losses they they sort of distract they're good to guide the training but they sort of distract and now they see okay maybe we have to introduce this one right here in order to make the training start because this is a this is a real signal but again you run into a problem namely if you produce something with the generator and so first of all this is not a discriminator anymore this is a true l1 loss so we potentially run into this problem right of the of the generator simply copying the input because you always tell it what the correct input is this is now a supervised loss that we guide the training with and what was I gonna say yeah so you take the generator output you transform it into a spectrogram you take the real output transform it into a spectrum compare the l1 loss now you sort of run into the same problem in that if these are completely not aligned then this is not going to work but since you have a supervised loss this it can it gives you a much stronger learning signal of what the generator should produce so you're kind of counting at the beginning of training you're counting on sort of a reverse reverse learning process in that the real the real sound will go into a spectrogram and the generator will go here and then that learning signal will sort of travel to make the generator produce more of whatever the real sound is and that almost like if you think that the aligner is so bad that we have even non-overlapping fragments basically you teach the generator to ignore the input that it gets from down here that it gets from its entire backbone you teach it to sort of ignore all of that if if that makes any sense it simply produces the sound according to this supervised loss now of course it doesn't ignore it it still takes the features but it ignores the this whole alignment thing and now once the generator gets a better signal of what it should produce that signal can travel back to the aligner module to this length estimation module and guide that one to make better predictions about the lengths okay so that's how you at the beginning of training you sort of rely on this path of learning to make to initialize this module of the aligner and then once these length predictors are better then the the loss can travel in its intended path where you forward produce these aligned sound waves and then these discriminators take over i don't exactly know if they trade this off during training or they simply set it to a number such that it helps them at the beginning but it's a it's a good idea and it's a it's a good trick to introduce here a a supervised portion to make the beginning easier but of course you'd run into the same problem as i said and that the fact that if you have two spectrograms they not don't necessarily align again and here they use this dynamic time warping loss now this looks very very similar to the aligner but it is something different because now you have to the difference here is you have two things that you know should match right you have this thing and you have this thing and they both have the same amount of entries so they both have a b c d e this has an a a b a c a d and an e slot and this also has an a a b a c a d and an e slot and you know that um you assume so here is something you assume you assume that the beginning and the ends match this is not true of course because we could have completely unaligned but they say in practice this works so you assume that sort of at least a little bit these are aligned all right so they have by the way there's so much to this paper by the way they have an auxiliary loss where the produced lengths all the lengths that the this length prediction module produces they i don't remember where that is but they have an auxiliary loss where all the lengths must add up right here all the lengths that these length predictors produce must add up to the total length of the sound which in our case i guess is the the two seconds okay so that's how they if so really quickly these length predictions will sort of at least the least thing they can do is they can all predict like um l over n and that will give you a sort of a rough alignment such that it it kind of makes sense to to do this um dynamic time warping to assume that the beginnings and the endings align all right so we have two things we they have the same amount of of slots we know the beginnings and ends align or we assume that how do we make it how do we find out which slots align to which and this is a dynamic programming they formulate this as a dynamic programming problem that you might you know from you might know from from like these are often taught in algorithms and data structure courses and so on where you you can figure out which of these align so if you go a step here that means that you go one step in each in each of the sequences and then if you go a step here that means only this one advances and this one still corresponds to this one right here and um okay i formulated it wrong at the beginning you don't have abcde i guess you would actually have all of these slots and you would figure out which ones correspond to which and yeah but i hope you recognize these sort of problems where and here you align them again so these are classic dynamic programming alignment problems and they align it like this and they simply say the more that this path deviates from the straight path the larger penalty we give so they give a penalty with respect to how much this path deviates so here you can see how much the spectrogram of the generated uh the generated sound aligns with the spectrogram of the ground truth and here is a penalty for each time that the two spectrograms don't align correctly they do this in a soft way so they do every single possible path right here and you can again do this using dynamic programming and the entire catch here is that the alignment must be monotonic because no matter how long you know or short these sequences are they always follow one after another in both of these spectrograms and both of these sounds so that's why you can optimize it in a way so over all the possible paths that you can align them you weigh these paths by their score that you give them here and then you calculate the loss across all these different paths and that will give you that is sort of a fuzzy loss so you don't compare the spectrograms directly but you compare them and you sort of forgive them for not aligning too well but the more they don't align you give a penalty and that's how you sort of force the generator again you force the generator to produce things that are aligned you produce produce these length predictions that make these spectrograms closer to each other so that's how you calculate the spectrogram loss this is entirely deterministic there's no learned weights right here okay cool last thing they say is that they use these phony miser that's the very beginning but they also ablate that so in the results they do a lot lot of ablation studies which I don't want to go into right now I've already shown you some they do a even I think they do a human evaluation do they do a human evaluation I know this might have been in another paper but as you have heard from the examples this sounds extremely realistic I'll link the website to these samples in the in in the video description for sure so I think we've gone over everything the generator starts off with text puts that into normalized text calculates hidden features right here these hidden features on one hand are used to predict the lengths of each of the tokens in the sound and are also used to as an input to the generator here now they can only be used as an input to the generator if the generator knows how to align them in time and how to align them in time is predicted from these predicted lengths right here via this aligner algorithm this is an asset the lengths are the only thing that is predicted everything then is deterministic the aligner is simply a Gaussian kernel over the predicted locations on the on the time axis it is so the Gaussian kernel is to make it to make this alignment a bit fuzzy to make this prediction fuzzy you perform a weighted sum with these features and then the generator knows where to put the feet where to put the tokens finally the generator can up sample the talk the now aligned tokens into sound this goes into the discriminator the discriminator is actually five different discriminators which try each try to discriminate the original from the real sorry the generated from the real at different time scales in addition to that you have a discriminator on the spectrograms and you also have an L one loss on the spectrograms which helps especially at the beginning of training for the L one loss of the spectrograms you have to again compute an alignment but you do this in a deterministic way by this thing down here this dynamic time warping where you simply assume that they are aligned and forgive them for not being aligned with a with a a soft penalty and not a hard hard zero score all right this was the paper again if you like this leave a like a comment share it out subscribe and have a good day bye bye
[{"start": 0.0, "end": 6.640000000000001, "text": " In this work we take on the challenging task of learning to synthesize speech from normalized"}, {"start": 6.640000000000001, "end": 11.040000000000001, "text": " text or phonemes in an end-to-end manner, resulting in models which operate directly"}, {"start": 11.040000000000001, "end": 17.96, "text": " on character or phoneme input sequences and produce raw speech audio outputs."}, {"start": 17.96, "end": 22.580000000000002, "text": " Okay that wasn't the real model I just thought it sounded really funny."}, {"start": 22.580000000000002, "end": 29.34, "text": " This is a text-to-speech model and it actually sounds like this."}, {"start": 29.34, "end": 33.76, "text": " In this work we take on the challenging task of learning to synthesize speech from normalized"}, {"start": 33.76, "end": 38.28, "text": " text or phonemes in an end-to-end manner, resulting in models which operate directly"}, {"start": 38.28, "end": 45.6, "text": " on character or phoneme input sequences and produce raw speech audio outputs."}, {"start": 45.6, "end": 51.28, "text": " Okay now you've probably if you have listened to the text and not just how the text sounds"}, {"start": 51.28, "end": 54.879999999999995, "text": " you have gotten what this paper is about."}, {"start": 54.88, "end": 62.120000000000005, "text": " So the paper is called End-to-End Adversarial Text-to-Speech by Jeff Donaway, Sander Diehlmann,"}, {"start": 62.120000000000005, "end": 71.52000000000001, "text": " Mikolaj Binkowski, Erik Elson and Karen Simonian of I believe of mostly DeepMind."}, {"start": 71.52000000000001, "end": 78.86, "text": " And this paper on a high level it produces speech so sound the sound waves of speech"}, {"start": 78.86, "end": 84.6, "text": " directly from text or from what they call normalized text or phoneme text and it does"}, {"start": 84.6, "end": 92.52, "text": " so without any intermediate supervised representations and that's a challenging task and the main"}, {"start": 92.52, "end": 99.03999999999999, "text": " problems here are the alignment problem that they have to solve and actually making this"}, {"start": 99.03999999999999, "end": 102.03999999999999, "text": " work in an adversarial manner."}, {"start": 102.03999999999999, "end": 107.96, "text": " So we're going to look at this paper as always if you like work like this consider subscribing"}, {"start": 107.96, "end": 113.28, "text": " and sharing it out and if you have any comments leave them in the comment section."}, {"start": 113.28, "end": 116.08, "text": " Okay so what's the problem with text-to-speech?"}, {"start": 116.08, "end": 120.88, "text": " Text-to-speech is basically you take a piece of text like this one modern text-to-speech"}, {"start": 120.88, "end": 127.68, "text": " synthesis pipelines typically involve blah blah blah and you want to make a model that"}, {"start": 127.68, "end": 134.52, "text": " takes this and outputs sound waves as if a human would say it right so you know modern"}, {"start": 134.52, "end": 138.56, "text": " text to speech and so on."}, {"start": 138.56, "end": 142.64, "text": " Now I have multiple problems when doing this."}, {"start": 142.64, "end": 149.0, "text": " First of all the text here is words let's say we can tokenize the text into words so"}, {"start": 149.0, "end": 156.0, "text": " you have modern text to speech those are four tokens however sound waves are of course much"}, {"start": 156.0, "end": 161.72, "text": " much densely sampled so the sound waves they are typically in the order of something like"}, {"start": 161.72, "end": 172.84, "text": " 24 kilohertz sampled so that's the ratio of one token to output samples is super high"}, {"start": 172.84, "end": 179.98, "text": " so one token will produce many many thousand samples in the speech."}, {"start": 179.98, "end": 181.68, "text": " So that's the first problem."}, {"start": 181.68, "end": 188.8, "text": " The second problem is that if you have training data so you have data that has a piece of"}, {"start": 188.8, "end": 193.84, "text": " text and you have the sound wave that a human you know the human read that particular piece"}, {"start": 193.84, "end": 200.76000000000002, "text": " of text you still don't know which word exactly corresponds to which portion of that text"}, {"start": 200.76000000000002, "end": 205.92000000000002, "text": " you simply know the entire text corresponds to the entire sound wave you don't know this"}, {"start": 205.92000000000002, "end": 210.44, "text": " word text right here you don't know you don't know where it starts and where it ends in"}, {"start": 210.44, "end": 218.44, "text": " this sound wave and the last problem you obviously have is that you want to make this in a way"}, {"start": 218.44, "end": 225.68, "text": " that it generalizes that it sounds like a human but also generalizes to some other text"}, {"start": 225.68, "end": 233.04, "text": " and this paper here solves all of these problems jointly by doing an adversarial approach to"}, {"start": 233.04, "end": 241.6, "text": " learning and it does it end to end now adversarial simply means that you have a generator that"}, {"start": 241.6, "end": 246.96, "text": " takes in the piece of text right here and generates this sound wave and then you have"}, {"start": 246.96, "end": 254.12, "text": " a discriminator that looks at this sound wave and it looks at the real sound wave so the"}, {"start": 254.12, "end": 260.48, "text": " real okay the real says let's say this over here is real and this is what the generator"}, {"start": 260.48, "end": 266.92, "text": " has produced the discriminator tries to discriminate between the two now this is not entirely the"}, {"start": 266.92, "end": 275.52, "text": " same thing as a as a supervised loss usually in a GAN you do not have the corresponding"}, {"start": 275.52, "end": 280.88, "text": " samples right you just you simply you simply input a real sample here and the generator"}, {"start": 280.88, "end": 287.96, "text": " produces a generated sample here you do not necessarily have in a classic GAN the corresponding"}, {"start": 287.96, "end": 293.97999999999996, "text": " sample here you assume that you have the corresponding real sample but it's still different than"}, {"start": 293.97999999999996, "end": 299.58, "text": " supervised learning in that both go through a discriminator and the discriminator tries"}, {"start": 299.58, "end": 304.78, "text": " to tell the discriminator is a neural network tries to tell which one is real and which"}, {"start": 304.78, "end": 311.28, "text": " one is generated in fact the discriminator is a set of neural networks that we're going"}, {"start": 311.28, "end": 318.52, "text": " to go into that shortly so it's adversarial in the sense that there is a generator and"}, {"start": 318.52, "end": 325.55999999999995, "text": " a discriminator and it is end to end in the sense that usually what these pipelines do"}, {"start": 325.55999999999995, "end": 331.15999999999997, "text": " is they take the text and we've looked at this for example in the video about this Facebook's"}, {"start": 331.16, "end": 336.0, "text": " text-to-speech system so they take the text and the first thing they do is they would"}, {"start": 336.0, "end": 347.48, "text": " produce a set of of of whatever they would call features like textual features call it"}, {"start": 347.48, "end": 355.96000000000004, "text": " textual features so these are these are sort of intermediate features for the text to be"}, {"start": 355.96, "end": 361.62, "text": " produced and then another model would take these and it would produce something like"}, {"start": 361.62, "end": 370.03999999999996, "text": " spectrograms spectrograms and then another model would take the spectrograms and finally"}, {"start": 370.03999999999996, "end": 379.15999999999997, "text": " produce sound or speech so you have usually in these systems you have intermediate representation"}, {"start": 379.15999999999997, "end": 384.88, "text": " and each of these models right here can be trained by itself so that's an advantage that"}, {"start": 384.88, "end": 389.4, "text": " you can train for example you can train a model that goes from a spectrogram to a sound"}, {"start": 389.4, "end": 395.04, "text": " wave by itself and you don't need you simply need sound for that the computation from sound"}, {"start": 395.04, "end": 401.08, "text": " to spectrogram is super easy so you can generate your own training data so you can go from"}, {"start": 401.08, "end": 407.32, "text": " spectrogram to sound you can train a model like this so in these pipelines usually there"}, {"start": 407.32, "end": 413.28, "text": " are multiple stages and each of these models has to be trained by itself this paper tries"}, {"start": 413.28, "end": 420.35999999999996, "text": " to do this end to end that means you input the text and you get out the you get out the"}, {"start": 420.35999999999996, "end": 429.4, "text": " sound wave and and there is nothing in between that the I mean of course there are latent"}, {"start": 429.4, "end": 436.71999999999997, "text": " representations but you train it ends to end in one go okay so let's look at the different"}, {"start": 436.72, "end": 444.32000000000005, "text": " systems they employ first of all let's look at the discriminators because that's the easiest"}, {"start": 444.32000000000005, "end": 451.92, "text": " so they have these discriminators and these are adopted from this Gantt TS paper now as"}, {"start": 451.92, "end": 458.32000000000005, "text": " we already said the discriminator try to to differentiate between real and fake sound"}, {"start": 458.32000000000005, "end": 465.64000000000004, "text": " and they do it in a sort of so if they were to just look at the entire sound wave then"}, {"start": 465.64, "end": 471.88, "text": " it would just basically reduce to comparing the two but instead the discriminators they"}, {"start": 471.88, "end": 477.71999999999997, "text": " operate on very small windows so in specific they have five different discriminators and"}, {"start": 477.71999999999997, "end": 482.52, "text": " each of the five different discriminators take a different size window length but all"}, {"start": 482.52, "end": 490.15999999999997, "text": " of these windows are super short so one discriminator might take this long windows another discriminator"}, {"start": 490.15999999999997, "end": 495.12, "text": " might take a bit longer windows and another discriminator might take a bit shorter windows"}, {"start": 495.12, "end": 499.4, "text": " and that of course from the real end from the fake and the discriminators simply try"}, {"start": 499.4, "end": 505.6, "text": " to discriminate only in these windows whether it's a real or fake and now we're a bit more"}, {"start": 505.6, "end": 511.28000000000003, "text": " into the Gantt setting where you know you simply have one data point of the real and"}, {"start": 511.28000000000003, "end": 516.22, "text": " one data point of the fake and you have to compare them and this here I believe is one"}, {"start": 516.22, "end": 521.72, "text": " of the keys why this model generalizes because the discriminators basically they try to assess"}, {"start": 521.72, "end": 529.86, "text": " whether a short sequence sounds like real or sounds like fake and whether the two samples"}, {"start": 529.86, "end": 536.32, "text": " sound alike in different scales of time and by only doing this on these short scales you"}, {"start": 536.32, "end": 541.6600000000001, "text": " can you can the loss sort of generalizes otherwise if you compare it on the entire sound wave"}, {"start": 541.6600000000001, "end": 550.88, "text": " you would just reduce to comparing point like point by point right here and if the generator"}, {"start": 550.88, "end": 555.76, "text": " produces something that's not exactly aligned then of course every point would be wrong"}, {"start": 555.76, "end": 561.28, "text": " and you you'd run into all sorts of questions so this is a set of five discriminators that"}, {"start": 561.28, "end": 569.0, "text": " all try to take each takes a different length of sub sound of this wave tries to discriminate"}, {"start": 569.0, "end": 574.12, "text": " real from fake that's the discriminator loss they have an additional discriminator loss"}, {"start": 574.12, "end": 584.5600000000001, "text": " where they compute spectrograms of these things so spectrograms and compute spectrogram of"}, {"start": 584.5600000000001, "end": 591.2, "text": " this and they have a discriminator another neural network here that it tries to distinguish"}, {"start": 591.2, "end": 596.64, "text": " which one is real and which one is fake note that this is not the same as down here where"}, {"start": 596.64, "end": 601.88, "text": " the spectrogram is an intermediate representation here the sound is the output and from the"}, {"start": 601.88, "end": 608.76, "text": " sound you compute the spectrogram and then you compare the two so this is simply a different"}, {"start": 608.76, "end": 613.36, "text": " spectrogram is a different feature space for the discriminator to compute the loss it is"}, {"start": 613.36, "end": 620.4399999999999, "text": " not an intermediate representation on the way to produce the sound itself so that the"}, {"start": 620.4399999999999, "end": 627.32, "text": " difference that's the difference here between the classic approach and this approach so"}, {"start": 627.32, "end": 631.9200000000001, "text": " it's end to end adversarial so we got the discriminator the discriminators simply try"}, {"start": 631.9200000000001, "end": 638.24, "text": " to differentiate the sound waves and short scales as well as the spectrograms now the"}, {"start": 638.24, "end": 644.84, "text": " second part is of course the generator how do we even produce sound and that's this diagram"}, {"start": 644.84, "end": 654.4000000000001, "text": " right here so you have this Gantt TS generator this is a generator that takes in a it takes"}, {"start": 654.4, "end": 661.1999999999999, "text": " in a hidden representation so it takes in tokens let's say token one token two let's"}, {"start": 661.1999999999999, "end": 672.3, "text": " go from the from the one before think of a sentence hello there okay so it takes these"}, {"start": 672.3, "end": 677.9599999999999, "text": " tokens and of course it takes like hidden representations of the tokens and it will"}, {"start": 677.96, "end": 685.88, "text": " output it will output for each one or for this joint sequence one hidden two it would"}, {"start": 685.88, "end": 695.76, "text": " output the sound wave okay and this has been a paper before the scan TTS and you also you"}, {"start": 695.76, "end": 700.12, "text": " condition it on the speaker and on latent variables like how you want the pitch to be"}, {"start": 700.12, "end": 706.12, "text": " and so on that's not really important for us right here the generator can simply take"}, {"start": 706.12, "end": 712.4, "text": " these token embeddings and produce sound the problem is in the original paper you had an"}, {"start": 712.4, "end": 719.2, "text": " alignment you knew which token corresponded to which piece of sound and therefore you"}, {"start": 719.2, "end": 727.52, "text": " sort of knew so after that you need to compare this to the generator thing and you knew which"}, {"start": 727.52, "end": 733.6800000000001, "text": " token corresponded to which piece of sound right here so the generator knew what it had"}, {"start": 733.68, "end": 739.3399999999999, "text": " to produce from each token how long it should be and so on so this is the generally the"}, {"start": 739.3399999999999, "end": 745.06, "text": " alignment problem or what I call the alignment problem so if you take a piece of text like"}, {"start": 745.06, "end": 751.64, "text": " this entire paragraph right here let's look at this paragraph this paragraph to read it"}, {"start": 751.64, "end": 758.8399999999999, "text": " out takes like 30 to 60 seconds you can't train really models that output this long"}, {"start": 758.84, "end": 764.4200000000001, "text": " of sound it it would be it would be too big of a sample you want to train ideally on segments"}, {"start": 764.4200000000001, "end": 772.7, "text": " they train segments that are I believe here two second windows from each examples so because"}, {"start": 772.7, "end": 779.62, "text": " they say if we train on 20 seconds that would just be wasteful and prohibitively expensive"}, {"start": 779.62, "end": 786.96, "text": " now the problem of course is if I simply take a window here like this one of two seconds"}, {"start": 786.96, "end": 794.88, "text": " and I have my human that has read this entire paragraph in one go I have no clue again which"}, {"start": 794.88, "end": 801.12, "text": " which part of the entire sound wave of this paragraph these this sub sequence corresponds"}, {"start": 801.12, "end": 809.32, "text": " to a good guess would be to go like well this is about 50% in so maybe here to here maybe"}, {"start": 809.32, "end": 814.64, "text": " who knows okay and even within that and that's what we discussed before you have no clue"}, {"start": 814.64, "end": 821.52, "text": " how long this word here is going to take up within this piece of sound and that's the"}, {"start": 821.52, "end": 827.16, "text": " general alignment problem right here so in this entire sound wave where is the piece"}, {"start": 827.16, "end": 836.08, "text": " and how do these words distribute across the wave of sound the original model had as I"}, {"start": 836.08, "end": 841.72, "text": " understand it such alignments and therefore this generator could work really well because"}, {"start": 841.72, "end": 847.1600000000001, "text": " you had these alignments without these alignments it doesn't work as well and you can on their"}, {"start": 847.1600000000001, "end": 851.44, "text": " website that I've shown you initially you can listen to samples where they disable each"}, {"start": 851.44, "end": 859.26, "text": " of these things so this generator is really good at producing sound when it has these"}, {"start": 859.26, "end": 865.46, "text": " alignments so the challenging task here is how do you compute these alignments how do"}, {"start": 865.46, "end": 871.46, "text": " you compute this thing if you don't have it if you're if you don't have it in your training"}, {"start": 871.46, "end": 877.48, "text": " data so it needs to be part of the loss so that's what this entire architecture down"}, {"start": 877.48, "end": 884.4200000000001, "text": " here is all right so the text is down here it goes in and the first thing they do is"}, {"start": 884.4200000000001, "end": 890.1, "text": " they normalize the text and they transform it into phonemes which is you can do this"}, {"start": 890.1, "end": 896.24, "text": " in a deterministic fashion there are scripts that do this this is the only pre-processing"}, {"start": 896.24, "end": 901.78, "text": " they do and they can also leave it away in the heaven ablation on their website so this"}, {"start": 901.78, "end": 910.24, "text": " is like phoneme text cat sat on the mat now this phoneme text goes through these big block"}, {"start": 910.24, "end": 918.96, "text": " of convolutions and of dilated convolutions and this outputs a 200 hertz representation"}, {"start": 918.96, "end": 928.9000000000001, "text": " length alignment okay I should specify this so for each token here it outputs a length"}, {"start": 928.9000000000001, "end": 934.82, "text": " so this thing predicts the length of each of the tokens these all of this all of this"}, {"start": 934.82, "end": 941.9000000000001, "text": " thing here is to to embed the tokens in hidden space and then predict its length you can"}, {"start": 941.9, "end": 958.72, "text": " see that right here okay so first we use F to to take X so F is a stack of dilated convolutions"}, {"start": 958.72, "end": 969.5, "text": " and it takes X and outputs a hidden representation so H so first X goes to H and then H is used"}, {"start": 969.5, "end": 979.34, "text": " to predict L and L is the length of that token so we embed this into a hidden representation"}, {"start": 979.34, "end": 985.42, "text": " with this right here and then we use this stack to predict the length of each token"}, {"start": 985.42, "end": 993.44, "text": " so this could be this could say something like this cat token right here is 20 milliseconds"}, {"start": 993.44, "end": 1000.2600000000001, "text": " long or instead of milliseconds you would use something like frames or data points maybe"}, {"start": 1000.2600000000001, "end": 1009.46, "text": " this is 200 data points long and then sat is a bit shorter so this is 100 long and on"}, {"start": 1009.46, "end": 1015.6600000000001, "text": " is really short so this is 50 long so for each token it predicts the length all right"}, {"start": 1015.6600000000001, "end": 1021.46, "text": " so now if we have the length of each we can sort of calculate where the starting point"}, {"start": 1021.46, "end": 1026.3400000000001, "text": " is so if we want to know if we know that here is the beginning and the beginning of the"}, {"start": 1026.3400000000001, "end": 1033.18, "text": " sentence we we conservatively assume that there is um so they give some silence buffer"}, {"start": 1033.18, "end": 1040.26, "text": " here but roughly you can assume that the beginning of the speech corresponds to the first the"}, {"start": 1040.26, "end": 1045.8, "text": " first token right you can simply trace the waveform and whenever it goes up that's where"}, {"start": 1045.8, "end": 1052.5, "text": " the first token starts so then if since we know that's where the first token starts and"}, {"start": 1052.5, "end": 1057.74, "text": " if we could predict the length of each one correctly we could simply sum those up to"}, {"start": 1057.74, "end": 1061.98, "text": " figure out where our word starts so if we want to know where on starts we simply go"}, {"start": 1061.98, "end": 1071.58, "text": " from the beginning and go 200 plus 100 milliseconds so or data points 200 plus 100 here is where"}, {"start": 1071.58, "end": 1080.1, "text": " on starts okay and if we want to figure out the middle of on we simply add the the half"}, {"start": 1080.1, "end": 1088.5, "text": " of this number so plus 25 gets you to the middle so this is this here is the center"}, {"start": 1088.5, "end": 1096.76, "text": " of the token on so for each token we predict the length like this and thereby we can just"}, {"start": 1096.76, "end": 1102.3799999999999, "text": " calculate for each one by summing up from the beginning and then adding half of its"}, {"start": 1102.3799999999999, "end": 1109.3, "text": " own length where the center of that token in the entire sequence is okay now we do this"}, {"start": 1109.3, "end": 1116.94, "text": " we said we take random two second audio but we do this procedure for the entire um for"}, {"start": 1116.94, "end": 1123.18, "text": " the entire text okay for the for every single token in the text that we look at so in the"}, {"start": 1123.18, "end": 1134.16, "text": " 20 second text we do this because then for each token we'll get a token center and now"}, {"start": 1134.16, "end": 1142.66, "text": " the aligners job here is to align that to the actual sound so what we also give the"}, {"start": 1142.66, "end": 1149.26, "text": " generators here the offset so let's say we have this 20 second of speech and we randomly"}, {"start": 1149.26, "end": 1156.24, "text": " sample these two seconds and that's maybe five seconds from the beginning we also tell"}, {"start": 1156.24, "end": 1165.02, "text": " it this is five seconds right here so what we can now do is we can calculate back sort"}, {"start": 1165.02, "end": 1174.46, "text": " of and say okay here I have I first need to discard five seconds of my signal and I have"}, {"start": 1174.46, "end": 1180.58, "text": " a prediction how long each token is so I can just cross out tokens until I have basically"}, {"start": 1180.58, "end": 1187.6200000000001, "text": " wasted five seconds and then I know okay from here to wherever these things sum up to two"}, {"start": 1187.6200000000001, "end": 1195.26, "text": " seconds from here to that those are my two seconds that I want to look at now this is"}, {"start": 1195.26, "end": 1203.18, "text": " how I figure out where in the big sound wave my fragment is right because I have this offset"}, {"start": 1203.18, "end": 1208.54, "text": " where I sampled it and I simply add use this and the predicted lengths to figure it out"}, {"start": 1208.54, "end": 1213.96, "text": " now I still need to figure out these tokens that are actually in the span how do they"}, {"start": 1213.96, "end": 1221.0600000000002, "text": " distribute and that's what this aligner here does since we've already predicted the token"}, {"start": 1221.0600000000002, "end": 1227.64, "text": " centers we simply assume that if these are correct right then if this is let's say if"}, {"start": 1227.64, "end": 1234.5800000000002, "text": " this is one second long I assume that the middle is after point five seconds so this"}, {"start": 1234.5800000000002, "end": 1240.5800000000002, "text": " is one second the middle is point five seconds so I think that this token is aligned right"}, {"start": 1240.5800000000002, "end": 1250.1000000000001, "text": " here this is the center of the token now we want to be a little bit a little bit fuzzy"}, {"start": 1250.1000000000001, "end": 1256.94, "text": " with respect to that so what they do is they sort of use a Gaussian kernel right here so"}, {"start": 1256.94, "end": 1264.46, "text": " for each token as you can see here each token has a center which is here so the y-axis is"}, {"start": 1264.46, "end": 1270.14, "text": " the time in sound and the x-axis is the token and for each token we say well it doesn't"}, {"start": 1270.14, "end": 1277.6200000000001, "text": " have to be exactly there it can be so they put a Gaussian kernel like this okay if you"}, {"start": 1277.6200000000001, "end": 1283.3400000000001, "text": " imagine this kernel popping out of the frame they say this is about where the center is"}, {"start": 1283.34, "end": 1289.34, "text": " and for this token right for this token right here they say well it's it's probably here"}, {"start": 1289.34, "end": 1295.26, "text": " in the middle but it could also be here or here or here or here and we wait this like"}, {"start": 1295.26, "end": 1303.52, "text": " this so these are these are the weights and then you simply sum up the weights with these"}, {"start": 1303.52, "end": 1310.5, "text": " embeddings so for each token out of this dilated convolution block you get a hidden embedding"}, {"start": 1310.5, "end": 1317.02, "text": " and by using this alignment matrix that you computed by predicting the lengths and therefore"}, {"start": 1317.02, "end": 1324.14, "text": " predicting the centers of the tokens you can then sort of shift so first you assume that"}, {"start": 1324.14, "end": 1332.14, "text": " h1 h2 h3 if you were to do nothing these would just all take up like a third of the time"}, {"start": 1332.14, "end": 1337.26, "text": " and now by multiplying with this matrix you have the opportunity because you predicted"}, {"start": 1337.26, "end": 1343.3, "text": " a longer length for the first token you have the opportunity to shift that a bit to the"}, {"start": 1343.3, "end": 1349.54, "text": " right and maybe shorten the second token a bit and then the third token goes until the"}, {"start": 1349.54, "end": 1355.82, "text": " end okay that's what this aligner thing is this is not a model by itself all that this"}, {"start": 1355.82, "end": 1361.74, "text": " takes in is the computation right here of the token lengths this estimates these token"}, {"start": 1361.74, "end": 1367.9, "text": " lengths for each of the tokens and the rest is deterministic it's simply saying okay how"}, {"start": 1367.9, "end": 1373.9, "text": " much is the offset cool that's how we know where in the sound wave we are and then where"}, {"start": 1373.9, "end": 1379.1, "text": " is each of the centers and we simply do that by summing up the predicted token lengths"}, {"start": 1379.1, "end": 1384.9, "text": " and then we use a Gaussian kernel with like a set hyper parameter to be a little bit fuzzy"}, {"start": 1384.9, "end": 1391.06, "text": " with respect to these lengths right here so to be differentiable basically and that will"}, {"start": 1391.06, "end": 1398.26, "text": " that will ultimately train this loss this model right here that computes the token lengths"}, {"start": 1398.26, "end": 1404.62, "text": " right so we sum up in a weighted fashion these embeddings right here and that's what goes"}, {"start": 1404.62, "end": 1409.86, "text": " into the generator so now we have embeddings and we have the alignments for the embeddings"}, {"start": 1409.86, "end": 1418.1399999999999, "text": " which are these pieces of where in the sound wave these are and from that the generator"}, {"start": 1418.14, "end": 1424.26, "text": " can now produce the sound wave itself okay and that's basically that's just an up sampling"}, {"start": 1424.26, "end": 1432.46, "text": " here I think that's just an up convolution up sampling from 200 Hertz signal to a 24"}, {"start": 1432.46, "end": 1445.1200000000001, "text": " kilohertz signal cool so that's that now they discover this doesn't work and why doesn't"}, {"start": 1445.12, "end": 1451.62, "text": " it work it's because at the beginning of training these token length predictions here are pretty"}, {"start": 1451.62, "end": 1460.4199999999998, "text": " crappy and so that means that I guess especially this part even where you say well where where"}, {"start": 1460.4199999999998, "end": 1467.8999999999999, "text": " in the sound wave of my 20 seconds do I even need to cut out to compare with the discriminator"}, {"start": 1467.8999999999999, "end": 1474.3, "text": " right if if you give if you sample this piece here and that's what you give to the discriminator"}, {"start": 1474.3, "end": 1479.44, "text": " but your length predictions are so far off that the generator is trying to produce this"}, {"start": 1479.44, "end": 1486.4199999999998, "text": " particular piece because it thinks it thinks oh instead of producing this tokens here which"}, {"start": 1486.4199999999998, "end": 1492.62, "text": " is what the discriminator looks at it produces these tokens here of course you have no no"}, {"start": 1492.62, "end": 1500.5, "text": " chance no matter how good your adversarial loss is remember the this is these length"}, {"start": 1500.5, "end": 1506.46, "text": " predictions are used to see basically to see which of these tokens the generator needs"}, {"start": 1506.46, "end": 1515.02, "text": " to produce the sound for and how they're aligned so they have an additional loss right here"}, {"start": 1515.02, "end": 1523.58, "text": " what they do is they produce from the again they go via the spectrograms within this spectrogram"}, {"start": 1523.58, "end": 1530.22, "text": " prediction loss so they say we discovered that adversarial feedback is insufficient"}, {"start": 1530.22, "end": 1535.18, "text": " to learn alignment at the start of training the aligner does not produce an accurate alignment"}, {"start": 1535.18, "end": 1540.94, "text": " so the information in the input tokens is incorrectly temporally distributed this encourages"}, {"start": 1540.94, "end": 1548.26, "text": " the decoder to ignore the aligner output the unconditional discriminators provide no useful"}, {"start": 1548.26, "end": 1552.58, "text": " signal to correct this oh yeah I should have mentioned this the discriminators here since"}, {"start": 1552.58, "end": 1557.54, "text": " you don't know you don't know which tokens you should produce the discriminators are"}, {"start": 1557.54, "end": 1562.8999999999999, "text": " unconditional they don't know which text is produced you don't give them the tokens you"}, {"start": 1562.8999999999999, "end": 1568.62, "text": " simply give them the sound waves that's something I find particularly interesting here now you"}, {"start": 1568.62, "end": 1575.3, "text": " of course this wouldn't work in a like a traditional GAN because you simply have a data sample"}, {"start": 1575.3, "end": 1581.42, "text": " here and a data sample right here but in this case you of course have the corresponding"}, {"start": 1581.42, "end": 1586.58, "text": " sound samples but still they are you know they are cut down to a subsequence so you"}, {"start": 1586.58, "end": 1591.1399999999999, "text": " don't know which text you're producing so you have to make the discriminators unconditional"}, {"start": 1591.1399999999999, "end": 1598.1399999999999, "text": " and therefore they are going to discriminate as we said between potentially between two"}, {"start": 1598.1399999999999, "end": 1603.78, "text": " completely non-overlapping pieces of the sound wave which of course doesn't help you and"}, {"start": 1603.78, "end": 1607.4399999999998, "text": " then the aligner can also not learn anything because there's no learning signal because"}, {"start": 1607.4399999999998, "end": 1615.58, "text": " everything just says this is not the same okay and that's what they say here we face"}, {"start": 1615.58, "end": 1622.3799999999999, "text": " a different problem we do not have aligned ground truth conditional discriminators which"}, {"start": 1622.3799999999999, "end": 1626.96, "text": " they don't have need an aligner module which cannot function correctly at the start of"}, {"start": 1626.96, "end": 1631.98, "text": " training effectively turning them into unconditional discriminators so even if they were to input"}, {"start": 1631.98, "end": 1638.6999999999998, "text": " the text it would still be the wrong text because their aligner is wrong at the beginning"}, {"start": 1638.6999999999998, "end": 1643.5, "text": " although it should be possible in theory to train the discriminators aligner module adversarially"}, {"start": 1643.5, "end": 1649.22, "text": " we find that this does not work in practice and training gets stuck so what do they do"}, {"start": 1649.22, "end": 1655.22, "text": " they say instead we propose to guide learning by using an explicit prediction loss in the"}, {"start": 1655.22, "end": 1660.86, "text": " spectrogram domain we minimize the l1 loss between the log-scaled male spectrograms of"}, {"start": 1660.86, "end": 1668.98, "text": " the generator output and the corresponding ground truth training window this helps learning"}, {"start": 1668.98, "end": 1674.8600000000001, "text": " to take off and renders conditional discriminators unnecessary simplifying the model so they"}, {"start": 1674.8600000000001, "end": 1682.78, "text": " take the they take the spectrogram of the generator output and the corresponding ground"}, {"start": 1682.78, "end": 1689.14, "text": " truth training window and they simply calculate the l1 difference of these spectrograms now"}, {"start": 1689.14, "end": 1696.88, "text": " this as I understand it this is different from this is different from because we said"}, {"start": 1696.88, "end": 1704.2600000000002, "text": " they also have a discriminator on the spectrograms now this is different from that this is even"}, {"start": 1704.2600000000002, "end": 1709.5800000000002, "text": " in addition to that so here somewhere we had yeah this this was the discriminator on the"}, {"start": 1709.5800000000002, "end": 1718.74, "text": " spectrograms and I think this is even different so what they're doing is they also the discriminator"}, {"start": 1718.74, "end": 1725.0200000000002, "text": " simply decides do the spectrograms look real or fake does the spectrogram look real or"}, {"start": 1725.02, "end": 1734.66, "text": " fake now they also take these spectrograms and compare them with the l1 loss so this"}, {"start": 1734.66, "end": 1740.66, "text": " is exactly what they said they wouldn't do right here now it's still the case right it's"}, {"start": 1740.66, "end": 1746.9, "text": " still the case that they don't use spectrograms as intermediate representations but they now"}, {"start": 1746.9, "end": 1753.42, "text": " do have a supervised loss on the spectrograms and one of the motivations to do this end"}, {"start": 1753.42, "end": 1759.3000000000002, "text": " to end is saying you know maybe these auxiliary losses and supervised losses they they sort"}, {"start": 1759.3000000000002, "end": 1763.4, "text": " of distract they're good to guide the training but they sort of distract and now they see"}, {"start": 1763.4, "end": 1771.3400000000001, "text": " okay maybe we have to introduce this one right here in order to make the training start because"}, {"start": 1771.3400000000001, "end": 1778.52, "text": " this is a this is a real signal but again you run into a problem namely if you produce"}, {"start": 1778.52, "end": 1786.5, "text": " something with the generator and so first of all this is not a discriminator anymore"}, {"start": 1786.5, "end": 1794.62, "text": " this is a true l1 loss so we potentially run into this problem right of the of the generator"}, {"start": 1794.62, "end": 1799.58, "text": " simply copying the input because you always tell it what the correct input is this is"}, {"start": 1799.58, "end": 1809.78, "text": " now a supervised loss that we guide the training with and what was I gonna say yeah so you"}, {"start": 1809.78, "end": 1813.9399999999998, "text": " take the generator output you transform it into a spectrogram you take the real output"}, {"start": 1813.9399999999998, "end": 1818.96, "text": " transform it into a spectrum compare the l1 loss now you sort of run into the same problem"}, {"start": 1818.96, "end": 1825.3799999999999, "text": " in that if these are completely not aligned then this is not going to work but since you"}, {"start": 1825.38, "end": 1831.9, "text": " have a supervised loss this it can it gives you a much stronger learning signal of what"}, {"start": 1831.9, "end": 1835.8200000000002, "text": " the generator should produce so you're kind of counting at the beginning of training you're"}, {"start": 1835.8200000000002, "end": 1844.22, "text": " counting on sort of a reverse reverse learning process in that the real the real sound will"}, {"start": 1844.22, "end": 1849.7800000000002, "text": " go into a spectrogram and the generator will go here and then that learning signal will"}, {"start": 1849.78, "end": 1858.46, "text": " sort of travel to make the generator produce more of whatever the real sound is and that"}, {"start": 1858.46, "end": 1864.62, "text": " almost like if you think that the aligner is so bad that we have even non-overlapping"}, {"start": 1864.62, "end": 1871.06, "text": " fragments basically you teach the generator to ignore the input that it gets from down"}, {"start": 1871.06, "end": 1880.22, "text": " here that it gets from its entire backbone you teach it to sort of ignore all of that"}, {"start": 1880.22, "end": 1886.62, "text": " if if that makes any sense it simply produces the sound according to this supervised loss"}, {"start": 1886.62, "end": 1891.22, "text": " now of course it doesn't ignore it it still takes the features but it ignores the this"}, {"start": 1891.22, "end": 1897.58, "text": " whole alignment thing and now once the generator gets a better signal of what it should produce"}, {"start": 1897.58, "end": 1904.8999999999999, "text": " that signal can travel back to the aligner module to this length estimation module and"}, {"start": 1904.8999999999999, "end": 1911.06, "text": " guide that one to make better predictions about the lengths okay so that's how you at"}, {"start": 1911.06, "end": 1916.1599999999999, "text": " the beginning of training you sort of rely on this path of learning to make to initialize"}, {"start": 1916.1599999999999, "end": 1924.02, "text": " this module of the aligner and then once these length predictors are better then the the"}, {"start": 1924.02, "end": 1930.42, "text": " loss can travel in its intended path where you forward produce these aligned sound waves"}, {"start": 1930.42, "end": 1934.98, "text": " and then these discriminators take over i don't exactly know if they trade this off"}, {"start": 1934.98, "end": 1942.02, "text": " during training or they simply set it to a number such that it helps them at the beginning"}, {"start": 1942.02, "end": 1947.3799999999999, "text": " but it's a it's a good idea and it's a it's a good trick to introduce here a a supervised"}, {"start": 1947.38, "end": 1956.18, "text": " portion to make the beginning easier but of course you'd run into the same problem as"}, {"start": 1956.18, "end": 1964.94, "text": " i said and that the fact that if you have two spectrograms they not don't necessarily"}, {"start": 1964.94, "end": 1972.14, "text": " align again and here they use this dynamic time warping loss now this looks very very"}, {"start": 1972.14, "end": 1980.7, "text": " similar to the aligner but it is something different because now you have to the difference"}, {"start": 1980.7, "end": 1986.3200000000002, "text": " here is you have two things that you know should match right you have this thing and"}, {"start": 1986.3200000000002, "end": 1991.66, "text": " you have this thing and they both have the same amount of entries so they both have a"}, {"start": 1991.66, "end": 2001.2800000000002, "text": " b c d e this has an a a b a c a d and an e slot and this also has an a a b a c a d and"}, {"start": 2001.28, "end": 2007.34, "text": " an e slot and you know that um you assume so here is something you assume you assume"}, {"start": 2007.34, "end": 2012.82, "text": " that the beginning and the ends match this is not true of course because we could have"}, {"start": 2012.82, "end": 2019.54, "text": " completely unaligned but they say in practice this works so you assume that sort of at least"}, {"start": 2019.54, "end": 2029.18, "text": " a little bit these are aligned all right so they have by the way there's so much to this"}, {"start": 2029.18, "end": 2036.26, "text": " paper by the way they have an auxiliary loss where the produced lengths all the lengths"}, {"start": 2036.26, "end": 2043.74, "text": " that the this length prediction module produces they i don't remember where that is but they"}, {"start": 2043.74, "end": 2049.14, "text": " have an auxiliary loss where all the lengths must add up right here all the lengths that"}, {"start": 2049.14, "end": 2053.56, "text": " these length predictors produce must add up to the total length of the sound which in"}, {"start": 2053.56, "end": 2060.4, "text": " our case i guess is the the two seconds okay so that's how they if so really quickly these"}, {"start": 2060.4, "end": 2067.42, "text": " length predictions will sort of at least the least thing they can do is they can all predict"}, {"start": 2067.42, "end": 2075.7799999999997, "text": " like um l over n and that will give you a sort of a rough alignment such that it it"}, {"start": 2075.7799999999997, "end": 2081.38, "text": " kind of makes sense to to do this um dynamic time warping to assume that the beginnings"}, {"start": 2081.38, "end": 2086.62, "text": " and the endings align all right so we have two things we they have the same amount of"}, {"start": 2086.62, "end": 2093.4, "text": " of slots we know the beginnings and ends align or we assume that how do we make it how do"}, {"start": 2093.4, "end": 2102.1, "text": " we find out which slots align to which and this is a dynamic programming they formulate"}, {"start": 2102.1, "end": 2108.54, "text": " this as a dynamic programming problem that you might you know from you might know from"}, {"start": 2108.54, "end": 2115.46, "text": " from like these are often taught in algorithms and data structure courses and so on where"}, {"start": 2115.46, "end": 2121.66, "text": " you you can figure out which of these align so if you go a step here that means that you"}, {"start": 2121.66, "end": 2129.06, "text": " go one step in each in each of the sequences and then if you go a step here that means"}, {"start": 2129.06, "end": 2136.54, "text": " only this one advances and this one still corresponds to this one right here and um"}, {"start": 2136.54, "end": 2142.02, "text": " okay i formulated it wrong at the beginning you don't have abcde i guess you would actually"}, {"start": 2142.02, "end": 2147.3, "text": " have all of these slots and you would figure out which ones correspond to which and yeah"}, {"start": 2147.3, "end": 2153.66, "text": " but i hope you recognize these sort of problems where and here you align them again so these"}, {"start": 2153.66, "end": 2160.42, "text": " are classic dynamic programming alignment problems and they align it like this and they"}, {"start": 2160.42, "end": 2168.14, "text": " simply say the more that this path deviates from the straight path the larger penalty"}, {"start": 2168.14, "end": 2175.66, "text": " we give so they give a penalty with respect to how much this path deviates so here you"}, {"start": 2175.66, "end": 2183.34, "text": " can see how much the spectrogram of the generated uh the generated sound aligns with the spectrogram"}, {"start": 2183.34, "end": 2190.7200000000003, "text": " of the ground truth and here is a penalty for each time that the two spectrograms don't"}, {"start": 2190.7200000000003, "end": 2196.78, "text": " align correctly they do this in a soft way so they do every single possible path right"}, {"start": 2196.78, "end": 2203.82, "text": " here and you can again do this using dynamic programming and the entire catch here is that"}, {"start": 2203.82, "end": 2210.6600000000003, "text": " the alignment must be monotonic because no matter how long you know or short these sequences"}, {"start": 2210.66, "end": 2215.98, "text": " are they always follow one after another in both of these spectrograms and both of these"}, {"start": 2215.98, "end": 2221.46, "text": " sounds so that's why you can optimize it in a way so over all the possible paths that"}, {"start": 2221.46, "end": 2230.54, "text": " you can align them you weigh these paths by their score that you give them here and then"}, {"start": 2230.54, "end": 2238.92, "text": " you calculate the loss across all these different paths and that will give you that is sort"}, {"start": 2238.92, "end": 2244.08, "text": " of a fuzzy loss so you don't compare the spectrograms directly but you compare them and you sort"}, {"start": 2244.08, "end": 2250.76, "text": " of forgive them for not aligning too well but the more they don't align you give a penalty"}, {"start": 2250.76, "end": 2257.1, "text": " and that's how you sort of force the generator again you force the generator to produce things"}, {"start": 2257.1, "end": 2262.82, "text": " that are aligned you produce produce these length predictions that make these spectrograms"}, {"start": 2262.82, "end": 2270.1800000000003, "text": " closer to each other so that's how you calculate the spectrogram loss this is entirely deterministic"}, {"start": 2270.1800000000003, "end": 2277.84, "text": " there's no learned weights right here okay cool last thing they say is that they use"}, {"start": 2277.84, "end": 2285.98, "text": " these phony miser that's the very beginning but they also ablate that so in the results"}, {"start": 2285.98, "end": 2292.7000000000003, "text": " they do a lot lot of ablation studies which I don't want to go into right now I've already"}, {"start": 2292.7, "end": 2301.04, "text": " shown you some they do a even I think they do a human evaluation do they do a human evaluation"}, {"start": 2301.04, "end": 2306.0, "text": " I know this might have been in another paper but as you have heard from the examples this"}, {"start": 2306.0, "end": 2314.4199999999996, "text": " sounds extremely realistic I'll link the website to these samples in the in in the video description"}, {"start": 2314.4199999999996, "end": 2320.96, "text": " for sure so I think we've gone over everything the generator starts off with text puts that"}, {"start": 2320.96, "end": 2327.2, "text": " into normalized text calculates hidden features right here these hidden features on one hand"}, {"start": 2327.2, "end": 2333.86, "text": " are used to predict the lengths of each of the tokens in the sound and are also used"}, {"start": 2333.86, "end": 2340.44, "text": " to as an input to the generator here now they can only be used as an input to the generator"}, {"start": 2340.44, "end": 2347.08, "text": " if the generator knows how to align them in time and how to align them in time is predicted"}, {"start": 2347.08, "end": 2353.7599999999998, "text": " from these predicted lengths right here via this aligner algorithm this is an asset the"}, {"start": 2353.7599999999998, "end": 2359.2599999999998, "text": " lengths are the only thing that is predicted everything then is deterministic the aligner"}, {"start": 2359.2599999999998, "end": 2369.22, "text": " is simply a Gaussian kernel over the predicted locations on the on the time axis it is so"}, {"start": 2369.22, "end": 2373.7999999999997, "text": " the Gaussian kernel is to make it to make this alignment a bit fuzzy to make this prediction"}, {"start": 2373.8, "end": 2379.84, "text": " fuzzy you perform a weighted sum with these features and then the generator knows where"}, {"start": 2379.84, "end": 2385.52, "text": " to put the feet where to put the tokens finally the generator can up sample the talk the now"}, {"start": 2385.52, "end": 2392.0800000000004, "text": " aligned tokens into sound this goes into the discriminator the discriminator is actually"}, {"start": 2392.0800000000004, "end": 2397.96, "text": " five different discriminators which try each try to discriminate the original from the"}, {"start": 2397.96, "end": 2403.76, "text": " real sorry the generated from the real at different time scales in addition to that"}, {"start": 2403.76, "end": 2411.4, "text": " you have a discriminator on the spectrograms and you also have an L one loss on the spectrograms"}, {"start": 2411.4, "end": 2417.14, "text": " which helps especially at the beginning of training for the L one loss of the spectrograms"}, {"start": 2417.14, "end": 2423.18, "text": " you have to again compute an alignment but you do this in a deterministic way by this"}, {"start": 2423.18, "end": 2428.16, "text": " thing down here this dynamic time warping where you simply assume that they are aligned"}, {"start": 2428.16, "end": 2438.0, "text": " and forgive them for not being aligned with a with a a soft penalty and not a hard hard"}, {"start": 2438.0, "end": 2445.24, "text": " zero score all right this was the paper again if you like this leave a like a comment share"}, {"start": 2445.24, "end": 2453.4799999999996, "text": " it out subscribe and have a good day bye bye"}]
Yannic Kilchner
https://www.youtube.com/watch?v=xTzFJIknh7E
TransCoder: Unsupervised Translation of Programming Languages (Paper Explained)
Code migration between languages is an expensive and laborious task. To translate from one language to the other, one needs to be an expert at both. Current automatic tools often produce illegible and complicated code. This paper applies unsupervised neural machine translation to source code of Python, C++, and Java and is able to translate between them, without ever being trained in a supervised fashion. OUTLINE: 0:00 - Intro & Overview 1:15 - The Transcompiling Problem 5:55 - Neural Machine Translation 8:45 - Unsupervised NMT 12:55 - Shared Embeddings via Token Overlap 20:45 - MLM Objective 25:30 - Denoising Objective 30:10 - Back-Translation Objective 33:00 - Evaluation Dataset 37:25 - Results 41:45 - Tokenization 42:40 - Shared Embeddings 43:30 - Human-Aware Translation 47:25 - Failure Cases 48:05 - Conclusion Paper: https://arxiv.org/abs/2006.03511 Abstract: A transcompiler, also known as source-to-source translator, is a system that converts source code from a high-level programming language (such as C++ or Python) to another. Transcompilers are primarily used for interoperability, and to port codebases written in an obsolete or deprecated language (e.g. COBOL, Python 2) to a modern one. They typically rely on handcrafted rewrite rules, applied to the source code abstract syntax tree. Unfortunately, the resulting translations often lack readability, fail to respect the target language conventions, and require manual modifications in order to work properly. The overall translation process is timeconsuming and requires expertise in both the source and target languages, making code-translation projects expensive. Although neural models significantly outperform their rule-based counterparts in the context of natural language translation, their applications to transcompilation have been limited due to the scarcity of parallel data in this domain. In this paper, we propose to leverage recent approaches in unsupervised machine translation to train a fully unsupervised neural transcompiler. We train our model on source code from open source GitHub projects, and show that it can translate functions between C++, Java, and Python with high accuracy. Our method relies exclusively on monolingual source code, requires no expertise in the source or target languages, and can easily be generalized to other programming languages. We also build and release a test set composed of 852 parallel functions, along with unit tests to check the correctness of translations. We show that our model outperforms rule-based commercial baselines by a significant margin. Authors: Marie-Anne Lachaux, Baptiste Roziere, Lowik Chanussot, Guillaume Lample Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there! So the paper we're looking at today can take the code on the left, which is written in Python, and can output the code on the right, which is written in C++. Now the point here is that the code on the right does the same thing as the code on the left, so it is implementing the same function. The surprising thing here is that this model that takes the Python as an input has never been explicitly trained to output C++, so this is an unsupervised translation model. And that's the the cool thing about this paper is that by having no target at having no supervised signal at translating source code languages into one another, it can perform pretty well at the task nonetheless. So we're going to look at this paper, it's called unsupervised translation of programming languages by Marianne Lachaud, Baptiste Rozier, Loïc Chanussault and Guillaume Lempel at Facebook AI Research. As always, if you like content like this, consider sharing it out and leaving a like, and also leaving a comment if you have something to say about it. They say a trans compiler, also known as a source-to-source translator, is a system that converts source code from a high-level programming language such as C++ or Python to another. They say trans compilers are primarily used for interoperability and to port code bases written in an obsolete or deprecated language such as COBOL or Python 2 to a modern one. So for Python 2 you might know this tool that's called 2to3. So 2to3 is a tool that ships with the Python 3 standard library, I believe, that allows you to take Python 2 code and produce Python 3 code. And that is to kind of push people to convert their old code bases of Python 2 to put to the modern Python 3. Now 2to3 is handwritten program. It has specific rules built in that the programmers know if we modify Python 2 like this, Python 3 gets out. For example, the print statement in Python 2 requires no brackets, so we make a rule that whenever there's a print statement with no brackets, we'll add the brackets such that it's Python 3 compliant. Most of this code will transfer, transform the source code first into an abstract syntax tree, modify that, apply specific rules to that, and then output the language from the abstract syntax tree. Now the problem here is manyfold. First of all, there can only be so much translation as there are rules. So every one of these rules has to be coded as a modification to the abstract syntax tree, and every one of these rules is handcrafted and therefore needs sort of human ingenuity. Humans need to go and write these rules of how to transform one language into another. And oftentimes this doesn't, even though it, if you can write these rules, oftentimes whatever comes out is sort of a bit of a cryptic source code because you kind of have to make sure that your rules cover all the possible things and the source code that comes out is oftentimes very cryptic and a bit hard to understand because it's been sort of expanded and formalized to make sure that it still does the same thing as the original source code. Now for Python 2 to Python 3, this is still easy, right? These languages are extremely similar because it's not that big of a step to Python 3 except if you use very low-level language language constructs or language features which have been obsoleted with Python 3. On the other hand, if there's something like COBOL, so a lot of this old banking code or insurance code or government agency code whatnot is written in these really old programming languages and they've been kept alive by these old-school programmers that are slowly but surely all retiring now and there are just not many new programmers around that can support these languages and the languages themselves aren't really updated that much anymore so you would like to transform COBOL into something like, I don't want to call Java modern programming language but it is used in modern times. I'd rather not call it modern per se. Java itself is a beast that's been sort of supported since forever but in any case you would like to transform something like COBOL to something like Java where you have a lot of programmers that can develop and further develop your code. This is much harder. COBOL and Java are much more away from each other than are Python 2 and Python 3. So what you would like to do is you would like to have a tool that is like 2 to 3 but humans, because now if you want a tool like this you need someone that's really proficient in COBOL and Java in order to write a tool like this and you need lots of them and they need to invest lots of time. What you would rather like to do is you would like to learn a system that translates from one language into another such that the meaning is conserved and this of course is exactly the domain of natural language machine translation except its source code. So we all know that we've all realized in the last years that things like Google Translate have become extremely good at translating. So they say right here although neural models significantly outperform their rule based counterparts in the context of natural language translation which is Google Translate is all learned right now. They say their applications to trans compilation have been limited due to the scarcity of parallel data in this domain. So what's the problem with just going and saying oh you know we can build really good neural machine translation models let's just apply them to source code. The problem is if you build a neural machine translation model say something that transforms English to German so you have the word hello and you output hello. You can do it not with just one word but with entire sentences and so on. These models they usually or in the classical sense what they need are parallel corpora which means that you have this you have documents that are written in many languages and you can guarantee that they mean the same thing. So this is a supervised signal. One example of this is let's say press releases of the United Nations. So the United Nations will make some press release and they will then have professional translators translate that press release into all of the different or into many different languages and so you can pretty much guarantee that these mean the same thing. So these pairs of documents or triplets or whatnot they are supervised training data for a machine translation model that translates from one language into the other and the neural machine translation models rely heavily on these parallel corpora. For source code you just don't have that as much. You don't have big code bases in great numbers where the exact same thing is implemented in one language and in the other language. There's just not that much data available. It is the case that sometimes sorry that sometimes let's say in the case of Torch it started as Lua and then it went to PyTorch and the developers had to translate the code from Torch to Python but in the same step they've also made improvements. They sort of re-engineered and reinvented the framework and made it better and so you can't really say these are the same things and likewise there's not a lot of code available where the same thing is implemented in two languages. So we just don't have these parallel corpora for the source code translation. So rather what this paper does is this paper goes into unsupervised machine translation. Now what does unsupervised machine translation mean? Unsupervised machine translation you imagine I have just a big database of documents and these documents I know they're all in English. And I have this other big database and I know that they are all in German. I just know their documents are in German but they don't correspond to each other. They're just German documents and over here they're just English documents. I don't say that these two here are somehow the same. No I just have a bunch of German a bunch of English. They don't even have to correspond they're just text and now what I want to do is I want to learn a shared embedding space. I sort of want to learn a shared space of embeddings for these two languages such that similar things are mapped to the similar place. So if these two documents just happen to talk about the same thing I want them to be mapped to similar spaces in this shared embedding space. So I'm going to have one model a single model where I input the text and it goes into this shared embedding space. Okay now this is unusual because usually in machine translation if you translate from here from English to German then you'll have your dedicated model that takes as English as an input and German as an output and that would be a different model than one that takes even German as an input in English as an output or French as an input and German as an output. In this case we have this process right here and this process right here is the same model and then the decoder that translates this of course now we have the encoder embedding and then the decoder that actually translates to a language is also going to be the same model so it's the same model that translates to English then it translates to German. So first of all how do we make the same model let's say let's say we have the perfect encoder right this is E the encoder the same encoder for all languages let's say we have the perfect encoder and it can map the if whenever a sentence means the same thing in different languages we can completely map it to the same point in embedding space irrespective of the language it comes from. Now how do we tell the decoder which is also the same model like how does it know what to do this is a little trick where you basically you take this embedding so you take the input you put it into your model I don't even know how you know this and then your output is going to be autoregressive right so you decode one token at a time so you decode this token and then you feed it back into the model and then you decode this token you feed that back into the model and so on this is an autoregressive language model and the trick here is that the first the very first token is a special token that describes the language you want to output so here you say I want German and then you let the model decode its its thing and by conditioning on this token right here it knows it should now produce German you will simply during training you will simply put the token here and if it produces something other than German that's a loss right so it will learn to produce German after you produce this tag. Alright so what we need is an encoder and a decoder such that in the encoder we can put in any language text and it will map to the same space the things that mean the same things and we need a decoder that you know can produce any language given this first thing now the decoder should be fairly easy right if we have a shared vocabulary between the languages and we we always put this token we can the decoder is not a problem you can just learn the decoder in a straightforward way but the encoder is going to be a problem so how does the encoder map the different languages to the same space such that the same things are ending up in the same place it seems it seems a bit counterintuitive right because it doesn't know which things correspond to which things now the first thing you need is a shared vocabulary here since we are in a shared space right here the what you need is a shared vocabulary so you tokenize all of the text with a shared vocabulary and this vocabulary is going to consist of sort of word pieces now if you don't know what we're pieces are in a word piece tokenization what you would you what you would do is you would split words into so-called word pieces so for example hello right here might be split into two word pieces the first word piece might be hey and the second word piece might be LLO okay there is usually like some kind of indicator here that this is the end of a word and so on but we'll simplify and hollow right here would be a ha for the first token and then LLO for the second token and these kind of word piece encodings since the smallest units are going to be the characters themselves they ensure that you always have everything is in vocabulary you have no out of vocabulary tokens but here you can already see that if we tokenize the languages like this and then we use the same encoder so the same encoder will pop them into this shared space that means that to the model this and this looks like the same thing it is the same thing right it's the same input token in different languages now as you can see this comes from the same word the low at the end in English and the low at the end in German it comes from the same word so you know it's fair to assume that since it's the same input it's going to be mapped into a same embedding space right here or since these things are usually context dependent we can say in a similar embedding space or a close embedding space but certainly the the initial vectors are the same that is already half the task right so by by tokenizing in this way we have already mapped part of our languages even though they're just a different languages we have mapped the same word to the same space and this relies on the fact that in this case for example English and German and for example French they have a significant overlap in their words as such so the the the word hello and the word hollow they are almost the same word as letters as word pieces and these these shared embedding techniques abuse sort of the fact that these languages are close they'll say ah there will be some word pieces that are going to be the same in these languages and naturally because they're the same they'll be they'll end up in the same place in embedding space and because because that now you have the so what these embedding techniques do is they simply figure out the statistical relations between the word pieces so if two things appear together often in the same context they'll be mapped into the same space as well so it would realize there is a lot of times where ha and hey appear in front of this low thing so I should probably map the ha and the hey to the same location in embedding space so the same relation to the low so they would end up at the same place so now you see even though these word pieces are different like they they get different IDs they'll be mapped to the same place in embedding space because their relation to the low is the same and the low themselves are being mapped to the same place because they are actually the same so you can see that this this partial overlap between word pieces in the different languages combined with the shared embedding pre training results in these token across the languages results in an alignment of the embeddings so naturally the things that mean the same things are going to be in the same places in embedding space either because they are the same or because their statistical relation to the things that are the same is the same it is it is sort of like these ha and the hey are like synonyms in this shared language so if you jumble all the English and German text together the model things ha and hey are synonyms and therefore maps it to the same space this happens exactly the same in if you only have one language to true synonyms so true this would exactly be the same thing in this case all right so now we have different languages we have a single encoder where we can input any of those languages mapping it to the shared space the decoder can be trained by simply giving it this indicator token right here to decode the appropriate language so now the question is how exactly do we train this such that such that this happens that there's one caveat in programming languages of course we still have to check whether that's the same or not and we know that in programming language is a lot of programming language for example the word if is the same right so if you tokenize Java or Python or C++ the word if is the same and likewise there is a lot of overlap between the different programming languages and that exactly is this correspondence to here these models use the parts that are overlapping either tokens themselves or this can also be grammatical constructs and so on they can also be overlapping and therefore map to the same space so if a construct is used in the same way and this can be in higher layers this can induce the same effect and they'll use that to map the and the sorry they'll use that the result will be that the div the similar things in the same in these languages will be mapped to the similar spaces in embedding space now this makes this example a bit weaker because that means this method would work exceptionally well for something like Python 2 to Python 3 because they of course have like a lot of overlap of syntax and keywords and constructs whereas something like cobalt to Java it's more let's say doubtable that they will they will work so well in this paper here they've chosen C++ Python and Java which do have significant overlap but especially something like Python to Java of course there is a lot of a difference or Python to C++ as well Python is not typed and so you can see a bit of the difficulty is already in the paper here but you have to be aware that this works less and less the less this shared overlap is given all right so how do you train these models and remember we don't have parallel corpora we are simply reliant on having databases from having big repositories of Python code C++ code and Java code and they don't correspond to each other so the first thing you do and as I understand it you can do these things in parallel but there are three different objectives that achieve three different things in these models the first objective is the cross-lingual masked language pre-training now the models here are going to be transformer models with encoders and decoders and that's comes from the attention is all you need papers and various other papers like this I've done videos on those if you want to see that this masked language model pre-training however is from the BERT paper so BERT if you don't know what that is I've also done a video on that this simply trains the encoder so this is to train the encoder what you would do is you would input code so usually in masked language model if you train the encoder you input code with tokens like hello there you would then so this is your input you would then mask some of the tokens for example here the low and maybe the entire word there we would scrap that you would put it through your encoder which is this transformer model like BERT and then BERT is supposed to reconstruct hey low there okay BERT is supposed to reconstruct these two tokens like it doesn't see them and you ask it what did I cross out and it needs to reconstruct that so you train the model to reconstruct these masked tokens and the research on BERT and other things has shown that if you train with this objective the encoder sort of learns about the structure of code it learns about it learns which tokens and which constructs often appear together and therefore it learns something about the the structure of the input and that means it can create whatever is up here is a good and meaningful embedding for these things that tells you something about the statistical coexistence of tokens and of course since we're doing this with all the languages so the Python goes in here C++ goes in here without telling the model what it is you just throw it in there right Java goes in there by tokenizing it and as you see an example right here so if this right here is C++ but in Python this would also be if and since it needs to learn a single encoder for all of these languages and since the tokens overlap partially it is going to result in exactly what we want namely a shared embedding space where even though the input comes from different languages it is mapped similar things are mapped to similar places in the embedding space all right so the mask language model pre-training very quickly as you take a piece of code like here on the left you mask out some of the tokens here you can see them in this mask and you simply ask the model the encoder to reconstruct those things okay so this is just for the encoder as far as I understand it the encoder doesn't it doesn't see the thing back here it simply sees this and you tell it please reconstruct please tell me which words or which tokens I I clipped out here and it's supposed to tell you okay the first one is if the second one is int and the third one is the I now if you consider what the encoder has to do here so if you were to see this then that pretty clearly you know you could you could guess that that is an if of course it's not a hundred percent but this is just pre training right so you train it to output if here now here you have to do a little bit more inference maybe you've seen this for construct a bunch of times and you can see that this is compared here and this is added so probably it's an integer and then in the last thing this is even more complicated if you don't see that the I is here you somehow have to guess that what it is it's not clear right but you can guess that okay there's a local variable I right here and probably it's going to be used somewhere in this block now this here isn't I and I don't see I anywhere else so probably I goes in here which makes sense because it's an integer and prime is an array and and integers index arrays so on okay so this is what the model does first the second thing is we need to train the decoder somehow how do we train the decoder in a very similar way we make the decoder do denoising auto encoding now before we just had single tokens we just asked the encoder to reconstruct tokens so the encoder is this box right here this colors this box is the encoder and the actual part that's going to predict these words is going to be one sort of one classification layer on top that is going to predict for each position the individual word now did this is just for pre training after the pre training you scrap that and you attach it to a decoder so you attach whatever you got out of the encoder to a decoder and the decoder will output in an autoregressive way one token after another right it output a it output a token right here and it feed that token back into the decoder saying okay here's what I've produced now produce the next thing it would produce the next token and so on so it would produce token after token the output and now as I said I'm not exactly sure I think they're doing all of these things at the same time so this would still be here but the information would just be routed in two different ways or maybe they do it one after another it doesn't really matter but what matters is in this thing here you now train the decoder I mean you train it jointly with the encoder but you also involve the decoder and you do this by doing something very similar you corrupt a piece of code and you get corrupted code now you can see part of this corruption is masking like you did before but also part of the corruption is like here you scramble some of the tokens right this was it was this over here you just jumble some of them around a bit and then you here you also drop a token as you can see that the one is dropped and you simply so you don't show this to the encoder or the decoder you input this corrupted code into the decode into the first the encoder and then you ask the decoder to give you back the original code without showing it the original code so the the task for the decode for the encoder decoder for the entire model here is if you're if you see this here is corrupt the code I have corrupted it in various ways please tell me what I originally had now it can the masking it does the same as before it sort of infers it this thing here it says well probably I probably this isn't really correct you don't even tell it where the errors are right before with the masking you at least told it where the errors are now you don't even tell it where the where the errors are so it needs to recognize this here is probably correct this isn't this I'm gonna rewrite this to that okay and it does this one token at a time so it first goes in to the and it needs to output the correct thing this is I hope the difference is clear to the masked language modeling which involved the decoder and here also is the first time where in the encoder you you prepend this Java token now this as you can see it still goes from the same language to the same language but this is where you train the decoder to output a given language so here with the token again this is the same decoder for all the three languages the only difference here is every time you simply provided with the special token at the beginning to tell it which language it should decode right now so this this now we have an encoder that maps all the languages to a shared space and we have a decoder that conditioned on a token like this can output valid code in that thing assuming this here was corrupted code now since the encoder is shared it should map the same kind of corrupted code of the different languages to the same place in the embedding space and therefore this would also this would already be enough to have this model that we desire we can input some code it doesn't actually have to be corrupted right we can just input some code in one language and ask the decoder to output the other language and this works but it doesn't work super well and here the authors go for another idea from the unsupervised machine translation literature which is back translation so back translation is a technique where you can tune an unsupervised machine translation model in a way that you would tune a supervised one but of course you don't have supervised data so what's the plan you will produce the data yourself using your own model so the plan is pretty simple it's actually contained in the back translation name so if you have a piece of code what you would do is you would first use your model to translate this to another language any of your choice now you have no clue whether this thing here is correct or not you have no clue and you have no way of assessing it because you don't have ground truth what you can do is use your model again or actually use a second model that you train in parallel I believe in this case they could use the same model but you could that could be instable and so on but in any case you can use your system again to translate it back to your original language your system can do that right and here whatever you get as an output you know the ground truth it's whatever you started with so now you can compare what comes out to what you started with the difficulty of course is if there is a mistake you don't know which of the two models made a mistake and you so it could be could be that your original translation model made a mistake and or it could be that your back translation model made a mistake and you have to find a loss function that kind of it punishes both equally or you simply keep one sort of constant and loss free and train the other one because there there's going to be a sample where you have C++ as an input and then the intermediate language is Python so all of the models sort of get trained once as an as a source to target translator and once as a target to source translator but I hope the the objective is clear from the back translation so now with the back translation you actually you train the models to go from one language to another language okay and that's the that's the final goal even though you do it without supervised data you now have a model that can encode things into a shared space that can decode into a language and that is attuned to translating from one language to another language so that's that's it how this is all how does this work now for evaluation the question is of course how do you evaluate models like this for evaluation they go to this website called geeks for geeks and this is a an online platform with computer science and programming articles it gathers many coding problems and presents solution in several programming languages okay so this is a website that teaches you to code and it will have like an exercise please do this and then it will provide solutions in the different languages now why is that cool and they they have an example they have an example right here why is that cool because not only can you be relatively sure that these different functions that you have here do the same thing but you can also relatively be relatively sure that they are implemented in the similar way right because what this website is trying to do is it's trying to teach the people how to how to code up an algorithm that they think up in their head and therefore not only is the solution correct and the same it is implemented in the in the same way as you can see here the construct there's this if construct is everywhere the else if is everywhere so even though some of the languages might have specialty things for implementing some algorithms these are really the same algorithmic the same expression of algorithmic thought in the different languages so that is a perfect parallel data set the problem of course is that there is not that many so it is good enough as a test set it is not good enough as a training set but given that it's a test set you can just have these as test set and then you can input the C++ and see whether or not the Java comes out the problem here of course is that even though this is very clear there are still you know sort of many variations of how you can implement that to even express the same algorithmic thought so metrics from natural language processing like below just aren't going to be very good because they look at n-gram overlap and you can write this function with very different n-grams and still be very very valid and correct and also exact match is not going to be really the the gold standard here so what they do is they create a set of unit tests where for each of these functions they go they check their input types they randomly generate input randomly generate a set of inputs look whatever comes out and if the same thing comes out in all of their test functions that they consider this a good unit test for that function so whenever you your model now produces let's say you input Python it produces a C++ you simply put these unit tests through the C++ function you produce and if they produce the same output as the Python the original Python function when on the same inputs then you consider the unit test to succeed and you consider the function to be correct now this of course this isn't this isn't it is super duper gold standard especially with random inputs because usually what you want to do is test sort of corner cases but it's better than anything else so far I've been a long dis advocate of unit tests honestly because I think whenever a human writes a unit test then they're probably since they have already implemented the function itself they're probably going to make the same mistakes or they're probably just going to replicate the code and thinking of the function in the unit test itself and therefore it doesn't really get you anything I guess in large organizations you write unit tests so that someone else doesn't screw up your code but in this case it would actually be cool because now as a human you could simply write a bunch of unit tests and then let your let your trans compiler do the heavy lifting and you simply check whether or not the output is good alright so how does this do here you can see they have some baselines the C++ to Java as I understand it is a commercial system and the Java to Python is an open source system both are human experts that make up these rule-based systems on how to trans on how to translate code into other languages now the if you do what what they have here is transcoder beam one which means a beam size of one so if you don't know what beam search is very shortly beam search is like if you decode from your language model you can either always take the next token that has the highest probability this would be greedy decoding or a beam size of one or you can sort of always keep the top n hypotheses of what the of what the most likely output is as you can keep that as a you can keep the top five in memory and always decode these five on sort of like you have a mini batch of five sequences and you always keep the top five in memory so at the end of the decoding you're going to have five different variants of the same sentence or of the same decoded output and you can then decide which one you like best and usually what you do is you then output the one that has the highest probability which is not the same as the greedy because sometimes the next token will be will look one next token will look very good in a greedy way but you'd better take the second most likely because the next to next token is going to sort of make up for that to make the entire sequence even more likely so more beam size basically means you can keep more hypotheses of the output in memory until the end so if you just do the greedy decoding you see you already get fairly close to these baselines it's very very cool very interesting and if you up the beam size you surpass these baselines now the way they up the beam size here I find to be a bit let's call it a bit cheaty because when they say beam five what they mean is they keep the five hypotheses and then at the end I as I understand it if any of the five hypotheses passes all the unit tests or the most they keep it right so basically they give themselves the freedom to say whichever one of the five we output is the best that's the one we count and of course that's not really a match to the commercial or to the baseline system because it can output one thing now it is maybe a good practical application to give the human that you know you input a function you give the human five options to choose from and it can choose and thereby decide which one the human likes best but it is sort of it is wonky what I like more is this here the beam 10 top one this is what you would actually do so we could keep 10 hypotheses during decoding and at the end output the top one the top likely one and as you can see that is better than greedy but it is worse than where you you know give yourself the freedom to output multiple ones of course though they say that most of the errors that this top one makes come from compilation errors when the target language is Java or C++ it suggests that the beam and top one metric could easily be improved we leave this to future work which this again I find valid right so if you if your method is I'm going to keep the top 10 hypothesis hypotheses until the end and then I'm going from the top and I simply compile them and I output the first one that compiles that that's not cheating right that's a valid thing again yeah so in that way I can I can understand what they're saying right here okay so they give some examples some of which I find very interesting so the first thing here is that oh yeah by the way I've said in the I've said that the tokenizer between the natural languages is shared they make a little tweak here in that they tokenize the different languages with their language respective tokenizers which will still end up tokenizing pretty much you know this the print statement in C++ or in Java no actually the print statement in Python is print and in Java it's println and so on but it will still like the all the if statements it will still tokenize into the same into the same word but it's simply not viable to to parse Python with a C++ parser okay so we have looked at this the results this is one of the results they look at their shared embedding space and this is a t-sneep plots a 2d projection of this shared embedding space and you can see that this is actually happening so the different so null null and none are mapped to similar locations println and cout are mapped to similar locations in this space so this is exactly what we want this is sort of a verification that this method of embedding the different languages into the same space really turns out such that whatever means the same thing is mapped to the same place you can see here catch and accept two very different tokens are mapped to the same place simply because they're used in the same sort of constructs across the languages very cool one of these examples here is quite impressive and kind of shows the difference between this and and rule based translation in this function right here you have a C++ function that takes a character pointer to that is called STR str in as an input now in C++ strings are at least in old versions of C++ strings are handled as character arrays so a string is indistinguishable from a character array and in this case usually what you do is you don't input the array because that will cause a copy you input a pointer to the first two input a pointer to the array and that would define the string ok so if you translate this again this the type of this is simply character array if you translate this with this transcoder system that they've built into Java in Java there is a type called string right there's a native type called string and is that true I think oh yeah that's and then that's handled really weirdly in the JVM I think yes so there is a at least there is a type called string so it would map that it would recognize I you mean a string therefore I'm going to put a string here and it uses all the string method like string length string character at and so on where in C++ this is just an array and you just have array accesses now they take this same C++ function and only change one thing they change the name of the parameter everything else is the same but now the character array is called R okay and they put it through the same system and that system now outputs a function that takes in a character array called R instead of a string and it uses you know here the property length it uses array access instead of this car character at method so simply by changing the name and this is something where I believe the the rule based systems can this can be an advantage over rule based system because what this here does is it simply says oh I've seen a lot of humans in my code base that use this use like stir as a as a variable name and that usually means that the constructs here are like the constructs in Java where people use strings and I've seen other places where people use you know names like this right here and usually that is used in the same context as in Java people use character arrays right so it in programming it's not only important what the the code actually does but a lot of programming goes via naming of things like other programmers will read your code and by reading stir right here they will sort of assume that this is a string whereas if they read our right here they will assume you're a pirate and you are referring to a character array and they will treat the code the code means something different and these systems right here these neural machine translation systems can actually understand that part because they do statistical inference on code that humans wrote if you change this back to say input then again it goes back to a string and uses all the string functions so that's fairly impressive in my mind and it yeah definitely an advantage over rule based systems of course the disadvantage of a rule based systems is that in rule based systems you can almost get on like sometimes you can even guarantee that the code does the same thing here you can't they give some examples of failed translations where so now you get you run into this problem where the min function in Python is overloaded it can either give you the minimum of a sequence or it can give you the minimum of two things now this is translated to Java right here and math dot min is not overloaded in Java it only gives you the minimum of two things and not the minimum of an array and it still outputs that now given enough data probably could learn because these things are all context dependent but this is one of the this is one of the failure cases of these models of course all right so this was this paper I I've I've read that the code of this and the unit tests will be output will be put online at some times they are not right now if I if I hear about it I can link to it or let you know about it let me know what you think of this paper in the comments share it out and subscribe if you haven't yet and bye bye
[{"start": 0.0, "end": 5.12, "text": " Hi there! So the paper we're looking at today can take the code on the left,"}, {"start": 5.12, "end": 9.88, "text": " which is written in Python, and can output the code on the right, which is"}, {"start": 9.88, "end": 15.16, "text": " written in C++. Now the point here is that the code on the right does the same"}, {"start": 15.16, "end": 20.2, "text": " thing as the code on the left, so it is implementing the same function. The"}, {"start": 20.2, "end": 25.560000000000002, "text": " surprising thing here is that this model that takes the Python as an input has"}, {"start": 25.56, "end": 32.239999999999995, "text": " never been explicitly trained to output C++, so this is an unsupervised"}, {"start": 32.239999999999995, "end": 37.6, "text": " translation model. And that's the the cool thing about this paper is that by"}, {"start": 37.6, "end": 43.68, "text": " having no target at having no supervised signal at translating source code"}, {"start": 43.68, "end": 47.76, "text": " languages into one another, it can perform pretty well at the task"}, {"start": 47.76, "end": 54.64, "text": " nonetheless. So we're going to look at this paper, it's called unsupervised"}, {"start": 54.64, "end": 60.72, "text": " translation of programming languages by Marianne Lachaud, Baptiste Rozier, Lo\u00efc"}, {"start": 60.72, "end": 67.92, "text": " Chanussault and Guillaume Lempel at Facebook AI Research. As always, if you like"}, {"start": 67.92, "end": 73.6, "text": " content like this, consider sharing it out and leaving a like, and also leaving"}, {"start": 73.6, "end": 80.24000000000001, "text": " a comment if you have something to say about it. They say a trans compiler, also"}, {"start": 80.24000000000001, "end": 84.32, "text": " known as a source-to-source translator, is a system that converts source code"}, {"start": 84.32, "end": 90.88, "text": " from a high-level programming language such as C++ or Python to another. They"}, {"start": 90.88, "end": 96.75999999999999, "text": " say trans compilers are primarily used for interoperability and to port code"}, {"start": 96.75999999999999, "end": 101.32, "text": " bases written in an obsolete or deprecated language such as COBOL or"}, {"start": 101.32, "end": 107.6, "text": " Python 2 to a modern one. So for Python 2 you might know this tool that's called"}, {"start": 107.6, "end": 114.0, "text": " 2to3. So 2to3 is a tool that ships with the Python 3 standard library, I"}, {"start": 114.0, "end": 120.36, "text": " believe, that allows you to take Python 2 code and produce Python 3 code. And that"}, {"start": 120.36, "end": 125.76, "text": " is to kind of push people to convert their old code bases of Python 2 to"}, {"start": 125.76, "end": 132.36, "text": " put to the modern Python 3. Now 2to3 is handwritten program. It has"}, {"start": 132.36, "end": 138.0, "text": " specific rules built in that the programmers know if we modify Python 2"}, {"start": 138.0, "end": 142.4, "text": " like this, Python 3 gets out. For example, the print statement in Python 2 requires"}, {"start": 142.4, "end": 146.84, "text": " no brackets, so we make a rule that whenever there's a print statement with"}, {"start": 146.84, "end": 152.28, "text": " no brackets, we'll add the brackets such that it's Python 3 compliant. Most of"}, {"start": 152.28, "end": 157.16, "text": " this code will transfer, transform the source code first into an abstract"}, {"start": 157.16, "end": 163.36, "text": " syntax tree, modify that, apply specific rules to that, and then output the"}, {"start": 163.36, "end": 169.92000000000002, "text": " language from the abstract syntax tree. Now the problem here is manyfold. First"}, {"start": 169.92, "end": 176.16, "text": " of all, there can only be so much translation as there are rules. So every"}, {"start": 176.16, "end": 180.67999999999998, "text": " one of these rules has to be coded as a modification to the abstract syntax tree,"}, {"start": 180.67999999999998, "end": 185.64, "text": " and every one of these rules is handcrafted and therefore needs sort of"}, {"start": 185.64, "end": 191.11999999999998, "text": " human ingenuity. Humans need to go and write these rules of how to transform"}, {"start": 191.11999999999998, "end": 199.39999999999998, "text": " one language into another. And oftentimes this doesn't, even though it, if you can"}, {"start": 199.4, "end": 204.28, "text": " write these rules, oftentimes whatever comes out is sort of a bit of a cryptic"}, {"start": 204.28, "end": 208.12, "text": " source code because you kind of have to make sure that your rules cover all the"}, {"start": 208.12, "end": 213.88, "text": " possible things and the source code that comes out is oftentimes very cryptic and"}, {"start": 213.88, "end": 218.88, "text": " a bit hard to understand because it's been sort of expanded and formalized to"}, {"start": 218.88, "end": 223.76, "text": " make sure that it still does the same thing as the original source code. Now"}, {"start": 223.76, "end": 228.64000000000001, "text": " for Python 2 to Python 3, this is still easy, right? These languages are"}, {"start": 228.64, "end": 235.11999999999998, "text": " extremely similar because it's not that big of a step to Python 3 except if you"}, {"start": 235.11999999999998, "end": 241.23999999999998, "text": " use very low-level language language constructs or language features which"}, {"start": 241.23999999999998, "end": 246.76, "text": " have been obsoleted with Python 3. On the other hand, if there's something like"}, {"start": 246.76, "end": 252.92, "text": " COBOL, so a lot of this old banking code or insurance code or government agency"}, {"start": 252.92, "end": 257.32, "text": " code whatnot is written in these really old programming languages and they've"}, {"start": 257.32, "end": 262.2, "text": " been kept alive by these old-school programmers that are slowly but surely"}, {"start": 262.2, "end": 267.32, "text": " all retiring now and there are just not many new programmers around that can"}, {"start": 267.32, "end": 270.71999999999997, "text": " support these languages and the languages themselves aren't really"}, {"start": 270.71999999999997, "end": 275.4, "text": " updated that much anymore so you would like to transform COBOL into something"}, {"start": 275.4, "end": 282.2, "text": " like, I don't want to call Java modern programming language but it is used in"}, {"start": 282.2, "end": 287.64, "text": " modern times. I'd rather not call it modern per se. Java itself is a beast"}, {"start": 287.64, "end": 294.24, "text": " that's been sort of supported since forever but in any case you would like"}, {"start": 294.24, "end": 298.71999999999997, "text": " to transform something like COBOL to something like Java where you have a"}, {"start": 298.71999999999997, "end": 304.0, "text": " lot of programmers that can develop and further develop your code. This is much"}, {"start": 304.0, "end": 309.64, "text": " harder. COBOL and Java are much more away from each other than are Python 2 and"}, {"start": 309.64, "end": 314.76, "text": " Python 3. So what you would like to do is you would like to have a tool that is"}, {"start": 314.76, "end": 320.64, "text": " like 2 to 3 but humans, because now if you want a tool like this you need"}, {"start": 320.64, "end": 325.03999999999996, "text": " someone that's really proficient in COBOL and Java in order to write a tool"}, {"start": 325.03999999999996, "end": 329.59999999999997, "text": " like this and you need lots of them and they need to invest lots of time. What"}, {"start": 329.59999999999997, "end": 333.76, "text": " you would rather like to do is you would like to learn a system that translates"}, {"start": 333.76, "end": 338.64, "text": " from one language into another such that the meaning is conserved and this of"}, {"start": 338.64, "end": 343.8, "text": " course is exactly the domain of natural language machine translation except its"}, {"start": 343.8, "end": 349.68, "text": " source code. So we all know that we've all realized in the last years that"}, {"start": 349.68, "end": 356.71999999999997, "text": " things like Google Translate have become extremely good at translating. So they"}, {"start": 356.71999999999997, "end": 361.36, "text": " say right here although neural models significantly outperform their rule"}, {"start": 361.36, "end": 365.4, "text": " based counterparts in the context of natural language translation which is"}, {"start": 365.4, "end": 370.76, "text": " Google Translate is all learned right now. They say their applications to"}, {"start": 370.76, "end": 375.28, "text": " trans compilation have been limited due to the scarcity of parallel data in this"}, {"start": 375.28, "end": 380.79999999999995, "text": " domain. So what's the problem with just going and saying oh you know we can"}, {"start": 380.79999999999995, "end": 384.47999999999996, "text": " build really good neural machine translation models let's just apply them"}, {"start": 384.47999999999996, "end": 388.47999999999996, "text": " to source code. The problem is if you build a neural machine translation model"}, {"start": 388.47999999999996, "end": 394.52, "text": " say something that transforms English to German so you have the word hello and"}, {"start": 394.52, "end": 401.47999999999996, "text": " you output hello. You can do it not with just one word but with entire sentences"}, {"start": 401.47999999999996, "end": 407.0, "text": " and so on. These models they usually or in the classical sense what they need are"}, {"start": 407.0, "end": 411.96, "text": " parallel corpora which means that you have this you have documents that are"}, {"start": 411.96, "end": 418.68, "text": " written in many languages and you can guarantee that they mean the same thing."}, {"start": 418.68, "end": 425.32, "text": " So this is a supervised signal. One example of this is let's say press releases of"}, {"start": 425.32, "end": 430.56, "text": " the United Nations. So the United Nations will make some press release and they"}, {"start": 430.56, "end": 436.24, "text": " will then have professional translators translate that press release into all of"}, {"start": 436.24, "end": 439.88, "text": " the different or into many different languages and so you can pretty much"}, {"start": 439.88, "end": 445.24, "text": " guarantee that these mean the same thing. So these pairs of documents or triplets"}, {"start": 445.24, "end": 450.84000000000003, "text": " or whatnot they are supervised training data for a machine translation model that"}, {"start": 450.84000000000003, "end": 456.08, "text": " translates from one language into the other and the neural machine translation"}, {"start": 456.08, "end": 462.0, "text": " models rely heavily on these parallel corpora. For source code you just don't"}, {"start": 462.0, "end": 468.8, "text": " have that as much. You don't have big code bases in great numbers where the"}, {"start": 468.8, "end": 472.92, "text": " exact same thing is implemented in one language and in the other language."}, {"start": 472.92, "end": 479.08000000000004, "text": " There's just not that much data available. It is the case that sometimes"}, {"start": 479.08000000000004, "end": 485.76, "text": " sorry that sometimes let's say in the case of Torch it started as Lua and then"}, {"start": 485.76, "end": 492.16, "text": " it went to PyTorch and the developers had to translate the code from Torch to"}, {"start": 492.16, "end": 498.08000000000004, "text": " Python but in the same step they've also made improvements. They sort"}, {"start": 498.08, "end": 503.03999999999996, "text": " of re-engineered and reinvented the framework and made it better and so you"}, {"start": 503.03999999999996, "end": 507.64, "text": " can't really say these are the same things and likewise there's not a lot of"}, {"start": 507.64, "end": 512.96, "text": " code available where the same thing is implemented in two languages. So we just"}, {"start": 512.96, "end": 518.72, "text": " don't have these parallel corpora for the source code translation. So rather"}, {"start": 518.72, "end": 525.0799999999999, "text": " what this paper does is this paper goes into unsupervised machine translation."}, {"start": 525.08, "end": 528.5200000000001, "text": " Now what does unsupervised machine translation mean? Unsupervised machine"}, {"start": 528.5200000000001, "end": 535.88, "text": " translation you imagine I have just a big database of documents and these"}, {"start": 535.88, "end": 541.9200000000001, "text": " documents I know they're all in English. And I have this other"}, {"start": 541.9200000000001, "end": 547.6, "text": " big database and I know that they are all in German. I just know their"}, {"start": 547.6, "end": 551.1600000000001, "text": " documents are in German but they don't correspond to each other. They're just"}, {"start": 551.16, "end": 555.56, "text": " German documents and over here they're just English documents. I don't"}, {"start": 555.56, "end": 561.0, "text": " say that these two here are somehow the same. No I just have a bunch of German a"}, {"start": 561.0, "end": 565.28, "text": " bunch of English. They don't even have to correspond they're just text and now"}, {"start": 565.28, "end": 570.0, "text": " what I want to do is I want to learn a shared embedding space. I sort of want"}, {"start": 570.0, "end": 577.24, "text": " to learn a shared space of embeddings for these two languages such that"}, {"start": 577.24, "end": 582.24, "text": " similar things are mapped to the similar place. So if these two documents just"}, {"start": 582.24, "end": 587.64, "text": " happen to talk about the same thing I want them to be mapped to similar spaces"}, {"start": 587.64, "end": 593.3, "text": " in this shared embedding space. So I'm going to have one model a single model"}, {"start": 593.3, "end": 599.88, "text": " where I input the text and it goes into this shared embedding space. Okay now"}, {"start": 599.88, "end": 603.76, "text": " this is unusual because usually in machine translation if you translate"}, {"start": 603.76, "end": 610.36, "text": " from here from English to German then you'll have your dedicated model that"}, {"start": 610.36, "end": 614.0, "text": " takes as English as an input and German as an output and that would be a"}, {"start": 614.0, "end": 619.3199999999999, "text": " different model than one that takes even German as an input in English as an"}, {"start": 619.3199999999999, "end": 624.52, "text": " output or French as an input and German as an output. In this case we have this"}, {"start": 624.52, "end": 630.88, "text": " process right here and this process right here is the same model and then"}, {"start": 630.88, "end": 635.88, "text": " the decoder that translates this of course now we have the encoder embedding"}, {"start": 635.88, "end": 640.48, "text": " and then the decoder that actually translates to a language is also going"}, {"start": 640.48, "end": 645.76, "text": " to be the same model so it's the same model that translates to English then it"}, {"start": 645.76, "end": 650.72, "text": " translates to German. So first of all how do we make the same model let's say"}, {"start": 650.72, "end": 654.88, "text": " let's say we have the perfect encoder right this is E the encoder the same"}, {"start": 654.88, "end": 658.84, "text": " encoder for all languages let's say we have the perfect encoder and it can map"}, {"start": 658.84, "end": 663.5600000000001, "text": " the if whenever a sentence means the same thing in different languages we can"}, {"start": 663.5600000000001, "end": 667.48, "text": " completely map it to the same point in embedding space irrespective of the"}, {"start": 667.48, "end": 672.8000000000001, "text": " language it comes from. Now how do we tell the decoder which is also the same"}, {"start": 672.8000000000001, "end": 678.1600000000001, "text": " model like how does it know what to do this is a little trick where you"}, {"start": 678.1600000000001, "end": 683.48, "text": " basically you take this embedding so you take the input you put it into your"}, {"start": 683.48, "end": 687.72, "text": " model I don't even know how you know this and then your output is going to be"}, {"start": 687.72, "end": 693.36, "text": " autoregressive right so you decode one token at a time so you decode this token"}, {"start": 693.36, "end": 698.28, "text": " and then you feed it back into the model and then you decode this token you feed"}, {"start": 698.28, "end": 702.84, "text": " that back into the model and so on this is an autoregressive language model and"}, {"start": 702.84, "end": 707.24, "text": " the trick here is that the first the very first token is a special token that"}, {"start": 707.24, "end": 711.8000000000001, "text": " describes the language you want to output so here you say I want German and"}, {"start": 711.8000000000001, "end": 717.58, "text": " then you let the model decode its its thing and by conditioning on this token"}, {"start": 717.58, "end": 723.0, "text": " right here it knows it should now produce German you will simply during"}, {"start": 723.0, "end": 728.24, "text": " training you will simply put the token here and if it produces something other"}, {"start": 728.24, "end": 732.32, "text": " than German that's a loss right so it will learn to produce German after you"}, {"start": 732.32, "end": 740.48, "text": " produce this tag. Alright so what we need is an encoder and a decoder such that in"}, {"start": 740.48, "end": 747.08, "text": " the encoder we can put in any language text and it will map to the same space"}, {"start": 747.08, "end": 753.96, "text": " the things that mean the same things and we need a decoder that you know can"}, {"start": 753.96, "end": 759.5600000000001, "text": " produce any language given this first thing now the decoder should be fairly"}, {"start": 759.5600000000001, "end": 764.2, "text": " easy right if we have a shared vocabulary between the languages and we"}, {"start": 764.2, "end": 770.0, "text": " we always put this token we can the decoder is not a problem you can just"}, {"start": 770.0, "end": 774.12, "text": " learn the decoder in a straightforward way but the encoder is going to be a"}, {"start": 774.12, "end": 780.24, "text": " problem so how does the encoder map the different languages to the same space"}, {"start": 780.24, "end": 786.08, "text": " such that the same things are ending up in the same place it seems it seems a"}, {"start": 786.08, "end": 792.0, "text": " bit counterintuitive right because it doesn't know which things correspond to"}, {"start": 792.0, "end": 796.52, "text": " which things now the first thing you need is a shared vocabulary here since"}, {"start": 796.52, "end": 801.12, "text": " we are in a shared space right here the what you need is a shared vocabulary so"}, {"start": 801.12, "end": 808.68, "text": " you tokenize all of the text with a shared vocabulary and this vocabulary is"}, {"start": 808.68, "end": 813.44, "text": " going to consist of sort of word pieces now if you don't know what we're pieces"}, {"start": 813.44, "end": 818.24, "text": " are in a word piece tokenization what you would you what you would do is you"}, {"start": 818.24, "end": 824.12, "text": " would split words into so-called word pieces so for example hello right here"}, {"start": 824.12, "end": 831.02, "text": " might be split into two word pieces the first word piece might be hey and the"}, {"start": 831.02, "end": 835.68, "text": " second word piece might be LLO okay there is usually like some kind of"}, {"start": 835.68, "end": 840.12, "text": " indicator here that this is the end of a word and so on but we'll simplify and"}, {"start": 840.12, "end": 846.84, "text": " hollow right here would be a ha for the first token and then LLO for the second"}, {"start": 846.84, "end": 851.04, "text": " token and these kind of word piece encodings since the smallest units are"}, {"start": 851.04, "end": 856.0, "text": " going to be the characters themselves they ensure that you always have"}, {"start": 856.0, "end": 860.68, "text": " everything is in vocabulary you have no out of vocabulary tokens but here you"}, {"start": 860.68, "end": 867.4, "text": " can already see that if we tokenize the languages like this and then we use the"}, {"start": 867.4, "end": 873.88, "text": " same encoder so the same encoder will pop them into this shared space that"}, {"start": 873.88, "end": 881.12, "text": " means that to the model this and this looks like the same thing it is the same"}, {"start": 881.12, "end": 886.8, "text": " thing right it's the same input token in different languages now as you can see"}, {"start": 886.8, "end": 892.0799999999999, "text": " this comes from the same word the low at the end in English and the low at the"}, {"start": 892.0799999999999, "end": 898.5999999999999, "text": " end in German it comes from the same word so you know it's fair to assume"}, {"start": 898.5999999999999, "end": 903.88, "text": " that since it's the same input it's going to be mapped into a same embedding"}, {"start": 903.88, "end": 908.3199999999999, "text": " space right here or since these things are usually context dependent we can say"}, {"start": 908.3199999999999, "end": 916.3199999999999, "text": " in a similar embedding space or a close embedding space but certainly the the"}, {"start": 916.32, "end": 922.6800000000001, "text": " initial vectors are the same that is already half the task right so by by"}, {"start": 922.6800000000001, "end": 929.5200000000001, "text": " tokenizing in this way we have already mapped part of our languages even though"}, {"start": 929.5200000000001, "end": 933.48, "text": " they're just a different languages we have mapped the same word to the same"}, {"start": 933.48, "end": 938.72, "text": " space and this relies on the fact that in this case for example English and"}, {"start": 938.72, "end": 945.12, "text": " German and for example French they have a significant overlap in their words as"}, {"start": 945.12, "end": 950.52, "text": " such so the the the word hello and the word hollow they are almost the same"}, {"start": 950.52, "end": 956.92, "text": " word as letters as word pieces and these these shared embedding techniques abuse"}, {"start": 956.92, "end": 961.76, "text": " sort of the fact that these languages are close they'll say ah there will be"}, {"start": 961.76, "end": 966.2, "text": " some word pieces that are going to be the same in these languages and"}, {"start": 966.2, "end": 969.36, "text": " naturally because they're the same they'll be they'll end up in the same"}, {"start": 969.36, "end": 976.08, "text": " place in embedding space and because because that now you have the so what"}, {"start": 976.08, "end": 980.52, "text": " these embedding techniques do is they simply figure out the statistical"}, {"start": 980.52, "end": 986.6, "text": " relations between the word pieces so if two things appear together often in the"}, {"start": 986.6, "end": 991.6, "text": " same context they'll be mapped into the same space as well so it would realize"}, {"start": 991.6, "end": 998.28, "text": " there is a lot of times where ha and hey appear in front of this low thing so I"}, {"start": 998.28, "end": 1003.64, "text": " should probably map the ha and the hey to the same location in embedding space"}, {"start": 1003.64, "end": 1008.9599999999999, "text": " so the same relation to the low so they would end up at the same place so now"}, {"start": 1008.9599999999999, "end": 1013.4399999999999, "text": " you see even though these word pieces are different like they they get"}, {"start": 1013.4399999999999, "end": 1018.48, "text": " different IDs they'll be mapped to the same place in embedding space because"}, {"start": 1018.48, "end": 1023.88, "text": " their relation to the low is the same and the low themselves are being mapped"}, {"start": 1023.88, "end": 1028.56, "text": " to the same place because they are actually the same so you can see that"}, {"start": 1028.56, "end": 1034.28, "text": " this this partial overlap between word pieces in the different languages"}, {"start": 1034.28, "end": 1042.72, "text": " combined with the shared embedding pre training results in these token across"}, {"start": 1042.72, "end": 1049.24, "text": " the languages results in an alignment of the embeddings so naturally the things"}, {"start": 1049.24, "end": 1053.72, "text": " that mean the same things are going to be in the same places in embedding space"}, {"start": 1053.72, "end": 1058.72, "text": " either because they are the same or because their statistical relation to"}, {"start": 1058.72, "end": 1064.76, "text": " the things that are the same is the same it is it is sort of like these ha and"}, {"start": 1064.76, "end": 1069.72, "text": " the hey are like synonyms in this shared language so if you jumble all the"}, {"start": 1069.72, "end": 1074.3600000000001, "text": " English and German text together the model things ha and hey are synonyms"}, {"start": 1074.3600000000001, "end": 1079.2, "text": " and therefore maps it to the same space this happens exactly the same in if you"}, {"start": 1079.2, "end": 1083.92, "text": " only have one language to true synonyms so true this would exactly be the same"}, {"start": 1083.92, "end": 1091.3600000000001, "text": " thing in this case all right so now we have different languages we have a"}, {"start": 1091.3600000000001, "end": 1096.6000000000001, "text": " single encoder where we can input any of those languages mapping it to the shared"}, {"start": 1096.6000000000001, "end": 1102.6000000000001, "text": " space the decoder can be trained by simply giving it this indicator token"}, {"start": 1102.6000000000001, "end": 1107.2, "text": " right here to decode the appropriate language so now the question is how"}, {"start": 1107.2, "end": 1113.92, "text": " exactly do we train this such that such that this happens that there's one"}, {"start": 1113.92, "end": 1119.0, "text": " caveat in programming languages of course we still have to check whether"}, {"start": 1119.0, "end": 1123.0, "text": " that's the same or not and we know that in programming language is a lot of"}, {"start": 1123.0, "end": 1127.22, "text": " programming language for example the word if is the same right so if you"}, {"start": 1127.22, "end": 1135.24, "text": " tokenize Java or Python or C++ the word if is the same and likewise there is a"}, {"start": 1135.24, "end": 1140.76, "text": " lot of overlap between the different programming languages and that exactly"}, {"start": 1140.76, "end": 1146.4, "text": " is this correspondence to here these models use the parts that are overlapping"}, {"start": 1146.4, "end": 1152.36, "text": " either tokens themselves or this can also be grammatical constructs and so on"}, {"start": 1152.36, "end": 1156.4, "text": " they can also be overlapping and therefore map to the same space so if a"}, {"start": 1156.4, "end": 1161.16, "text": " construct is used in the same way and this can be in higher layers this can"}, {"start": 1161.16, "end": 1166.24, "text": " induce the same effect and they'll use that to map the and the sorry they'll"}, {"start": 1166.24, "end": 1171.0400000000002, "text": " use that the result will be that the div the similar things in the same in these"}, {"start": 1171.0400000000002, "end": 1175.76, "text": " languages will be mapped to the similar spaces in embedding space now this makes"}, {"start": 1175.76, "end": 1179.48, "text": " this example a bit weaker because that means this method would work"}, {"start": 1179.48, "end": 1184.0, "text": " exceptionally well for something like Python 2 to Python 3 because they of"}, {"start": 1184.0, "end": 1189.6000000000001, "text": " course have like a lot of overlap of syntax and keywords and constructs"}, {"start": 1189.6, "end": 1195.08, "text": " whereas something like cobalt to Java it's more let's say doubtable that they"}, {"start": 1195.08, "end": 1201.12, "text": " will they will work so well in this paper here they've chosen C++ Python"}, {"start": 1201.12, "end": 1205.8799999999999, "text": " and Java which do have significant overlap but especially something like"}, {"start": 1205.8799999999999, "end": 1212.3999999999999, "text": " Python to Java of course there is a lot of a difference or Python to C++ as"}, {"start": 1212.3999999999999, "end": 1218.36, "text": " well Python is not typed and so you can see a bit of the difficulty is already"}, {"start": 1218.36, "end": 1223.04, "text": " in the paper here but you have to be aware that this works less and less the"}, {"start": 1223.04, "end": 1229.28, "text": " less this shared overlap is given all right so how do you train these models"}, {"start": 1229.28, "end": 1235.4799999999998, "text": " and remember we don't have parallel corpora we are simply reliant on having"}, {"start": 1235.4799999999998, "end": 1241.36, "text": " databases from having big repositories of Python code C++ code and Java code"}, {"start": 1241.36, "end": 1246.9599999999998, "text": " and they don't correspond to each other so the first thing you do and as I"}, {"start": 1246.96, "end": 1250.04, "text": " understand it you can do these things in parallel but there are three different"}, {"start": 1250.04, "end": 1255.4, "text": " objectives that achieve three different things in these models the first"}, {"start": 1255.4, "end": 1260.24, "text": " objective is the cross-lingual masked language pre-training now the models"}, {"start": 1260.24, "end": 1265.1200000000001, "text": " here are going to be transformer models with encoders and decoders and that's"}, {"start": 1265.1200000000001, "end": 1269.96, "text": " comes from the attention is all you need papers and various other papers like"}, {"start": 1269.96, "end": 1275.88, "text": " this I've done videos on those if you want to see that this masked language"}, {"start": 1275.88, "end": 1280.8000000000002, "text": " model pre-training however is from the BERT paper so BERT if you don't know"}, {"start": 1280.8000000000002, "end": 1286.4, "text": " what that is I've also done a video on that this simply trains the encoder so"}, {"start": 1286.4, "end": 1292.24, "text": " this is to train the encoder what you would do is you would input code so"}, {"start": 1292.24, "end": 1297.0400000000002, "text": " usually in masked language model if you train the encoder you input code with"}, {"start": 1297.04, "end": 1308.56, "text": " tokens like hello there you would then so this is your input you would then"}, {"start": 1308.56, "end": 1315.36, "text": " mask some of the tokens for example here the low and maybe the entire word there"}, {"start": 1315.36, "end": 1320.44, "text": " we would scrap that you would put it through your encoder which is this"}, {"start": 1320.44, "end": 1326.76, "text": " transformer model like BERT and then BERT is supposed to reconstruct hey low"}, {"start": 1326.76, "end": 1332.8, "text": " there okay BERT is supposed to reconstruct these two tokens like it"}, {"start": 1332.8, "end": 1337.4, "text": " doesn't see them and you ask it what did I cross out and it needs to"}, {"start": 1337.4, "end": 1342.92, "text": " reconstruct that so you train the model to reconstruct these masked tokens and"}, {"start": 1342.92, "end": 1347.8799999999999, "text": " the research on BERT and other things has shown that if you train with this"}, {"start": 1347.8799999999999, "end": 1354.28, "text": " objective the encoder sort of learns about the structure of code it learns"}, {"start": 1354.28, "end": 1359.84, "text": " about it learns which tokens and which constructs often appear together and"}, {"start": 1359.84, "end": 1365.0, "text": " therefore it learns something about the the structure of the input and that"}, {"start": 1365.0, "end": 1371.16, "text": " means it can create whatever is up here is a good and meaningful embedding for"}, {"start": 1371.16, "end": 1375.76, "text": " these things that tells you something about the statistical coexistence of"}, {"start": 1375.76, "end": 1380.52, "text": " tokens and of course since we're doing this with all the languages so the"}, {"start": 1380.52, "end": 1386.48, "text": " Python goes in here C++ goes in here without telling the model what it is you"}, {"start": 1386.48, "end": 1393.16, "text": " just throw it in there right Java goes in there by tokenizing it and as you see"}, {"start": 1393.16, "end": 1399.6399999999999, "text": " an example right here so if this right here is C++ but in Python this would"}, {"start": 1399.6399999999999, "end": 1405.32, "text": " also be if and since it needs to learn a single encoder for all of these"}, {"start": 1405.32, "end": 1410.8799999999999, "text": " languages and since the tokens overlap partially it is going to result in"}, {"start": 1410.8799999999999, "end": 1415.56, "text": " exactly what we want namely a shared embedding space where even though the"}, {"start": 1415.56, "end": 1419.9199999999998, "text": " input comes from different languages it is mapped similar things are mapped to"}, {"start": 1419.9199999999998, "end": 1425.12, "text": " similar places in the embedding space all right so the mask language model"}, {"start": 1425.12, "end": 1430.2, "text": " pre-training very quickly as you take a piece of code like here on the left you"}, {"start": 1430.2, "end": 1435.44, "text": " mask out some of the tokens here you can see them in this mask and you simply ask"}, {"start": 1435.44, "end": 1442.0800000000002, "text": " the model the encoder to reconstruct those things okay so this is just for"}, {"start": 1442.0800000000002, "end": 1446.3600000000001, "text": " the encoder as far as I understand it the encoder doesn't it doesn't see the"}, {"start": 1446.3600000000001, "end": 1452.76, "text": " thing back here it simply sees this and you tell it please reconstruct please"}, {"start": 1452.76, "end": 1459.3600000000001, "text": " tell me which words or which tokens I I clipped out here and it's supposed to"}, {"start": 1459.36, "end": 1463.12, "text": " tell you okay the first one is if the second one is int and the third one is"}, {"start": 1463.12, "end": 1469.32, "text": " the I now if you consider what the encoder has to do here so if you were to"}, {"start": 1469.32, "end": 1476.3999999999999, "text": " see this then that pretty clearly you know you could you could guess that that"}, {"start": 1476.3999999999999, "end": 1480.36, "text": " is an if of course it's not a hundred percent but this is just pre training"}, {"start": 1480.36, "end": 1485.1599999999999, "text": " right so you train it to output if here now here you have to do a little bit"}, {"start": 1485.16, "end": 1489.8000000000002, "text": " more inference maybe you've seen this for construct a bunch of times and you"}, {"start": 1489.8000000000002, "end": 1493.72, "text": " can see that this is compared here and this is added so probably it's an"}, {"start": 1493.72, "end": 1498.44, "text": " integer and then in the last thing this is even more complicated if you don't"}, {"start": 1498.44, "end": 1503.8000000000002, "text": " see that the I is here you somehow have to guess that what it is it's not clear"}, {"start": 1503.8000000000002, "end": 1508.5600000000002, "text": " right but you can guess that okay there's a local variable I right here"}, {"start": 1508.5600000000002, "end": 1514.3600000000001, "text": " and probably it's going to be used somewhere in this block now this here"}, {"start": 1514.36, "end": 1518.8, "text": " isn't I and I don't see I anywhere else so probably I goes in here which makes"}, {"start": 1518.8, "end": 1524.52, "text": " sense because it's an integer and prime is an array and and integers index"}, {"start": 1524.52, "end": 1529.84, "text": " arrays so on okay so this is what the model does first the second thing is we"}, {"start": 1529.84, "end": 1535.04, "text": " need to train the decoder somehow how do we train the decoder in a very similar"}, {"start": 1535.04, "end": 1541.3999999999999, "text": " way we make the decoder do denoising auto encoding now before we just had"}, {"start": 1541.4, "end": 1547.76, "text": " single tokens we just asked the encoder to reconstruct tokens so the encoder is"}, {"start": 1547.76, "end": 1555.64, "text": " this box right here this colors this box is the encoder and the actual part"}, {"start": 1555.64, "end": 1561.16, "text": " that's going to predict these words is going to be one sort of one"}, {"start": 1561.16, "end": 1565.8400000000001, "text": " classification layer on top that is going to predict for each position the"}, {"start": 1565.8400000000001, "end": 1570.92, "text": " individual word now did this is just for pre training after the pre training you"}, {"start": 1570.92, "end": 1576.1200000000001, "text": " scrap that and you attach it to a decoder so you attach whatever you got"}, {"start": 1576.1200000000001, "end": 1582.0800000000002, "text": " out of the encoder to a decoder and the decoder will output in an"}, {"start": 1582.0800000000002, "end": 1587.64, "text": " autoregressive way one token after another right it output a it output a"}, {"start": 1587.64, "end": 1592.92, "text": " token right here and it feed that token back into the decoder saying okay here's"}, {"start": 1592.92, "end": 1596.88, "text": " what I've produced now produce the next thing it would produce the next token and"}, {"start": 1596.88, "end": 1604.64, "text": " so on so it would produce token after token the output and now as I said I'm"}, {"start": 1604.64, "end": 1608.8000000000002, "text": " not exactly sure I think they're doing all of these things at the same time so"}, {"start": 1608.8000000000002, "end": 1613.3600000000001, "text": " this would still be here but the information would just be routed in two"}, {"start": 1613.3600000000001, "end": 1618.44, "text": " different ways or maybe they do it one after another it doesn't really matter"}, {"start": 1618.44, "end": 1624.3600000000001, "text": " but what matters is in this thing here you now train the decoder I mean you"}, {"start": 1624.36, "end": 1629.3999999999999, "text": " train it jointly with the encoder but you also involve the decoder and you do"}, {"start": 1629.3999999999999, "end": 1636.4399999999998, "text": " this by doing something very similar you corrupt a piece of code and you get"}, {"start": 1636.4399999999998, "end": 1641.6399999999999, "text": " corrupted code now you can see part of this corruption is masking like you did"}, {"start": 1641.6399999999999, "end": 1646.12, "text": " before but also part of the corruption is like here you scramble some of the"}, {"start": 1646.12, "end": 1651.12, "text": " tokens right this was it was this over here you just jumble some of them around"}, {"start": 1651.12, "end": 1656.8799999999999, "text": " a bit and then you here you also drop a token as you can see that the one is"}, {"start": 1656.8799999999999, "end": 1662.8, "text": " dropped and you simply so you don't show this to the encoder or the decoder you"}, {"start": 1662.8, "end": 1668.4399999999998, "text": " input this corrupted code into the decode into the first the encoder and"}, {"start": 1668.4399999999998, "end": 1675.4399999999998, "text": " then you ask the decoder to give you back the original code without showing"}, {"start": 1675.4399999999998, "end": 1680.3999999999999, "text": " it the original code so the the task for the decode for the encoder decoder for"}, {"start": 1680.4, "end": 1684.92, "text": " the entire model here is if you're if you see this here is corrupt the code I"}, {"start": 1684.92, "end": 1693.3200000000002, "text": " have corrupted it in various ways please tell me what I originally had now it can"}, {"start": 1693.3200000000002, "end": 1700.0, "text": " the masking it does the same as before it sort of infers it this thing here it"}, {"start": 1700.0, "end": 1706.48, "text": " says well probably I probably this isn't really correct you don't even tell it"}, {"start": 1706.48, "end": 1709.92, "text": " where the errors are right before with the masking you at least told it where"}, {"start": 1709.92, "end": 1714.3200000000002, "text": " the errors are now you don't even tell it where the where the errors are so it"}, {"start": 1714.3200000000002, "end": 1718.0, "text": " needs to recognize this here is probably correct this isn't this I'm gonna"}, {"start": 1718.0, "end": 1723.8400000000001, "text": " rewrite this to that okay and it does this one token at a time so it first"}, {"start": 1723.8400000000001, "end": 1729.76, "text": " goes in to the and it needs to output the correct thing this is I hope the"}, {"start": 1729.76, "end": 1734.72, "text": " difference is clear to the masked language modeling which involved the"}, {"start": 1734.72, "end": 1740.88, "text": " decoder and here also is the first time where in the encoder you you prepend"}, {"start": 1740.88, "end": 1745.92, "text": " this Java token now this as you can see it still goes from the same language to"}, {"start": 1745.92, "end": 1750.72, "text": " the same language but this is where you train the decoder to output a given"}, {"start": 1750.72, "end": 1756.96, "text": " language so here with the token again this is the same decoder for all the"}, {"start": 1756.96, "end": 1761.44, "text": " three languages the only difference here is every time you simply provided with"}, {"start": 1761.44, "end": 1766.16, "text": " the special token at the beginning to tell it which language it should decode"}, {"start": 1766.16, "end": 1772.16, "text": " right now so this this now we have an encoder that maps all the languages to a"}, {"start": 1772.16, "end": 1776.0800000000002, "text": " shared space and we have a decoder that conditioned on a token like this can"}, {"start": 1776.0800000000002, "end": 1785.3600000000001, "text": " output valid code in that thing assuming this here was corrupted code now since"}, {"start": 1785.3600000000001, "end": 1790.16, "text": " the encoder is shared it should map the same kind of corrupted code of the"}, {"start": 1790.16, "end": 1794.5600000000002, "text": " different languages to the same place in the embedding space and therefore this"}, {"start": 1794.5600000000002, "end": 1800.0800000000002, "text": " would also this would already be enough to have this model that we desire we can"}, {"start": 1800.0800000000002, "end": 1804.0800000000002, "text": " input some code it doesn't actually have to be corrupted right we can just input"}, {"start": 1804.0800000000002, "end": 1809.0400000000002, "text": " some code in one language and ask the decoder to output the other language and"}, {"start": 1809.0400000000002, "end": 1814.24, "text": " this works but it doesn't work super well and here the authors go for another"}, {"start": 1814.24, "end": 1818.8000000000002, "text": " idea from the unsupervised machine translation literature which is"}, {"start": 1818.8, "end": 1824.48, "text": " back translation so back translation is a technique where you can tune an"}, {"start": 1824.48, "end": 1829.84, "text": " unsupervised machine translation model in a way that you would tune a"}, {"start": 1829.84, "end": 1833.9199999999998, "text": " supervised one but of course you don't have supervised data so what's the plan"}, {"start": 1833.9199999999998, "end": 1840.56, "text": " you will produce the data yourself using your own model so the plan is pretty"}, {"start": 1840.56, "end": 1846.1599999999999, "text": " simple it's actually contained in the back translation name so if you have a"}, {"start": 1846.16, "end": 1850.48, "text": " piece of code what you would do is you would first use your model to translate"}, {"start": 1850.48, "end": 1856.0, "text": " this to another language any of your choice now you have no clue whether this"}, {"start": 1856.0, "end": 1859.92, "text": " thing here is correct or not you have no clue and you have no way of assessing it"}, {"start": 1859.92, "end": 1864.48, "text": " because you don't have ground truth what you can do is use your model again or"}, {"start": 1864.48, "end": 1870.8000000000002, "text": " actually use a second model that you train in parallel I believe in this case"}, {"start": 1870.8000000000002, "end": 1874.4, "text": " they could use the same model but you could that could be instable and so on"}, {"start": 1874.4, "end": 1880.8000000000002, "text": " but in any case you can use your system again to translate it back to your"}, {"start": 1880.8000000000002, "end": 1886.24, "text": " original language your system can do that right and here whatever you get as"}, {"start": 1886.24, "end": 1890.88, "text": " an output you know the ground truth it's whatever you started with so now you can"}, {"start": 1890.88, "end": 1895.8400000000001, "text": " compare what comes out to what you started with the difficulty of course is"}, {"start": 1895.8400000000001, "end": 1900.8000000000002, "text": " if there is a mistake you don't know which of the two models made a mistake"}, {"start": 1900.8, "end": 1908.48, "text": " and you so it could be could be that your original translation model made a"}, {"start": 1908.48, "end": 1913.84, "text": " mistake and or it could be that your back translation model made a mistake"}, {"start": 1913.84, "end": 1920.0, "text": " and you have to find a loss function that kind of it punishes both equally or"}, {"start": 1920.0, "end": 1926.3999999999999, "text": " you simply keep one sort of constant and loss free and train the other one"}, {"start": 1926.4, "end": 1931.52, "text": " because there there's going to be a sample where you have C++ as an input"}, {"start": 1931.52, "end": 1935.1200000000001, "text": " and then the intermediate language is Python so all of the models sort of get"}, {"start": 1935.1200000000001, "end": 1941.2, "text": " trained once as an as a source to target translator and once as a target to"}, {"start": 1941.2, "end": 1946.0, "text": " source translator but I hope the the objective is clear from the back"}, {"start": 1946.0, "end": 1951.68, "text": " translation so now with the back translation you actually you train the"}, {"start": 1951.68, "end": 1958.24, "text": " models to go from one language to another language okay and that's the"}, {"start": 1958.24, "end": 1962.8, "text": " that's the final goal even though you do it without supervised data you now have"}, {"start": 1962.8, "end": 1968.4, "text": " a model that can encode things into a shared space that can decode into a"}, {"start": 1968.4, "end": 1973.44, "text": " language and that is attuned to translating from one language to another"}, {"start": 1973.44, "end": 1982.4, "text": " language so that's that's it how this is all how does this work now for"}, {"start": 1982.4, "end": 1986.64, "text": " evaluation the question is of course how do you evaluate models like this for"}, {"start": 1986.64, "end": 1993.52, "text": " evaluation they go to this website called geeks for geeks and this is a an"}, {"start": 1993.52, "end": 2000.48, "text": " online platform with computer science and programming articles it gathers many"}, {"start": 2000.48, "end": 2005.28, "text": " coding problems and presents solution in several programming languages okay so"}, {"start": 2005.28, "end": 2010.32, "text": " this is a website that teaches you to code and it will have like an exercise"}, {"start": 2010.32, "end": 2015.68, "text": " please do this and then it will provide solutions in the different languages now"}, {"start": 2015.68, "end": 2022.04, "text": " why is that cool and they they have an example they have an example right here"}, {"start": 2022.04, "end": 2028.4, "text": " why is that cool because not only can you be relatively sure that these"}, {"start": 2028.4, "end": 2033.6000000000001, "text": " different functions that you have here do the same thing but you can also"}, {"start": 2033.6000000000001, "end": 2038.2800000000002, "text": " relatively be relatively sure that they are implemented in the similar way"}, {"start": 2038.2800000000002, "end": 2043.92, "text": " right because what this website is trying to do is it's trying to teach the"}, {"start": 2043.92, "end": 2049.52, "text": " people how to how to code up an algorithm that they think up in their"}, {"start": 2049.52, "end": 2053.6800000000003, "text": " head and therefore not only is the solution correct and the same it is"}, {"start": 2053.6800000000003, "end": 2057.88, "text": " implemented in the in the same way as you can see here the construct there's"}, {"start": 2057.88, "end": 2063.6400000000003, "text": " this if construct is everywhere the else if is everywhere so even though some of"}, {"start": 2063.6400000000003, "end": 2068.2000000000003, "text": " the languages might have specialty things for implementing some algorithms"}, {"start": 2068.2000000000003, "end": 2073.56, "text": " these are really the same algorithmic the same expression of algorithmic"}, {"start": 2073.56, "end": 2077.96, "text": " thought in the different languages so that is a perfect parallel data set the"}, {"start": 2077.96, "end": 2082.44, "text": " problem of course is that there is not that many so it is good enough as a test"}, {"start": 2082.44, "end": 2088.04, "text": " set it is not good enough as a training set but given that it's a test set you"}, {"start": 2088.04, "end": 2094.68, "text": " can just have these as test set and then you can input the C++ and see whether or"}, {"start": 2094.68, "end": 2100.88, "text": " not the Java comes out the problem here of course is that even though this is"}, {"start": 2100.88, "end": 2105.08, "text": " very clear there are still you know sort of many variations of how you can"}, {"start": 2105.08, "end": 2110.96, "text": " implement that to even express the same algorithmic thought so metrics from"}, {"start": 2110.96, "end": 2115.08, "text": " natural language processing like below just aren't going to be very good"}, {"start": 2115.08, "end": 2119.16, "text": " because they look at n-gram overlap and you can write this function with very"}, {"start": 2119.16, "end": 2126.4, "text": " different n-grams and still be very very valid and correct and also exact match"}, {"start": 2126.4, "end": 2131.12, "text": " is not going to be really the the gold standard here so what they do is they"}, {"start": 2131.12, "end": 2137.12, "text": " create a set of unit tests where for each of these functions they go they"}, {"start": 2137.12, "end": 2143.48, "text": " check their input types they randomly generate input randomly generate a set"}, {"start": 2143.48, "end": 2148.96, "text": " of inputs look whatever comes out and if the same thing comes out in all of their"}, {"start": 2148.96, "end": 2154.7999999999997, "text": " test functions that they consider this a good unit test for that function so"}, {"start": 2154.7999999999997, "end": 2159.4, "text": " whenever you your model now produces let's say you input Python it produces"}, {"start": 2159.4, "end": 2165.12, "text": " a C++ you simply put these unit tests through the C++ function you produce and"}, {"start": 2165.12, "end": 2170.96, "text": " if they produce the same output as the Python the original Python function when"}, {"start": 2170.96, "end": 2177.3199999999997, "text": " on the same inputs then you consider the unit test to succeed and you consider"}, {"start": 2177.3199999999997, "end": 2184.2, "text": " the function to be correct now this of course this isn't this isn't it is"}, {"start": 2184.2, "end": 2189.64, "text": " super duper gold standard especially with random inputs because usually what"}, {"start": 2189.64, "end": 2194.3199999999997, "text": " you want to do is test sort of corner cases but it's better than anything else"}, {"start": 2194.32, "end": 2200.48, "text": " so far I've been a long dis advocate of unit tests honestly because I think"}, {"start": 2200.48, "end": 2206.48, "text": " whenever a human writes a unit test then they're probably since they have already"}, {"start": 2206.48, "end": 2212.32, "text": " implemented the function itself they're probably going to make the same mistakes"}, {"start": 2212.32, "end": 2216.1000000000004, "text": " or they're probably just going to replicate the code and thinking of the"}, {"start": 2216.1000000000004, "end": 2221.4, "text": " function in the unit test itself and therefore it doesn't really get you"}, {"start": 2221.4, "end": 2225.6, "text": " anything I guess in large organizations you write unit tests so that someone"}, {"start": 2225.6, "end": 2230.28, "text": " else doesn't screw up your code but in this case it would actually be cool"}, {"start": 2230.28, "end": 2235.96, "text": " because now as a human you could simply write a bunch of unit tests and then let"}, {"start": 2235.96, "end": 2241.32, "text": " your let your trans compiler do the heavy lifting and you simply check"}, {"start": 2241.32, "end": 2247.88, "text": " whether or not the output is good alright so how does this do here you can"}, {"start": 2247.88, "end": 2252.4, "text": " see they have some baselines the C++ to Java as I understand it is a"}, {"start": 2252.4, "end": 2258.48, "text": " commercial system and the Java to Python is an open source system both are human"}, {"start": 2258.48, "end": 2263.7200000000003, "text": " experts that make up these rule-based systems on how to trans on how to"}, {"start": 2263.7200000000003, "end": 2270.2400000000002, "text": " translate code into other languages now the if you do what what they have here"}, {"start": 2270.2400000000002, "end": 2274.04, "text": " is transcoder beam one which means a beam size of one so if you don't know"}, {"start": 2274.04, "end": 2279.16, "text": " what beam search is very shortly beam search is like if you decode from your"}, {"start": 2279.16, "end": 2283.6, "text": " language model you can either always take the next token that has the highest"}, {"start": 2283.6, "end": 2288.88, "text": " probability this would be greedy decoding or a beam size of one or you"}, {"start": 2288.88, "end": 2293.6, "text": " can sort of always keep the top n hypotheses of what the of what the most"}, {"start": 2293.6, "end": 2300.2, "text": " likely output is as you can keep that as a you can keep the top five in memory"}, {"start": 2300.2, "end": 2306.96, "text": " and always decode these five on sort of like you have a mini batch of five"}, {"start": 2306.96, "end": 2313.12, "text": " sequences and you always keep the top five in memory so at the end of the"}, {"start": 2313.12, "end": 2317.3599999999997, "text": " decoding you're going to have five different variants of the same sentence"}, {"start": 2317.3599999999997, "end": 2322.3999999999996, "text": " or of the same decoded output and you can then decide which one you like best"}, {"start": 2322.3999999999996, "end": 2326.48, "text": " and usually what you do is you then output the one that has the highest"}, {"start": 2326.48, "end": 2331.72, "text": " probability which is not the same as the greedy because sometimes the next token"}, {"start": 2331.72, "end": 2337.92, "text": " will be will look one next token will look very good in a greedy way but you'd"}, {"start": 2337.92, "end": 2343.2400000000002, "text": " better take the second most likely because the next to next token is going"}, {"start": 2343.2400000000002, "end": 2350.68, "text": " to sort of make up for that to make the entire sequence even more likely so more"}, {"start": 2350.68, "end": 2355.84, "text": " beam size basically means you can keep more hypotheses of the output in memory"}, {"start": 2355.84, "end": 2360.76, "text": " until the end so if you just do the greedy decoding you see you already get"}, {"start": 2360.76, "end": 2366.4, "text": " fairly close to these baselines it's very very cool very interesting and if"}, {"start": 2366.4, "end": 2373.2000000000003, "text": " you up the beam size you surpass these baselines now the way they up the beam"}, {"start": 2373.2000000000003, "end": 2378.2000000000003, "text": " size here I find to be a bit let's call it a bit cheaty because when they say"}, {"start": 2378.2000000000003, "end": 2381.96, "text": " beam five what they mean is they keep the five hypotheses and then at the end"}, {"start": 2381.96, "end": 2388.96, "text": " I as I understand it if any of the five hypotheses passes all the unit tests or"}, {"start": 2388.96, "end": 2394.76, "text": " the most they keep it right so basically they give themselves the freedom to say"}, {"start": 2394.76, "end": 2400.88, "text": " whichever one of the five we output is the best that's the one we count and of"}, {"start": 2400.88, "end": 2406.16, "text": " course that's not really a match to the commercial or to the baseline system"}, {"start": 2406.16, "end": 2412.7599999999998, "text": " because it can output one thing now it is maybe a good practical application to"}, {"start": 2412.7599999999998, "end": 2417.3999999999996, "text": " give the human that you know you input a function you give the human five options"}, {"start": 2417.3999999999996, "end": 2424.44, "text": " to choose from and it can choose and thereby decide which one the human likes"}, {"start": 2424.44, "end": 2431.64, "text": " best but it is sort of it is wonky what I like more is this here the beam 10 top"}, {"start": 2431.64, "end": 2435.48, "text": " one this is what you would actually do so we could keep 10 hypotheses during"}, {"start": 2435.48, "end": 2442.0, "text": " decoding and at the end output the top one the top likely one and as you can"}, {"start": 2442.0, "end": 2446.4, "text": " see that is better than greedy but it is worse than where you you know give"}, {"start": 2446.4, "end": 2451.6, "text": " yourself the freedom to output multiple ones of course though they say that most"}, {"start": 2451.6, "end": 2457.2, "text": " of the errors that this top one makes come from compilation errors when the"}, {"start": 2457.2, "end": 2462.52, "text": " target language is Java or C++ it suggests that the beam and top one"}, {"start": 2462.52, "end": 2467.32, "text": " metric could easily be improved we leave this to future work which this again I"}, {"start": 2467.32, "end": 2472.04, "text": " find valid right so if you if your method is I'm going to keep the top 10"}, {"start": 2472.04, "end": 2477.72, "text": " hypothesis hypotheses until the end and then I'm going from the top and I simply"}, {"start": 2477.72, "end": 2483.88, "text": " compile them and I output the first one that compiles that that's not cheating"}, {"start": 2483.88, "end": 2492.24, "text": " right that's a valid thing again yeah so in that way I can I can understand what"}, {"start": 2492.24, "end": 2499.4399999999996, "text": " they're saying right here okay so they give some examples some of which I find"}, {"start": 2499.4399999999996, "end": 2506.8399999999997, "text": " very interesting so the first thing here is that oh yeah by the way I've said in"}, {"start": 2506.8399999999997, "end": 2512.08, "text": " the I've said that the tokenizer between the natural languages is shared they"}, {"start": 2512.08, "end": 2515.72, "text": " make a little tweak here in that they tokenize the different languages with"}, {"start": 2515.72, "end": 2521.8799999999997, "text": " their language respective tokenizers which will still end up tokenizing"}, {"start": 2521.88, "end": 2529.28, "text": " pretty much you know this the print statement in C++ or in Java no actually"}, {"start": 2529.28, "end": 2533.6, "text": " the print statement in Python is print and in Java it's println and so on but"}, {"start": 2533.6, "end": 2537.44, "text": " it will still like the all the if statements it will still tokenize into"}, {"start": 2537.44, "end": 2546.2400000000002, "text": " the same into the same word but it's simply not viable to to parse Python"}, {"start": 2546.24, "end": 2558.12, "text": " with a C++ parser okay so we have looked at this the results this is one of the"}, {"start": 2558.12, "end": 2562.4799999999996, "text": " results they look at their shared embedding space and this is a t-sneep"}, {"start": 2562.4799999999996, "end": 2566.3599999999997, "text": " plots a 2d projection of this shared embedding space and you can see that"}, {"start": 2566.3599999999997, "end": 2571.8799999999997, "text": " this is actually happening so the different so null null and none are mapped"}, {"start": 2571.88, "end": 2579.0, "text": " to similar locations println and cout are mapped to similar locations in this"}, {"start": 2579.0, "end": 2583.52, "text": " space so this is exactly what we want this is sort of a verification that this"}, {"start": 2583.52, "end": 2589.36, "text": " method of embedding the different languages into the same space really"}, {"start": 2589.36, "end": 2594.2000000000003, "text": " turns out such that whatever means the same thing is mapped to the same place"}, {"start": 2594.2000000000003, "end": 2598.78, "text": " you can see here catch and accept two very different tokens are mapped to the"}, {"start": 2598.78, "end": 2603.1600000000003, "text": " same place simply because they're used in the same sort of constructs across"}, {"start": 2603.1600000000003, "end": 2610.2400000000002, "text": " the languages very cool one of these examples here is quite impressive and"}, {"start": 2610.2400000000002, "end": 2617.1200000000003, "text": " kind of shows the difference between this and and rule based translation in"}, {"start": 2617.1200000000003, "end": 2621.88, "text": " this function right here you have a C++ function that takes a character"}, {"start": 2621.88, "end": 2630.32, "text": " pointer to that is called STR str in as an input now in C++ strings are at"}, {"start": 2630.32, "end": 2635.56, "text": " least in old versions of C++ strings are handled as character arrays so a"}, {"start": 2635.56, "end": 2641.2400000000002, "text": " string is indistinguishable from a character array and in this case usually"}, {"start": 2641.2400000000002, "end": 2645.52, "text": " what you do is you don't input the array because that will cause a copy you input"}, {"start": 2645.52, "end": 2652.0, "text": " a pointer to the first two input a pointer to the array and that would"}, {"start": 2652.0, "end": 2659.52, "text": " define the string ok so if you translate this again this the type of this is"}, {"start": 2659.52, "end": 2664.72, "text": " simply character array if you translate this with this transcoder system that"}, {"start": 2664.72, "end": 2670.2, "text": " they've built into Java in Java there is a type called string right there's a"}, {"start": 2670.2, "end": 2676.48, "text": " native type called string and is that true I think oh yeah that's and then"}, {"start": 2676.48, "end": 2684.24, "text": " that's handled really weirdly in the JVM I think yes so there is a at least there"}, {"start": 2684.24, "end": 2688.64, "text": " is a type called string so it would map that it would recognize I you mean a"}, {"start": 2688.64, "end": 2692.9199999999996, "text": " string therefore I'm going to put a string here and it uses all the string"}, {"start": 2692.9199999999996, "end": 2697.96, "text": " method like string length string character at and so on where in C++ this"}, {"start": 2697.96, "end": 2704.16, "text": " is just an array and you just have array accesses now they take this same C++"}, {"start": 2704.16, "end": 2708.76, "text": " function and only change one thing they change the name of the parameter"}, {"start": 2708.76, "end": 2714.88, "text": " everything else is the same but now the character array is called R okay and"}, {"start": 2714.88, "end": 2720.0, "text": " they put it through the same system and that system now outputs a function that"}, {"start": 2720.0, "end": 2727.56, "text": " takes in a character array called R instead of a string and it uses you know"}, {"start": 2727.56, "end": 2733.0, "text": " here the property length it uses array access instead of this car character at"}, {"start": 2733.0, "end": 2737.7599999999998, "text": " method so simply by changing the name and this is something where I believe"}, {"start": 2737.7599999999998, "end": 2743.0, "text": " the the rule based systems can this can be an advantage over rule based system"}, {"start": 2743.0, "end": 2749.6, "text": " because what this here does is it simply says oh I've seen a lot of humans in my"}, {"start": 2749.6, "end": 2757.12, "text": " code base that use this use like stir as a as a variable name and that usually"}, {"start": 2757.12, "end": 2762.88, "text": " means that the constructs here are like the constructs in Java where people use"}, {"start": 2762.88, "end": 2768.3599999999997, "text": " strings and I've seen other places where people use you know names like this"}, {"start": 2768.3599999999997, "end": 2773.88, "text": " right here and usually that is used in the same context as in Java people use"}, {"start": 2773.88, "end": 2779.48, "text": " character arrays right so it in programming it's not only important what"}, {"start": 2779.48, "end": 2784.7599999999998, "text": " the the code actually does but a lot of programming goes via naming of things"}, {"start": 2784.76, "end": 2789.6800000000003, "text": " like other programmers will read your code and by reading stir right here they"}, {"start": 2789.6800000000003, "end": 2794.48, "text": " will sort of assume that this is a string whereas if they read our right"}, {"start": 2794.48, "end": 2799.84, "text": " here they will assume you're a pirate and you are referring to a character"}, {"start": 2799.84, "end": 2805.0800000000004, "text": " array and they will treat the code the code means something different and these"}, {"start": 2805.0800000000004, "end": 2809.44, "text": " systems right here these neural machine translation systems can actually"}, {"start": 2809.44, "end": 2815.12, "text": " understand that part because they do statistical inference on code that humans"}, {"start": 2815.12, "end": 2821.2400000000002, "text": " wrote if you change this back to say input then again it goes back to a"}, {"start": 2821.2400000000002, "end": 2827.44, "text": " string and uses all the string functions so that's fairly impressive in my mind"}, {"start": 2827.44, "end": 2833.48, "text": " and it yeah definitely an advantage over rule based systems of course the"}, {"start": 2833.48, "end": 2836.8, "text": " disadvantage of a rule based systems is that in rule based systems you can"}, {"start": 2836.8, "end": 2841.0600000000004, "text": " almost get on like sometimes you can even guarantee that the code does the"}, {"start": 2841.0600000000004, "end": 2848.6000000000004, "text": " same thing here you can't they give some examples of failed translations where so"}, {"start": 2848.6000000000004, "end": 2853.36, "text": " now you get you run into this problem where the min function in Python is"}, {"start": 2853.36, "end": 2858.2000000000003, "text": " overloaded it can either give you the minimum of a sequence or it can give you"}, {"start": 2858.2000000000003, "end": 2864.7200000000003, "text": " the minimum of two things now this is translated to Java right here and math"}, {"start": 2864.72, "end": 2869.9199999999996, "text": " dot min is not overloaded in Java it only gives you the minimum of two things"}, {"start": 2869.9199999999996, "end": 2876.16, "text": " and not the minimum of an array and it still outputs that now given enough data"}, {"start": 2876.16, "end": 2880.68, "text": " probably could learn because these things are all context dependent but"}, {"start": 2880.68, "end": 2886.7599999999998, "text": " this is one of the this is one of the failure cases of these models of course"}, {"start": 2886.7599999999998, "end": 2894.6, "text": " all right so this was this paper I I've I've read that the code of this and"}, {"start": 2894.6, "end": 2900.56, "text": " the unit tests will be output will be put online at some times they are not"}, {"start": 2900.56, "end": 2907.6, "text": " right now if I if I hear about it I can link to it or let you know about it let"}, {"start": 2907.6, "end": 2912.72, "text": " me know what you think of this paper in the comments share it out and subscribe"}, {"start": 2912.72, "end": 2925.48, "text": " if you haven't yet and bye bye"}]
Yannic Kilchner
https://www.youtube.com/watch?v=cvkeWwDQr0A
JOIN ME for the NeurIPS 2020 Flatland Multi-Agent RL Challenge!
Join me to solve the NeurIPS 2020 challenge on multi-agent reinforcement learning in the flatland environment. This challenge has participants optimize a complex train scheduling system, subject to accidents, delays and re-routing. The plan is to solve this as a community with no expectations of winning and fully in the open. Discord: https://discord.gg/4H8xxDF Community GitHub Repo: https://github.com/yk/youtube-flatland Neurips 2020 Flatland Challenge: https://www.aicrowd.com/challenges/neurips-2020-flatland-challenge Flatland Environment: https://gitlab.aicrowd.com/flatland/flatland OUTLINE: 0:00 - Intro 1:00 - The Flatland Environment 2:00 - The NeurIPS 2020 Flatland Challenge 3:20 - Let's do this as a Community 4:10 - Ground Rules 6:15 - Conclusion Links: YouTube: https://www.youtube.com/c/yannickilcher Twitter: https://twitter.com/ykilcher Discord: https://discord.gg/4H8xxDF BitChute: https://www.bitchute.com/channel/yannic-kilcher Minds: https://www.minds.com/ykilcher
Hi there, today I want to talk to you about something that's very near and dear to my heart. And that is the flatland environment. Now the flatland environment is a train simulator that has been developed by the Swiss train company. And I ride the trains every day. So when I heard that there is a new ribs challenge to use the flatland environment to make the train system in my country better. I of course was very excited to do that. So out of purely egotistical reasons, I'm going to present to you the flatland environment. And I invite you to join me in solving this as a group together. So the plan is basically that we as a community sort of do this challenge and completely in the open, with absolutely no aspirations of winning or doing well or getting any of the prizes just for the fun of it. And we'll see how far it will come together. Okay, so let me demonstrate the environment itself. So as you can see here, this is a visualization of the environments. There are these agents in the environments and they have to reach certain goals. And of course, they can't crash. If you look here to the left, there's a bunch of them crashing right now, which is not good. And your task is this is a multi agent reinforcement learning problem. All of these agents have to reach their goal and as fast as possible without any collisions along these tracks right here. So you have based basically have to specify for every single agent what their next action at each time step is. Now the simulator is completely given to you. This is you can you can use it. And basically, it's a planning problem for multiple agents. So you at each step, you have to decide, does the agent move up, down, left or right, depending on whether they can do so depending on the tracks and whether something is in their way or is not in their way. And you know, every agent should reach their goal at the closest possible or at the shortest possible time, of course. Now there is this NeurIPS 2020 flatland challenge. And basically, you can submit your solutions to their evaluator. And there's a leaderboard and everything and I thought it would be fun to participate in this. Now I don't exactly know what the what's the exact connection to NeurIPS and so on. But I don't care, honestly. And this hasn't started yet. The timeline isn't really open yet, but it will start soon. But I think we can already start working on it. So the plan here is basically to just kind of, I have no idea of traffic scheduling, no idea, absolutely clueless. But I know a lot about reinforcement learning. And even though they say the challenge has already existed last year, in a very in a slightly different form, I think it was just one agent instead of multi agent. And they said, usually you have to combine the reinforcement learning with like some traditional stuff in order to perform really well like screw that. No, I'm totally up for that. But it would be fun to just blast it off with RL and go there. So here's my proposition. I have opened a Discord server for you to join where you can join and basically people can discuss solutions to this problem. I'll make a GitHub repository in public where people can submit poll requests to and I'll be sort of the merger and whatnot of these. And we together sort of develop solutions. Now my idea is that people would sort of independently try things and then kind of suggest things and if they work, we can merge them and whatnot. And there's just a lot of discussion in the Discord server. I myself will not be like super active on the server. It's meant for the community basically together to discuss things and whoever wants to do that. So I just want to make some things clear from the beginning. I will be the dictator of this project, the 100% authoritarian, no compromises dictator. If anything is supposed to make it be decided, I may elect to hold a vote and I may not. If we win something, I'll decide what to do with it. So just this because otherwise there's just trouble, right? Are we going to win? Probably not because anyone could just come to our GitHub repo, clone it and then tune it a little bit more. Right? So I have no aspirations of winning right here. So as I already said, I'm not going to be super active in this Discord. It's meant as a method for the community among itself to communicate. Third, if you decide to put in work, don't expect others to do so. Expect nothing. If the project doesn't work out, we scrap it. If people get tired of it, we scrap it. If there's some other problem, we scrap it. No expectations. Never get mad at anyone else for not doing as much work or anything like this. This is purely you participate because you yourself want to learn something, want to have fun. And if someone else does the same thing, that's all the better. Okay, I will have a mainly supervisory role in this in that I will look at things that are happening and advise and occasionally I of course will participate myself. So I hope the framing of this is clear. This is not me throwing a hundred percent at this. I just thought it would be cool to do something as a community together. And this challenge, it seems like, you know, there are other challenges like MineRL where everyone needs like a billion GPUs to even get competitive. This seems like small enough that we could actually make a difference here and hopefully do something very cool. Alright, if you still want to participate, even though I really, really, really try to talk you out of this right now, I will leave a link to the Discord somewhere in the description and a link to the Git repo as well. And I hope that some of you will be motivated enough to come join and have some fun. Alright, I'll see you there. Bye bye.
[{"start": 0.0, "end": 4.12, "text": " Hi there, today I want to talk to you about something that's very near and dear to my"}, {"start": 4.12, "end": 5.12, "text": " heart."}, {"start": 5.12, "end": 8.06, "text": " And that is the flatland environment."}, {"start": 8.06, "end": 12.88, "text": " Now the flatland environment is a train simulator that has been developed by the Swiss train"}, {"start": 12.88, "end": 14.040000000000001, "text": " company."}, {"start": 14.040000000000001, "end": 16.36, "text": " And I ride the trains every day."}, {"start": 16.36, "end": 21.86, "text": " So when I heard that there is a new ribs challenge to use the flatland environment to make the"}, {"start": 21.86, "end": 23.96, "text": " train system in my country better."}, {"start": 23.96, "end": 27.060000000000002, "text": " I of course was very excited to do that."}, {"start": 27.06, "end": 32.82, "text": " So out of purely egotistical reasons, I'm going to present to you the flatland environment."}, {"start": 32.82, "end": 38.32, "text": " And I invite you to join me in solving this as a group together."}, {"start": 38.32, "end": 44.64, "text": " So the plan is basically that we as a community sort of do this challenge and completely in"}, {"start": 44.64, "end": 51.0, "text": " the open, with absolutely no aspirations of winning or doing well or getting any of the"}, {"start": 51.0, "end": 53.72, "text": " prizes just for the fun of it."}, {"start": 53.72, "end": 57.24, "text": " And we'll see how far it will come together."}, {"start": 57.24, "end": 61.1, "text": " Okay, so let me demonstrate the environment itself."}, {"start": 61.1, "end": 63.94, "text": " So as you can see here, this is a visualization of the environments."}, {"start": 63.94, "end": 67.84, "text": " There are these agents in the environments and they have to reach certain goals."}, {"start": 67.84, "end": 69.96000000000001, "text": " And of course, they can't crash."}, {"start": 69.96000000000001, "end": 74.92, "text": " If you look here to the left, there's a bunch of them crashing right now, which is not good."}, {"start": 74.92, "end": 79.58, "text": " And your task is this is a multi agent reinforcement learning problem."}, {"start": 79.58, "end": 85.64, "text": " All of these agents have to reach their goal and as fast as possible without any collisions"}, {"start": 85.64, "end": 87.92, "text": " along these tracks right here."}, {"start": 87.92, "end": 93.92, "text": " So you have based basically have to specify for every single agent what their next action"}, {"start": 93.92, "end": 96.3, "text": " at each time step is."}, {"start": 96.3, "end": 99.75999999999999, "text": " Now the simulator is completely given to you."}, {"start": 99.75999999999999, "end": 102.08, "text": " This is you can you can use it."}, {"start": 102.08, "end": 104.74, "text": " And basically, it's a planning problem for multiple agents."}, {"start": 104.74, "end": 109.32, "text": " So you at each step, you have to decide, does the agent move up, down, left or right, depending"}, {"start": 109.32, "end": 114.08, "text": " on whether they can do so depending on the tracks and whether something is in their way"}, {"start": 114.08, "end": 116.22, "text": " or is not in their way."}, {"start": 116.22, "end": 122.11999999999999, "text": " And you know, every agent should reach their goal at the closest possible or at the shortest"}, {"start": 122.11999999999999, "end": 124.52, "text": " possible time, of course."}, {"start": 124.52, "end": 129.56, "text": " Now there is this NeurIPS 2020 flatland challenge."}, {"start": 129.56, "end": 134.72, "text": " And basically, you can submit your solutions to their evaluator."}, {"start": 134.72, "end": 140.4, "text": " And there's a leaderboard and everything and I thought it would be fun to participate in"}, {"start": 140.4, "end": 141.4, "text": " this."}, {"start": 141.4, "end": 147.2, "text": " Now I don't exactly know what the what's the exact connection to NeurIPS and so on."}, {"start": 147.2, "end": 149.28, "text": " But I don't care, honestly."}, {"start": 149.28, "end": 151.4, "text": " And this hasn't started yet."}, {"start": 151.4, "end": 156.18, "text": " The timeline isn't really open yet, but it will start soon."}, {"start": 156.18, "end": 159.32, "text": " But I think we can already start working on it."}, {"start": 159.32, "end": 165.78, "text": " So the plan here is basically to just kind of, I have no idea of traffic scheduling,"}, {"start": 165.78, "end": 169.35999999999999, "text": " no idea, absolutely clueless."}, {"start": 169.35999999999999, "end": 171.7, "text": " But I know a lot about reinforcement learning."}, {"start": 171.7, "end": 177.01999999999998, "text": " And even though they say the challenge has already existed last year, in a very in a"}, {"start": 177.01999999999998, "end": 181.0, "text": " slightly different form, I think it was just one agent instead of multi agent."}, {"start": 181.0, "end": 186.01999999999998, "text": " And they said, usually you have to combine the reinforcement learning with like some"}, {"start": 186.02, "end": 190.8, "text": " traditional stuff in order to perform really well like screw that."}, {"start": 190.8, "end": 192.72, "text": " No, I'm totally up for that."}, {"start": 192.72, "end": 198.24, "text": " But it would be fun to just blast it off with RL and go there."}, {"start": 198.24, "end": 200.88, "text": " So here's my proposition."}, {"start": 200.88, "end": 207.44, "text": " I have opened a Discord server for you to join where you can join and basically people"}, {"start": 207.44, "end": 209.88, "text": " can discuss solutions to this problem."}, {"start": 209.88, "end": 216.64, "text": " I'll make a GitHub repository in public where people can submit poll requests to and I'll"}, {"start": 216.64, "end": 221.44, "text": " be sort of the merger and whatnot of these."}, {"start": 221.44, "end": 224.68, "text": " And we together sort of develop solutions."}, {"start": 224.68, "end": 231.48, "text": " Now my idea is that people would sort of independently try things and then kind of suggest things"}, {"start": 231.48, "end": 234.35999999999999, "text": " and if they work, we can merge them and whatnot."}, {"start": 234.35999999999999, "end": 237.92, "text": " And there's just a lot of discussion in the Discord server."}, {"start": 237.92, "end": 241.79999999999998, "text": " I myself will not be like super active on the server."}, {"start": 241.79999999999998, "end": 247.64, "text": " It's meant for the community basically together to discuss things and whoever wants to do"}, {"start": 247.64, "end": 248.83999999999997, "text": " that."}, {"start": 248.83999999999997, "end": 254.11999999999998, "text": " So I just want to make some things clear from the beginning."}, {"start": 254.11999999999998, "end": 263.28, "text": " I will be the dictator of this project, the 100% authoritarian, no compromises dictator."}, {"start": 263.28, "end": 269.67999999999995, "text": " If anything is supposed to make it be decided, I may elect to hold a vote and I may not."}, {"start": 269.67999999999995, "end": 274.15999999999997, "text": " If we win something, I'll decide what to do with it."}, {"start": 274.15999999999997, "end": 279.02, "text": " So just this because otherwise there's just trouble, right?"}, {"start": 279.02, "end": 280.08, "text": " Are we going to win?"}, {"start": 280.08, "end": 283.59999999999997, "text": " Probably not because anyone could just come to our GitHub repo, clone it and then tune"}, {"start": 283.59999999999997, "end": 285.44, "text": " it a little bit more."}, {"start": 285.44, "end": 286.44, "text": " Right?"}, {"start": 286.44, "end": 290.59999999999997, "text": " So I have no aspirations of winning right here."}, {"start": 290.6, "end": 295.46000000000004, "text": " So as I already said, I'm not going to be super active in this Discord."}, {"start": 295.46000000000004, "end": 301.36, "text": " It's meant as a method for the community among itself to communicate."}, {"start": 301.36, "end": 306.32000000000005, "text": " Third, if you decide to put in work, don't expect others to do so."}, {"start": 306.32000000000005, "end": 307.38, "text": " Expect nothing."}, {"start": 307.38, "end": 309.88, "text": " If the project doesn't work out, we scrap it."}, {"start": 309.88, "end": 312.38, "text": " If people get tired of it, we scrap it."}, {"start": 312.38, "end": 314.66, "text": " If there's some other problem, we scrap it."}, {"start": 314.66, "end": 317.36, "text": " No expectations."}, {"start": 317.36, "end": 322.72, "text": " Never get mad at anyone else for not doing as much work or anything like this."}, {"start": 322.72, "end": 327.64, "text": " This is purely you participate because you yourself want to learn something, want to"}, {"start": 327.64, "end": 328.8, "text": " have fun."}, {"start": 328.8, "end": 332.44, "text": " And if someone else does the same thing, that's all the better."}, {"start": 332.44, "end": 338.76, "text": " Okay, I will have a mainly supervisory role in this in that I will look at things that"}, {"start": 338.76, "end": 345.16, "text": " are happening and advise and occasionally I of course will participate myself."}, {"start": 345.16, "end": 348.44, "text": " So I hope the framing of this is clear."}, {"start": 348.44, "end": 351.04, "text": " This is not me throwing a hundred percent at this."}, {"start": 351.04, "end": 357.22, "text": " I just thought it would be cool to do something as a community together."}, {"start": 357.22, "end": 361.6, "text": " And this challenge, it seems like, you know, there are other challenges like MineRL where"}, {"start": 361.6, "end": 366.0, "text": " everyone needs like a billion GPUs to even get competitive."}, {"start": 366.0, "end": 372.04, "text": " This seems like small enough that we could actually make a difference here and hopefully"}, {"start": 372.04, "end": 373.48, "text": " do something very cool."}, {"start": 373.48, "end": 378.12, "text": " Alright, if you still want to participate, even though I really, really, really try to"}, {"start": 378.12, "end": 385.04, "text": " talk you out of this right now, I will leave a link to the Discord somewhere in the description"}, {"start": 385.04, "end": 388.8, "text": " and a link to the Git repo as well."}, {"start": 388.8, "end": 395.36, "text": " And I hope that some of you will be motivated enough to come join and have some fun."}, {"start": 395.36, "end": 397.92, "text": " Alright, I'll see you there."}, {"start": 397.92, "end": 403.52000000000004, "text": " Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=rl4nUngiR2k
BLEURT: Learning Robust Metrics for Text Generation (Paper Explained)
Proper evaluation of text generation models, such as machine translation systems, requires expensive and slow human assessment. As these models have gotten better in previous years, proxy-scores, like BLEU, are becoming less and less useful. This paper proposes to learn a proxy score and demonstrates that it correlates well with human raters, even as the data distribution shifts. OUTLINE: 0:00 - Intro & High-Level Overview 1:00 - The Problem with Evaluating Machine Translation 5:10 - Task Evaluation as a Learning Problem 10:45 - Naive Fine-Tuning BERT 13:25 - Pre-Training on Synthetic Data 16:50 - Generating the Synthetic Data 18:30 - Priming via Auxiliary Tasks 23:35 - Experiments & Distribution Shifts 27:00 - Concerns & Conclusion Paper: https://arxiv.org/abs/2004.04696 Code: https://github.com/google-research/bleurt Abstract: Text generation has made significant advances in the last few years. Yet, evaluation metrics have lagged behind, as the most popular choices (e.g., BLEU and ROUGE) may correlate poorly with human judgments. We propose BLEURT, a learned evaluation metric based on BERT that can model human judgments with a few thousand possibly biased training examples. A key aspect of our approach is a novel pre-training scheme that uses millions of synthetic examples to help the model generalize. BLEURT provides state-of-the-art results on the last three years of the WMT Metrics shared task and the WebNLG Competition dataset. In contrast to a vanilla BERT-based approach, it yields superior results even when the training data is scarce and out-of-distribution. Abstract: Thibault Sellam, Dipanjan Das, Ankur P. Parikh 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
Hello there, today we'll look at Blurt learning robust metrics for text generation by Tibalt Selam, Tipanjan Das and Ankur P. Parikh. So this paper on a high level proposes a new metric for text generation tasks such as machine translation by leveraging a BERT model to produce like an automated metric, an automated quality metric. And they make this BERT model robust by pre training it on a very wide array of tasks that they can use synthetic data to train it. And therefore, the model and this resulting score is very robust to shifts in distribution. And they advocate that this could be used in the future to assess text generation systems. Alright, as always, if you like content like this, consider subscribing and sharing it out and leaving a like tell YouTube that it's good content. Of course, only if you agree. So what's the problem with with evaluation for text generation? So if you know, the machine translation community, basically, what they do is they have these data sets where they translate from one language into another, let's say, English to French. And they have a training data set that is fairly okayishly large. And then they somehow need to evaluate this, okay, so you have like a test data set, but all you can really do is sort of calculate the perplexity of a language model that you produce or of a translation model that you produce. There's not really a metric for translation. So the gold standard is to get it to humans. So you train on this data set, you produce a program, let's this is your machine translation program that you produce from the data. And you you let this run on your evaluation data set. And you give the results to a bunch of human raters. These could be regular people, these could be linguists that are experts in translation in both languages. And they will score the each of the outputs of the machine translation systems. And at the end, you will get like a number like eight, your your system is eight good. The problem, of course, is this process is very, very slow. So the machine translation community does this every year. And it's, it's quite slow. And it's quite expensive, as you know, it requires these humans here to assess all of these systems output. And you want a sort of a sizable output, right, because you want sort of a good sample of the machine translation system. So this is not really satisfactory. But like an automated score, like perplexity is also not satisfactory. What people have done is they've come up with proxy scores for the humans. And two of those scores are called rouge and blue. And specifically blue is one of these metrics that people use. And it, it kind of it takes n grams in the sentences. So n grams would be like snippets of like, let's say four words after one another. And there would be these snippets and that the machine translation system produces, and then it would go into the validation data set, and look at the gold standard translation that was also produced by humans. And it would also look at these snippets of size four. And it would just kind of assess how many of the snippets overlap. Of course, the machine translation system has never seen the label like the gold standard for that particular set. Otherwise, it wouldn't, you know, be fair. But you basically compare n grams of output and gold and some gold standard, you can have multiple gold standards and so on. So this blue metric is more of like a heuristic. And it has been found to correlate fairly well with the humans up until recently, of course, with the explosion of neural machine translation, and especially transformer based machine translation, I guess and but also the their their system that use LSTMs with attention. These systems have become extremely, extremely good. I don't know if you've noticed, but Google Translate has been getting better and better really fast. I remember the the first years of Google Translate when people still made fun of it. I don't think many people make fun of it now. At least it's not a meme anymore. So this, the more the better and better these systems were, the more these metrics like blue and rouge have diverged from the humans. And they're not really reliable anymore, especially if you compare really high skill systems to each other. Blue tends to not correlate well with humans. And therefore, we're looking for a new metric, a new metric that correlates well with humans, but can be evaluated automatically. And this, this paper here proposes this blurt. Can we just stop with the variants on BERT? We get it, use BERT for everything, but you know, yeah, so they say it's a learned evaluation metric based on BERT that can model human judgments with a few 1000, possibly biased training examples. Okay, so what what you what you would do, in these cases, is now the the creation of a metric becomes a machine learning task itself. So what you'll have is, you'll have a data set of things that are gold standard translations by humans, you will have the output of the machine translation system, okay, you put them together. So you have the gold standard sentence, this is this would be the optimal translation, you'll have whatever the machine translation produced, and then you'll have a human look at it and create a score, like this eight right here, it says this, these two sentences, they match eight good. Okay, so eight, maybe it's out of 10. So this, this bottom thing is a very good translation for the for the top thing, like to match the top thing or the human assesses the quality of the sample. And now we have a training data set, right, you have a z they call I think this z and z tilde or something or y. Yes, this is zip, zip. They call this y, which is the gold standard label. This is y tilde, whatever the machine produced, and or x, x, x tilde, and then y is the label. So your task is now given x and x tilde, predict whatever the human would say about this. Okay, so if you can collect a few of these samples right here, of different machine translation systems, then you can formulate you can make a data set out of this, right and formulate a machine learning task. And that's exactly what these competitions have done. So it's like a meta meta competition now can it's a competition for designing the best metrics of the other competitions, basically. And of course, the difficulty here is that the data set isn't static. Because if you come up with a metric such as blue, let's say you come up with a better blue, you would want these, these these other tasks to use it in the next years as well, because the thing about metrics is you need to be able to compare to like previous years and so on. So you would want a metric that is still valid for other years and other sort of other slightly different tasks and also for other machine translation systems. So if you just learn on data from now from this year's this year's competitions, and in five years, all of these models will have become so much better and they'll produce different output. And that's the difficulty your metric should still be valid at that point. And this paper basically deals with the deals with the fact that can you learn such a metric from data that exists at one point in time, that will be robust to shifts in distribution. So in five years, the machine translation systems, they're better, they may be used different language constructs to translate certain things, because that's they assess that better, can you still make a good judgment about which one, which of these systems is better than the other system? Can you still assess how humans would rate the systems. And they're saying that they found the method to do this. This blurt as they said, not only have they found the method, but their method only uses a few 1000 possibly biased training examples. And they do this via a new pre training scheme. So they say a key aspect of our approach is a novel pre training scheme that uses millions of synthetic examples to help the model generalize. Now, why is it important that it only uses a few 1000 training examples, because these are generated by humans, right, and humans are expensive. So and, and it's not like like ImageNet, you do it once you have it for 20 years, this is done year after year, and you need real experts like translation experts. So this is expensive. So the fewer of these actual training examples that the thing can can be efficient on the better. So they circumvent this by using, they say millions of synthetic examples to help the model generalize, they do this in a pre training step. They stay. Blurt provides state of the art results on the last three years of the WMT metrics shared tasks. Now this is this, this is this meta task, where you're asked to come up with a metric for the other tasks, and the web NLG competition data set, in contrast to a vanilla bird based approach yield superior results even when the training data scares and out of distribution. Right? So let's have a look at what they do. Okay, so they say, what what do we need to do to fine tune BERT for quality evaluation? Now, if you don't know what BERT is, BERT is this, it's basically a model that takes in a bunch of text. So you have a bunch of text, and then it's a model that is a transformer, I've made a video on it, if you if you want to check that out. And then you get as outputs, you get like a sequence of vectors, but important, most of the time is only the first one, which you then use in a subsequent task. For example, if you want to do classification, you would output you would put a classification layer on top to classify it into certain classes. If you want to do regression, you do that. You can do other things with these outputs right here. But for this particular paper, only this CLS output is relevant. Okay, so you would input this pair of gold standard and output of the machine. And the output would be a output y, which is either a number or a class label. And in this case, it's a number, okay, so you input right here, you input these, these two things, and outcomes this whole sequence and you only you take the CLS output vector, and you put it through a linear layer right here, weights and bias, and that would output the number y and the number y you train to be as close as possible to the human to what the human would say about this pair x, the gold standard and x tilde, the output of the system, okay. So this is what you would do. If you were simply going about it, just take BERT, take the the model. So BERT is really good at language, right? Take the model and train it on this data set. They say, however, fine tuning BERT requires a sizable amount of IID data, okay, we don't have that in these tasks, which is less than ideal for a metric that should generalize to a variety of tasks and model drift. So the problem with just applying BERT here is that way, they say it, you don't have enough data, and it's it won't be a robust solution, it will only work for this particular data set that you train it on. The solution they say is the pre train on synthetic data. So what does that mean? They say, the key aspect of our approach is a pre training technique that we use to warm up BERT before fine tuning on the rating data. And you might know BERT, BERT training, which is where you do this masked language model pre training, right? So if you are given a piece of text, let's say you're given this piece of text right here, what you would do is you would drop out a couple of words like this one and this one, and ask BERT to reconstruct it like a denoising auto encoder. And that way, BERT learns sort of about language in this particular way. Now, they they're not saying you should replace that what they're saying is first, first, you should do this masked language model pre training. Second, you should do their synthetic pre training. And third, you should do the fine tuning. Now, if in the in the naive approach, you would skip this step too, right? So their claim is that by introduction of this step two, that you could be a lot better and a lot more robust, because you've already had like, so you're already exposed to information in this step that will make you more robust to distribution shifts in this fine tuning data later. Okay, now, I've short inter interlude right here, I've advocated for this step to be called priming, priming, because otherwise, you always have to say like, okay, pre I want to pre train BERT, but I don't mean like pre pre training, like I don't mean this, this, this is already called pre training. I want to pre train after pre train. So I just vote for this to be called priming. I have no idea. Like if you come up with stuff like this, probably you've heard it somewhere. So I'm, I guess I'm, I might not be the inventor of this. But it is a good sounding word. And it sort of fits, right? Okay. So they say we generate a large number of synthetic reference candidate pairs. So what they're going to do is, they're going to take a bunch of text, and in their case, I think it's Wikipedia. And for each Wikipedia article, they're going to, so they, they take Wikipedia, they're going to draw sentences or samples or paragraphs from Wikipedia. And these are going to be your Z. And then they're going to kind of muddle with them a bit, they're going to disturb them a bit to make them a bit different, to make them go Z tilde. And this simulates that the difference between what the machine translation outputs and the gold standard sentence, they're usually not exactly the same, right? If you translate a sentence, there are many ways you can do it. And their goal is to sort of produce a data set that has sentences and sort of perturbed versions of the sentence, but not perturbed, like randomly, but perturbed in a sort of language knowledgeable way. Okay. So how do they how do they do this? They have three different ways. First of all, mask filling with BERT. So what they're doing is they take a BERT that can do language modeling, right, a pre trained BERT, and let's again, say we have this text right here, and they simply drop out two words or so and fill them in again with BERT. Now BERT might produce the same words, or it might produce slightly different words, depending on how many you drop out, you can choose the kind of amount that you perturb these sentences. Okay. So the second is they back translate. So what they do with back translation is they use a machine translation model. Now it doesn't matter which one you take at a they use any machine translation model to take a sentence z, and then they map it to another language, say, from English to French. So this is z French, and then they map it back again, which the z tilde is now the French to English translation. So you need to translation model. First, you translate it to French, and then you translate it back again. And that would sometimes give you the same sentence, but often it will give you sort of a paraphrase of the sentence that you had at the beginning. Okay, so that would be the second version that you could make pairs of sentences that are sort of similar. And the third way is just to drop out words. They just found this to to help. Okay, so now they have a giant data set of sentences and perturbed versions of sentences. So what are they going to do with that giant data set? And the answer is they're going to take this z and z tilde, and you're going to put that into Bert into their thing that they prime now, this is the priming stage, right? This was pre trained on mask language modeling. Now they want to prime it, what are they going to do, they're going to take this CLS vector. And now of course, this is not the final task, and we don't have final labels for these two things. So we need to somehow come up with our own late tasks and labels for them. And they decide to go a whole bunch of tasks. So they go like, they go like, I think, I don't even know they go eight or so or five or so different tasks, they construct different tasks to perform with these two things. And this could be metrics like blue or rouge or this Bert score right here. So you simply calculate the n gram overlap between z and z prime, that would be one of the scores. It could be the back translation likelihood, which is how likely does a back translation model assess this sentence? Oh, here's all the things, six, six different tasks, okay, so six different tasks. And that the catch here is. So what would happen, for example, with blue is, you would take a model and you would calculate the blue score between those two things. But you wouldn't input that into Bert, you would ask Bert to predict the blue score, okay, so Bert would be outputting B hat, and B would be the actual blue score. So you would train Bert to predict the blue score of this particular pair of input. And so one you want you take as like the input and the other one you take as the reference. Okay, and you would ask Bert to predict the blue score of this to predict the rouge score, you would ask it all of these signals, you ask this one the same model, you ask to predict all of these scores for these two things, okay, so you can calculate all of these scores by either blow is like a script you run, or you have some other model, like a pre trained translation model that you use to assess the that you ask, how good is this in terms of this particular task back translation? And then you try to predict that score, where is important, you're not training the model to perform these tasks. These tasks, you already have another model that's specialized to these particular tasks, and you simply ask them to score the input. Okay, you have an entailment model that outputs how much by how much does the second sentence entail the first that basically means does the second sentence follow from the first? And of course, this is not, you know, it's not actually proper input data for that task, but you can still ask the model. And if these are good translations of each other, if these sentences match, then the second one should probably follow fairly well for the first. But at least you can, if you make Bert predict that it will learn something useful about the relation between the two sentences. So the entire game name of the game here is to come up with tasks that if Bert learns to predict the score of these tasks on those inputs, sorry, on pretending one is the input and the other one is the output or on the two inputs, and then trying to predict the score, then Bert would learn something useful. Okay, so that's that's the the the trick here is to come up with these pre training tasks, and you train them all at the same time. And by doing it all at the same time, and by doing it on many, many different perturbations on these different tasks, you hope that your model learns something. Some, it's kind of becoming attune to the variations that language can have and what it needs to pay attention to. And then you hope that if you then have done this, then take this model, and then do step three, which is fine tuning on the actual data you have, you would guess that it becomes very good at that data, but also it retains all of these abilities, and and generalizes better to other sort of distribution shifts. Alright, so that is that is the thing here. And they on this task on this metric learning tasks, they do outperform all other models right here. And what I find interesting is down here where they now test for the for the distribution shift. So what they're saying is, okay, this is all on data, basically, where, you know, we train on training data and evaluate on testing data, and they're sort of the same, they come from the same year from the same machine turn translation models. And we don't really know how, you know, next year, the machine translation models might be different, does our scores still hold. So they try to simulate this by splitting the data. And they introduced this skew factor. So what they'll do is they'll split the data. So usually, as you can see right here, the training date, the ratings, these are the human ratings, these are the human ratings, the training data is sort of distributed like this would be the test data. And the training data would almost be overlapping that if you can see like the dotted lines right here or so. So you can see the overlap between the test and the trained out of the human ratings is very close. Now they say we can we can skew that we can sort of filter the data such that in the training data, only very bad sentences are and in the test data, there are only very good sentences, okay. And this simulates the fact that, you know, we this might be the previous year's data that we train our metric on. And then we evaluated on the next year's data where all the systems have become better. And what this does is you can see right here, the bottom axis is the test skew. And the color here is the training skew. Okay, so what interests what we're interested in is to the right and down the colors. So as these skew increases, you can see right here that the the quality of the metric decreases, okay, the correlation with the human ratings decreases, but it, it still remains fairly well. But especially the training skew, if you update the train, so if you make the training examples really bad, so to say, it the score just drops down. And they can show pretty well here that if you add this pre training, then the score except in this extreme case, so the score for all of these, it remains relatively high and especially remains above the blue score, which is always sort of worse. Right? So this is is pretty, as pretty neat and shows this power of this pre training. Basically, that's that's the the robustness to quality drift metric. And they have a bunch of other metrics right here where they ablate and so on. But I don't want to go too much into that. I more want to make some comments on on this work. So what what I think so first of all, in a paper like this, what what I would like to see is like the extrapolation right here to if and where this ever crosses the the blue score, right? Because I mean, okay, it seems like yeah, this skew of three is a big number. But who knows if three is a big number, right? Like, we can't assess that. What we need to see is really the where the crossover point between the models to to assess where does it where is it no longer valid and so on. The second part here is that my problem with this method of splitting the data, I mean, yes, okay, you split the bad from the good, but it's not it's not only that these things are getting better. So right now, everyone's using transformers for everyone's using BERT for everything, right? And BERT is a specific architecture that is going to be good at specific things at specific grammatical constructs in specific languages, right? So it's the mistakes it makes are very systematic. Now, if in one year or two years, all of a sudden, the new model pops up, I don't know, like, someone discovers that graph neural networks are really good at machine translation, these models are going to be attuned to a very, very different set of construct, they might be better overall, but they're going to make a different sort of mistake. And so I think just assessing the skew via just dividing up the data in into bad and good ratings, I don't think that covers these distribution shifts that they set out to cover, right? What I would have expected is something like them, because these tasks are repeated, year after year, and I would have expected them to, for example, train on 2017 and then evaluate on 2019 or something like or show, like evaluate on like evaluate on 2017 2018 and 2019. And there we would have a much better assessment of a distribution shift over the years, right? So so it is not super convincing to me. And what is most worrisome is if you look at their pre training tasks, I mean, okay, there is a there's blue and rouge. But there is BERT score, right, there is entailment, which is also a BERT model. And the back translation, I mean, who knows, that's probably either going to be a transformer or a LSTM with an attention mechanism, which is the attention mechanism is the basis for transformers. So all of these things are basically going to make the same sort of bias mistakes, right, they're going to, to, it's not it's not like there is Gaussian noise on top of these things, all of these things are going to be weak in the same sort of assessments, and not agree with, like, they're going to have systematic errors in them with respect to them predicting the human scores. And if we evaluate our systems that some are also using exactly that thing, right, so these the systems we evaluate, they are using the same type of models as here, they're going to fall prey to the same type of mistakes. And then if we switch over to systems that use some different right, so next year, we have some systems that use different techniques, they're going to be like, exactly, maybe not bad in these particular things, but bad in other things. And then this thing will output a systematically biased assessment. So it's sort of a house of like, if you've seen these images of plugging in the power strip into itself, and you have infinite power, it's like it's very, to me, it's seems very dangerous to have a such an overlap of architectures and methods to evaluate systems as you have in the systems themselves. But I hope this will be regularly checked with human scores and assessed as to how much these systems are out of sync or in sync with humans. Alright, this was it for me for Blurt. Check out they have the code available. The metric is available. Evaluate your stuff with it and bye bye.
[{"start": 0.0, "end": 6.640000000000001, "text": " Hello there, today we'll look at Blurt learning robust metrics for text generation by Tibalt"}, {"start": 6.640000000000001, "end": 14.32, "text": " Selam, Tipanjan Das and Ankur P. Parikh. So this paper on a high level proposes a new metric for"}, {"start": 14.32, "end": 21.6, "text": " text generation tasks such as machine translation by leveraging a BERT model to produce like an"}, {"start": 21.6, "end": 28.6, "text": " automated metric, an automated quality metric. And they make this BERT model robust by pre training"}, {"start": 28.6, "end": 36.120000000000005, "text": " it on a very wide array of tasks that they can use synthetic data to train it. And therefore,"}, {"start": 36.120000000000005, "end": 44.52, "text": " the model and this resulting score is very robust to shifts in distribution. And they advocate that"}, {"start": 44.52, "end": 50.36, "text": " this could be used in the future to assess text generation systems. Alright, as always, if you"}, {"start": 50.36, "end": 56.72, "text": " like content like this, consider subscribing and sharing it out and leaving a like tell YouTube"}, {"start": 56.72, "end": 65.6, "text": " that it's good content. Of course, only if you agree. So what's the problem with with evaluation"}, {"start": 65.6, "end": 72.03999999999999, "text": " for text generation? So if you know, the machine translation community, basically, what they do is"}, {"start": 72.03999999999999, "end": 77.98, "text": " they have these data sets where they translate from one language into another, let's say, English to"}, {"start": 77.98, "end": 88.08, "text": " French. And they have a training data set that is fairly okayishly large. And then they somehow need"}, {"start": 88.08, "end": 93.44, "text": " to evaluate this, okay, so you have like a test data set, but all you can really do is sort of"}, {"start": 93.44, "end": 99.04, "text": " calculate the perplexity of a language model that you produce or of a translation model that you"}, {"start": 99.04, "end": 104.68, "text": " produce. There's not really a metric for translation. So the gold standard is to get it to"}, {"start": 104.68, "end": 110.92, "text": " humans. So you train on this data set, you produce a program, let's this is your machine translation"}, {"start": 110.92, "end": 117.72000000000001, "text": " program that you produce from the data. And you you let this run on your evaluation data set. And"}, {"start": 117.72000000000001, "end": 122.72, "text": " you give the results to a bunch of human raters. These could be regular people, these could be"}, {"start": 122.72, "end": 130.44, "text": " linguists that are experts in translation in both languages. And they will score the each of the"}, {"start": 130.44, "end": 136.16, "text": " outputs of the machine translation systems. And at the end, you will get like a number like eight,"}, {"start": 136.32, "end": 142.68, "text": " your your system is eight good. The problem, of course, is this process is very, very slow. So the"}, {"start": 142.68, "end": 147.4, "text": " machine translation community does this every year. And it's, it's quite slow. And it's quite"}, {"start": 147.4, "end": 153.04, "text": " expensive, as you know, it requires these humans here to assess all of these systems output. And"}, {"start": 153.04, "end": 158.7, "text": " you want a sort of a sizable output, right, because you want sort of a good sample of the machine"}, {"start": 158.7, "end": 166.51999999999998, "text": " translation system. So this is not really satisfactory. But like an automated score, like"}, {"start": 166.51999999999998, "end": 172.32, "text": " perplexity is also not satisfactory. What people have done is they've come up with proxy scores for"}, {"start": 172.32, "end": 180.83999999999997, "text": " the humans. And two of those scores are called rouge and blue. And specifically blue is one of"}, {"start": 180.83999999999997, "end": 187.76, "text": " these metrics that people use. And it, it kind of it takes n grams in the sentences. So n grams would"}, {"start": 187.76, "end": 193.28, "text": " be like snippets of like, let's say four words after one another. And there would be these"}, {"start": 193.32, "end": 198.76, "text": " snippets and that the machine translation system produces, and then it would go into the validation"}, {"start": 198.76, "end": 205.16, "text": " data set, and look at the gold standard translation that was also produced by humans. And it would"}, {"start": 205.16, "end": 210.95999999999998, "text": " also look at these snippets of size four. And it would just kind of assess how many of the snippets"}, {"start": 211.0, "end": 217.04, "text": " overlap. Of course, the machine translation system has never seen the label like the gold standard"}, {"start": 217.04, "end": 223.51999999999998, "text": " for that particular set. Otherwise, it wouldn't, you know, be fair. But you basically compare n"}, {"start": 223.51999999999998, "end": 230.64, "text": " grams of output and gold and some gold standard, you can have multiple gold standards and so on. So"}, {"start": 230.64, "end": 237.35999999999999, "text": " this blue metric is more of like a heuristic. And it has been found to correlate fairly well with"}, {"start": 237.35999999999999, "end": 243.04, "text": " the humans up until recently, of course, with the explosion of neural machine translation, and"}, {"start": 243.04, "end": 249.4, "text": " especially transformer based machine translation, I guess and but also the their their system that"}, {"start": 249.4, "end": 255.16, "text": " use LSTMs with attention. These systems have become extremely, extremely good. I don't know if"}, {"start": 255.2, "end": 262.03999999999996, "text": " you've noticed, but Google Translate has been getting better and better really fast. I remember"}, {"start": 262.03999999999996, "end": 267.4, "text": " the the first years of Google Translate when people still made fun of it. I don't think many"}, {"start": 267.4, "end": 275.67999999999995, "text": " people make fun of it now. At least it's not a meme anymore. So this, the more the better and"}, {"start": 275.67999999999995, "end": 283.23999999999995, "text": " better these systems were, the more these metrics like blue and rouge have diverged from the humans."}, {"start": 284.03999999999996, "end": 290.76, "text": " And they're not really reliable anymore, especially if you compare really high skill systems to each"}, {"start": 290.76, "end": 297.88, "text": " other. Blue tends to not correlate well with humans. And therefore, we're looking for a new"}, {"start": 297.88, "end": 307.44, "text": " metric, a new metric that correlates well with humans, but can be evaluated automatically. And"}, {"start": 307.76, "end": 314.88, "text": " this, this paper here proposes this blurt. Can we just stop with the variants on BERT? We get it,"}, {"start": 314.88, "end": 323.4, "text": " use BERT for everything, but you know, yeah, so they say it's a learned evaluation metric based on"}, {"start": 323.4, "end": 331.92, "text": " BERT that can model human judgments with a few 1000, possibly biased training examples. Okay, so"}, {"start": 332.2, "end": 342.0, "text": " what what you what you would do, in these cases, is now the the creation of a metric becomes a"}, {"start": 342.0, "end": 352.52, "text": " machine learning task itself. So what you'll have is, you'll have a data set of things that are gold"}, {"start": 352.52, "end": 360.08, "text": " standard translations by humans, you will have the output of the machine translation system, okay,"}, {"start": 360.08, "end": 364.88, "text": " you put them together. So you have the gold standard sentence, this is this would be the optimal"}, {"start": 364.88, "end": 369.84, "text": " translation, you'll have whatever the machine translation produced, and then you'll have a human"}, {"start": 369.84, "end": 377.15999999999997, "text": " look at it and create a score, like this eight right here, it says this, these two sentences, they"}, {"start": 377.15999999999997, "end": 384.84, "text": " match eight good. Okay, so eight, maybe it's out of 10. So this, this bottom thing is a very good"}, {"start": 384.84, "end": 391.47999999999996, "text": " translation for the for the top thing, like to match the top thing or the human assesses the"}, {"start": 391.47999999999996, "end": 399.47999999999996, "text": " quality of the sample. And now we have a training data set, right, you have a z they call I think"}, {"start": 399.48, "end": 408.64000000000004, "text": " this z and z tilde or something or y. Yes, this is zip, zip. They call this y, which is the gold"}, {"start": 408.64000000000004, "end": 416.76, "text": " standard label. This is y tilde, whatever the machine produced, and or x, x, x tilde, and then y"}, {"start": 416.78000000000003, "end": 425.08000000000004, "text": " is the label. So your task is now given x and x tilde, predict whatever the human would say about"}, {"start": 425.08, "end": 433.35999999999996, "text": " this. Okay, so if you can collect a few of these samples right here, of different machine translation"}, {"start": 433.35999999999996, "end": 440.03999999999996, "text": " systems, then you can formulate you can make a data set out of this, right and formulate a machine"}, {"start": 440.08, "end": 446.36, "text": " learning task. And that's exactly what these competitions have done. So it's like a meta meta"}, {"start": 446.36, "end": 453.15999999999997, "text": " competition now can it's a competition for designing the best metrics of the other competitions,"}, {"start": 453.16, "end": 460.40000000000003, "text": " basically. And of course, the difficulty here is that the data set isn't static. Because if you come"}, {"start": 460.40000000000003, "end": 466.52000000000004, "text": " up with a metric such as blue, let's say you come up with a better blue, you would want these, these"}, {"start": 466.56, "end": 472.0, "text": " these other tasks to use it in the next years as well, because the thing about metrics is you need"}, {"start": 472.0, "end": 477.04, "text": " to be able to compare to like previous years and so on. So you would want a metric that is still"}, {"start": 477.04, "end": 483.68, "text": " valid for other years and other sort of other slightly different tasks and also for other"}, {"start": 483.68, "end": 491.8, "text": " machine translation systems. So if you just learn on data from now from this year's this year's"}, {"start": 491.8, "end": 497.92, "text": " competitions, and in five years, all of these models will have become so much better and they'll"}, {"start": 497.92, "end": 504.8, "text": " produce different output. And that's the difficulty your metric should still be valid at that point."}, {"start": 504.8, "end": 512.96, "text": " And this paper basically deals with the deals with the fact that can you learn such a metric from"}, {"start": 512.96, "end": 521.24, "text": " data that exists at one point in time, that will be robust to shifts in distribution. So in five"}, {"start": 521.24, "end": 525.6, "text": " years, the machine translation systems, they're better, they may be used different language"}, {"start": 525.6, "end": 531.5600000000001, "text": " constructs to translate certain things, because that's they assess that better, can you still make"}, {"start": 531.56, "end": 536.4799999999999, "text": " a good judgment about which one, which of these systems is better than the other system? Can you"}, {"start": 536.4799999999999, "end": 545.8399999999999, "text": " still assess how humans would rate the systems. And they're saying that they found the method to"}, {"start": 545.8399999999999, "end": 554.16, "text": " do this. This blurt as they said, not only have they found the method, but their method only uses"}, {"start": 554.16, "end": 562.6, "text": " a few 1000 possibly biased training examples. And they do this via a new pre training scheme. So"}, {"start": 562.6, "end": 568.9599999999999, "text": " they say a key aspect of our approach is a novel pre training scheme that uses millions of synthetic"}, {"start": 568.9599999999999, "end": 574.56, "text": " examples to help the model generalize. Now, why is it important that it only uses a few 1000"}, {"start": 574.6, "end": 582.3199999999999, "text": " training examples, because these are generated by humans, right, and humans are expensive. So and,"}, {"start": 582.32, "end": 590.84, "text": " and it's not like like ImageNet, you do it once you have it for 20 years, this is done year after"}, {"start": 590.84, "end": 598.2, "text": " year, and you need real experts like translation experts. So this is expensive. So the fewer of"}, {"start": 598.2, "end": 607.2, "text": " these actual training examples that the thing can can be efficient on the better. So they"}, {"start": 607.2, "end": 613.0, "text": " circumvent this by using, they say millions of synthetic examples to help the model generalize,"}, {"start": 613.0, "end": 619.62, "text": " they do this in a pre training step. They stay. Blurt provides state of the art results on the"}, {"start": 619.62, "end": 626.0, "text": " last three years of the WMT metrics shared tasks. Now this is this, this is this meta task, where"}, {"start": 626.0, "end": 633.1600000000001, "text": " you're asked to come up with a metric for the other tasks, and the web NLG competition data"}, {"start": 633.16, "end": 638.76, "text": " set, in contrast to a vanilla bird based approach yield superior results even when the training data"}, {"start": 638.76, "end": 649.8399999999999, "text": " scares and out of distribution. Right? So let's have a look at what they do. Okay, so they say,"}, {"start": 650.24, "end": 656.0, "text": " what what do we need to do to fine tune BERT for quality evaluation? Now, if you don't know what"}, {"start": 656.0, "end": 664.84, "text": " BERT is, BERT is this, it's basically a model that takes in a bunch of text. So you have a bunch of"}, {"start": 664.84, "end": 670.84, "text": " text, and then it's a model that is a transformer, I've made a video on it, if you if you want to"}, {"start": 670.84, "end": 677.76, "text": " check that out. And then you get as outputs, you get like a sequence of vectors, but important,"}, {"start": 677.76, "end": 685.0, "text": " most of the time is only the first one, which you then use in a subsequent task. For example,"}, {"start": 685.0, "end": 691.2, "text": " if you want to do classification, you would output you would put a classification layer on top to"}, {"start": 691.2, "end": 697.92, "text": " classify it into certain classes. If you want to do regression, you do that. You can do other things"}, {"start": 697.92, "end": 704.88, "text": " with these outputs right here. But for this particular paper, only this CLS output is"}, {"start": 705.16, "end": 714.56, "text": " relevant. Okay, so you would input this pair of gold standard and output of the machine. And the"}, {"start": 714.56, "end": 722.3599999999999, "text": " output would be a output y, which is either a number or a class label. And in this case, it's a"}, {"start": 722.3599999999999, "end": 733.4799999999999, "text": " number, okay, so you input right here, you input these, these two things, and outcomes this whole"}, {"start": 733.4799999999999, "end": 740.7199999999999, "text": " sequence and you only you take the CLS output vector, and you put it through a linear layer"}, {"start": 740.72, "end": 747.22, "text": " right here, weights and bias, and that would output the number y and the number y you train to"}, {"start": 747.22, "end": 754.5400000000001, "text": " be as close as possible to the human to what the human would say about this pair x, the gold"}, {"start": 754.5400000000001, "end": 762.34, "text": " standard and x tilde, the output of the system, okay. So this is what you would do. If you were"}, {"start": 762.34, "end": 768.5, "text": " simply going about it, just take BERT, take the the model. So BERT is really good at language,"}, {"start": 768.5, "end": 777.02, "text": " right? Take the model and train it on this data set. They say, however, fine tuning BERT requires"}, {"start": 777.02, "end": 783.7, "text": " a sizable amount of IID data, okay, we don't have that in these tasks, which is less than ideal for"}, {"start": 783.7, "end": 790.98, "text": " a metric that should generalize to a variety of tasks and model drift. So the problem with just"}, {"start": 790.98, "end": 796.78, "text": " applying BERT here is that way, they say it, you don't have enough data, and it's it won't be a"}, {"start": 796.78, "end": 802.9399999999999, "text": " robust solution, it will only work for this particular data set that you train it on. The"}, {"start": 802.9399999999999, "end": 814.4599999999999, "text": " solution they say is the pre train on synthetic data. So what does that mean? They say, the key"}, {"start": 814.48, "end": 820.06, "text": " aspect of our approach is a pre training technique that we use to warm up BERT before fine tuning on"}, {"start": 820.06, "end": 828.26, "text": " the rating data. And you might know BERT, BERT training, which is where you do this masked"}, {"start": 828.26, "end": 833.26, "text": " language model pre training, right? So if you are given a piece of text, let's say you're given this"}, {"start": 833.7399999999999, "end": 838.8599999999999, "text": " piece of text right here, what you would do is you would drop out a couple of words like this one"}, {"start": 838.8599999999999, "end": 846.6999999999999, "text": " and this one, and ask BERT to reconstruct it like a denoising auto encoder. And that way, BERT"}, {"start": 846.7, "end": 852.6600000000001, "text": " learns sort of about language in this particular way. Now, they they're not saying you should"}, {"start": 852.6600000000001, "end": 859.4200000000001, "text": " replace that what they're saying is first, first, you should do this masked language model pre"}, {"start": 859.4200000000001, "end": 867.46, "text": " training. Second, you should do their synthetic pre training. And third, you should do the fine"}, {"start": 867.46, "end": 878.14, "text": " tuning. Now, if in the in the naive approach, you would skip this step too, right? So their claim is"}, {"start": 878.14, "end": 883.86, "text": " that by introduction of this step two, that you could be a lot better and a lot more robust,"}, {"start": 883.86, "end": 889.7, "text": " because you've already had like, so you're already exposed to information in this step that will"}, {"start": 889.7, "end": 900.1400000000001, "text": " make you more robust to distribution shifts in this fine tuning data later. Okay, now, I've short"}, {"start": 900.1400000000001, "end": 907.62, "text": " inter interlude right here, I've advocated for this step to be called priming, priming, because"}, {"start": 907.62, "end": 913.74, "text": " otherwise, you always have to say like, okay, pre I want to pre train BERT, but I don't mean like"}, {"start": 913.74, "end": 920.1, "text": " pre pre training, like I don't mean this, this, this is already called pre training. I want to pre"}, {"start": 920.1, "end": 929.98, "text": " train after pre train. So I just vote for this to be called priming. I have no idea. Like if you come"}, {"start": 929.98, "end": 935.54, "text": " up with stuff like this, probably you've heard it somewhere. So I'm, I guess I'm, I might not be the"}, {"start": 935.54, "end": 943.58, "text": " inventor of this. But it is a good sounding word. And it sort of fits, right? Okay. So they say we"}, {"start": 943.58, "end": 949.1800000000001, "text": " generate a large number of synthetic reference candidate pairs. So what they're going to do is,"}, {"start": 950.14, "end": 956.14, "text": " they're going to take a bunch of text, and in their case, I think it's Wikipedia. And for each"}, {"start": 956.14, "end": 964.4200000000001, "text": " Wikipedia article, they're going to, so they, they take Wikipedia, they're going to draw sentences"}, {"start": 964.4200000000001, "end": 971.6600000000001, "text": " or samples or paragraphs from Wikipedia. And these are going to be your Z. And then they're going to"}, {"start": 971.66, "end": 979.42, "text": " kind of muddle with them a bit, they're going to disturb them a bit to make them a bit different,"}, {"start": 979.5799999999999, "end": 986.18, "text": " to make them go Z tilde. And this simulates that the difference between what the machine"}, {"start": 986.18, "end": 991.6999999999999, "text": " translation outputs and the gold standard sentence, they're usually not exactly the same, right? If"}, {"start": 991.6999999999999, "end": 995.98, "text": " you translate a sentence, there are many ways you can do it. And their goal is to sort of produce a"}, {"start": 995.98, "end": 1003.7, "text": " data set that has sentences and sort of perturbed versions of the sentence, but not perturbed, like"}, {"start": 1003.74, "end": 1011.66, "text": " randomly, but perturbed in a sort of language knowledgeable way. Okay. So how do they how do"}, {"start": 1011.66, "end": 1020.22, "text": " they do this? They have three different ways. First of all, mask filling with BERT. So what"}, {"start": 1020.22, "end": 1025.02, "text": " they're doing is they take a BERT that can do language modeling, right, a pre trained BERT,"}, {"start": 1025.02, "end": 1031.62, "text": " and let's again, say we have this text right here, and they simply drop out two words or so and fill"}, {"start": 1031.62, "end": 1037.98, "text": " them in again with BERT. Now BERT might produce the same words, or it might produce slightly"}, {"start": 1037.98, "end": 1042.54, "text": " different words, depending on how many you drop out, you can choose the kind of amount that you"}, {"start": 1042.54, "end": 1053.58, "text": " perturb these sentences. Okay. So the second is they back translate. So what they do with back"}, {"start": 1053.58, "end": 1060.6599999999999, "text": " translation is they use a machine translation model. Now it doesn't matter which one you take"}, {"start": 1060.6599999999999, "end": 1069.6999999999998, "text": " at a they use any machine translation model to take a sentence z, and then they map it to another"}, {"start": 1069.6999999999998, "end": 1080.1, "text": " language, say, from English to French. So this is z French, and then they map it back again, which"}, {"start": 1080.1, "end": 1086.6599999999999, "text": " the z tilde is now the French to English translation. So you need to translation model. First, you"}, {"start": 1086.6599999999999, "end": 1092.5, "text": " translate it to French, and then you translate it back again. And that would sometimes give you the"}, {"start": 1092.5, "end": 1098.1, "text": " same sentence, but often it will give you sort of a paraphrase of the sentence that you had at the"}, {"start": 1098.1, "end": 1106.4199999999998, "text": " beginning. Okay, so that would be the second version that you could make pairs of sentences"}, {"start": 1106.42, "end": 1112.9, "text": " that are sort of similar. And the third way is just to drop out words. They just found this to"}, {"start": 1112.9, "end": 1120.02, "text": " to help. Okay, so now they have a giant data set of sentences and perturbed versions of sentences."}, {"start": 1120.02, "end": 1126.9, "text": " So what are they going to do with that giant data set? And the answer is they're going to take this"}, {"start": 1126.9, "end": 1136.66, "text": " z and z tilde, and you're going to put that into Bert into their thing that they prime now, this is"}, {"start": 1136.66, "end": 1141.14, "text": " the priming stage, right? This was pre trained on mask language modeling. Now they want to prime it,"}, {"start": 1141.14, "end": 1146.26, "text": " what are they going to do, they're going to take this CLS vector. And now of course, this is not"}, {"start": 1146.26, "end": 1152.3400000000001, "text": " the final task, and we don't have final labels for these two things. So we need to somehow come up"}, {"start": 1152.34, "end": 1160.74, "text": " with our own late tasks and labels for them. And they decide to go a whole bunch of tasks. So they"}, {"start": 1160.74, "end": 1170.8999999999999, "text": " go like, they go like, I think, I don't even know they go eight or so or five or so different tasks,"}, {"start": 1170.8999999999999, "end": 1178.1799999999998, "text": " they construct different tasks to perform with these two things. And this could be metrics like"}, {"start": 1178.18, "end": 1185.78, "text": " blue or rouge or this Bert score right here. So you simply calculate the n gram overlap between z"}, {"start": 1186.3400000000001, "end": 1193.3, "text": " and z prime, that would be one of the scores. It could be the back translation likelihood, which is"}, {"start": 1193.8600000000001, "end": 1200.5, "text": " how likely does a back translation model assess this sentence? Oh, here's all the things, six,"}, {"start": 1200.5, "end": 1209.38, "text": " six different tasks, okay, so six different tasks. And that the catch here is. So what would happen,"}, {"start": 1209.38, "end": 1217.14, "text": " for example, with blue is, you would take a model and you would calculate the blue score between"}, {"start": 1217.14, "end": 1223.38, "text": " those two things. But you wouldn't input that into Bert, you would ask Bert to predict the blue"}, {"start": 1223.38, "end": 1231.46, "text": " score, okay, so Bert would be outputting B hat, and B would be the actual blue score. So you would"}, {"start": 1231.46, "end": 1240.8200000000002, "text": " train Bert to predict the blue score of this particular pair of input. And so one you want"}, {"start": 1240.8200000000002, "end": 1246.3400000000001, "text": " you take as like the input and the other one you take as the reference. Okay, and you would ask"}, {"start": 1246.3400000000001, "end": 1252.42, "text": " Bert to predict the blue score of this to predict the rouge score, you would ask it all of these"}, {"start": 1252.42, "end": 1258.9, "text": " signals, you ask this one the same model, you ask to predict all of these scores for these two"}, {"start": 1258.9, "end": 1265.14, "text": " things, okay, so you can calculate all of these scores by either blow is like a script you run,"}, {"start": 1265.8600000000001, "end": 1273.0600000000002, "text": " or you have some other model, like a pre trained translation model that you use to assess the"}, {"start": 1274.3400000000001, "end": 1279.78, "text": " that you ask, how good is this in terms of this particular task back translation?"}, {"start": 1279.78, "end": 1285.86, "text": " And then you try to predict that score, where is important, you're not training the model to"}, {"start": 1285.86, "end": 1293.06, "text": " perform these tasks. These tasks, you already have another model that's specialized to these"}, {"start": 1293.06, "end": 1300.1, "text": " particular tasks, and you simply ask them to score the input. Okay, you have an entailment model"}, {"start": 1300.1, "end": 1305.7, "text": " that outputs how much by how much does the second sentence entail the first that basically means"}, {"start": 1305.7, "end": 1312.3400000000001, "text": " does the second sentence follow from the first? And of course, this is not, you know, it's not"}, {"start": 1312.3400000000001, "end": 1317.38, "text": " actually proper input data for that task, but you can still ask the model. And if these are"}, {"start": 1317.38, "end": 1323.38, "text": " good translations of each other, if these sentences match, then the second one should probably follow"}, {"start": 1323.38, "end": 1330.1000000000001, "text": " fairly well for the first. But at least you can, if you make Bert predict that it will learn"}, {"start": 1330.1, "end": 1336.82, "text": " something useful about the relation between the two sentences. So the entire game name of the game"}, {"start": 1336.82, "end": 1343.9399999999998, "text": " here is to come up with tasks that if Bert learns to predict the score of these tasks on those"}, {"start": 1343.9399999999998, "end": 1351.6999999999998, "text": " inputs, sorry, on pretending one is the input and the other one is the output or on the two inputs,"}, {"start": 1351.6999999999998, "end": 1358.82, "text": " and then trying to predict the score, then Bert would learn something useful. Okay, so that's"}, {"start": 1358.82, "end": 1366.5, "text": " that's the the the trick here is to come up with these pre training tasks, and you train them all"}, {"start": 1366.5, "end": 1372.26, "text": " at the same time. And by doing it all at the same time, and by doing it on many, many different"}, {"start": 1372.26, "end": 1379.46, "text": " perturbations on these different tasks, you hope that your model learns something. Some, it's kind"}, {"start": 1379.46, "end": 1385.78, "text": " of becoming attune to the variations that language can have and what it needs to pay attention to."}, {"start": 1385.78, "end": 1392.74, "text": " And then you hope that if you then have done this, then take this model, and then do step three,"}, {"start": 1392.74, "end": 1397.94, "text": " which is fine tuning on the actual data you have, you would guess that it becomes very good at that"}, {"start": 1397.94, "end": 1406.8999999999999, "text": " data, but also it retains all of these abilities, and and generalizes better to other sort of"}, {"start": 1406.9, "end": 1418.18, "text": " distribution shifts. Alright, so that is that is the thing here. And they on this task on this"}, {"start": 1418.18, "end": 1427.7, "text": " metric learning tasks, they do outperform all other models right here. And what I find interesting"}, {"start": 1427.7, "end": 1439.54, "text": " is down here where they now test for the for the distribution shift. So what they're saying is,"}, {"start": 1439.54, "end": 1447.22, "text": " okay, this is all on data, basically, where, you know, we train on training data and evaluate on"}, {"start": 1447.22, "end": 1451.38, "text": " testing data, and they're sort of the same, they come from the same year from the same machine"}, {"start": 1451.38, "end": 1458.5, "text": " turn translation models. And we don't really know how, you know, next year, the machine translation"}, {"start": 1458.5, "end": 1465.3000000000002, "text": " models might be different, does our scores still hold. So they try to simulate this by splitting"}, {"start": 1465.3000000000002, "end": 1472.0200000000002, "text": " the data. And they introduced this skew factor. So what they'll do is they'll split the data. So"}, {"start": 1472.0200000000002, "end": 1476.98, "text": " usually, as you can see right here, the training date, the ratings, these are the human ratings,"}, {"start": 1476.98, "end": 1486.02, "text": " these are the human ratings, the training data is sort of distributed like this would be the test"}, {"start": 1486.02, "end": 1493.38, "text": " data. And the training data would almost be overlapping that if you can see like the dotted"}, {"start": 1493.38, "end": 1500.42, "text": " lines right here or so. So you can see the overlap between the test and the trained out of the human"}, {"start": 1500.42, "end": 1507.3000000000002, "text": " ratings is very close. Now they say we can we can skew that we can sort of filter the data such that"}, {"start": 1507.3000000000002, "end": 1516.1000000000001, "text": " in the training data, only very bad sentences are and in the test data, there are only very good"}, {"start": 1516.1000000000001, "end": 1522.18, "text": " sentences, okay. And this simulates the fact that, you know, we this might be the previous year's"}, {"start": 1522.18, "end": 1528.26, "text": " data that we train our metric on. And then we evaluated on the next year's data where all the"}, {"start": 1528.26, "end": 1536.74, "text": " systems have become better. And what this does is you can see right here, the bottom axis is the"}, {"start": 1536.74, "end": 1547.06, "text": " test skew. And the color here is the training skew. Okay, so what interests what we're interested in is"}, {"start": 1548.82, "end": 1556.9, "text": " to the right and down the colors. So as these skew increases, you can see right here that the"}, {"start": 1556.9, "end": 1562.9, "text": " the quality of the metric decreases, okay, the correlation with the human ratings decreases,"}, {"start": 1562.9, "end": 1571.14, "text": " but it, it still remains fairly well. But especially the training skew, if you update the"}, {"start": 1571.14, "end": 1577.14, "text": " train, so if you make the training examples really bad, so to say, it the score just drops down."}, {"start": 1577.94, "end": 1585.14, "text": " And they can show pretty well here that if you add this pre training, then the score except in this"}, {"start": 1585.14, "end": 1591.14, "text": " extreme case, so the score for all of these, it remains relatively high and especially remains"}, {"start": 1591.14, "end": 1599.5400000000002, "text": " above the blue score, which is always sort of worse. Right? So this is is pretty, as pretty neat"}, {"start": 1599.5400000000002, "end": 1608.74, "text": " and shows this power of this pre training. Basically, that's that's the the robustness to"}, {"start": 1608.74, "end": 1614.5, "text": " quality drift metric. And they have a bunch of other metrics right here where they ablate and"}, {"start": 1614.5, "end": 1623.14, "text": " so on. But I don't want to go too much into that. I more want to make some comments on on this work."}, {"start": 1623.14, "end": 1630.34, "text": " So what what I think so first of all, in a paper like this, what what I would like to see is like"}, {"start": 1630.34, "end": 1639.14, "text": " the extrapolation right here to if and where this ever crosses the the blue score, right? Because I"}, {"start": 1639.14, "end": 1645.38, "text": " mean, okay, it seems like yeah, this skew of three is a big number. But who knows if three is a big"}, {"start": 1645.38, "end": 1651.6200000000001, "text": " number, right? Like, we can't assess that. What we need to see is really the where the crossover"}, {"start": 1651.6200000000001, "end": 1658.42, "text": " point between the models to to assess where does it where is it no longer valid and so on. The"}, {"start": 1658.42, "end": 1664.5, "text": " second part here is that my problem with this method of splitting the data, I mean, yes, okay,"}, {"start": 1664.5, "end": 1670.18, "text": " you split the bad from the good, but it's not it's not only that these things are getting better."}, {"start": 1671.06, "end": 1675.94, "text": " So right now, everyone's using transformers for everyone's using BERT for everything, right? And"}, {"start": 1675.94, "end": 1682.26, "text": " BERT is a specific architecture that is going to be good at specific things at specific grammatical"}, {"start": 1682.26, "end": 1689.14, "text": " constructs in specific languages, right? So it's the mistakes it makes are very systematic. Now,"}, {"start": 1689.14, "end": 1695.3000000000002, "text": " if in one year or two years, all of a sudden, the new model pops up, I don't know, like, someone"}, {"start": 1695.3000000000002, "end": 1700.5, "text": " discovers that graph neural networks are really good at machine translation, these models are"}, {"start": 1700.5, "end": 1706.98, "text": " going to be attuned to a very, very different set of construct, they might be better overall,"}, {"start": 1706.98, "end": 1713.0600000000002, "text": " but they're going to make a different sort of mistake. And so I think just assessing the skew"}, {"start": 1713.06, "end": 1720.02, "text": " via just dividing up the data in into bad and good ratings, I don't think that covers these"}, {"start": 1720.02, "end": 1725.54, "text": " distribution shifts that they set out to cover, right? What I would have expected is something"}, {"start": 1725.54, "end": 1732.8999999999999, "text": " like them, because these tasks are repeated, year after year, and I would have expected them to,"}, {"start": 1732.8999999999999, "end": 1740.98, "text": " for example, train on 2017 and then evaluate on 2019 or something like or show, like evaluate on"}, {"start": 1740.98, "end": 1748.5, "text": " like evaluate on 2017 2018 and 2019. And there we would have a much better assessment of a"}, {"start": 1748.5, "end": 1756.74, "text": " distribution shift over the years, right? So so it is not super convincing to me. And what is most"}, {"start": 1756.74, "end": 1763.14, "text": " worrisome is if you look at their pre training tasks, I mean, okay, there is a there's blue and"}, {"start": 1763.14, "end": 1771.5400000000002, "text": " rouge. But there is BERT score, right, there is entailment, which is also a BERT model. And the"}, {"start": 1771.5400000000002, "end": 1777.22, "text": " back translation, I mean, who knows, that's probably either going to be a transformer or a"}, {"start": 1777.22, "end": 1784.1000000000001, "text": " LSTM with an attention mechanism, which is the attention mechanism is the basis for transformers."}, {"start": 1784.1000000000001, "end": 1790.42, "text": " So all of these things are basically going to make the same sort of bias mistakes, right,"}, {"start": 1790.42, "end": 1796.42, "text": " they're going to, to, it's not it's not like there is Gaussian noise on top of these things,"}, {"start": 1796.42, "end": 1804.1000000000001, "text": " all of these things are going to be weak in the same sort of assessments, and not agree with,"}, {"start": 1804.1000000000001, "end": 1808.8200000000002, "text": " like, they're going to have systematic errors in them with respect to them predicting the"}, {"start": 1808.8200000000002, "end": 1817.0600000000002, "text": " human scores. And if we evaluate our systems that some are also using exactly that thing, right,"}, {"start": 1817.06, "end": 1824.26, "text": " so these the systems we evaluate, they are using the same type of models as here, they're going to"}, {"start": 1824.26, "end": 1830.82, "text": " fall prey to the same type of mistakes. And then if we switch over to systems that use some different"}, {"start": 1830.82, "end": 1837.3799999999999, "text": " right, so next year, we have some systems that use different techniques, they're going to be like,"}, {"start": 1838.74, "end": 1844.74, "text": " exactly, maybe not bad in these particular things, but bad in other things. And then this"}, {"start": 1844.74, "end": 1850.9, "text": " thing will output a systematically biased assessment. So it's sort of a house of like,"}, {"start": 1850.9, "end": 1856.5, "text": " if you've seen these images of plugging in the power strip into itself, and you have infinite"}, {"start": 1856.5, "end": 1864.58, "text": " power, it's like it's very, to me, it's seems very dangerous to have a such an overlap of"}, {"start": 1864.58, "end": 1874.02, "text": " architectures and methods to evaluate systems as you have in the systems themselves. But I hope"}, {"start": 1874.02, "end": 1881.54, "text": " this will be regularly checked with human scores and assessed as to how much these systems are out"}, {"start": 1881.54, "end": 1888.02, "text": " of sync or in sync with humans. Alright, this was it for me for Blurt. Check out they have the code"}, {"start": 1888.02, "end": 1904.98, "text": " available. The metric is available. Evaluate your stuff with it and bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=4GKCxJQSw-g
Synthetic Petri Dish: A Novel Surrogate Model for Rapid Architecture Search (Paper Explained)
Neural Architecture Search is usually prohibitively expensive in both time and resources to be useful. A search strategy has to keep evaluating new models, training them to convergence in an inner loop to find out if they are any good. This paper proposes to abstract the problem and extract the essential part of the architecture to be optimized into a smaller version and evaluates that version on specifically custom learned data points to predict its performance, which is much faster and cheaper than running the full model. OUTLINE: 0:00 - Intro & High-Level Overview 1:00 - Neural Architecture Search 4:30 - Predicting performance via architecture encoding 7:50 - Synthetic Petri Dish 12:50 - Motivating MNIST example 18:15 - Entire Algorithm 23:00 - Producing the synthetic data 26:00 - Combination with architecture search 27:30 - PTB RNN-Cell Experiment 29:20 - Comments & Conclusion Paper: https://arxiv.org/abs/2005.13092 Code: https://github.com/uber-research/Synthetic-Petri-Dish Abstract: Neural Architecture Search (NAS) explores a large space of architectural motifs -- a compute-intensive process that often involves ground-truth evaluation of each motif by instantiating it within a large network, and training and evaluating the network with thousands of domain-specific data samples. Inspired by how biological motifs such as cells are sometimes extracted from their natural environment and studied in an artificial Petri dish setting, this paper proposes the Synthetic Petri Dish model for evaluating architectural motifs. In the Synthetic Petri Dish, architectural motifs are instantiated in very small networks and evaluated using very few learned synthetic data samples (to effectively approximate performance in the full problem). The relative performance of motifs in the Synthetic Petri Dish can substitute for their ground-truth performance, thus accelerating the most expensive step of NAS. Unlike other neural network-based prediction models that parse the structure of the motif to estimate its performance, the Synthetic Petri Dish predicts motif performance by training the actual motif in an artificial setting, thus deriving predictions from its true intrinsic properties. Experiments in this paper demonstrate that the Synthetic Petri Dish can therefore predict the performance of new motifs with significantly higher accuracy, especially when insufficient ground truth data is available. Our hope is that this work can inspire a new research direction in studying the performance of extracted components of models in an alternative controlled setting. Authors: Aditya Rawal, Joel Lehman, Felipe Petroski Such, Jeff Clune, Kenneth O. Stanley 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 Synthetic Petri Dish, a novel surrogate model for rapid architecture search by Adi Tarawal, Joel Leeman, Felipe Petroski-Suc, Jeff Klune and Kenneth O. Stanley. This paper on a high level, it basically says if you want to do neural architecture search, if you for example search for a better non-linearity, you should be able to extract that non-linearity instantiated in a very small network and then evaluate that very small network in order to predict the performance of a large network and therefore you can find a better non-linearity in much less time. Now the exact procedure how you do this in the small network is the topic of this paper. As always if you like content like this I encourage you to subscribe if you are not already and to share out the video so other people can experience the joy themselves. All right let's dive in. So they say in the abstract neural architecture search explores a large space of architectural motives which basically so it basically means you want to find a neural architecture let's say you have a multi-layer perceptron right here a couple of layers okay and they're all connected by you know feet forward weights whatnot and each of these weights basically is a multiplication so each one of these is a multiplication of x by your weight w and then there is a non-linearity so the non-linearity could be a sigmoid so the sigmoid would be something like 1 over 1 plus e to the negative x now there's a bit of an extension in a sigmoid where you can do a sigmoid that has like a temperature parameter attached or a slope parameter where you go cx so in one case you can set c such that the sigmoid has a shape like this and in then if you put c to a different value you can make this slope you can make it like a shape well this is terrible like this you know what I mean okay so this this C right here can potentially change the behavior of your network and you want to find a good parameter C and this is a hyper parameter now there are many hyper parameters like this for example how many units you have in a particular layer in a CNN it could be your filter size in a transformer could be the number of heads and so on it could actually be not only the slope of the non-linearity but the actual non-linearity itself or famously in recurrent neural networks you have these recurrent cells and they're like okay we have an input signal and a carry signal and then the in the input here is like dot multiplied here and then there is like a gate with a non-linearity and then it's kind of like multiplied by the carry but then there is also a like a forget gate and whatnot there's a minus right here it's very complicated and so people do architecture search over these kind of problems to find better architectures for particular problems now the problem is of course that how do you know if if a given architecture is good what you have to do is you'll have to go take that cell that you have dreamed up you think well I think that's a good cell and you have to train it on the full training data set this is a data set a database right this is a full training data set then you need to evaluate it on your validation data set and then you have like a number you have like okay this is eight good and then you go back and you say okay what if I change this cell here what if I change it to a plus instead of a minus and you do the entire thing again train it for I don't know how much validate it and then this is like a nine and you can say oh cool that's a nine so this is a very basic architecture search and there has been a lot of development in this space so like evolutionary search and so on but they most of the time they require pretty much evaluating the entire thing on the full data so you get a good you get a good estimate of what your final performance back here is going to be now people have come up with methods to counter that and they say well if we can sort of encode the cell structure let's go with the let's go with the RNN cell if we could encode the cell structure in in a sort of a continuous way so you know we can encode text in a continuous way let we could also encode a cell structure because the cell structure I can write it down as an equation I can say like okay it's the forget gate of the carry times the sigmoid output of X plus the so this is the plus here and plus the sigmoid output of X multiplied by the input let's call that I something like this right this is text I can like write it down and then I can encode that into a vector much I can for example build another RNN ironically or something to to encode that or I can represent it as a computation graph like it is here and use a graph neural network to encode that into a single vector and then I have sort of an embedding space where each cell that I could build is a point in that embedding space and then I can evaluate a couple of them I can for example say okay this one here this one here this one here this one here I'm going to train them these cells I'm going to do the full training eval and so on get their scores and then I can learn basically in this latent space I can learn a predictor I can say okay here I get I got an eight I got a nine I got a two and I got a four so it appears to be that in this direction that the good cells are in this direction and then I can do it again I can sample or I can do gradient descent in this space since this is now a continuous space and the gradient descent on the model that gives me this space it's right so this this method basically tries to take in the building plan of a cell and learn to predict the performance just by looking at it if if you're thinking of the touring machine right now then you like I I immediately thought of like this this halting problem because it appears to be exactly what it is so you're trying to build a machine that takes the building plan of another machine and tries to predict its performance now in a general sense we can already state that this problem is sort of the difficulty of this problem is equivalent to the difficulty of the original problem so I'm not sure but it appears to you know it appears to work if you throw lots of compute at it but of course that's a problem you need lots of compute right so either your your option one is to run all of these things and kind of iterate them in a neural sorry in an evolutionary way or your second option is to take the building plan and predict the performance from that both are not satisfactory and both use lots of compute now neural petri dish is a or synthetic petri dish is a way to combine the two together it says can we take the building plan here but actually run on the data on data to predict the performance so what they're saying is basically if I have this cell right here and usually this cell you know it deals with vectors of let's say size 512 and so on it will say it since this is let me draw it again up here so here you have the cell and here you have somehow the connections in there when you carry and the input and the input here okay and this is the output or the carry I have 512 embedding like size of this so this is a giant cell there's 512 the vector has 512 dimensions going in basically can't I take the exact same thing but and keep the connection pattern so I would keep the entire pattern of connection right here but I only do it for one or two so this is 512 and this is just two right just the I just reduce the dimensionality but I sort of keep the connection pattern alive if I only do that I have like a very small network right now and the same goes for if this is so a lot of times these RN ends they have multiple layers of these things so they have another exactly equal box up here and then another up here I can just reduce this to one layer and out of the regularity of these neural network things it is known that or one can make the assumption that the performance on this thing will sort of kind of be correlated to the performance of the entire thing and that's one of the things that this Petri dish paper does so we try to take out what we are trying to search over namely the connection pattern we keep that as it is up here but we reduce everything else we reduce the dimensionality we reduce the number of layers and so on now they don't actually reduce the number of layers here but you can reduce the number of units and so on okay so this in essence this works whenever you can do that whenever you can keep the structure you're searching over but can reduce the rest so that's one precondition doesn't work for everything the second part here is that you don't want to use this particular training data and then this particular validation data because first of all it's a lot of training data and second of all it won't give you that good of a prediction instead of what you're trying to do and this is the second part of the idea of Petri dish is you're trying to abstract the training data to get you a very small data set such that and the validation data as well as well such that if you train on this data and evaluate on this data the performance that you get will be very predictive of the performance had you trained the big model on the big data set okay in fact in this Petri dish paper these little data sets they have nothing to do with the with the original train and validation data and that's I think that's one of the cool things here these things this training data and this validation data they are optimized as well by the procedure they're optimized special data points that are trained these are trained parameters such that if you train on the training on the small training data and evaluate on the small eval data the you will be able to predict this performance back here with high accuracy okay and this I think is where previous approaches have or might have failed because it's you know the the idea of scaling down your network in order to do the architecture search is probably has it has appeared to many people before that's not you know that's not really genius idea but probably they have all found that now we can't really do it it doesn't really give us accurate enough numbers but in this case the addition of adding these synthetic data sets that are much smaller but can still if you train and evaluate on them can still predict with high accuracy the full score of the full model that I think makes this idea work all right so I guess we're already through the idea and problem setting and everything without actually reading the paper so they give this example right here at the beginning that if you have a a two layer 100 wide so 100 dimensional MNIST networks it's two layers it's I think it's an MLP two layer MLP with a non linearity that is this the sigmoid right here this okay now you can see it has this temperature parameter here it has this slope parameter and you you want to do neural architecture search to find the best slope parameter now usually you would just do a grid search but this is an this is an example because this can be of course much higher dimensional things and then you don't want to do grid search anymore okay so what do we do if you look at how the 100 white MNIST network so we can draw it right here so this is a 100 dimensional MNIST network so this is 100 and each cell each connection here first has a weight and then has the sigmoid non-linearity and the sigmoid non-linearity is parameterized by the parameter C okay and you have you have many of them right you have one here and so on and each one has a different C and each of these networks represents one blue dot here so if you let C vary so this sigmoid slope value right here that's your parameter C if you let this vary and train the big network on the entire data set to convergence and then you eval on the validation data set you get the slope like the blue curve so if you see the blue curve the blue curve is if you start over here if you reduce this slope you'll gain in performance but if you reduce it too much you drop drastically okay until it's if it's if it's zero it's basically you know the the X is not the signal doesn't propagate anymore and you you have no learning occurring okay so that's the original performance now what if I only give you training data in this range right here I only showed you this particular range I can can't actually zoom in that much but if if I give you this and I ask you to build one of these please take the architecture and predict the performance that we saw at the beginning like one of these good little machines or Turing Turing machines you would it's basically say well that looks to me like a line so I'm gonna predict the red thing here and even if you can you know evaluate a bunch of these it just looks like a line and you're going to predict it's probably a slope like this right this happens almost independently of which model you choose to predict right here the the data of training is simply doesn't give away that the fact that there is a there is this break down here which happens in the real world so if you just give this as training data there is no way so so the the criticism about these models is valid that they will only work where you give them training data they can at best interpolate their training data but they can't really extrapolate now here since the synthetic Petri dish method which is the green thing here uses the actual not the actual non-linearity that this thing characterizes so it it instantiates the sigmoid with the parameter C that you give it just not on the large network but on a small network in fact their network is just one unit sorry one unit and then another unit so it's just a two hidden layer but just with one unit instead of 100 and of course you can't feed in MNIST right here right but we said they don't feed in the data they actually feed in their synthetic data that they learn so you give them the points here and they learn the synthetic data to to evaluate to evaluate the others and then once you ask them well if if my C is right here what's the performance going to be it's going to instantiate that in its small network it is going to use the training data that it has learned from this region right here in order to train this and then it's going to evaluate this on the synthetic validation data that is also learned on the training data and it is going to come up with a performance metric it says okay this is how good it's going to be and since it is an approximation in its building plan to the entire network it will react similarly so it will get that there is this performance dip right here okay so it you can see how this sort of makes sense you are actually running an approximation to the actual program instead of just looking at the plan of the program and trying to predict it which you know halting problem says hello okay so that is the motivating example of their MNIST thing and here is the entire algorithm all right so you take MNIST training and validation data and you instantiate a bunch of really big networks this is ground truth okay you you need this you need this to learn from you instantiate a bunch of really big networks now if I draw the graph from before right we had this was the performance of the actual networks you want you this comes from here from this region right here this is the training data okay so you instantiate a bunch of these networks each one you instantiate in one of them right each one gives rise to a different non-linearity and you do the full training ground truth training and evaluation on the full training set and the full validation set and you get validation losses right for each of these and these are the points right here now you that's the training data for your neural for your neural architecture search so for your Petri dish method what the Petri dish does is it says it extracts the motive and the motive is the thing that you optimize over so as I said you want to keep that thing in its essence but you want to reduce everything else so it reduces it instead of from a two layer on hundred YML MLP it reduces that to a two layer single neuron wide MLP okay and it now this over here is the training data for the procedure that we're going to do now so what it would take is it would take it would take one of these values it would instantiate and we have that here would instantiate the neural network in the small form of that and now we know that if I train the full data and evaluate if I train on the full training data and evaluate on the full validation data I should get this accuracy all right so I will create and we're going to look at in a second I will create training and validation data such that if I train on this training data and then validate on this validation data I get the same validation loss as if I had trained the big network with the same you know the same C parameter on the full training data and evaluate on the full validation data okay so in this step I'm optimizing the data here the training and validation data all right and now in the second step once I have this training and validation data such like that I can basically reproduce this this graph right here then I can go and actually ask my model okay now please tell me what happens over here so what am I going to do I'm gonna take that I'm gonna instantiate it I'm going to use my training data that I learned to train it I'm going to use my validation data that I learned to evaluate it and it's going to give me a number and that number is going to be like close to hopefully close to do this so this is how we can extrapolate using that method okay now there are a number of assumptions right here and you can imagine this doesn't work in any situation this works if if you you know if you basically you have to get lucky in that you have to abstract the correct things right I said you need to reduce everything else so they reduce notably you see they reduce the 100 the 100 layer width to a single neuron wide MLP and they sort of guess that that doesn't change the fundamental thing but you can also see they leave the two layer right they leave the two the two layer neural network and I'm can almost guarantee you that they tried this reducing this to a one layer neural network and it did not work and so you have to be sort of very careful of what quantities you abstract and what quantities you don't because okay now you might always think oh I can reduce the you know number of dimensions or channels that's also not always the case so I think that's kind of the crux of the method you have to actually engineer this down compressing of the architecture such that it's its properties are still kept and yeah but yeah in other things how do you how do you actually produce training and validation data to match these and there are a number of ways but what comes to mind is is meta learning right so because what you're doing they initialize the training and validation data at random points so these are just random at the beginning and then they optimize the data itself using gradient descent okay now I see synthetic training data and they are randomly initialized okay and they use gradient descent they have it somewhere yes so they have this inner training loop okay which is many steps of inner training and then they have the outer loss which is the it's the validation loss after the inner training loop and the difference for that to the true validation loss and then they do gradient descent on this outer loss now this outer loss is a result of the inner loss and the inner loss is a result of the inner training procedure and the inner training procedure is n steps of feeding in the training data every step you feed in the training data so your computational graph is going to look like so here's your training data as train and here are your initial parameters you at random lies initialize them randomly in the first step use the training data to produce theta one then in the second step you use your training parameter your training data again to produce theta two and then you use it again to use theta three and so on each time you feed the training data in order to evolve your parameters to give you a better prediction right so the gradient since somewhere back here there's a loss the gradient here will have to flow back through all of these paths and through all of these connections to the training data this is kind of you back propagate through an optimization procedure and we have this a bunch of times here and I've looked at the code and the code is like really crazy and it looks like proper research code but it appears to be that that's actually what's happening they back prop through the optimization procedure to find this synthetic training and validation data now that's I mean that's crazy but it also kind of limits how far you can go with this because usually you can't back prop for more than a couple of steps doing this now that the model the fact that the model inner model is small helps but also this introduces very very much like these things are very brittle if you back prop through an optimization procedure like this these things tend to be very brittle and so I think there's another thing there where you have to pay careful attention all right that's it's basically it the last thing they say is that they can combine this with architecture search in that so not only can you predict good architectures what you can do is you can actually predict the which architectures are good and then you can use that prediction to get new to basically input this into your neural architecture search to inform it so instead of the neural architecture search having to evaluate all of the candidates that it produces it only has to now evaluate the very small subset of candidates that the synthetic petri dish training deems most worthy of being evaluated in this case here instead of evaluating all of the things here it would limit itself to whatever the synthetic petri dish says are the highest performing ones because if the synthetic petri dishes and is any good then it will you know give accurate predictions of how they're performing and then that can go in multiple rounds so the architecture search can find new come up with new things that it thinks are better through like an evolutionary mutation algorithm the petri dish can evaluate them in the synthetic way and then suggest the like ten candidates to evaluate on the full test set and you see that way you don't have to evaluate all the like thousand candidates all right all right cool they do this for this MNIST and they also do it for finding a RNN cell for the pen treebank this is a language modeling task and the this is a benchmark for neural architecture search where you're trying to find a good RNN cell to get the perplexity really low and here you can see if they give the same amount of data to all the methods then the benchmark neural architecture search is worse than the synthetic petri dish informed architecture search now one has to say on the full date I believe the NAO gets to about here but of course if you give all of them the same data the neural the petri dish beats this method and I think still this method here uses way more compute because it always has to evaluate all the candidates and that's exactly one of these where I learn an architecture to predict the other architecture by just looking at it so it works but it doesn't work as well as actually running the architecture in an abstract fashion this also shows you the importance of selecting your experimental evaluation in a smart way like they argue they argue for very long why it makes sense to evaluate everything on reduced data such that their method here can be better and they don't have to compare to the full thing it's easier for them to work on reduced data and they argue you know it's it's it's what people usually do in practice and that's the the task they focus on so you know good good good good paper writing right here yeah that's basically it to the paper there's a lot of things to be said here I think this works in very very limited settings it seems to me that it's sort of brittle with respect to how you abstract and also it it's always the case like how many how large is this synthetic training data in their case there they like abstract this to 20 or 30 data points or something like this so it seems to me since you're optimizing this training data with gradient descent what you would mainly find are adversarial sort of adversarial examples to this architecture here so I'm going to guess that the inner optimization is very noisy and that's because if you really let your optimizer run then it will abuse every single thing it can to match that validation loss and that will usually lead to an adversarial example since you're optimizing the data itself okay so I think this suffers from that and this is we had this in the in the planning you know the planning in in learned world models and reinforcement learning where if you have a really really good planner it will just abuse the mistakes that you make in approximating the true world and the same here you're going to make mistakes approximating this architecture here and the better your your optimizer is for producing this synthetic data the probably the worse the worse the result is going to match the worst that these losses are going to actually match now okay these losses will match because they're that's what you train for but the worse these two curves will match each other because now you're just finding adversarial examples for your particular training data another concern I have here is with respect to the double descent phenomenon so if you know the double descent phenomenon if here you have your number of parameters and here you have your validation loss let's say and you know that if I add parameters I can make my validation loss go down so this is assuming I have a model with p parameters and I always train it on the train data to like to convergence if I add parameters I can generalize better until a point where I add too many parameters and I start overfitting and my validation loss goes up again but the double descent phenomenon and I think I've done a video on this shows that after a certain threshold you get the interpolation threshold the validation loss goes actually down again it goes down even further here now I'm so this is a very strange phenomenon by itself but I'm sort of concerned that if you do this abstraction that this paper proposes so you read your let's say your full model is here with a large number of parameters so it is past this interpolation threshold if you now seriously reduce the number of parameters because you want to go into this petri dish you will get maybe you will cross this interpolation threshold and actually be on this side of the curve right here now of course at the same time you reduce the amount of data which would push you over here again but it is different data so I'm not sure how all of this is going to play out it appears to work in these settings right here but I I think this is it's it's sort of it's sort of applicable in some situations and it's it'd be very cool if we develop this further such that we understand when it applies and when we can use it because I feel this can be a very cool thing if we understand it better and if we can apply it throughout all right that's the end if you like this paper leave a comment if you didn't like it leave a comment and bye bye see you next time
[{"start": 0.0, "end": 4.96, "text": " Hi there, today we're looking at Synthetic Petri Dish, a novel surrogate model for"}, {"start": 4.96, "end": 11.120000000000001, "text": " rapid architecture search by Adi Tarawal, Joel Leeman, Felipe Petroski-Suc, Jeff"}, {"start": 11.120000000000001, "end": 18.080000000000002, "text": " Klune and Kenneth O. Stanley. This paper on a high level, it basically says if you"}, {"start": 18.080000000000002, "end": 22.56, "text": " want to do neural architecture search, if you for example search for a better"}, {"start": 22.56, "end": 29.04, "text": " non-linearity, you should be able to extract that non-linearity instantiated"}, {"start": 29.04, "end": 33.76, "text": " in a very small network and then evaluate that very small network in"}, {"start": 33.76, "end": 38.24, "text": " order to predict the performance of a large network and therefore you can find"}, {"start": 38.24, "end": 44.96, "text": " a better non-linearity in much less time. Now the exact procedure how you do this"}, {"start": 44.96, "end": 50.32, "text": " in the small network is the topic of this paper. As always if you like content"}, {"start": 50.32, "end": 55.28, "text": " like this I encourage you to subscribe if you are not already and to share out"}, {"start": 55.28, "end": 61.44, "text": " the video so other people can experience the joy themselves. All right let's"}, {"start": 61.44, "end": 67.68, "text": " dive in. So they say in the abstract neural architecture search explores a"}, {"start": 67.68, "end": 74.08, "text": " large space of architectural motives which basically so it basically means"}, {"start": 74.08, "end": 78.64, "text": " you want to find a neural architecture let's say you have a multi-layer"}, {"start": 78.64, "end": 86.24, "text": " perceptron right here a couple of layers okay and they're all connected by you"}, {"start": 86.24, "end": 90.96000000000001, "text": " know feet forward weights whatnot and each of these weights basically is a"}, {"start": 90.96000000000001, "end": 96.96000000000001, "text": " multiplication so each one of these is a multiplication of x by your weight w and"}, {"start": 96.96000000000001, "end": 103.56, "text": " then there is a non-linearity so the non-linearity could be a sigmoid so the"}, {"start": 103.56, "end": 110.16, "text": " sigmoid would be something like 1 over 1 plus e to the negative x now there's a"}, {"start": 110.16, "end": 114.24000000000001, "text": " bit of an extension in a sigmoid where you can do a sigmoid that has like a"}, {"start": 114.24000000000001, "end": 119.80000000000001, "text": " temperature parameter attached or a slope parameter where you go cx so in"}, {"start": 119.80000000000001, "end": 126.36, "text": " one case you can set c such that the sigmoid has a shape like this and in"}, {"start": 126.36, "end": 131.22, "text": " then if you put c to a different value you can make this slope you can make it"}, {"start": 131.22, "end": 137.28, "text": " like a shape well this is terrible like this you know what I mean okay so this"}, {"start": 137.28, "end": 143.44, "text": " this C right here can potentially change the behavior of your network and you"}, {"start": 143.44, "end": 147.48, "text": " want to find a good parameter C and this is a hyper parameter now there are many"}, {"start": 147.48, "end": 152.92, "text": " hyper parameters like this for example how many units you have in a particular"}, {"start": 152.92, "end": 157.98, "text": " layer in a CNN it could be your filter size in a transformer could be the"}, {"start": 157.98, "end": 163.35999999999999, "text": " number of heads and so on it could actually be not only the slope of the"}, {"start": 163.35999999999999, "end": 167.83999999999997, "text": " non-linearity but the actual non-linearity itself or famously in"}, {"start": 167.83999999999997, "end": 173.07999999999998, "text": " recurrent neural networks you have these recurrent cells and they're like okay we"}, {"start": 173.07999999999998, "end": 177.32, "text": " have an input signal and a carry signal and then the in the input here is like"}, {"start": 177.32, "end": 182.35999999999999, "text": " dot multiplied here and then there is like a gate with a non-linearity and"}, {"start": 182.35999999999999, "end": 186.56, "text": " then it's kind of like multiplied by the carry but then there is also a like a"}, {"start": 186.56, "end": 192.52, "text": " forget gate and whatnot there's a minus right here it's very complicated and so"}, {"start": 192.52, "end": 196.72, "text": " people do architecture search over these kind of problems to find better"}, {"start": 196.72, "end": 203.28, "text": " architectures for particular problems now the problem is of course that how do"}, {"start": 203.28, "end": 208.6, "text": " you know if if a given architecture is good what you have to do is you'll have"}, {"start": 208.6, "end": 213.92000000000002, "text": " to go take that cell that you have dreamed up you think well I think that's"}, {"start": 213.92, "end": 218.51999999999998, "text": " a good cell and you have to train it on the full training data set this is a"}, {"start": 218.51999999999998, "end": 223.76, "text": " data set a database right this is a full training data set then you need to"}, {"start": 223.76, "end": 228.92, "text": " evaluate it on your validation data set and then you have like a number you have"}, {"start": 228.92, "end": 234.07999999999998, "text": " like okay this is eight good and then you go back and you say okay what if I"}, {"start": 234.07999999999998, "end": 239.32, "text": " change this cell here what if I change it to a plus instead of a minus and you"}, {"start": 239.32, "end": 244.92, "text": " do the entire thing again train it for I don't know how much validate it and then"}, {"start": 244.92, "end": 249.51999999999998, "text": " this is like a nine and you can say oh cool that's a nine so this is a very"}, {"start": 249.51999999999998, "end": 255.64, "text": " basic architecture search and there has been a lot of development in this space"}, {"start": 255.64, "end": 260.36, "text": " so like evolutionary search and so on but they most of the time they require"}, {"start": 260.36, "end": 266.03999999999996, "text": " pretty much evaluating the entire thing on the full data so you get a good you"}, {"start": 266.04, "end": 271.20000000000005, "text": " get a good estimate of what your final performance back here is going to be now"}, {"start": 271.20000000000005, "end": 276.0, "text": " people have come up with methods to counter that and they say well if we can"}, {"start": 276.0, "end": 282.16, "text": " sort of encode the cell structure let's go with the let's go with the RNN cell"}, {"start": 282.16, "end": 288.36, "text": " if we could encode the cell structure in in a sort of a continuous way so you"}, {"start": 288.36, "end": 293.04, "text": " know we can encode text in a continuous way let we could also encode a cell"}, {"start": 293.04, "end": 298.20000000000005, "text": " structure because the cell structure I can write it down as an equation I can"}, {"start": 298.20000000000005, "end": 305.04, "text": " say like okay it's the forget gate of the carry times the sigmoid output of X"}, {"start": 305.04, "end": 314.40000000000003, "text": " plus the so this is the plus here and plus the sigmoid output of X multiplied"}, {"start": 314.40000000000003, "end": 320.48, "text": " by the input let's call that I something like this right this is text I can like"}, {"start": 320.48, "end": 326.6, "text": " write it down and then I can encode that into a vector much I can for example"}, {"start": 326.6, "end": 333.96000000000004, "text": " build another RNN ironically or something to to encode that or I can"}, {"start": 333.96000000000004, "end": 337.8, "text": " represent it as a computation graph like it is here and use a graph neural"}, {"start": 337.8, "end": 342.02000000000004, "text": " network to encode that into a single vector and then I have sort of an"}, {"start": 342.02000000000004, "end": 347.56, "text": " embedding space where each cell that I could build is a point in that embedding"}, {"start": 347.56, "end": 353.04, "text": " space and then I can evaluate a couple of them I can for example say okay this"}, {"start": 353.04, "end": 357.16, "text": " one here this one here this one here this one here I'm going to train them"}, {"start": 357.16, "end": 361.62, "text": " these cells I'm going to do the full training eval and so on get their"}, {"start": 361.62, "end": 366.98, "text": " scores and then I can learn basically in this latent space I can learn a"}, {"start": 366.98, "end": 372.8, "text": " predictor I can say okay here I get I got an eight I got a nine I got a two"}, {"start": 372.8, "end": 379.6, "text": " and I got a four so it appears to be that in this direction that the good"}, {"start": 379.6, "end": 384.2, "text": " cells are in this direction and then I can do it again I can sample or I can do"}, {"start": 384.2, "end": 389.88, "text": " gradient descent in this space since this is now a continuous space and the"}, {"start": 389.88, "end": 394.64, "text": " gradient descent on the model that gives me this space it's right so this this"}, {"start": 394.64, "end": 400.8, "text": " method basically tries to take in the building plan of a cell and learn to"}, {"start": 400.8, "end": 406.92, "text": " predict the performance just by looking at it if if you're thinking of the"}, {"start": 406.92, "end": 412.24, "text": " touring machine right now then you like I I immediately thought of like this"}, {"start": 412.24, "end": 416.28000000000003, "text": " this halting problem because it appears to be exactly what it is so you're"}, {"start": 416.28000000000003, "end": 420.24, "text": " trying to build a machine that takes the building plan of another machine and"}, {"start": 420.24, "end": 427.84000000000003, "text": " tries to predict its performance now in a general sense we can already state"}, {"start": 427.84, "end": 433.23999999999995, "text": " that this problem is sort of the difficulty of this problem is"}, {"start": 433.23999999999995, "end": 439.64, "text": " equivalent to the difficulty of the original problem so I'm not sure but it"}, {"start": 439.64, "end": 443.23999999999995, "text": " appears to you know it appears to work if you throw lots of compute at it but"}, {"start": 443.23999999999995, "end": 448.03999999999996, "text": " of course that's a problem you need lots of compute right so either your your"}, {"start": 448.03999999999996, "end": 454.52, "text": " option one is to run all of these things and kind of iterate them in a neural"}, {"start": 454.52, "end": 461.12, "text": " sorry in an evolutionary way or your second option is to take the building"}, {"start": 461.12, "end": 466.44, "text": " plan and predict the performance from that both are not satisfactory and both"}, {"start": 466.44, "end": 472.03999999999996, "text": " use lots of compute now neural petri dish is a or synthetic petri dish is a"}, {"start": 472.03999999999996, "end": 479.0, "text": " way to combine the two together it says can we take the building plan here but"}, {"start": 479.0, "end": 486.28, "text": " actually run on the data on data to predict the performance so what they're"}, {"start": 486.28, "end": 492.4, "text": " saying is basically if I have this cell right here and usually this cell you know"}, {"start": 492.4, "end": 499.12, "text": " it deals with vectors of let's say size 512 and so on it will say it since this"}, {"start": 499.12, "end": 504.84, "text": " is let me draw it again up here so here you have the cell and here you have"}, {"start": 504.84, "end": 509.08, "text": " somehow the connections in there when you carry and the input and the input"}, {"start": 509.08, "end": 518.56, "text": " here okay and this is the output or the carry I have 512 embedding like size of"}, {"start": 518.56, "end": 524.16, "text": " this so this is a giant cell there's 512 the vector has 512 dimensions going in"}, {"start": 524.16, "end": 530.4, "text": " basically can't I take the exact same thing but and keep the connection"}, {"start": 530.4, "end": 534.52, "text": " pattern so I would keep the entire pattern of connection right here but I"}, {"start": 534.52, "end": 544.28, "text": " only do it for one or two so this is 512 and this is just two right just the I"}, {"start": 544.28, "end": 549.52, "text": " just reduce the dimensionality but I sort of keep the connection pattern"}, {"start": 549.52, "end": 556.36, "text": " alive if I only do that I have like a very small network right now and the"}, {"start": 556.36, "end": 561.64, "text": " same goes for if this is so a lot of times these RN ends they have multiple"}, {"start": 561.64, "end": 566.3199999999999, "text": " layers of these things so they have another exactly equal box up here and"}, {"start": 566.3199999999999, "end": 572.6, "text": " then another up here I can just reduce this to one layer and out of the"}, {"start": 572.6, "end": 578.88, "text": " regularity of these neural network things it is known that or one can make"}, {"start": 578.88, "end": 583.48, "text": " the assumption that the performance on this thing will sort of kind of be"}, {"start": 583.48, "end": 588.72, "text": " correlated to the performance of the entire thing and that's one of the"}, {"start": 588.72, "end": 596.5600000000001, "text": " things that this Petri dish paper does so we try to take out what we are"}, {"start": 596.5600000000001, "end": 600.96, "text": " trying to search over namely the connection pattern we keep that as it"}, {"start": 600.96, "end": 607.36, "text": " is up here but we reduce everything else we reduce the dimensionality we reduce"}, {"start": 607.36, "end": 610.6, "text": " the number of layers and so on now they don't actually reduce the number of"}, {"start": 610.6, "end": 615.6, "text": " layers here but you can reduce the number of units and so on okay so this"}, {"start": 615.6, "end": 621.28, "text": " in essence this works whenever you can do that whenever you can keep the"}, {"start": 621.28, "end": 627.84, "text": " structure you're searching over but can reduce the rest so that's one"}, {"start": 627.84, "end": 632.84, "text": " precondition doesn't work for everything the second part here is that"}, {"start": 632.84, "end": 637.0, "text": " you don't want to use this particular training data and then this particular"}, {"start": 637.0, "end": 641.72, "text": " validation data because first of all it's a lot of training data and second"}, {"start": 641.72, "end": 647.84, "text": " of all it won't give you that good of a prediction instead of what you're trying"}, {"start": 647.84, "end": 652.72, "text": " to do and this is the second part of the idea of Petri dish is you're trying to"}, {"start": 652.72, "end": 661.24, "text": " abstract the training data to get you a very small data set such that and the"}, {"start": 661.24, "end": 667.12, "text": " validation data as well as well such that if you train on this data and"}, {"start": 667.12, "end": 673.48, "text": " evaluate on this data the performance that you get will be very predictive of"}, {"start": 673.48, "end": 679.88, "text": " the performance had you trained the big model on the big data set okay in fact"}, {"start": 679.88, "end": 685.64, "text": " in this Petri dish paper these little data sets they have nothing to do with"}, {"start": 685.64, "end": 690.52, "text": " the with the original train and validation data and that's I think that's"}, {"start": 690.52, "end": 695.8, "text": " one of the cool things here these things this training data and this validation"}, {"start": 695.8, "end": 702.0, "text": " data they are optimized as well by the procedure they're optimized special data"}, {"start": 702.0, "end": 707.76, "text": " points that are trained these are trained parameters such that if you"}, {"start": 707.76, "end": 711.3199999999999, "text": " train on the training on the small training data and evaluate on the small"}, {"start": 711.3199999999999, "end": 717.12, "text": " eval data the you will be able to predict this performance back here with"}, {"start": 717.12, "end": 722.9599999999999, "text": " high accuracy okay and this I think is where previous approaches have or might"}, {"start": 722.96, "end": 727.36, "text": " have failed because it's you know the the idea of scaling down your network in"}, {"start": 727.36, "end": 731.64, "text": " order to do the architecture search is probably has it has appeared to many"}, {"start": 731.64, "end": 737.7, "text": " people before that's not you know that's not really genius idea but probably they"}, {"start": 737.7, "end": 741.26, "text": " have all found that now we can't really do it it doesn't really give us accurate"}, {"start": 741.26, "end": 746.6800000000001, "text": " enough numbers but in this case the addition of adding these synthetic data"}, {"start": 746.68, "end": 753.16, "text": " sets that are much smaller but can still if you train and evaluate on them can"}, {"start": 753.16, "end": 759.8399999999999, "text": " still predict with high accuracy the full score of the full model that I"}, {"start": 759.8399999999999, "end": 765.3599999999999, "text": " think makes this idea work all right so I guess we're already through the idea"}, {"start": 765.3599999999999, "end": 772.1999999999999, "text": " and problem setting and everything without actually reading the paper so"}, {"start": 772.2, "end": 779.08, "text": " they give this example right here at the beginning that if you have a a two layer"}, {"start": 779.08, "end": 784.36, "text": " 100 wide so 100 dimensional MNIST networks it's two layers it's I think"}, {"start": 784.36, "end": 792.88, "text": " it's an MLP two layer MLP with a non linearity that is this the sigmoid right"}, {"start": 792.88, "end": 800.5200000000001, "text": " here this okay now you can see it has this temperature parameter here it has"}, {"start": 800.52, "end": 806.04, "text": " this slope parameter and you you want to do neural architecture search to find"}, {"start": 806.04, "end": 810.4399999999999, "text": " the best slope parameter now usually you would just do a grid search but this is"}, {"start": 810.4399999999999, "end": 814.84, "text": " an this is an example because this can be of course much higher dimensional"}, {"start": 814.84, "end": 821.96, "text": " things and then you don't want to do grid search anymore okay so what do we"}, {"start": 821.96, "end": 828.36, "text": " do if you look at how the 100 white MNIST network so we can draw it right"}, {"start": 828.36, "end": 836.32, "text": " here so this is a 100 dimensional MNIST network so this is 100 and each cell"}, {"start": 836.32, "end": 840.96, "text": " each connection here first has a weight and then has the sigmoid non-linearity"}, {"start": 840.96, "end": 845.84, "text": " and the sigmoid non-linearity is parameterized by the parameter C okay"}, {"start": 845.84, "end": 852.44, "text": " and you have you have many of them right you have one here and so on and each one"}, {"start": 852.44, "end": 857.8000000000001, "text": " has a different C and each of these networks represents one blue dot here"}, {"start": 857.8, "end": 862.76, "text": " so if you let C vary so this sigmoid slope value right here that's your"}, {"start": 862.76, "end": 866.88, "text": " parameter C if you let this vary and train the big network on the entire"}, {"start": 866.88, "end": 872.0799999999999, "text": " data set to convergence and then you eval on the validation data set you get"}, {"start": 872.0799999999999, "end": 876.8399999999999, "text": " the slope like the blue curve so if you see the blue curve the blue curve is if"}, {"start": 876.8399999999999, "end": 881.16, "text": " you start over here if you reduce this slope you'll gain in performance but if"}, {"start": 881.16, "end": 886.12, "text": " you reduce it too much you drop drastically okay until it's if it's if"}, {"start": 886.12, "end": 892.92, "text": " it's zero it's basically you know the the X is not the signal doesn't propagate"}, {"start": 892.92, "end": 898.88, "text": " anymore and you you have no learning occurring okay so that's the original"}, {"start": 898.88, "end": 904.88, "text": " performance now what if I only give you training data in this range right here I"}, {"start": 904.88, "end": 909.68, "text": " only showed you this particular range I can can't actually zoom in that much but"}, {"start": 909.68, "end": 915.34, "text": " if if I give you this and I ask you to build one of these please take the"}, {"start": 915.34, "end": 918.88, "text": " architecture and predict the performance that we saw at the beginning like one of"}, {"start": 918.88, "end": 927.88, "text": " these good little machines or Turing Turing machines you would it's basically"}, {"start": 927.88, "end": 933.32, "text": " say well that looks to me like a line so I'm gonna predict the red thing here and"}, {"start": 933.32, "end": 937.48, "text": " even if you can you know evaluate a bunch of these it just looks like a line"}, {"start": 937.48, "end": 943.1600000000001, "text": " and you're going to predict it's probably a slope like this right this"}, {"start": 943.16, "end": 947.8, "text": " happens almost independently of which model you choose to predict right here"}, {"start": 947.8, "end": 952.88, "text": " the the data of training is simply doesn't give away that the fact that"}, {"start": 952.88, "end": 957.8399999999999, "text": " there is a there is this break down here which happens in the real world so if you"}, {"start": 957.8399999999999, "end": 965.16, "text": " just give this as training data there is no way so so the the criticism about"}, {"start": 965.16, "end": 970.36, "text": " these models is valid that they will only work where you give them training"}, {"start": 970.36, "end": 974.12, "text": " data they can at best interpolate their training data but they can't really"}, {"start": 974.12, "end": 980.04, "text": " extrapolate now here since the synthetic Petri dish method which is the green"}, {"start": 980.04, "end": 986.92, "text": " thing here uses the actual not the actual non-linearity that this thing"}, {"start": 986.92, "end": 992.76, "text": " characterizes so it it instantiates the sigmoid with the parameter C that you"}, {"start": 992.76, "end": 996.64, "text": " give it just not on the large network but on a small network in fact their"}, {"start": 996.64, "end": 1004.04, "text": " network is just one unit sorry one unit and then another unit so it's just a two"}, {"start": 1004.04, "end": 1009.1999999999999, "text": " hidden layer but just with one unit instead of 100 and of course you can't"}, {"start": 1009.1999999999999, "end": 1013.4, "text": " feed in MNIST right here right but we said they don't feed in the data they"}, {"start": 1013.4, "end": 1019.12, "text": " actually feed in their synthetic data that they learn so you give them the"}, {"start": 1019.12, "end": 1025.56, "text": " points here and they learn the synthetic data to to evaluate to evaluate the"}, {"start": 1025.56, "end": 1031.48, "text": " others and then once you ask them well if if my C is right here what's the"}, {"start": 1031.48, "end": 1036.8799999999999, "text": " performance going to be it's going to instantiate that in its small network it"}, {"start": 1036.8799999999999, "end": 1041.48, "text": " is going to use the training data that it has learned from this region right"}, {"start": 1041.48, "end": 1045.56, "text": " here in order to train this and then it's going to evaluate this on the"}, {"start": 1045.56, "end": 1051.0, "text": " synthetic validation data that is also learned on the training data and it is"}, {"start": 1051.0, "end": 1056.16, "text": " going to come up with a performance metric it says okay this is how good"}, {"start": 1056.16, "end": 1061.4, "text": " it's going to be and since it is an approximation in its building plan to"}, {"start": 1061.4, "end": 1069.6, "text": " the entire network it will react similarly so it will get that there is"}, {"start": 1069.6, "end": 1074.08, "text": " this performance dip right here okay so it you can see how this sort of makes"}, {"start": 1074.08, "end": 1078.16, "text": " sense you are actually running an approximation to the actual program"}, {"start": 1078.16, "end": 1082.52, "text": " instead of just looking at the plan of the program and trying to predict it"}, {"start": 1082.52, "end": 1090.92, "text": " which you know halting problem says hello okay so that is the motivating"}, {"start": 1090.92, "end": 1100.24, "text": " example of their MNIST thing and here is the entire algorithm all right so you"}, {"start": 1100.24, "end": 1106.8000000000002, "text": " take MNIST training and validation data and you instantiate a bunch of really"}, {"start": 1106.8, "end": 1111.12, "text": " big networks this is ground truth okay you you need this you need this to learn"}, {"start": 1111.12, "end": 1116.44, "text": " from you instantiate a bunch of really big networks now if I draw the graph"}, {"start": 1116.44, "end": 1125.44, "text": " from before right we had this was the performance of the actual networks you"}, {"start": 1125.44, "end": 1130.6399999999999, "text": " want you this comes from here from this region right here this is the training"}, {"start": 1130.6399999999999, "end": 1135.8799999999999, "text": " data okay so you instantiate a bunch of these networks each one you instantiate"}, {"start": 1135.88, "end": 1140.8400000000001, "text": " in one of them right each one gives rise to a different non-linearity and you do"}, {"start": 1140.8400000000001, "end": 1145.0400000000002, "text": " the full training ground truth training and evaluation on the full training set"}, {"start": 1145.0400000000002, "end": 1149.6000000000001, "text": " and the full validation set and you get validation losses right for each of"}, {"start": 1149.6000000000001, "end": 1154.64, "text": " these and these are the points right here now you that's the training data"}, {"start": 1154.64, "end": 1159.3600000000001, "text": " for your neural for your neural architecture search so for your Petri"}, {"start": 1159.36, "end": 1166.36, "text": " dish method what the Petri dish does is it says it extracts the motive and the"}, {"start": 1166.36, "end": 1171.24, "text": " motive is the thing that you optimize over so as I said you want to keep that"}, {"start": 1171.24, "end": 1177.6, "text": " thing in its essence but you want to reduce everything else so it reduces it"}, {"start": 1177.6, "end": 1183.4799999999998, "text": " instead of from a two layer on hundred YML MLP it reduces that to a two layer"}, {"start": 1183.48, "end": 1193.92, "text": " single neuron wide MLP okay and it now this over here is the training data for"}, {"start": 1193.92, "end": 1197.72, "text": " the procedure that we're going to do now so what it would take is it would take"}, {"start": 1197.72, "end": 1202.68, "text": " it would take one of these values it would instantiate and we have that here"}, {"start": 1202.68, "end": 1208.84, "text": " would instantiate the neural network in the small form of that and now we know"}, {"start": 1208.84, "end": 1214.84, "text": " that if I train the full data and evaluate if I train on the full training"}, {"start": 1214.84, "end": 1221.36, "text": " data and evaluate on the full validation data I should get this accuracy all"}, {"start": 1221.36, "end": 1228.52, "text": " right so I will create and we're going to look at in a second I will create"}, {"start": 1228.52, "end": 1233.9199999999998, "text": " training and validation data such that if I train on this training data and"}, {"start": 1233.92, "end": 1241.5600000000002, "text": " then validate on this validation data I get the same validation loss as if I had"}, {"start": 1241.5600000000002, "end": 1246.78, "text": " trained the big network with the same you know the same C parameter on the"}, {"start": 1246.78, "end": 1250.6000000000001, "text": " full training data and evaluate on the full validation data okay so in this"}, {"start": 1250.6000000000001, "end": 1256.04, "text": " step I'm optimizing the data here the training and validation data all right"}, {"start": 1256.04, "end": 1261.68, "text": " and now in the second step once I have this training and validation data such"}, {"start": 1261.68, "end": 1269.3600000000001, "text": " like that I can basically reproduce this this graph right here then I can go and"}, {"start": 1269.3600000000001, "end": 1275.76, "text": " actually ask my model okay now please tell me what happens over here so what"}, {"start": 1275.76, "end": 1281.04, "text": " am I going to do I'm gonna take that I'm gonna instantiate it I'm going to use my"}, {"start": 1281.04, "end": 1285.5600000000002, "text": " training data that I learned to train it I'm going to use my validation data that"}, {"start": 1285.5600000000002, "end": 1289.16, "text": " I learned to evaluate it and it's going to give me a number and that number is"}, {"start": 1289.16, "end": 1295.76, "text": " going to be like close to hopefully close to do this so this is how we can"}, {"start": 1295.76, "end": 1301.88, "text": " extrapolate using that method okay now there are a number of assumptions right"}, {"start": 1301.88, "end": 1306.92, "text": " here and you can imagine this doesn't work in any situation this works if if"}, {"start": 1306.92, "end": 1313.3200000000002, "text": " you you know if you basically you have to get lucky in that you have to"}, {"start": 1313.3200000000002, "end": 1318.88, "text": " abstract the correct things right I said you need to reduce everything else so"}, {"start": 1318.88, "end": 1325.2800000000002, "text": " they reduce notably you see they reduce the 100 the 100 layer width to a single"}, {"start": 1325.2800000000002, "end": 1330.4, "text": " neuron wide MLP and they sort of guess that that doesn't change the fundamental"}, {"start": 1330.4, "end": 1336.72, "text": " thing but you can also see they leave the two layer right they leave the two"}, {"start": 1336.72, "end": 1342.48, "text": " the two layer neural network and I'm can almost guarantee you that they tried"}, {"start": 1342.48, "end": 1348.3200000000002, "text": " this reducing this to a one layer neural network and it did not work and so you"}, {"start": 1348.32, "end": 1353.4399999999998, "text": " have to be sort of very careful of what quantities you abstract and what"}, {"start": 1353.4399999999998, "end": 1358.08, "text": " quantities you don't because okay now you might always think oh I can reduce"}, {"start": 1358.08, "end": 1363.1599999999999, "text": " the you know number of dimensions or channels that's also not always the case"}, {"start": 1363.1599999999999, "end": 1367.04, "text": " so I think that's kind of the crux of the method you have to actually"}, {"start": 1367.04, "end": 1372.6399999999999, "text": " engineer this down compressing of the architecture such that it's its"}, {"start": 1372.64, "end": 1381.0, "text": " properties are still kept and yeah but yeah in other things how do you how do"}, {"start": 1381.0, "end": 1385.76, "text": " you actually produce training and validation data to match these and there"}, {"start": 1385.76, "end": 1390.8000000000002, "text": " are a number of ways but what comes to mind is is meta learning right so"}, {"start": 1390.8000000000002, "end": 1395.3600000000001, "text": " because what you're doing they initialize the training and validation"}, {"start": 1395.3600000000001, "end": 1400.24, "text": " data at random points so these are just random at the beginning and then they"}, {"start": 1400.24, "end": 1408.68, "text": " optimize the data itself using gradient descent okay now I see synthetic training"}, {"start": 1408.68, "end": 1415.32, "text": " data and they are randomly initialized okay and they use gradient descent they"}, {"start": 1415.32, "end": 1420.68, "text": " have it somewhere yes so they have this inner training loop okay which is many"}, {"start": 1420.68, "end": 1427.84, "text": " steps of inner training and then they have the outer loss which is the it's"}, {"start": 1427.84, "end": 1432.0, "text": " the validation loss after the inner training loop and the difference for"}, {"start": 1432.0, "end": 1436.04, "text": " that to the true validation loss and then they do gradient descent on this"}, {"start": 1436.04, "end": 1440.8, "text": " outer loss now this outer loss is a result of the inner loss and the inner"}, {"start": 1440.8, "end": 1444.9599999999998, "text": " loss is a result of the inner training procedure and the inner training"}, {"start": 1444.9599999999998, "end": 1450.3999999999999, "text": " procedure is n steps of feeding in the training data every step you feed in the"}, {"start": 1450.3999999999999, "end": 1454.52, "text": " training data so your computational graph is going to look like so here's"}, {"start": 1454.52, "end": 1460.48, "text": " your training data as train and here are your initial parameters you at random"}, {"start": 1460.48, "end": 1464.12, "text": " lies initialize them randomly in the first step use the training data to"}, {"start": 1464.12, "end": 1470.84, "text": " produce theta one then in the second step you use your training parameter"}, {"start": 1470.84, "end": 1475.48, "text": " your training data again to produce theta two and then you use it again to"}, {"start": 1475.48, "end": 1479.56, "text": " use theta three and so on each time you feed the training data in order to"}, {"start": 1479.56, "end": 1484.2, "text": " evolve your parameters to give you a better prediction right so the gradient"}, {"start": 1484.2, "end": 1490.1200000000001, "text": " since somewhere back here there's a loss the gradient here will have to flow back"}, {"start": 1490.1200000000001, "end": 1494.52, "text": " through all of these paths and through all of these connections to the training"}, {"start": 1494.52, "end": 1499.0, "text": " data this is kind of you back propagate through an optimization procedure and we"}, {"start": 1499.0, "end": 1503.32, "text": " have this a bunch of times here and I've looked at the code and the code is like"}, {"start": 1503.32, "end": 1510.2, "text": " really crazy and it looks like proper research code but it appears to be that"}, {"start": 1510.2, "end": 1513.52, "text": " that's actually what's happening they back prop through the optimization"}, {"start": 1513.52, "end": 1521.44, "text": " procedure to find this synthetic training and validation data now that's"}, {"start": 1521.44, "end": 1525.48, "text": " I mean that's crazy but it also kind of limits how far you can go with this"}, {"start": 1525.48, "end": 1530.84, "text": " because usually you can't back prop for more than a couple of steps doing this"}, {"start": 1530.84, "end": 1534.72, "text": " now that the model the fact that the model inner model is small helps but"}, {"start": 1534.72, "end": 1539.36, "text": " also this introduces very very much like these things are very brittle if you"}, {"start": 1539.36, "end": 1543.84, "text": " back prop through an optimization procedure like this these things tend to"}, {"start": 1543.84, "end": 1550.1599999999999, "text": " be very brittle and so I think there's another thing there where you have to"}, {"start": 1550.1599999999999, "end": 1558.1999999999998, "text": " pay careful attention all right that's it's basically it the last thing they"}, {"start": 1558.1999999999998, "end": 1563.8799999999999, "text": " say is that they can combine this with architecture search in that so not only"}, {"start": 1563.88, "end": 1570.0400000000002, "text": " can you predict good architectures what you can do is you can actually predict"}, {"start": 1570.0400000000002, "end": 1574.96, "text": " the which architectures are good and then you can use that prediction to get"}, {"start": 1574.96, "end": 1580.7600000000002, "text": " new to basically input this into your neural architecture search to inform it"}, {"start": 1580.7600000000002, "end": 1585.1200000000001, "text": " so instead of the neural architecture search having to evaluate all of the"}, {"start": 1585.1200000000001, "end": 1590.3200000000002, "text": " candidates that it produces it only has to now evaluate the very small subset of"}, {"start": 1590.32, "end": 1595.2, "text": " candidates that the synthetic petri dish training deems most worthy of being"}, {"start": 1595.2, "end": 1601.84, "text": " evaluated in this case here instead of evaluating all of the things here it"}, {"start": 1601.84, "end": 1606.4399999999998, "text": " would limit itself to whatever the synthetic petri dish says are the"}, {"start": 1606.4399999999998, "end": 1611.8, "text": " highest performing ones because if the synthetic petri dishes and is any good"}, {"start": 1611.8, "end": 1615.6799999999998, "text": " then it will you know give accurate predictions of how they're performing"}, {"start": 1615.68, "end": 1621.2, "text": " and then that can go in multiple rounds so the architecture search can find new"}, {"start": 1621.2, "end": 1626.0800000000002, "text": " come up with new things that it thinks are better through like an evolutionary"}, {"start": 1626.0800000000002, "end": 1631.3200000000002, "text": " mutation algorithm the petri dish can evaluate them in the synthetic way and"}, {"start": 1631.3200000000002, "end": 1638.96, "text": " then suggest the like ten candidates to evaluate on the full test set and you"}, {"start": 1638.96, "end": 1643.4, "text": " see that way you don't have to evaluate all the like thousand candidates all"}, {"start": 1643.4, "end": 1650.48, "text": " right all right cool they do this for this MNIST and they also do it for"}, {"start": 1650.48, "end": 1660.96, "text": " finding a RNN cell for the pen treebank this is a language modeling task and the"}, {"start": 1660.96, "end": 1664.44, "text": " this is a benchmark for neural architecture search where you're trying"}, {"start": 1664.44, "end": 1671.0400000000002, "text": " to find a good RNN cell to get the perplexity really low and here you can"}, {"start": 1671.04, "end": 1676.8799999999999, "text": " see if they give the same amount of data to all the methods then the benchmark"}, {"start": 1676.8799999999999, "end": 1684.52, "text": " neural architecture search is worse than the synthetic petri dish informed"}, {"start": 1684.52, "end": 1689.56, "text": " architecture search now one has to say on the full date I believe the NAO gets"}, {"start": 1689.56, "end": 1696.2, "text": " to about here but of course if you give all of them the same data the neural the"}, {"start": 1696.2, "end": 1702.76, "text": " petri dish beats this method and I think still this method here uses way more"}, {"start": 1702.76, "end": 1708.3600000000001, "text": " compute because it always has to evaluate all the candidates and that's"}, {"start": 1708.3600000000001, "end": 1713.32, "text": " exactly one of these where I learn an architecture to predict the other"}, {"start": 1713.32, "end": 1718.52, "text": " architecture by just looking at it so it works but it doesn't work as well as"}, {"start": 1718.52, "end": 1723.16, "text": " actually running the architecture in an abstract fashion this also shows you the"}, {"start": 1723.16, "end": 1728.6000000000001, "text": " importance of selecting your experimental evaluation in a smart way"}, {"start": 1728.6000000000001, "end": 1732.64, "text": " like they argue they argue for very long why it makes sense to evaluate"}, {"start": 1732.64, "end": 1739.1200000000001, "text": " everything on reduced data such that their method here can be better and they"}, {"start": 1739.1200000000001, "end": 1744.6000000000001, "text": " don't have to compare to the full thing it's easier for them to work on reduced"}, {"start": 1744.6000000000001, "end": 1749.48, "text": " data and they argue you know it's it's it's what people usually do in practice"}, {"start": 1749.48, "end": 1756.76, "text": " and that's the the task they focus on so you know good good good good paper"}, {"start": 1756.76, "end": 1763.84, "text": " writing right here yeah that's basically it to the paper there's a lot of things"}, {"start": 1763.84, "end": 1772.64, "text": " to be said here I think this works in very very limited settings it seems to"}, {"start": 1772.64, "end": 1778.32, "text": " me that it's sort of brittle with respect to how you abstract and also it"}, {"start": 1778.32, "end": 1783.3999999999999, "text": " it's always the case like how many how large is this synthetic training data in"}, {"start": 1783.3999999999999, "end": 1789.08, "text": " their case there they like abstract this to 20 or 30 data points or something like"}, {"start": 1789.08, "end": 1793.1599999999999, "text": " this so it seems to me since you're optimizing this training data with"}, {"start": 1793.1599999999999, "end": 1799.76, "text": " gradient descent what you would mainly find are adversarial sort of adversarial"}, {"start": 1799.76, "end": 1804.76, "text": " examples to this architecture here so I'm going to guess that the inner"}, {"start": 1804.76, "end": 1810.36, "text": " optimization is very noisy and that's because if you really let your"}, {"start": 1810.36, "end": 1816.56, "text": " optimizer run then it will abuse every single thing it can to match that"}, {"start": 1816.56, "end": 1820.24, "text": " validation loss and that will usually lead to an adversarial example since"}, {"start": 1820.24, "end": 1827.64, "text": " you're optimizing the data itself okay so I think this suffers from that and"}, {"start": 1827.64, "end": 1832.04, "text": " this is we had this in the in the planning you know the planning in in"}, {"start": 1832.04, "end": 1836.48, "text": " learned world models and reinforcement learning where if you have a really"}, {"start": 1836.48, "end": 1840.58, "text": " really good planner it will just abuse the mistakes that you make in"}, {"start": 1840.58, "end": 1844.32, "text": " approximating the true world and the same here you're going to make mistakes"}, {"start": 1844.32, "end": 1850.0, "text": " approximating this architecture here and the better your your optimizer is for"}, {"start": 1850.0, "end": 1856.44, "text": " producing this synthetic data the probably the worse the worse the result"}, {"start": 1856.44, "end": 1861.76, "text": " is going to match the worst that these losses are going to actually match now"}, {"start": 1861.76, "end": 1865.36, "text": " okay these losses will match because they're that's what you train for but"}, {"start": 1865.36, "end": 1869.72, "text": " the worse these two curves will match each other because now you're just"}, {"start": 1869.72, "end": 1875.72, "text": " finding adversarial examples for your particular training data another concern"}, {"start": 1875.72, "end": 1879.8799999999999, "text": " I have here is with respect to the double descent phenomenon so if you know"}, {"start": 1879.8799999999999, "end": 1884.72, "text": " the double descent phenomenon if here you have your number of parameters and"}, {"start": 1884.72, "end": 1892.48, "text": " here you have your validation loss let's say and you know that if I add parameters"}, {"start": 1892.48, "end": 1897.24, "text": " I can make my validation loss go down so this is assuming I have a model with p"}, {"start": 1897.24, "end": 1902.44, "text": " parameters and I always train it on the train data to like to convergence if I"}, {"start": 1902.44, "end": 1907.16, "text": " add parameters I can generalize better until a point where I add too many"}, {"start": 1907.16, "end": 1911.68, "text": " parameters and I start overfitting and my validation loss goes up again but the"}, {"start": 1911.68, "end": 1918.3200000000002, "text": " double descent phenomenon and I think I've done a video on this shows that"}, {"start": 1918.3200000000002, "end": 1923.44, "text": " after a certain threshold you get the interpolation threshold the validation"}, {"start": 1923.44, "end": 1929.24, "text": " loss goes actually down again it goes down even further here now I'm so this"}, {"start": 1929.24, "end": 1933.68, "text": " is a very strange phenomenon by itself but I'm sort of concerned that if you do"}, {"start": 1933.68, "end": 1938.3200000000002, "text": " this abstraction that this paper proposes so you read your let's say your"}, {"start": 1938.32, "end": 1942.4399999999998, "text": " full model is here with a large number of parameters so it is past this"}, {"start": 1942.4399999999998, "end": 1947.6399999999999, "text": " interpolation threshold if you now seriously reduce the number of"}, {"start": 1947.6399999999999, "end": 1953.9199999999998, "text": " parameters because you want to go into this petri dish you will get maybe you"}, {"start": 1953.9199999999998, "end": 1957.54, "text": " will cross this interpolation threshold and actually be on this side of the"}, {"start": 1957.54, "end": 1962.12, "text": " curve right here now of course at the same time you reduce the amount of data"}, {"start": 1962.12, "end": 1969.3999999999999, "text": " which would push you over here again but it is different data so I'm not sure how"}, {"start": 1969.3999999999999, "end": 1973.08, "text": " all of this is going to play out it appears to work in these settings right"}, {"start": 1973.08, "end": 1982.04, "text": " here but I I think this is it's it's sort of it's sort of applicable in some"}, {"start": 1982.04, "end": 1987.4799999999998, "text": " situations and it's it'd be very cool if we develop this further such that we"}, {"start": 1987.4799999999998, "end": 1992.08, "text": " understand when it applies and when we can use it because I feel this can be a"}, {"start": 1992.08, "end": 1997.76, "text": " very cool thing if we understand it better and if we can apply it throughout"}, {"start": 1997.76, "end": 2004.12, "text": " all right that's the end if you like this paper leave a comment if you didn't"}, {"start": 2004.12, "end": 2025.52, "text": " like it leave a comment and bye bye see you next time"}]
Yannic Kilchner
https://www.youtube.com/watch?v=CA8JPbJ75tY
CornerNet: Detecting Objects as Paired Keypoints (Paper Explained)
Many object detectors focus on locating the center of the object they want to find. However, this leaves them with the secondary problem of determining the specifications of the bounding box, leading to undesirable solutions like anchor boxes. This paper directly detects the top left and the bottom right corners of objects independently, along with descriptors that allows to match the two later and form a complete bounding box. For this, a new pooling method, called corner pooling, is introduced. OUTLINE: 0:00 - Intro & High-Level Overview 1:40 - Object Detection 2:40 - Pipeline I - Hourglass 4:00 - Heatmap & Embedding Outputs 8:40 - Heatmap Loss 10:55 - Embedding Loss 14:35 - Corner Pooling 20:40 - Experiments Paper: https://arxiv.org/abs/1808.01244 Code: https://github.com/princeton-vl/CornerNet Abstract: We propose CornerNet, a new approach to object detection where we detect an object bounding box as a pair of keypoints, the top-left corner and the bottom-right corner, using a single convolution neural network. By detecting objects as paired keypoints, we eliminate the need for designing a set of anchor boxes commonly used in prior single-stage detectors. In addition to our novel formulation, we introduce corner pooling, a new type of pooling layer that helps the network better localize corners. Experiments show that CornerNet achieves a 42.2% AP on MS COCO, outperforming all existing one-stage detectors. Authors: Hei Law, Jia Deng 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
Hello there, today we're looking at cornernet detecting objects as paired key points by Heilaw and Jia Ding. So on a high level, this paper detects objects in images. Let's say this is an image and here's a chair, you know, you have your chair. And the way you detect the chair for this paper is going to be you detect the bottom right and the top left corners of the bounding box of the image. So rather than detecting the middle and then specifying height and width, like we saw in the Facebook DTR paper, you detect the two corners. And this paper goes through what they have to do to get this to work, including a new pooling method called corner pooling. So that's the gist of the paper. As always, if you like content like this, consider subscribing and sharing it out to other people. That would be very helpful. So a commenter actually recommended this paper to me after I made a video on Facebook's DETR object detection pipeline. I said something like, okay, since that paper always would detect the middle of the object and the height and width, couldn't you make something that also that detects the corners here and the corner here and then that would define a bounding box just as well. And in the comments and thank you very much for that. Someone made that pointed me to this paper. It's a bit older, as you can see, but it's I still think it's, it's pretty cool. So we've already seen the problem. Like the problem isn't hard. And it's detecting bounding boxes and images. And in these data set, the problems, the difficult parts are that you sometimes have multiple objects like here, if two humans, they can be overlapping, they can be of different sizes, that could be like a third human, like small back here, there can be other objects, you don't know how many there are, and so on. So it is it is a fairly complicated problem. But as I already said, the way that cornernet here does this is by predicting the locations of the top left and bottom right corner, thereby defining a bounding box. And it does this independently. So there's one network basically, that does the top left and one that does the bottom right and they are then combined and at the end, they're sort of refined, I think. So the architecture is pretty simple. First you put the image through a ConvNet, which is like a feature extractor. So this is the basic part. It was even the basic part of Facebook's DETR pipeline. First you have some sort of ConvNet. Now they in this case use in this hourglass architecture that described down, down here somewhere. And this basically compresses the image into a smaller resolutions, I would take that image and compress it down to very small resolution, but many, many channels. So it's sort of forced to learn a global semantic representation, and then it up samples the image again, and down samples it again, and it up samples it again through. So at each of these steps, there are many convolutional layers right here. And because that would lose you too much space, like local information, there are skip connections built in between pairs of layers, where information can travel without computation, basically. So this is a this is fairly standard architecture right here. But then after these hourglass CNN, you get to these prediction modules. Now let me switch back to the top drawing. Basically what you want as an output of these prediction modules is two things. So first of all, you want these heat maps, sorry about that. And these heat maps will simply tell you where are the corners. Okay. Now the heat maps, their dimensions are the height of the image. Sorry, the height here, H, come on. And the width of the image. And this here would be the number of classes C. Okay, so you have one channel for each of the classes that you predict. And the heat map will basically be very high at the location and channel where there is a corner of that. So you see have one heat map for the top left corners, and one heat map for the bottom right corners. And then also what you want to predict are these embeddings. Now, simply because you have, you know, I said there can be multiple instances of the same class in the in the same image. So now you have, in this case, particular case, you're going to even if you predict absolutely correctly, you predict two top left corners and two bottom right corners. Now this isn't particularly hard because there's only one configuration that can possibly be but there could be situations where there are multiple. And that's why you need to somehow match these corners, you have to match, you have to know which ones of those are the same objects. And they do this by a second output in their heads called this embeddings. Now these embeddings, they're simply vectors. And the only thing that they're asked to do is they're asked to have a large inner product whenever they belong to the same object. And they are asked to have a small inner product, sorry, when they're when they belong to the different, to different objects. So this orange thing here would have a large inner product with this green bottom right corner embedding. Okay, so you train these embeddings, they don't need to mean anything, you simply train them to predict the same thing for the same objects and different things for different objects. So after that, when you match the corners, you can simply go over, you can say, ah, this which one of these two right here has the larger inner product, or you can do like some Hungarian matching, and maximize the total inner product or something like this. This was quite surprising to me that it works, but it's based on a line of research that is already has already established that this can work. Because ultimately, these things, these two pipelines do not really communicate, right. So I'm going to guess what they learn is sort of a sort of a descriptor of the actual object that's there, because if both describe the objects that that's there, with their embeddings, their embeddings are going to have a large inner product. And if they describe different objects, then their embeddings are not going to match, right. So even though you train the this objective, I still think that these embeddings would pick up something about the object, something about the visual characteristics of the objects will be very interesting to see whether someone could actually parse out what they what they do, because it's almost impossible otherwise for these things to be learnable. All right, so that's the that's the goal right here, you want to get these heat maps and these embeddings. And the way you do it is fairly easy architecturally, you have these two prediction modules, one for top left and one for bottom right, and each of them have three outputs, the heat maps, the embeddings, and here the offsets are simply a way for you to deal with the fact that you downsample and by downsampling, you have to round certain pixels to certain locations, and then the offsets, they they compensate for this, but I don't want to focus on these right now. So you simply have these two outputs right here. Now we'll look at corner pooling in a second. But how do you train this? So you can now say, okay, if I have a picture like this, there, there is exactly two locations in the class human, where the the top left corner is correct. And that's right here. And that's right here. Okay, so two locations. So I fill I make my matrix, my target matrix with a one here and the one here, and zeros everywhere else, right? 0000000000. And I train my network to give me this particular thing as an output for these heat for this heat map in the channel human. This this might work, but it is more profitable, let's say, if you allow for some slack. So what they say is, you know, since if I'm anywhere within this orange circle right here with my prediction, my resulting bounding box is still going to overlap fairly well with the ground truth bounding box. And the accuracy measures for these things, I think are based on how much you overlap with the ground truth bounding boxes. So what they do basically is they, they give, they put a one in the spot where the actual corner is, and then they put like a 0.9 around it 0.9 0.9, and so on, and they kind of flatten out. So this is sort of a Gaussian right here in multiple dimensions, if that drawing makes any sense. And they say, well, you the closer you are, basically, the more reward you get. So you train it to predict in this general location. Now of course, the size exact size of this Gaussian has to be dependent on the actual size of the box itself. And they have, they, they regard that and say exactly how they calculate these Gaussians. But for the understanding, it's just important that they do give some slack here in how they compute the loss with respect to the heat map. Now the loss with respect to the, to the embeddings is pretty simple, pretty straightforward. So remember these embeddings, you have two embeddings per, you have the top left embedding, that's the E tk, the top embed, the top corner embedding, and you have the bottom right embedding. And what you want is for them to be close together when they describe the same object, right. So this is this push and pull losses. So in the pull loss, what you want to do is you want to minimize the distances of these two things to this thing right here. And this thing is simply so E k is simply the the mean, so it's E tk plus E bk divided by two, that's simply if your top left corner is here, and your bottom right corner is here, and they have embeddings, this one has this embedding, and this one has that embedding, then the mean of the two embeddings, which I guess is whatever this right here. Yeah, that's about the mean. So the location is not important, actually. So it's about the embedding vectors, it's not about where the corners are. The two embedding vectors must be close together. And you model that not directly by making them close to each other, but by making both close to their mean. And that probably saves you some back propagation troubles, where you, if you if you have two moving parts in a loss function, and you optimize both, then you tend to, so you have two things, you want to bring them closer together, they might tend to overshoot or something like this. Okay, so this brings those two closer together. And in the push loss, what you want to do is you want to simply make the mean between the two, remember, this is this is the mean, this the mean embedding of this object far away from the mean embedding of any other object in the picture. Okay, so this here is a is a margin loss, which means that you cap it at some point. So the if they're close together, you if two different if the embeddings of two different objects are close together, and see here, this quantity will be small, and therefore, it will lead to this delta, you give a loss of one, the delta here is one in this case, but as they get further apart, you're more and more happy. And you reduce your loss until you don't give you so you don't give any any bonus for them being super far apart, you don't simply don't want them to be closer together than one. All right, in their case, I think they have a the dimension of these vectors is actually one, which basically means they just put a single number, which I find astonishing that that works. Yes, they use embeddings of one dimension. So they just use numbers. Astonishing that it works, but okay. So that's how you train the the embedding output embeddings close together of the same objects of the two corners and embeddings far apart for different objects. All right, so we can now predict where the corners are, and we can match them. Now, one center part of this is the corner pooling. And why is the corner pooling necessary? So what's the problem with this sort of approach? The problem and they have a an example right here. The problem when you want to predict a corner of an object is that in a CNN, what the CNN can is good at is like local neighborhood information, right? So if you have to predict, let's go for the moon, actually, here, let's predict the location of the moon. If I have to predict the location of the moon, and I'm a CNN, and I have this receptive field I'm like, Oh, yes, it's like in here. And then I have this receptive field. And I'm like, yes, it's in here. And then I zoom in on the corner, not on the moon itself, but on the corner where I need to predict, right? At some point, I like I'm sort of, I'm like, wait, wait, where is it? Because in this particular field receptive field of this resolution, I have I have no clue if the moon is close, right? So at the location where the actual bounding box is, I have no local information of the object, because usually objects are not squares, they're sort of round like the moon, or like here the plane, these corners, they have no local information about where the plane is. And corner pooling is a method to propagate that information along the axis. So what corner in corner pooling, what you would allow the location here in the CNN to do is to not only look at its itself, so its own location, but actually to extend its field of view over to the right, and down to the bottom, it's asked to predict a top left corner. So what you do is you max pool everything from here to this corner detector. So the corner detector will basically be able to detect whenever in either this band right here. So whenever in this band right here, there is the top, like the top of an object like the top of the moon here, this corner detector can say, ah, that's probably the right height, right here for a corner. And it combines this with the information of this, this side here, where it also says, oh, there is the side of the moon, that's probably the correct, you know, up down. So there's probably a corner right here. Okay, whereas a, like a location right here, which would get the same signal from the right, or like almost the same signal plus this signal right here. But in essence, it would also detect the top of the moon, but it would not get the same signal from down here. And therefore it says, ah, even though to the right, I see some the top of an object, I don't see the left of an object to my bottom. So I'm not going to predict a corner right here. Alright, so this corner pooling goes for the top left, and of course, equivalently goes for the bottom right, that can always max pools to up and to the left of itself. And that's exactly what you see here. So in this corner pooling, what you can do is you can propagate signal to the left, and to up, and then you add the two informations. And that will give you your output feature. And you can calculate this actually fairly efficiently by doing like, like you do a cumulative sum, you do like a cumulative maximum across the different axes. And then you simply add two arrays. And that's it. So you simply put the corner pooling before you predict the the these different outputs right here, the heat maps and the embeddings, which means that this hourglass network is not affected by this. Just the predictors of heat maps and embeddings, they then get the information from this hourglass network into these into these directions. Okay, I think that's a pretty, pretty neat method of solving this. And here they show how you can calculate this. And then the corner pooling is right here, they do add a skip connection here. Because sometimes, if you just aggregate this information, you might, you might actually get confused because so the trouble, of course, comes when there are multiple, like, different objects that have, you know, the same top, and then there's also a person right here, that so it gets like a signal, it gets another signal that there is the left side of a person right here, or maybe, you know, like this, so it will, it will predict like a corner, maybe here, where there is none, so it's, it's, sometimes it is important to have local information still. And that's exactly what this skip connection is supposed to address, I guess the situation up here would be resolved by the different embeddings, but still, so you have that you add and you put another bunch of convolutional layers on top of that, and then you'll get your predictions. And that's it. You mix all the losses, so there is a detection loss from the embeddings, there's a, sorry, from the heat maps, there is the pull and push losses for the embeddings. And there's this offset loss that you train to compensate for the down, the downsampling errors. And that's it. And they ablate the various things here, basically, they show that they're better than other one shot, or one stage predictors is so apparently, there's one stage predictors where you have a single pass through a neural network. And there's two stage predictors where you have multiple or two passes through different neural networks. And they compete in the in the one, one stage neural network category, if so to say, and they show that they get significant improvements with and due to this corner pooling, which is pretty cool to see, because it makes sense. It sort of makes sense how you would like to think about it like this. And to see that it helps is pretty neat. Yeah, they also investigate how large they have to make these these Gaussians and so on. And these are some qualitative examples, you can see that without the corner pooling, what you'll get is that so the top here and the left and the right are correct are detected correctly. But you can see that probably the network thinks that there is an extension of the object right here, and therefore doesn't do doesn't do a good job. Because this, this position right here, it has no access to sort of it has to use like a long range access. It can't it can't really look in detail at the features here or here. So when it scans up and down the side, where the bottom corner where the bottom break is, it can it can only look at very coarse features, because it has to basically transmit information in the CNN of a higher layer. And the higher layer has a higher receptive field, which means it has a lower resolution. So it can't really go and look very in very detailed fashion at this border right here. So it misses it. Okay. Same right here, as you can see, so there are a number of failure cases that they can now solve using this method compared to if they didn't use the corner pooling. They show some also some times where their method fails. For example, here, it matches the top bot, top left and bottom right corners of two different objects, because they their embeddings were close enough. And yeah, that's what I'm saying. I'm I'm wondering what these embeddings actually learn, because they are generated independently. So not entirely sure. It's also not exactly what I had in mind when I formulated this idea in the last video. But I'm actually not sure what I had in mind myself, to be honest. But in my mind, it seemed to be like you should be able to train a network. If there is an object right here, you could train a network to predict for any given location, let's say how many pixels to its bottom right, or maybe you want to normalize by the area. That's there are part of a particular object. And then you could use you could predict each pixel and use like the differences between the differences between the points as as scores for bounding boxes. I don't know if you see what I mean. You could basically tell the you have you'd have one network predict everything to the bottom right, and then you'd use the differences. And the transformers would be very good at that because they can sort of have this attention between each pairs of points and so on. I'm not entirely sure, but this might just be crap. Yeah, here's some more examples. This appears to work really nicely. But of course, in the qualitative qualitative examples, it always works nicely, but they also demonstrated. All right, I found this paper all in all pretty cool, pretty neat. It's a simple idea. It's executed. Well, I don't have the feeling that there are like too many tricks in here. And they show really that the improvement seems to be due to their their corner pooling method. And that's pretty neat. So if you like this paper, make sure to check it out. And I'll see you next time. Bye bye.
[{"start": 0.0, "end": 6.08, "text": " Hello there, today we're looking at cornernet detecting objects as paired key points by"}, {"start": 6.08, "end": 9.1, "text": " Heilaw and Jia Ding."}, {"start": 9.1, "end": 14.700000000000001, "text": " So on a high level, this paper detects objects in images."}, {"start": 14.700000000000001, "end": 20.14, "text": " Let's say this is an image and here's a chair, you know, you have your chair."}, {"start": 20.14, "end": 25.88, "text": " And the way you detect the chair for this paper is going to be you detect the bottom"}, {"start": 25.88, "end": 30.759999999999998, "text": " right and the top left corners of the bounding box of the image."}, {"start": 30.759999999999998, "end": 35.76, "text": " So rather than detecting the middle and then specifying height and width, like we saw in"}, {"start": 35.76, "end": 39.92, "text": " the Facebook DTR paper, you detect the two corners."}, {"start": 39.92, "end": 44.16, "text": " And this paper goes through what they have to do to get this to work, including a new"}, {"start": 44.16, "end": 47.84, "text": " pooling method called corner pooling."}, {"start": 47.84, "end": 51.32, "text": " So that's the gist of the paper."}, {"start": 51.32, "end": 56.52, "text": " As always, if you like content like this, consider subscribing and sharing it out to"}, {"start": 56.52, "end": 57.52, "text": " other people."}, {"start": 57.52, "end": 60.74, "text": " That would be very helpful."}, {"start": 60.74, "end": 68.58, "text": " So a commenter actually recommended this paper to me after I made a video on Facebook's DETR"}, {"start": 68.58, "end": 70.03999999999999, "text": " object detection pipeline."}, {"start": 70.03999999999999, "end": 75.44, "text": " I said something like, okay, since that paper always would detect the middle of the object"}, {"start": 75.44, "end": 82.2, "text": " and the height and width, couldn't you make something that also that detects the corners"}, {"start": 82.2, "end": 88.0, "text": " here and the corner here and then that would define a bounding box just as well."}, {"start": 88.0, "end": 92.88, "text": " And in the comments and thank you very much for that."}, {"start": 92.88, "end": 95.92, "text": " Someone made that pointed me to this paper."}, {"start": 95.92, "end": 101.8, "text": " It's a bit older, as you can see, but it's I still think it's, it's pretty cool."}, {"start": 101.8, "end": 104.72, "text": " So we've already seen the problem."}, {"start": 104.72, "end": 106.67999999999999, "text": " Like the problem isn't hard."}, {"start": 106.67999999999999, "end": 110.4, "text": " And it's detecting bounding boxes and images."}, {"start": 110.4, "end": 116.72, "text": " And in these data set, the problems, the difficult parts are that you sometimes have multiple"}, {"start": 116.72, "end": 123.0, "text": " objects like here, if two humans, they can be overlapping, they can be of different sizes,"}, {"start": 123.0, "end": 127.96000000000001, "text": " that could be like a third human, like small back here, there can be other objects, you"}, {"start": 127.96000000000001, "end": 129.8, "text": " don't know how many there are, and so on."}, {"start": 129.8, "end": 134.56, "text": " So it is it is a fairly complicated problem."}, {"start": 134.56, "end": 140.88, "text": " But as I already said, the way that cornernet here does this is by predicting the locations"}, {"start": 140.88, "end": 145.96, "text": " of the top left and bottom right corner, thereby defining a bounding box."}, {"start": 145.96, "end": 147.48, "text": " And it does this independently."}, {"start": 147.48, "end": 154.84, "text": " So there's one network basically, that does the top left and one that does the bottom"}, {"start": 154.84, "end": 162.66, "text": " right and they are then combined and at the end, they're sort of refined, I think."}, {"start": 162.66, "end": 165.96, "text": " So the architecture is pretty simple."}, {"start": 165.96, "end": 171.04, "text": " First you put the image through a ConvNet, which is like a feature extractor."}, {"start": 171.04, "end": 174.38, "text": " So this is the basic part."}, {"start": 174.38, "end": 179.04, "text": " It was even the basic part of Facebook's DETR pipeline."}, {"start": 179.04, "end": 180.64, "text": " First you have some sort of ConvNet."}, {"start": 180.64, "end": 188.48, "text": " Now they in this case use in this hourglass architecture that described down, down here"}, {"start": 188.48, "end": 190.12, "text": " somewhere."}, {"start": 190.12, "end": 198.24, "text": " And this basically compresses the image into a smaller resolutions, I would take that image"}, {"start": 198.24, "end": 202.68, "text": " and compress it down to very small resolution, but many, many channels."}, {"start": 202.68, "end": 208.24, "text": " So it's sort of forced to learn a global semantic representation, and then it up samples the"}, {"start": 208.24, "end": 212.12, "text": " image again, and down samples it again, and it up samples it again through."}, {"start": 212.12, "end": 217.34, "text": " So at each of these steps, there are many convolutional layers right here."}, {"start": 217.34, "end": 223.20000000000002, "text": " And because that would lose you too much space, like local information, there are skip connections"}, {"start": 223.20000000000002, "end": 229.84, "text": " built in between pairs of layers, where information can travel without computation, basically."}, {"start": 229.84, "end": 233.82, "text": " So this is a this is fairly standard architecture right here."}, {"start": 233.82, "end": 239.6, "text": " But then after these hourglass CNN, you get to these prediction modules."}, {"start": 239.6, "end": 243.9, "text": " Now let me switch back to the top drawing."}, {"start": 243.9, "end": 249.28, "text": " Basically what you want as an output of these prediction modules is two things."}, {"start": 249.28, "end": 253.34, "text": " So first of all, you want these heat maps, sorry about that."}, {"start": 253.34, "end": 257.52, "text": " And these heat maps will simply tell you where are the corners."}, {"start": 257.52, "end": 258.96, "text": " Okay."}, {"start": 258.96, "end": 263.8, "text": " Now the heat maps, their dimensions are the height of the image."}, {"start": 263.8, "end": 270.36, "text": " Sorry, the height here, H, come on."}, {"start": 270.36, "end": 272.8, "text": " And the width of the image."}, {"start": 272.8, "end": 279.46000000000004, "text": " And this here would be the number of classes C. Okay, so you have one channel for each"}, {"start": 279.46000000000004, "end": 281.84000000000003, "text": " of the classes that you predict."}, {"start": 281.84000000000003, "end": 288.56, "text": " And the heat map will basically be very high at the location and channel where there is"}, {"start": 288.56, "end": 290.08000000000004, "text": " a corner of that."}, {"start": 290.08000000000004, "end": 296.2, "text": " So you see have one heat map for the top left corners, and one heat map for the bottom right"}, {"start": 296.2, "end": 297.78000000000003, "text": " corners."}, {"start": 297.78000000000003, "end": 301.56, "text": " And then also what you want to predict are these embeddings."}, {"start": 301.56, "end": 307.88, "text": " Now, simply because you have, you know, I said there can be multiple instances of the"}, {"start": 307.88, "end": 311.08, "text": " same class in the in the same image."}, {"start": 311.08, "end": 316.88, "text": " So now you have, in this case, particular case, you're going to even if you predict"}, {"start": 316.88, "end": 323.16, "text": " absolutely correctly, you predict two top left corners and two bottom right corners."}, {"start": 323.16, "end": 328.68, "text": " Now this isn't particularly hard because there's only one configuration that can possibly be"}, {"start": 328.68, "end": 332.48, "text": " but there could be situations where there are multiple."}, {"start": 332.48, "end": 338.36, "text": " And that's why you need to somehow match these corners, you have to match, you have to know"}, {"start": 338.36, "end": 340.72, "text": " which ones of those are the same objects."}, {"start": 340.72, "end": 345.92, "text": " And they do this by a second output in their heads called this embeddings."}, {"start": 345.92, "end": 350.14, "text": " Now these embeddings, they're simply vectors."}, {"start": 350.14, "end": 357.88, "text": " And the only thing that they're asked to do is they're asked to have a large inner product"}, {"start": 357.88, "end": 361.46, "text": " whenever they belong to the same object."}, {"start": 361.46, "end": 367.68, "text": " And they are asked to have a small inner product, sorry, when they're when they belong to the"}, {"start": 367.68, "end": 372.48, "text": " different, to different objects."}, {"start": 372.48, "end": 377.15999999999997, "text": " So this orange thing here would have a large inner product with this green bottom right"}, {"start": 377.15999999999997, "end": 378.15999999999997, "text": " corner embedding."}, {"start": 378.15999999999997, "end": 382.44, "text": " Okay, so you train these embeddings, they don't need to mean anything, you simply train"}, {"start": 382.44, "end": 388.84, "text": " them to predict the same thing for the same objects and different things for different objects."}, {"start": 388.84, "end": 395.08, "text": " So after that, when you match the corners, you can simply go over, you can say, ah, this"}, {"start": 395.08, "end": 401.12, "text": " which one of these two right here has the larger inner product, or you can do like some"}, {"start": 401.12, "end": 407.48, "text": " Hungarian matching, and maximize the total inner product or something like this."}, {"start": 407.48, "end": 412.6, "text": " This was quite surprising to me that it works, but it's based on a line of research that"}, {"start": 412.6, "end": 417.24, "text": " is already has already established that this can work."}, {"start": 417.24, "end": 423.02000000000004, "text": " Because ultimately, these things, these two pipelines do not really communicate, right."}, {"start": 423.02000000000004, "end": 432.16, "text": " So I'm going to guess what they learn is sort of a sort of a descriptor of the actual object"}, {"start": 432.16, "end": 438.88000000000005, "text": " that's there, because if both describe the objects that that's there, with their embeddings,"}, {"start": 438.88000000000005, "end": 441.96000000000004, "text": " their embeddings are going to have a large inner product."}, {"start": 441.96000000000004, "end": 445.82000000000005, "text": " And if they describe different objects, then their embeddings are not going to match, right."}, {"start": 445.82000000000005, "end": 451.28000000000003, "text": " So even though you train the this objective, I still think that these embeddings would"}, {"start": 451.28000000000003, "end": 457.40000000000003, "text": " pick up something about the object, something about the visual characteristics of the objects"}, {"start": 457.4, "end": 463.88, "text": " will be very interesting to see whether someone could actually parse out what they what they"}, {"start": 463.88, "end": 471.79999999999995, "text": " do, because it's almost impossible otherwise for these things to be learnable."}, {"start": 471.79999999999995, "end": 477.79999999999995, "text": " All right, so that's the that's the goal right here, you want to get these heat maps and"}, {"start": 477.79999999999995, "end": 478.96, "text": " these embeddings."}, {"start": 478.96, "end": 484.46, "text": " And the way you do it is fairly easy architecturally, you have these two prediction modules, one"}, {"start": 484.46, "end": 489.82, "text": " for top left and one for bottom right, and each of them have three outputs, the heat"}, {"start": 489.82, "end": 495.64, "text": " maps, the embeddings, and here the offsets are simply a way for you to deal with the"}, {"start": 495.64, "end": 501.96, "text": " fact that you downsample and by downsampling, you have to round certain pixels to certain"}, {"start": 501.96, "end": 508.4, "text": " locations, and then the offsets, they they compensate for this, but I don't want to focus"}, {"start": 508.4, "end": 511.46, "text": " on these right now."}, {"start": 511.46, "end": 514.6, "text": " So you simply have these two outputs right here."}, {"start": 514.6, "end": 516.84, "text": " Now we'll look at corner pooling in a second."}, {"start": 516.84, "end": 519.86, "text": " But how do you train this?"}, {"start": 519.86, "end": 527.68, "text": " So you can now say, okay, if I have a picture like this, there, there is exactly two locations"}, {"start": 527.68, "end": 534.26, "text": " in the class human, where the the top left corner is correct."}, {"start": 534.26, "end": 535.72, "text": " And that's right here."}, {"start": 535.72, "end": 536.88, "text": " And that's right here."}, {"start": 536.88, "end": 538.76, "text": " Okay, so two locations."}, {"start": 538.76, "end": 545.9, "text": " So I fill I make my matrix, my target matrix with a one here and the one here, and zeros"}, {"start": 545.9, "end": 547.96, "text": " everywhere else, right?"}, {"start": 547.96, "end": 549.98, "text": " 0000000000."}, {"start": 549.98, "end": 555.42, "text": " And I train my network to give me this particular thing as an output for these heat for this"}, {"start": 555.42, "end": 558.84, "text": " heat map in the channel human."}, {"start": 558.84, "end": 569.5600000000001, "text": " This this might work, but it is more profitable, let's say, if you allow for some slack."}, {"start": 569.5600000000001, "end": 574.98, "text": " So what they say is, you know, since if I'm anywhere within this orange circle right here"}, {"start": 574.98, "end": 580.24, "text": " with my prediction, my resulting bounding box is still going to overlap fairly well"}, {"start": 580.24, "end": 582.7800000000001, "text": " with the ground truth bounding box."}, {"start": 582.7800000000001, "end": 587.8000000000001, "text": " And the accuracy measures for these things, I think are based on how much you overlap"}, {"start": 587.8, "end": 590.3599999999999, "text": " with the ground truth bounding boxes."}, {"start": 590.3599999999999, "end": 600.88, "text": " So what they do basically is they, they give, they put a one in the spot where the actual"}, {"start": 600.88, "end": 609.4399999999999, "text": " corner is, and then they put like a 0.9 around it 0.9 0.9, and so on, and they kind of flatten"}, {"start": 609.4399999999999, "end": 610.4399999999999, "text": " out."}, {"start": 610.4399999999999, "end": 616.02, "text": " So this is sort of a Gaussian right here in multiple dimensions, if that drawing makes"}, {"start": 616.02, "end": 620.12, "text": " any sense."}, {"start": 620.12, "end": 624.46, "text": " And they say, well, you the closer you are, basically, the more reward you get."}, {"start": 624.46, "end": 628.9, "text": " So you train it to predict in this general location."}, {"start": 628.9, "end": 635.42, "text": " Now of course, the size exact size of this Gaussian has to be dependent on the actual"}, {"start": 635.42, "end": 637.9399999999999, "text": " size of the box itself."}, {"start": 637.9399999999999, "end": 644.78, "text": " And they have, they, they regard that and say exactly how they calculate these Gaussians."}, {"start": 644.78, "end": 650.52, "text": " But for the understanding, it's just important that they do give some slack here in how they"}, {"start": 650.52, "end": 654.8399999999999, "text": " compute the loss with respect to the heat map."}, {"start": 654.8399999999999, "end": 665.16, "text": " Now the loss with respect to the, to the embeddings is pretty simple, pretty straightforward."}, {"start": 665.16, "end": 672.36, "text": " So remember these embeddings, you have two embeddings per, you have the top left embedding,"}, {"start": 672.36, "end": 679.7, "text": " that's the E tk, the top embed, the top corner embedding, and you have the bottom right embedding."}, {"start": 679.7, "end": 685.98, "text": " And what you want is for them to be close together when they describe the same object,"}, {"start": 685.98, "end": 687.12, "text": " right."}, {"start": 687.12, "end": 690.08, "text": " So this is this push and pull losses."}, {"start": 690.08, "end": 695.3000000000001, "text": " So in the pull loss, what you want to do is you want to minimize the distances of these"}, {"start": 695.3000000000001, "end": 698.82, "text": " two things to this thing right here."}, {"start": 698.82, "end": 707.6800000000001, "text": " And this thing is simply so E k is simply the the mean, so it's E tk plus E bk divided"}, {"start": 707.6800000000001, "end": 713.4200000000001, "text": " by two, that's simply if your top left corner is here, and your bottom right corner is here,"}, {"start": 713.4200000000001, "end": 718.36, "text": " and they have embeddings, this one has this embedding, and this one has that embedding,"}, {"start": 718.36, "end": 723.46, "text": " then the mean of the two embeddings, which I guess is whatever this right here."}, {"start": 723.46, "end": 726.94, "text": " Yeah, that's about the mean."}, {"start": 726.94, "end": 728.82, "text": " So the location is not important, actually."}, {"start": 728.82, "end": 733.1, "text": " So it's about the embedding vectors, it's not about where the corners are."}, {"start": 733.1, "end": 736.58, "text": " The two embedding vectors must be close together."}, {"start": 736.58, "end": 741.0, "text": " And you model that not directly by making them close to each other, but by making both"}, {"start": 741.0, "end": 742.96, "text": " close to their mean."}, {"start": 742.96, "end": 750.0400000000001, "text": " And that probably saves you some back propagation troubles, where you, if you if you have two"}, {"start": 750.0400000000001, "end": 755.6600000000001, "text": " moving parts in a loss function, and you optimize both, then you tend to, so you have two things,"}, {"start": 755.66, "end": 760.3, "text": " you want to bring them closer together, they might tend to overshoot or something like"}, {"start": 760.3, "end": 761.3, "text": " this."}, {"start": 761.3, "end": 765.28, "text": " Okay, so this brings those two closer together."}, {"start": 765.28, "end": 774.4, "text": " And in the push loss, what you want to do is you want to simply make the mean between"}, {"start": 774.4, "end": 781.3399999999999, "text": " the two, remember, this is this is the mean, this the mean embedding of this object far"}, {"start": 781.34, "end": 787.02, "text": " away from the mean embedding of any other object in the picture."}, {"start": 787.02, "end": 793.4200000000001, "text": " Okay, so this here is a is a margin loss, which means that you cap it at some point."}, {"start": 793.4200000000001, "end": 802.1800000000001, "text": " So the if they're close together, you if two different if the embeddings of two different"}, {"start": 802.1800000000001, "end": 807.86, "text": " objects are close together, and see here, this quantity will be small, and therefore,"}, {"start": 807.86, "end": 815.44, "text": " it will lead to this delta, you give a loss of one, the delta here is one in this case,"}, {"start": 815.44, "end": 820.24, "text": " but as they get further apart, you're more and more happy."}, {"start": 820.24, "end": 827.14, "text": " And you reduce your loss until you don't give you so you don't give any any bonus for them"}, {"start": 827.14, "end": 832.78, "text": " being super far apart, you don't simply don't want them to be closer together than one."}, {"start": 832.78, "end": 840.06, "text": " All right, in their case, I think they have a the dimension of these vectors is actually"}, {"start": 840.06, "end": 846.86, "text": " one, which basically means they just put a single number, which I find astonishing that"}, {"start": 846.86, "end": 847.86, "text": " that works."}, {"start": 847.86, "end": 850.54, "text": " Yes, they use embeddings of one dimension."}, {"start": 850.54, "end": 854.5, "text": " So they just use numbers."}, {"start": 854.5, "end": 857.5799999999999, "text": " Astonishing that it works, but okay."}, {"start": 857.58, "end": 867.1800000000001, "text": " So that's how you train the the embedding output embeddings close together of the same"}, {"start": 867.1800000000001, "end": 872.82, "text": " objects of the two corners and embeddings far apart for different objects."}, {"start": 872.82, "end": 877.7800000000001, "text": " All right, so we can now predict where the corners are, and we can match them."}, {"start": 877.7800000000001, "end": 882.0600000000001, "text": " Now, one center part of this is the corner pooling."}, {"start": 882.0600000000001, "end": 884.82, "text": " And why is the corner pooling necessary?"}, {"start": 884.82, "end": 888.7600000000001, "text": " So what's the problem with this sort of approach?"}, {"start": 888.7600000000001, "end": 893.1800000000001, "text": " The problem and they have a an example right here."}, {"start": 893.1800000000001, "end": 900.7800000000001, "text": " The problem when you want to predict a corner of an object is that in a CNN, what the CNN"}, {"start": 900.7800000000001, "end": 905.34, "text": " can is good at is like local neighborhood information, right?"}, {"start": 905.34, "end": 909.58, "text": " So if you have to predict, let's go for the moon, actually, here, let's predict the location"}, {"start": 909.58, "end": 910.58, "text": " of the moon."}, {"start": 910.58, "end": 914.7800000000001, "text": " If I have to predict the location of the moon, and I'm a CNN, and I have this receptive field"}, {"start": 914.78, "end": 916.6999999999999, "text": " I'm like, Oh, yes, it's like in here."}, {"start": 916.6999999999999, "end": 918.9399999999999, "text": " And then I have this receptive field."}, {"start": 918.9399999999999, "end": 920.28, "text": " And I'm like, yes, it's in here."}, {"start": 920.28, "end": 924.78, "text": " And then I zoom in on the corner, not on the moon itself, but on the corner where I need"}, {"start": 924.78, "end": 926.18, "text": " to predict, right?"}, {"start": 926.18, "end": 932.62, "text": " At some point, I like I'm sort of, I'm like, wait, wait, where is it?"}, {"start": 932.62, "end": 938.12, "text": " Because in this particular field receptive field of this resolution, I have I have no"}, {"start": 938.12, "end": 941.9599999999999, "text": " clue if the moon is close, right?"}, {"start": 941.96, "end": 948.82, "text": " So at the location where the actual bounding box is, I have no local information of the"}, {"start": 948.82, "end": 957.0600000000001, "text": " object, because usually objects are not squares, they're sort of round like the moon, or like"}, {"start": 957.0600000000001, "end": 962.36, "text": " here the plane, these corners, they have no local information about where the plane is."}, {"start": 962.36, "end": 968.88, "text": " And corner pooling is a method to propagate that information along the axis."}, {"start": 968.88, "end": 975.3, "text": " So what corner in corner pooling, what you would allow the location here in the CNN to"}, {"start": 975.3, "end": 983.54, "text": " do is to not only look at its itself, so its own location, but actually to extend its field"}, {"start": 983.54, "end": 991.84, "text": " of view over to the right, and down to the bottom, it's asked to predict a top left corner."}, {"start": 991.84, "end": 1000.74, "text": " So what you do is you max pool everything from here to this corner detector."}, {"start": 1000.74, "end": 1007.2800000000001, "text": " So the corner detector will basically be able to detect whenever in either this band right"}, {"start": 1007.2800000000001, "end": 1008.2800000000001, "text": " here."}, {"start": 1008.2800000000001, "end": 1014.96, "text": " So whenever in this band right here, there is the top, like the top of an object like"}, {"start": 1014.96, "end": 1021.5, "text": " the top of the moon here, this corner detector can say, ah, that's probably the right height,"}, {"start": 1021.5, "end": 1023.44, "text": " right here for a corner."}, {"start": 1023.44, "end": 1030.88, "text": " And it combines this with the information of this, this side here, where it also says,"}, {"start": 1030.88, "end": 1036.16, "text": " oh, there is the side of the moon, that's probably the correct, you know, up down."}, {"start": 1036.16, "end": 1039.08, "text": " So there's probably a corner right here."}, {"start": 1039.08, "end": 1046.6, "text": " Okay, whereas a, like a location right here, which would get the same signal from the right,"}, {"start": 1046.6, "end": 1050.44, "text": " or like almost the same signal plus this signal right here."}, {"start": 1050.44, "end": 1054.8600000000001, "text": " But in essence, it would also detect the top of the moon, but it would not get the same"}, {"start": 1054.8600000000001, "end": 1056.28, "text": " signal from down here."}, {"start": 1056.28, "end": 1061.96, "text": " And therefore it says, ah, even though to the right, I see some the top of an object,"}, {"start": 1061.96, "end": 1065.02, "text": " I don't see the left of an object to my bottom."}, {"start": 1065.02, "end": 1068.28, "text": " So I'm not going to predict a corner right here."}, {"start": 1068.28, "end": 1072.66, "text": " Alright, so this corner pooling goes for the top left, and of course, equivalently goes"}, {"start": 1072.66, "end": 1080.0800000000002, "text": " for the bottom right, that can always max pools to up and to the left of itself."}, {"start": 1080.08, "end": 1082.22, "text": " And that's exactly what you see here."}, {"start": 1082.22, "end": 1088.8799999999999, "text": " So in this corner pooling, what you can do is you can propagate signal to the left, and"}, {"start": 1088.8799999999999, "end": 1092.78, "text": " to up, and then you add the two informations."}, {"start": 1092.78, "end": 1095.36, "text": " And that will give you your output feature."}, {"start": 1095.36, "end": 1100.12, "text": " And you can calculate this actually fairly efficiently by doing like, like you do a cumulative"}, {"start": 1100.12, "end": 1106.1599999999999, "text": " sum, you do like a cumulative maximum across the different axes."}, {"start": 1106.1599999999999, "end": 1109.56, "text": " And then you simply add two arrays."}, {"start": 1109.56, "end": 1110.56, "text": " And that's it."}, {"start": 1110.56, "end": 1117.1799999999998, "text": " So you simply put the corner pooling before you predict the the these different outputs"}, {"start": 1117.1799999999998, "end": 1122.04, "text": " right here, the heat maps and the embeddings, which means that this hourglass network is"}, {"start": 1122.04, "end": 1124.9199999999998, "text": " not affected by this."}, {"start": 1124.9199999999998, "end": 1131.58, "text": " Just the predictors of heat maps and embeddings, they then get the information from this hourglass"}, {"start": 1131.58, "end": 1135.2, "text": " network into these into these directions."}, {"start": 1135.2, "end": 1139.96, "text": " Okay, I think that's a pretty, pretty neat method of solving this."}, {"start": 1139.96, "end": 1143.24, "text": " And here they show how you can calculate this."}, {"start": 1143.24, "end": 1150.22, "text": " And then the corner pooling is right here, they do add a skip connection here."}, {"start": 1150.22, "end": 1156.66, "text": " Because sometimes, if you just aggregate this information, you might, you might actually"}, {"start": 1156.66, "end": 1164.42, "text": " get confused because so the trouble, of course, comes when there are multiple, like, different"}, {"start": 1164.42, "end": 1172.96, "text": " objects that have, you know, the same top, and then there's also a person right here,"}, {"start": 1172.96, "end": 1180.42, "text": " that so it gets like a signal, it gets another signal that there is the left side of a person"}, {"start": 1180.42, "end": 1188.5600000000002, "text": " right here, or maybe, you know, like this, so it will, it will predict like a corner,"}, {"start": 1188.56, "end": 1195.04, "text": " maybe here, where there is none, so it's, it's, sometimes it is important to have local"}, {"start": 1195.04, "end": 1196.6599999999999, "text": " information still."}, {"start": 1196.6599999999999, "end": 1201.08, "text": " And that's exactly what this skip connection is supposed to address, I guess the situation"}, {"start": 1201.08, "end": 1207.72, "text": " up here would be resolved by the different embeddings, but still, so you have that you"}, {"start": 1207.72, "end": 1212.9199999999998, "text": " add and you put another bunch of convolutional layers on top of that, and then you'll get"}, {"start": 1212.9199999999998, "end": 1215.28, "text": " your predictions."}, {"start": 1215.28, "end": 1216.58, "text": " And that's it."}, {"start": 1216.58, "end": 1222.76, "text": " You mix all the losses, so there is a detection loss from the embeddings, there's a, sorry,"}, {"start": 1222.76, "end": 1228.06, "text": " from the heat maps, there is the pull and push losses for the embeddings."}, {"start": 1228.06, "end": 1234.1399999999999, "text": " And there's this offset loss that you train to compensate for the down, the downsampling"}, {"start": 1234.1399999999999, "end": 1236.82, "text": " errors."}, {"start": 1236.82, "end": 1238.06, "text": " And that's it."}, {"start": 1238.06, "end": 1244.26, "text": " And they ablate the various things here, basically, they show that they're better than other one"}, {"start": 1244.26, "end": 1250.74, "text": " shot, or one stage predictors is so apparently, there's one stage predictors where you have"}, {"start": 1250.74, "end": 1252.9, "text": " a single pass through a neural network."}, {"start": 1252.9, "end": 1256.8799999999999, "text": " And there's two stage predictors where you have multiple or two passes through different"}, {"start": 1256.8799999999999, "end": 1258.36, "text": " neural networks."}, {"start": 1258.36, "end": 1265.98, "text": " And they compete in the in the one, one stage neural network category, if so to say, and"}, {"start": 1265.98, "end": 1271.6, "text": " they show that they get significant improvements with and due to this corner pooling, which"}, {"start": 1271.6, "end": 1276.26, "text": " is pretty cool to see, because it makes sense."}, {"start": 1276.26, "end": 1281.5, "text": " It sort of makes sense how you would like to think about it like this."}, {"start": 1281.5, "end": 1285.86, "text": " And to see that it helps is pretty neat."}, {"start": 1285.86, "end": 1293.1, "text": " Yeah, they also investigate how large they have to make these these Gaussians and so"}, {"start": 1293.1, "end": 1295.24, "text": " on."}, {"start": 1295.24, "end": 1301.3, "text": " And these are some qualitative examples, you can see that without the corner pooling, what"}, {"start": 1301.3, "end": 1306.62, "text": " you'll get is that so the top here and the left and the right are correct are detected"}, {"start": 1306.62, "end": 1308.3, "text": " correctly."}, {"start": 1308.3, "end": 1313.82, "text": " But you can see that probably the network thinks that there is an extension of the object"}, {"start": 1313.82, "end": 1319.98, "text": " right here, and therefore doesn't do doesn't do a good job."}, {"start": 1319.98, "end": 1328.4199999999998, "text": " Because this, this position right here, it has no access to sort of it has to use like"}, {"start": 1328.4199999999998, "end": 1330.02, "text": " a long range access."}, {"start": 1330.02, "end": 1336.1, "text": " It can't it can't really look in detail at the features here or here."}, {"start": 1336.1, "end": 1342.06, "text": " So when it scans up and down the side, where the bottom corner where the bottom break is,"}, {"start": 1342.06, "end": 1347.32, "text": " it can it can only look at very coarse features, because it has to basically transmit information"}, {"start": 1347.32, "end": 1349.42, "text": " in the CNN of a higher layer."}, {"start": 1349.42, "end": 1354.24, "text": " And the higher layer has a higher receptive field, which means it has a lower resolution."}, {"start": 1354.24, "end": 1360.04, "text": " So it can't really go and look very in very detailed fashion at this border right here."}, {"start": 1360.04, "end": 1361.7, "text": " So it misses it."}, {"start": 1361.7, "end": 1362.7, "text": " Okay."}, {"start": 1362.7, "end": 1369.86, "text": " Same right here, as you can see, so there are a number of failure cases that they can"}, {"start": 1369.86, "end": 1377.52, "text": " now solve using this method compared to if they didn't use the corner pooling."}, {"start": 1377.52, "end": 1381.82, "text": " They show some also some times where their method fails."}, {"start": 1381.82, "end": 1389.58, "text": " For example, here, it matches the top bot, top left and bottom right corners of two different"}, {"start": 1389.58, "end": 1394.96, "text": " objects, because they their embeddings were close enough."}, {"start": 1394.96, "end": 1397.1, "text": " And yeah, that's what I'm saying."}, {"start": 1397.1, "end": 1404.8999999999999, "text": " I'm I'm wondering what these embeddings actually learn, because they are generated independently."}, {"start": 1404.8999999999999, "end": 1408.8999999999999, "text": " So not entirely sure."}, {"start": 1408.9, "end": 1415.2800000000002, "text": " It's also not exactly what I had in mind when I formulated this idea in the last video."}, {"start": 1415.2800000000002, "end": 1420.5800000000002, "text": " But I'm actually not sure what I had in mind myself, to be honest."}, {"start": 1420.5800000000002, "end": 1425.38, "text": " But in my mind, it seemed to be like you should be able to train a network."}, {"start": 1425.38, "end": 1432.6200000000001, "text": " If there is an object right here, you could train a network to predict for any given location,"}, {"start": 1432.6200000000001, "end": 1438.8600000000001, "text": " let's say how many pixels to its bottom right, or maybe you want to normalize by the area."}, {"start": 1438.86, "end": 1442.8999999999999, "text": " That's there are part of a particular object."}, {"start": 1442.8999999999999, "end": 1448.08, "text": " And then you could use you could predict each pixel and use like the differences between"}, {"start": 1448.08, "end": 1454.74, "text": " the differences between the points as as scores for bounding boxes."}, {"start": 1454.74, "end": 1458.12, "text": " I don't know if you see what I mean."}, {"start": 1458.12, "end": 1464.6, "text": " You could basically tell the you have you'd have one network predict everything to the"}, {"start": 1464.6, "end": 1468.9199999999998, "text": " bottom right, and then you'd use the differences."}, {"start": 1468.9199999999998, "end": 1474.1399999999999, "text": " And the transformers would be very good at that because they can sort of have this attention"}, {"start": 1474.1399999999999, "end": 1476.78, "text": " between each pairs of points and so on."}, {"start": 1476.78, "end": 1481.4599999999998, "text": " I'm not entirely sure, but this might just be crap."}, {"start": 1481.4599999999998, "end": 1483.78, "text": " Yeah, here's some more examples."}, {"start": 1483.78, "end": 1486.6, "text": " This appears to work really nicely."}, {"start": 1486.6, "end": 1492.34, "text": " But of course, in the qualitative qualitative examples, it always works nicely, but they"}, {"start": 1492.34, "end": 1493.34, "text": " also demonstrated."}, {"start": 1493.34, "end": 1498.06, "text": " All right, I found this paper all in all pretty cool, pretty neat."}, {"start": 1498.06, "end": 1499.02, "text": " It's a simple idea."}, {"start": 1499.02, "end": 1500.02, "text": " It's executed."}, {"start": 1500.02, "end": 1505.02, "text": " Well, I don't have the feeling that there are like too many tricks in here."}, {"start": 1505.02, "end": 1510.74, "text": " And they show really that the improvement seems to be due to their their corner pooling"}, {"start": 1510.74, "end": 1512.1799999999998, "text": " method."}, {"start": 1512.1799999999998, "end": 1514.5, "text": " And that's pretty neat."}, {"start": 1514.5, "end": 1518.78, "text": " So if you like this paper, make sure to check it out."}, {"start": 1518.78, "end": 1519.78, "text": " And I'll see you next time."}, {"start": 1519.78, "end": 1523.58, "text": " Bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=nxEr4VNgYOE
Movement Pruning: Adaptive Sparsity by Fine-Tuning (Paper Explained)
Deep neural networks are large models and pruning has become an important part of ML product pipelines, making models small while keeping their performance high. However, the classic pruning method, Magnitude Pruning, is suboptimal in models that are obtained by transfer learning. This paper proposes a solution, called Movement Pruning and shows its superior performance. OUTLINE: 0:00 - Intro & High-Level Overview 0:55 - Magnitude Pruning 4:25 - Transfer Learning 7:25 - The Problem with Magnitude Pruning in Transfer Learning 9:20 - Movement Pruning 22:20 - Experiments 24:20 - Improvements via Distillation 26:40 - Analysis of the Learned Weights Paper: https://arxiv.org/abs/2005.07683 Code: https://github.com/huggingface/transformers/tree/master/examples/movement-pruning Abstract: Magnitude pruning is a widely used strategy for reducing model size in pure supervised learning; however, it is less effective in the transfer learning regime that has become standard for state-of-the-art natural language processing applications. We propose the use of movement pruning, a simple, deterministic first-order weight pruning method that is more adaptive to pretrained model fine-tuning. We give mathematical foundations to the method and compare it to existing zeroth- and first-order pruning methods. Experiments show that when pruning large pretrained language models, movement pruning shows significant improvements in high-sparsity regimes. When combined with distillation, the approach achieves minimal accuracy loss with down to only 3% of the model parameters. Authors: Victor Sanh, Thomas Wolf, Alexander M. Rush 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 movement pruning, adaptive sparsity by fine-tuning, by Victor Sun, Thomas Wolfe, and Alexander M. Rush of Hugging Face and Cornell University. On a high level, this paper proposes that you should, if you have a transfer learning objective and you want to do pruning, you should not do pruning by weight magnitude, you should do pruning by how much the weights move during the transfer learning. This yields better results in the very sparse model regimes and is specifically relevant to current NLP transfer learning tasks such as BERT models. So if you like content like this, consider subscribing and sharing it to your friends and as always leave a comment if you have anything to say on this. Alright let's dive in. So they say magnitude pruning is a widely used strategy for reducing model size in pure supervised learning. So what is magnitude pruning? Now if I have a neural network, let's say I have a convolutional neural network and I input my little cat right here and I have a bunch of layers, right? And now if we look at these layers, each of these layers is going to be made up of these units of the neurons and the next layer is also made up of these neurons. Now what kind of neural network that is, is not that important but what is important is that you have these connections from neuron to neuron and in let's say a fully connected network every neuron is connected to every other neuron. In a CNN that would be slightly different but in essence you have a lot of connections here and these are usually called weights. So these are the weights. Now the problem is if I train like this giant neural networks and I want to ship them for example to mobile devices to my customers then they won't be able to download gigabytes of models or even like hundreds of megabytes of models, just not possible. So what we want to do is we want to prune this model which means we want to remove parts of these weights, a lot of these weights but we don't want to lose accuracy of the network. So imagine I have a network and that's trained, it's an image classifier, it's here, it's cats or dogs and I have it trained to a good accuracy. I want to delete these weights but I want to retain the performance and these methods are called pruning. Now what people do is usually they sort of go in a stepwise fashion they say well first of all I don't need some of these and then they delete some and then they sort of retrain the pruned network and after that they go again and they say well I don't really need that one and they don't really need that one so they do it in this stepwise fashion until the network is of the size that they want and the hope is that you don't lose too much accuracy. So the current the question is how do you select which weights you need and which ones you don't need and usually this is done by so-called magnitude pruning which means that look at the weight, you look at the weights and the weights they'll have some distribution there will be very negative so here is very negative weights and here is very large positive weights and what you'll say is that okay probably the weights that are very large they contribute a lot to the signal of the network within the network and the weights that are quite small they're you know since there's all this noise and stuff they're probably not that important so I'm going to cut off basically right here and everything that's in here I'm going to delete those are the non-important weights whereas on the outside those are the important weights. This is called magnitude pruning because it goes by the magnitude of the weight the absolute value of the weight so you don't actually need so there's not one threshold here you don't need a threshold you simply need a method to order the weights right and then you keep removing them until you're satisfied with the size. So this is magnitude pruning now what's the problem with the magnitude pruning in these kinds of tasks they say however it is less effective in the transfer learning regime that has become standard for state-of-the-art natural language processing applications. So what do you do in these transfer learning regimes in the transfer learning regime and actually let's go with the image example right here even though it's mostly used in NLP we can do the same thing so let's say we have a classifier here for cats and dogs our classifier and we had a big big database of cats and dogs images right so we were able to train that fairly well and we don't prune it yet we have this full network now we want to adapt this to a task where we want to recognize whether or not the animal is is sick so we developed this app for a veterinarian and it's like a short screening for a particular disease that a cat might have and we already have this cats and dogs classifier so it's reasonable to assume that this classifier has some good features to work with cats and dog images so what we can do instead of because let's assume for this other task we just have this tiny little data set which is not enough to train a neural network of this size right but so in a first step we'll train this big neural network on the cats versus dogs and then we what we do is we transfer learn it so we transfer all the weights right here and here we have a different task now sick or not sick right this is cat this is dog and here is sick or not sick not sick and of course we can't transfer these particular weights but we hope that the features here will sort of be the same so we transfer them and then we train these weights including the the head right here this part we train it on this little data set and we hope that we already have this good starting point we only need to you know learn the basically the specifics of what makes these two data sets different and we won't have to learn entire task of dealing with cat and dog images from the get-go okay so this is called transfer learning now in this case we combine the two so first we want to transfer learn like if we build this app for vets and then we might say oh this is not you know this is not only for vets this is actually for anyone you you know who has a cat or a dog at home so what we could do is build an app where anyone at home could scan their their cat and it would output like a probability of the cat having that disease so we want this neural network is still the same size as this neural network so now we want to do the pruning we want this neural network to become sparse to only have a couple of connections left such that it's a few kilobytes large but retain performance now they say when you do this step you can't just do the magnitude pruning like you did right here and why not because this is not this model right here is not the result of a training step like of a regular training process but is the result of a transfer learning process where first you do the big training and then second you adapt it and why is that the case well ultimately what you want to do is you want to prove the non-important weights now there could be a weight right here this one that is very important for the cat versus dog task but that is not important for the sick versus non-sick task and we also we know that in these transfer learning settings the weights they don't tend to move that much in general the research shows that once you've trained a neural network basically the beginning is important but then once you did it like if you adapt it or transfer learn it and so on the weights they won't move that much so in in essence this weight maybe starts out right here and it will sort of stay around this place it will maybe go a little bit down because it's not important but it won't move much during transfer learning that's just a property of transfer learning so this paper here says we can't just use magnitude pruning when we transfer learn because what we'll basically go by what we'll basically say is the will assign the importance based on based on the original neural network task on the cat versus dog we we will misspecify the importance of the weights what we should do is actually measure the importance with respect to this task and how do they achieve it so on a high level they're basically saying okay if we start out well this was fatal if we start out with a point over here let's make that red red I want the color red well it's blue now so if we ah if we start out with a point over here what we should do what we should do is we should observe how it moves during transfer learning if it moves towards zero then it's probably not that important for the new task and if it moves to the to be even larger then it's probably important for that new task and so that's that's a high level now how do you measure how it moves and what exact how exactly do you do all of this during training such that you don't make mistakes that's the point of this paper they say we propose movement pruning a simple deterministic first order weight pruning method that is more adaptive to pre-trained model fine-tuning we give mathematical foundations to the method and compare it to existing zero and first order pruning methods okay so yeah we said so that's basically on a high level that's that now how do they actually do it what they do right here is the following they say what we can define we can define each network layer basically as a matrix multiplication by a weight now you can express pretty much any neural network as such a multiplication with a weight so you have X the in the signal in each layer and you multiply that by the weight matrix at W now if you prune the neural network you can see that right here what you're saying is I basically in here I have the matrix M which is a mask so the mask is either 0 or 1 for if a weight is active or if a weight is not active now this is not a matrix multiply actually this is like a Hadamard product but you have this mask matrix and what decides on this mask this mask is decided as you can see right here by this S so S S is a matrix that for each entry in W it will decide how important it is now in the classic sense in the magnitude pruning you already saw that this is just going to be the absolute value of W IJ okay and then the top V simply means that you take the whoever are the most important the most magnitude that those are going to be one in the mask and everything else is going to be zero in the mask okay that's how this S this the W determines the S and the S determines the M okay so what you ultimately use is the M right here but in now what we want to do is we want to actually make the S based on the movement and the movement is not really a defined concept because it goes over steps and so on so how do you do the movement in in a kind of dynamic way and this paper says you should do it by gradient so you you should observe the gradient of your loss function with respect to this S matrix to this importance matrix right what does it mean so the what does it mean it means let's consider this quantity right here if S is the importance of a particular connection and if the gradient is large that means this this connection moves a lot right it like the loss pulls it into a particular direction okay so we're not talking about yet which direction actually the gradient has a sign it's either positive or negative right so by this quantity you can decide how much does this new task want this particular importance score to move so if this is a direct direct measure of how much basically the loss function pulls on that importance score how much and it now you can simply decide if and they have these they have I think I have a diagram yes so but I don't like that let's go so we have right here we have what's the value of this gradient of L with respect to S and here is W so if the gradient is positive and W is already positive that means the gradient goes into the positive direction so you increase the loss function in that let's put the negative gradient here because you do gradient descent right so so if the negative gradient is positive and the weight is already positive in in this case that means you're all the weight is already high but now the loss function wants to push it even higher so that must be a very very important weight right like it's like very good the same goes if the gradient the negative gradient is negative and the weight is already negative the weight being negative already means the weight you know it has a negative sign and then the gradient wants it to go even more negative the the optimization procedure says this thing should become even more negative and also we say that's probably a good weight now the other two cases means basically the weights already positive but the gradient wants it to go negative which means it's pulled towards zero now it's entirely possible that it's going across zero and going like if you're here going from over here going to here cross zero and become like super large but that violates our basic assumptions that the transfer learning doesn't move the weights too much right what you're caring for is basically this local neighborhood right here okay so you can make the fair assumption that these weights are not that important in the case where the negative gradient goes against the sign of the weight so this this is of course discrete right now but we can actually assign a number by how large the gradient is and by how large the weight already is and therefore we can make a score so the important score right here as you can see is the weight multiplied by the gradient of the weight and they can actually show mathematically that if you do this over multiple steps so you optimize while you do this pruning and they do some sort of a soft pruning so you can kind of correct your mistakes later on i mean they have hard and soft pruning but in any case they can correct their mistakes later on this will actually result in these important scores being an accumulation over the training over the entire training of this quantity and that's pretty cool because that means eventually you sort of have a consistent estimator of these important scores across your training procedure okay because the main fear with something like this of course is that it's very brittle and very much depends on the training dynamics and who knows if in step one something bad happens and so on but the the math behind this here gives sort of more evidence that this it can be like a self-correcting mechanism and is actually not too dependent on the particular training dynamics so they do this experimental setup now they have some they have some quirks here actually let's first go to the the actual different methods they compare different methods right here where they say okay there's magnitude pruning it's a zero with order which basically just means you just look at the weight magnitude that that's it it's top v which means you just pick the top whatever and the objective is just the loss and the scores are just the absolute value we've seen this now movement pruning on the other hand is first order which means you look at the movement in our case of the gradient as you can see here those are the important scores and you use this straight through estimator which is basically just a way of saying that even though you're masking some things in the forward step you shouldn't mask them in the in the gradient backward step because you still want gradient signal to reach so if you have layers and you have a weight right here at least that's how I understand it I have not read that paper but if you mask this one here you still want the gradient to sort of flow backwards because you still need the actual important scores for the weights that here below connect to this weight I think that's what is meant not entirely sure in this though so but you can see that the objective function is also the actual loss function now this is contrasted to a baseline called l0 regularization which is quite similar but is also first order but has this sort of regularizer right here and uses the Gumbel softmax in order to determine the scores and as you can see it also has a different score function and it has this continuous hard concrete importance in masking function sorry masking function and they have a variant of movement pruning that tends to perform a little bit better which is soft movement pruning where instead of just going by the loss function optimizing the loss function they optimize the loss function plus something now they have as you can see here they have a thresholding masking function and the threshold is actually dynamic or it's determined by the important scores and they have then a regularizer that make the important scores sparse so instead of saying we just want the top 5% of weights they now just put a lot of mass on this lambda right here which will cause the S to be sparse and you know they if they are not happy with how many weights they from the simply increase or decrease this lambda such that such that they get to their desired sparsity of course you see there's the direct trade-off with the loss function right so the more you put weight on this lambda the the less weight is you put basically on the loss function itself so you have the the trade-off here is very explicit whereas in basic movement pruning it's just given by you masking away completely the bottom 1 minus V of percent of the weights but you see the the score function is the same oh well the score function here the score function is the same okay now there there are quite a number of tricks here like there's this a sparsity scheduling function and so on so as always in NLP and with any big models there are a bunch and bunch of engineering tricks that make everything work better and you can never exactly tell how much is due to that and how much is due to the the actual technique but if you know you can sort of assess whether or not these it's done well and this here actually the rationale makes sense and that's why I tend to think that it is actually a a better method and the experiments are very very convincing let's say okay this is just a pictorial comparison where you can see movement pruning sorry magnitude pruning all it does is it looks at after you fine-tune what are the weights and it just cuts away everything in the middle doesn't care about how the weights were when before however movement pruning looks at the combination of what were the weights before and what are the weights now and it cuts away everything where the weights moved towards zero which are these quadrants right here and it leaves in everything where it moved away from zero or that's that's the ordering let's say that how much it moved okay experiments now as you might already have figured out by now in the machine learning and especially the nlp community the methods presented always outperform the previous methods in this case it's pretty special so they test this on these number of tasks quad and nlmi and qqp and these are quite hard tasks from an nlp perspective like squad is question answering mnlis like language inference so these would be on the I would I would guess these are on on the foreign nlp system on the harder side of tasks that's it's fairly cool and as you can see here now just focus on first of all focus on this map which is the magnitude pruning so that's the baseline if you will and the the purple one the smvp which which is the soft movement pruning okay now you can also focus on the mvp right here but they're approximately the same now the rpp you can maybe see in the graph is performing fairly well even compared to the full model it's it's it's another baseline basically but we just want to compare those two and you can see that in this regime that the magnitude pruning outperforms the movement pruning but however in this regime the movement pruning is much better and that's the percent where the percent of remaining weights is very very low so this is kind of the extreme sparse case where you only have 10 or you only have 3 percent of the weights left and you can see that the movement pruning is outperforming the magnitude pruning by a lot okay now they do discover that so this this happens in all in all of these tasks as you can see right here and they do they do discover that if you then distill the model further so in distillation this is yet another technique that you can use to boost the performance of the transfer learned model so in distillation you would not only train the model on you so you have you now you have your this model that you transfer learn and you have the prune version and in the prune version what you would do is you would simply also train it on this data set but what you can also do is you can distill this model right here the one that you train on the same task right that's that's presumably better because it still has all the weights okay you can run a data point through both so the same data point goes through this and you get an output which are logits which is like representing a distribution saying yeah it's about this high now instead of assigning the hard labels so here we also get the label right it's a supervised learning task like one and zero you also put the data point through this model right here obtain whatever that model would have said and let's say it's about this and now presumably this model is better already so you say well the label here says that it's this class but the model that's really good says you shouldn't be too sure about it so you can sort of mix the two losses and this this process of transferring the knowledge of this model to here is called distillation with the lower model being the teacher model now if you do distillation you can actually improve your performance even more and they show that in the experiments here especially again in the low in the low parameter regime but you can see for example in squad here that the distilled movement pruned method now catches up with the magnitude pruned method in the also in the high in the not so sparse regime okay and they analyze these weights and as you can see that expected the magnitude pruned method it will simply cut out anything right here right that's not not a surprise whereas the movement pruned method it will leave a lot of these weights alive so as you can as you can see basically it's it's very much the case since you can outperform the red the yellow one can outperform the red one it is almost warranted to say that the this magnitude pruning wasn't the best choice it's actually a better choice to leave some of those weights in and actually cut some of the weights that are large out just based on their movement now the V here in the middle is of course due to the fact that if a weight is here it was probably not super important in the first place and since since this thing removes anything that moves towards zero any point starting let's say around here moving towards zero would end up here so all the points that end up in this region probably moved towards zero during training and therefore are cut away so there's there's not just like for there to be points there would have been points that started even more in the middle and then moved out to here right and there's just not as many so that's why you have the V shape is very natural to expect right here so they they analyze this then in terms of the where the model cuts the weights out now they experiment on the BERT base thing that which is a transformer with 12 layers and if you don't know what BERT is you can go look at my video on BERT but you can see that the magnitude pruning will sort of cut all the weights on the layers equally so it will sort of go through the layers and take away let's say 90% of each here you can see 10% of weights remaining whereas the movement pruning especially the soft movement pruning will actually make a large difference it will remove much much more of the later layers weights and keep the lower layer weights which I think if you do transfer learning from these language models it tends to be that the lower layers maybe pick up if you if you think of a CNN the lower layers might pick up you know on these essential image features like corners and so on and the higher layers will pick up on the task specific things now if you do like a big pre-training tasks you might have a lot of information that you need there but then if you distill it and transfer it down to like a small set small task where only a single thing is important like in squad it's only important what's the answer to the question then you can probably remove a lot of that superfluous information that was there like high-level features from the pre-training task I mean that's my my guess here but they also have explained that so yeah that was this paper if you're still here and you enjoyed it leave a like tell me in the comments what you think and I'll see you next time bye bye
[{"start": 0.0, "end": 6.16, "text": " Hi there, today we're looking at movement pruning, adaptive sparsity by fine-tuning,"}, {"start": 6.16, "end": 13.120000000000001, "text": " by Victor Sun, Thomas Wolfe, and Alexander M. Rush of Hugging Face and Cornell University."}, {"start": 13.120000000000001, "end": 17.92, "text": " On a high level, this paper proposes that you should, if you have a transfer learning"}, {"start": 17.92, "end": 23.98, "text": " objective and you want to do pruning, you should not do pruning by weight magnitude,"}, {"start": 23.98, "end": 28.740000000000002, "text": " you should do pruning by how much the weights move during the transfer learning."}, {"start": 28.74, "end": 35.72, "text": " This yields better results in the very sparse model regimes and is specifically relevant"}, {"start": 35.72, "end": 41.64, "text": " to current NLP transfer learning tasks such as BERT models."}, {"start": 41.64, "end": 47.16, "text": " So if you like content like this, consider subscribing and sharing it to your friends"}, {"start": 47.16, "end": 52.2, "text": " and as always leave a comment if you have anything to say on this."}, {"start": 52.2, "end": 53.959999999999994, "text": " Alright let's dive in."}, {"start": 53.96, "end": 60.64, "text": " So they say magnitude pruning is a widely used strategy for reducing model size in pure"}, {"start": 60.64, "end": 62.480000000000004, "text": " supervised learning."}, {"start": 62.480000000000004, "end": 64.9, "text": " So what is magnitude pruning?"}, {"start": 64.9, "end": 70.4, "text": " Now if I have a neural network, let's say I have a convolutional neural network and"}, {"start": 70.4, "end": 75.72, "text": " I input my little cat right here and I have a bunch of layers, right?"}, {"start": 75.72, "end": 79.72, "text": " And now if we look at these layers, each of these layers is going to be made up of these"}, {"start": 79.72, "end": 85.53999999999999, "text": " units of the neurons and the next layer is also made up of these neurons."}, {"start": 85.53999999999999, "end": 91.02, "text": " Now what kind of neural network that is, is not that important but what is important is"}, {"start": 91.02, "end": 96.16, "text": " that you have these connections from neuron to neuron and in let's say a fully connected"}, {"start": 96.16, "end": 100.36, "text": " network every neuron is connected to every other neuron."}, {"start": 100.36, "end": 105.2, "text": " In a CNN that would be slightly different but in essence you have a lot of connections"}, {"start": 105.2, "end": 108.68, "text": " here and these are usually called weights."}, {"start": 108.68, "end": 110.62, "text": " So these are the weights."}, {"start": 110.62, "end": 117.32000000000001, "text": " Now the problem is if I train like this giant neural networks and I want to ship them for"}, {"start": 117.32000000000001, "end": 124.5, "text": " example to mobile devices to my customers then they won't be able to download gigabytes"}, {"start": 124.5, "end": 129.16, "text": " of models or even like hundreds of megabytes of models, just not possible."}, {"start": 129.16, "end": 133.8, "text": " So what we want to do is we want to prune this model which means we want to remove parts"}, {"start": 133.8, "end": 140.34, "text": " of these weights, a lot of these weights but we don't want to lose accuracy of the network."}, {"start": 140.34, "end": 144.12, "text": " So imagine I have a network and that's trained, it's an image classifier, it's here, it's"}, {"start": 144.12, "end": 149.0, "text": " cats or dogs and I have it trained to a good accuracy."}, {"start": 149.0, "end": 157.08, "text": " I want to delete these weights but I want to retain the performance and these methods"}, {"start": 157.08, "end": 158.46, "text": " are called pruning."}, {"start": 158.46, "end": 163.4, "text": " Now what people do is usually they sort of go in a stepwise fashion they say well first"}, {"start": 163.4, "end": 170.6, "text": " of all I don't need some of these and then they delete some and then they sort of retrain"}, {"start": 170.6, "end": 175.20000000000002, "text": " the pruned network and after that they go again and they say well I don't really need"}, {"start": 175.20000000000002, "end": 180.12, "text": " that one and they don't really need that one so they do it in this stepwise fashion until"}, {"start": 180.12, "end": 185.92000000000002, "text": " the network is of the size that they want and the hope is that you don't lose too much"}, {"start": 185.92000000000002, "end": 187.14000000000001, "text": " accuracy."}, {"start": 187.14000000000001, "end": 192.08, "text": " So the current the question is how do you select which weights you need and which ones"}, {"start": 192.08, "end": 200.22000000000003, "text": " you don't need and usually this is done by so-called magnitude pruning which means that"}, {"start": 200.22000000000003, "end": 205.88000000000002, "text": " look at the weight, you look at the weights and the weights they'll have some distribution"}, {"start": 205.88000000000002, "end": 214.04000000000002, "text": " there will be very negative so here is very negative weights and here is very large positive"}, {"start": 214.04000000000002, "end": 220.12, "text": " weights and what you'll say is that okay probably the weights that are very large they contribute"}, {"start": 220.12, "end": 224.56, "text": " a lot to the signal of the network within the network and the weights that are quite"}, {"start": 224.56, "end": 228.18, "text": " small they're you know since there's all this noise and stuff they're probably not that"}, {"start": 228.18, "end": 234.56, "text": " important so I'm going to cut off basically right here and everything that's in here I'm"}, {"start": 234.56, "end": 239.12, "text": " going to delete those are the non-important weights whereas on the outside those are the"}, {"start": 239.12, "end": 240.12, "text": " important weights."}, {"start": 240.12, "end": 244.68, "text": " This is called magnitude pruning because it goes by the magnitude of the weight the absolute"}, {"start": 244.68, "end": 251.64000000000001, "text": " value of the weight so you don't actually need so there's not one threshold here you"}, {"start": 251.64000000000001, "end": 256.72, "text": " don't need a threshold you simply need a method to order the weights right and then you keep"}, {"start": 256.72, "end": 260.84000000000003, "text": " removing them until you're satisfied with the size."}, {"start": 260.84000000000003, "end": 266.72, "text": " So this is magnitude pruning now what's the problem with the magnitude pruning in these"}, {"start": 266.72, "end": 272.58, "text": " kinds of tasks they say however it is less effective in the transfer learning regime"}, {"start": 272.58, "end": 278.56, "text": " that has become standard for state-of-the-art natural language processing applications."}, {"start": 278.56, "end": 282.56, "text": " So what do you do in these transfer learning regimes in the transfer learning regime and"}, {"start": 282.56, "end": 288.44, "text": " actually let's go with the image example right here even though it's mostly used in NLP we"}, {"start": 288.44, "end": 294.47999999999996, "text": " can do the same thing so let's say we have a classifier here for cats and dogs our classifier"}, {"start": 294.47999999999996, "end": 299.32, "text": " and we had a big big database of cats and dogs images right so we were able to train"}, {"start": 299.32, "end": 306.0, "text": " that fairly well and we don't prune it yet we have this full network now we want to adapt"}, {"start": 306.0, "end": 314.08, "text": " this to a task where we want to recognize whether or not the animal is is sick so we"}, {"start": 314.08, "end": 319.36, "text": " developed this app for a veterinarian and it's like a short screening for a particular"}, {"start": 319.36, "end": 325.21999999999997, "text": " disease that a cat might have and we already have this cats and dogs classifier so it's"}, {"start": 325.22, "end": 331.52000000000004, "text": " reasonable to assume that this classifier has some good features to work with cats and"}, {"start": 331.52000000000004, "end": 337.44000000000005, "text": " dog images so what we can do instead of because let's assume for this other task we just have"}, {"start": 337.44000000000005, "end": 342.36, "text": " this tiny little data set which is not enough to train a neural network of this size right"}, {"start": 342.36, "end": 348.68, "text": " but so in a first step we'll train this big neural network on the cats versus dogs and"}, {"start": 348.68, "end": 354.08000000000004, "text": " then we what we do is we transfer learn it so we transfer all the weights right here"}, {"start": 354.08, "end": 360.47999999999996, "text": " and here we have a different task now sick or not sick right this is cat this is dog"}, {"start": 360.47999999999996, "end": 369.2, "text": " and here is sick or not sick not sick and of course we can't transfer these particular"}, {"start": 369.2, "end": 375.84, "text": " weights but we hope that the features here will sort of be the same so we transfer them"}, {"start": 375.84, "end": 382.12, "text": " and then we train these weights including the the head right here this part we train"}, {"start": 382.12, "end": 387.16, "text": " it on this little data set and we hope that we already have this good starting point we"}, {"start": 387.16, "end": 393.0, "text": " only need to you know learn the basically the specifics of what makes these two data"}, {"start": 393.0, "end": 399.84000000000003, "text": " sets different and we won't have to learn entire task of dealing with cat and dog images"}, {"start": 399.84000000000003, "end": 406.94, "text": " from the get-go okay so this is called transfer learning now in this case we combine the two"}, {"start": 406.94, "end": 412.64, "text": " so first we want to transfer learn like if we build this app for vets and then we might"}, {"start": 412.64, "end": 418.0, "text": " say oh this is not you know this is not only for vets this is actually for anyone you you"}, {"start": 418.0, "end": 423.15999999999997, "text": " know who has a cat or a dog at home so what we could do is build an app where anyone at"}, {"start": 423.15999999999997, "end": 428.78, "text": " home could scan their their cat and it would output like a probability of the cat having"}, {"start": 428.78, "end": 433.8, "text": " that disease so we want this neural network is still the same size as this neural network"}, {"start": 433.8, "end": 440.64, "text": " so now we want to do the pruning we want this neural network to become sparse to only have"}, {"start": 440.64, "end": 446.44, "text": " a couple of connections left such that it's a few kilobytes large but retain performance"}, {"start": 446.44, "end": 454.96000000000004, "text": " now they say when you do this step you can't just do the magnitude pruning like you did"}, {"start": 454.96000000000004, "end": 461.7, "text": " right here and why not because this is not this model right here is not the result of"}, {"start": 461.7, "end": 468.76, "text": " a training step like of a regular training process but is the result of a transfer learning"}, {"start": 468.76, "end": 475.71999999999997, "text": " process where first you do the big training and then second you adapt it and why is that"}, {"start": 475.71999999999997, "end": 481.59999999999997, "text": " the case well ultimately what you want to do is you want to prove the non-important"}, {"start": 481.59999999999997, "end": 487.52, "text": " weights now there could be a weight right here this one that is very important for the"}, {"start": 487.52, "end": 495.84, "text": " cat versus dog task but that is not important for the sick versus non-sick task and we also"}, {"start": 495.84, "end": 501.28, "text": " we know that in these transfer learning settings the weights they don't tend to move that much"}, {"start": 501.28, "end": 508.35999999999996, "text": " in general the research shows that once you've trained a neural network basically the beginning"}, {"start": 508.35999999999996, "end": 513.14, "text": " is important but then once you did it like if you adapt it or transfer learn it and so"}, {"start": 513.14, "end": 520.76, "text": " on the weights they won't move that much so in in essence this weight maybe starts out"}, {"start": 520.76, "end": 527.88, "text": " right here and it will sort of stay around this place it will maybe go a little bit down"}, {"start": 527.88, "end": 531.52, "text": " because it's not important but it won't move much during transfer learning that's just"}, {"start": 531.52, "end": 537.3199999999999, "text": " a property of transfer learning so this paper here says we can't just use magnitude pruning"}, {"start": 537.3199999999999, "end": 542.52, "text": " when we transfer learn because what we'll basically go by what we'll basically say is"}, {"start": 542.52, "end": 548.84, "text": " the will assign the importance based on based on the original neural network task on the"}, {"start": 548.84, "end": 555.24, "text": " cat versus dog we we will misspecify the importance of the weights what we should do is actually"}, {"start": 555.24, "end": 561.04, "text": " measure the importance with respect to this task and how do they achieve it so on a high"}, {"start": 561.04, "end": 568.62, "text": " level they're basically saying okay if we start out well this was fatal if we start"}, {"start": 568.62, "end": 577.92, "text": " out with a point over here let's make that red red I want the color red well it's blue"}, {"start": 577.92, "end": 583.64, "text": " now so if we ah if we start out with a point over here what we should do what we should"}, {"start": 583.64, "end": 590.28, "text": " do is we should observe how it moves during transfer learning if it moves towards zero"}, {"start": 590.28, "end": 596.16, "text": " then it's probably not that important for the new task and if it moves to the to be"}, {"start": 596.16, "end": 602.16, "text": " even larger then it's probably important for that new task and so that's that's a high"}, {"start": 602.16, "end": 608.16, "text": " level now how do you measure how it moves and what exact how exactly do you do all of"}, {"start": 608.16, "end": 613.6, "text": " this during training such that you don't make mistakes that's the point of this paper they"}, {"start": 613.6, "end": 620.1999999999999, "text": " say we propose movement pruning a simple deterministic first order weight pruning method"}, {"start": 620.1999999999999, "end": 625.9599999999999, "text": " that is more adaptive to pre-trained model fine-tuning we give mathematical foundations"}, {"start": 625.96, "end": 635.0400000000001, "text": " to the method and compare it to existing zero and first order pruning methods okay so yeah"}, {"start": 635.0400000000001, "end": 644.2, "text": " we said so that's basically on a high level that's that now how do they actually do it"}, {"start": 644.2, "end": 655.2, "text": " what they do right here is the following they say what we can define we can define each"}, {"start": 655.2, "end": 661.76, "text": " network layer basically as a matrix multiplication by a weight now you can express pretty much"}, {"start": 661.76, "end": 667.9000000000001, "text": " any neural network as such a multiplication with a weight so you have X the in the signal"}, {"start": 667.9000000000001, "end": 674.5600000000001, "text": " in each layer and you multiply that by the weight matrix at W now if you prune the neural"}, {"start": 674.5600000000001, "end": 681.2, "text": " network you can see that right here what you're saying is I basically in here I have the matrix"}, {"start": 681.2, "end": 688.4000000000001, "text": " M which is a mask so the mask is either 0 or 1 for if a weight is active or if a weight"}, {"start": 688.4000000000001, "end": 696.36, "text": " is not active now this is not a matrix multiply actually this is like a Hadamard product but"}, {"start": 696.36, "end": 703.24, "text": " you have this mask matrix and what decides on this mask this mask is decided as you can"}, {"start": 703.24, "end": 714.5600000000001, "text": " see right here by this S so S S is a matrix that for each entry in W it will decide how"}, {"start": 714.5600000000001, "end": 720.84, "text": " important it is now in the classic sense in the magnitude pruning you already saw that"}, {"start": 720.84, "end": 728.16, "text": " this is just going to be the absolute value of W IJ okay and then the top V simply means"}, {"start": 728.16, "end": 733.8, "text": " that you take the whoever are the most important the most magnitude that those are going to"}, {"start": 733.8, "end": 739.8, "text": " be one in the mask and everything else is going to be zero in the mask okay that's how"}, {"start": 739.8, "end": 747.0, "text": " this S this the W determines the S and the S determines the M okay so what you ultimately"}, {"start": 747.0, "end": 754.9599999999999, "text": " use is the M right here but in now what we want to do is we want to actually make the"}, {"start": 754.96, "end": 759.84, "text": " S based on the movement and the movement is not really a defined concept because it goes"}, {"start": 759.84, "end": 767.72, "text": " over steps and so on so how do you do the movement in in a kind of dynamic way and this"}, {"start": 767.72, "end": 775.84, "text": " paper says you should do it by gradient so you you should observe the gradient of your"}, {"start": 775.84, "end": 782.46, "text": " loss function with respect to this S matrix to this importance matrix right what does"}, {"start": 782.46, "end": 797.2, "text": " it mean so the what does it mean it means let's consider this quantity right here if"}, {"start": 797.2, "end": 805.76, "text": " S is the importance of a particular connection and if the gradient is large that means this"}, {"start": 805.76, "end": 812.76, "text": " this connection moves a lot right it like the loss pulls it into a particular direction"}, {"start": 812.76, "end": 817.68, "text": " okay so we're not talking about yet which direction actually the gradient has a sign"}, {"start": 817.68, "end": 823.3199999999999, "text": " it's either positive or negative right so by this quantity you can decide how much does"}, {"start": 823.3199999999999, "end": 830.6, "text": " this new task want this particular importance score to move so if this is a direct direct"}, {"start": 830.6, "end": 837.16, "text": " measure of how much basically the loss function pulls on that importance score how much and"}, {"start": 837.16, "end": 847.96, "text": " it now you can simply decide if and they have these they have I think I have a diagram yes"}, {"start": 847.96, "end": 856.6, "text": " so but I don't like that let's go so we have right here we have what's the value of this"}, {"start": 856.6, "end": 866.44, "text": " gradient of L with respect to S and here is W so if the gradient is positive and W is"}, {"start": 866.44, "end": 876.82, "text": " already positive that means the gradient goes into the positive direction so you increase"}, {"start": 876.82, "end": 882.32, "text": " the loss function in that let's put the negative gradient here because you do gradient descent"}, {"start": 882.32, "end": 889.72, "text": " right so so if the negative gradient is positive and the weight is already positive in in this"}, {"start": 889.72, "end": 895.88, "text": " case that means you're all the weight is already high but now the loss function wants to push"}, {"start": 895.88, "end": 901.2, "text": " it even higher so that must be a very very important weight right like it's like very"}, {"start": 901.2, "end": 909.3800000000001, "text": " good the same goes if the gradient the negative gradient is negative and the weight is already"}, {"start": 909.38, "end": 914.2, "text": " negative the weight being negative already means the weight you know it has a negative"}, {"start": 914.2, "end": 920.24, "text": " sign and then the gradient wants it to go even more negative the the optimization procedure"}, {"start": 920.24, "end": 926.48, "text": " says this thing should become even more negative and also we say that's probably a good weight"}, {"start": 926.48, "end": 931.28, "text": " now the other two cases means basically the weights already positive but the gradient"}, {"start": 931.28, "end": 936.36, "text": " wants it to go negative which means it's pulled towards zero now it's entirely possible that"}, {"start": 936.36, "end": 944.12, "text": " it's going across zero and going like if you're here going from over here going to here cross"}, {"start": 944.12, "end": 949.44, "text": " zero and become like super large but that violates our basic assumptions that the transfer"}, {"start": 949.44, "end": 953.52, "text": " learning doesn't move the weights too much right what you're caring for is basically"}, {"start": 953.52, "end": 959.1800000000001, "text": " this local neighborhood right here okay so you can make the fair assumption that these"}, {"start": 959.1800000000001, "end": 964.84, "text": " weights are not that important in the case where the negative gradient goes against the"}, {"start": 964.84, "end": 970.44, "text": " sign of the weight so this this is of course discrete right now but we can actually assign"}, {"start": 970.44, "end": 976.5600000000001, "text": " a number by how large the gradient is and by how large the weight already is and therefore"}, {"start": 976.5600000000001, "end": 985.46, "text": " we can make a score so the important score right here as you can see is the weight multiplied"}, {"start": 985.46, "end": 991.36, "text": " by the gradient of the weight and they can actually show mathematically that if you do"}, {"start": 991.36, "end": 996.6, "text": " this over multiple steps so you optimize while you do this pruning and they do some sort"}, {"start": 996.6, "end": 1002.04, "text": " of a soft pruning so you can kind of correct your mistakes later on i mean they have hard"}, {"start": 1002.04, "end": 1007.2, "text": " and soft pruning but in any case they can correct their mistakes later on this will"}, {"start": 1007.2, "end": 1012.2, "text": " actually result in these important scores being an accumulation over the training over"}, {"start": 1012.2, "end": 1020.44, "text": " the entire training of this quantity and that's pretty cool because that means eventually"}, {"start": 1020.44, "end": 1025.28, "text": " you sort of have a consistent estimator of these important scores across your training"}, {"start": 1025.28, "end": 1030.16, "text": " procedure okay because the main fear with something like this of course is that it's"}, {"start": 1030.16, "end": 1035.2, "text": " very brittle and very much depends on the training dynamics and who knows if in step"}, {"start": 1035.2, "end": 1041.52, "text": " one something bad happens and so on but the the math behind this here gives sort of more"}, {"start": 1041.52, "end": 1048.0, "text": " evidence that this it can be like a self-correcting mechanism and is actually not too dependent"}, {"start": 1048.0, "end": 1055.28, "text": " on the particular training dynamics so they do this experimental setup now they have some"}, {"start": 1055.28, "end": 1060.16, "text": " they have some quirks here actually let's first go to the the actual different methods"}, {"start": 1060.16, "end": 1064.96, "text": " they compare different methods right here where they say okay there's magnitude pruning"}, {"start": 1064.96, "end": 1069.4, "text": " it's a zero with order which basically just means you just look at the weight magnitude"}, {"start": 1069.4, "end": 1076.6, "text": " that that's it it's top v which means you just pick the top whatever and the objective"}, {"start": 1076.6, "end": 1081.6, "text": " is just the loss and the scores are just the absolute value we've seen this now movement"}, {"start": 1081.6, "end": 1085.56, "text": " pruning on the other hand is first order which means you look at the movement in our case"}, {"start": 1085.56, "end": 1090.6599999999999, "text": " of the gradient as you can see here those are the important scores and you use this"}, {"start": 1090.6599999999999, "end": 1095.8, "text": " straight through estimator which is basically just a way of saying that even though you're"}, {"start": 1095.8, "end": 1100.6, "text": " masking some things in the forward step you shouldn't mask them in the in the gradient"}, {"start": 1100.6, "end": 1106.12, "text": " backward step because you still want gradient signal to reach so if you have layers and"}, {"start": 1106.12, "end": 1110.7199999999998, "text": " you have a weight right here at least that's how I understand it I have not read that paper"}, {"start": 1110.7199999999998, "end": 1116.56, "text": " but if you mask this one here you still want the gradient to sort of flow backwards because"}, {"start": 1116.56, "end": 1122.84, "text": " you still need the actual important scores for the weights that here below connect to"}, {"start": 1122.84, "end": 1130.84, "text": " this weight I think that's what is meant not entirely sure in this though so but you can"}, {"start": 1130.84, "end": 1136.76, "text": " see that the objective function is also the actual loss function now this is contrasted"}, {"start": 1136.76, "end": 1144.1599999999999, "text": " to a baseline called l0 regularization which is quite similar but is also first order but"}, {"start": 1144.1599999999999, "end": 1149.84, "text": " has this sort of regularizer right here and uses the Gumbel softmax in order to determine"}, {"start": 1149.84, "end": 1155.1999999999998, "text": " the scores and as you can see it also has a different score function and it has this"}, {"start": 1155.2, "end": 1163.48, "text": " continuous hard concrete importance in masking function sorry masking function and they have"}, {"start": 1163.48, "end": 1168.6000000000001, "text": " a variant of movement pruning that tends to perform a little bit better which is soft"}, {"start": 1168.6000000000001, "end": 1174.28, "text": " movement pruning where instead of just going by the loss function optimizing the loss function"}, {"start": 1174.28, "end": 1179.6000000000001, "text": " they optimize the loss function plus something now they have as you can see here they have"}, {"start": 1179.6, "end": 1189.04, "text": " a thresholding masking function and the threshold is actually dynamic or it's determined by"}, {"start": 1189.04, "end": 1193.76, "text": " the important scores and they have then a regularizer that make the important scores"}, {"start": 1193.76, "end": 1200.84, "text": " sparse so instead of saying we just want the top 5% of weights they now just put a lot"}, {"start": 1200.84, "end": 1208.32, "text": " of mass on this lambda right here which will cause the S to be sparse and you know they"}, {"start": 1208.32, "end": 1212.3999999999999, "text": " if they are not happy with how many weights they from the simply increase or decrease"}, {"start": 1212.3999999999999, "end": 1218.6, "text": " this lambda such that such that they get to their desired sparsity of course you see there's"}, {"start": 1218.6, "end": 1225.36, "text": " the direct trade-off with the loss function right so the more you put weight on this lambda"}, {"start": 1225.36, "end": 1231.84, "text": " the the less weight is you put basically on the loss function itself so you have the the"}, {"start": 1231.84, "end": 1237.2, "text": " trade-off here is very explicit whereas in basic movement pruning it's just given by"}, {"start": 1237.2, "end": 1245.72, "text": " you masking away completely the bottom 1 minus V of percent of the weights but you see the"}, {"start": 1245.72, "end": 1254.88, "text": " the score function is the same oh well the score function here the score function is"}, {"start": 1254.88, "end": 1262.6000000000001, "text": " the same okay now there there are quite a number of tricks here like there's this a"}, {"start": 1262.6, "end": 1270.04, "text": " sparsity scheduling function and so on so as always in NLP and with any big models there"}, {"start": 1270.04, "end": 1276.76, "text": " are a bunch and bunch of engineering tricks that make everything work better and you can"}, {"start": 1276.76, "end": 1282.12, "text": " never exactly tell how much is due to that and how much is due to the the actual technique"}, {"start": 1282.12, "end": 1288.4399999999998, "text": " but if you know you can sort of assess whether or not these it's done well and this here"}, {"start": 1288.44, "end": 1295.52, "text": " actually the rationale makes sense and that's why I tend to think that it is actually a"}, {"start": 1295.52, "end": 1302.88, "text": " a better method and the experiments are very very convincing let's say okay this is just"}, {"start": 1302.88, "end": 1309.0800000000002, "text": " a pictorial comparison where you can see movement pruning sorry magnitude pruning all it does"}, {"start": 1309.0800000000002, "end": 1314.3600000000001, "text": " is it looks at after you fine-tune what are the weights and it just cuts away everything"}, {"start": 1314.36, "end": 1320.08, "text": " in the middle doesn't care about how the weights were when before however movement pruning"}, {"start": 1320.08, "end": 1325.62, "text": " looks at the combination of what were the weights before and what are the weights now"}, {"start": 1325.62, "end": 1332.1999999999998, "text": " and it cuts away everything where the weights moved towards zero which are these quadrants"}, {"start": 1332.1999999999998, "end": 1338.4799999999998, "text": " right here and it leaves in everything where it moved away from zero or that's that's the"}, {"start": 1338.48, "end": 1348.16, "text": " ordering let's say that how much it moved okay experiments now as you might already"}, {"start": 1348.16, "end": 1354.32, "text": " have figured out by now in the machine learning and especially the nlp community the methods"}, {"start": 1354.32, "end": 1360.88, "text": " presented always outperform the previous methods in this case it's pretty special so they test"}, {"start": 1360.88, "end": 1368.7, "text": " this on these number of tasks quad and nlmi and qqp and these are quite hard tasks from"}, {"start": 1368.7, "end": 1374.16, "text": " an nlp perspective like squad is question answering mnlis like language inference so"}, {"start": 1374.16, "end": 1380.96, "text": " these would be on the I would I would guess these are on on the foreign nlp system on"}, {"start": 1380.96, "end": 1386.64, "text": " the harder side of tasks that's it's fairly cool and as you can see here now just focus"}, {"start": 1386.64, "end": 1393.8400000000001, "text": " on first of all focus on this map which is the magnitude pruning so that's the baseline"}, {"start": 1393.8400000000001, "end": 1403.0, "text": " if you will and the the purple one the smvp which which is the soft movement pruning okay"}, {"start": 1403.0, "end": 1407.8400000000001, "text": " now you can also focus on the mvp right here but they're approximately the same now the"}, {"start": 1407.8400000000001, "end": 1415.68, "text": " rpp you can maybe see in the graph is performing fairly well even compared to the full model"}, {"start": 1415.68, "end": 1422.0, "text": " it's it's it's another baseline basically but we just want to compare those two and"}, {"start": 1422.0, "end": 1430.8, "text": " you can see that in this regime that the magnitude pruning outperforms the movement pruning but"}, {"start": 1430.8, "end": 1436.52, "text": " however in this regime the movement pruning is much better and that's the percent where"}, {"start": 1436.52, "end": 1441.24, "text": " the percent of remaining weights is very very low so this is kind of the extreme sparse"}, {"start": 1441.24, "end": 1446.92, "text": " case where you only have 10 or you only have 3 percent of the weights left and you can"}, {"start": 1446.92, "end": 1455.1200000000001, "text": " see that the movement pruning is outperforming the magnitude pruning by a lot okay now they"}, {"start": 1455.1200000000001, "end": 1463.52, "text": " do discover that so this this happens in all in all of these tasks as you can see right"}, {"start": 1463.52, "end": 1472.68, "text": " here and they do they do discover that if you then distill the model further so in distillation"}, {"start": 1472.68, "end": 1477.72, "text": " this is yet another technique that you can use to boost the performance of the transfer"}, {"start": 1477.72, "end": 1488.96, "text": " learned model so in distillation you would not only train the model on you so you have"}, {"start": 1488.96, "end": 1496.52, "text": " you now you have your this model that you transfer learn and you have the prune version"}, {"start": 1496.52, "end": 1500.96, "text": " and in the prune version what you would do is you would simply also train it on this"}, {"start": 1500.96, "end": 1506.6000000000001, "text": " data set but what you can also do is you can distill this model right here the one that"}, {"start": 1506.6000000000001, "end": 1511.04, "text": " you train on the same task right that's that's presumably better because it still has all"}, {"start": 1511.04, "end": 1517.92, "text": " the weights okay you can run a data point through both so the same data point goes through"}, {"start": 1517.92, "end": 1523.0800000000002, "text": " this and you get an output which are logits which is like representing a distribution"}, {"start": 1523.0800000000002, "end": 1529.96, "text": " saying yeah it's about this high now instead of assigning the hard labels so here we also"}, {"start": 1529.96, "end": 1534.76, "text": " get the label right it's a supervised learning task like one and zero you also put the data"}, {"start": 1534.76, "end": 1544.24, "text": " point through this model right here obtain whatever that model would have said and let's"}, {"start": 1544.24, "end": 1553.8, "text": " say it's about this and now presumably this model is better already so you say well the"}, {"start": 1553.8, "end": 1559.88, "text": " label here says that it's this class but the model that's really good says you shouldn't"}, {"start": 1559.88, "end": 1566.1200000000001, "text": " be too sure about it so you can sort of mix the two losses and this this process of transferring"}, {"start": 1566.1200000000001, "end": 1572.28, "text": " the knowledge of this model to here is called distillation with the lower model being the"}, {"start": 1572.28, "end": 1578.84, "text": " teacher model now if you do distillation you can actually improve your performance even"}, {"start": 1578.84, "end": 1587.2, "text": " more and they show that in the experiments here especially again in the low in the low"}, {"start": 1587.2, "end": 1593.24, "text": " parameter regime but you can see for example in squad here that the distilled movement"}, {"start": 1593.24, "end": 1600.36, "text": " pruned method now catches up with the magnitude pruned method in the also in the high in the"}, {"start": 1600.36, "end": 1610.0, "text": " not so sparse regime okay and they analyze these weights and as you can see that expected"}, {"start": 1610.0, "end": 1616.12, "text": " the magnitude pruned method it will simply cut out anything right here right that's not"}, {"start": 1616.12, "end": 1621.6, "text": " not a surprise whereas the movement pruned method it will leave a lot of these weights"}, {"start": 1621.6, "end": 1630.8799999999999, "text": " alive so as you can as you can see basically it's it's very much the case since you can"}, {"start": 1630.8799999999999, "end": 1637.58, "text": " outperform the red the yellow one can outperform the red one it is almost warranted to say"}, {"start": 1637.58, "end": 1643.6799999999998, "text": " that the this magnitude pruning wasn't the best choice it's actually a better choice"}, {"start": 1643.6799999999998, "end": 1648.6799999999998, "text": " to leave some of those weights in and actually cut some of the weights that are large out"}, {"start": 1648.68, "end": 1653.6000000000001, "text": " just based on their movement now the V here in the middle is of course due to the fact"}, {"start": 1653.6000000000001, "end": 1662.44, "text": " that if a weight is here it was probably not super important in the first place and since"}, {"start": 1662.44, "end": 1668.6200000000001, "text": " since this thing removes anything that moves towards zero any point starting let's say"}, {"start": 1668.6200000000001, "end": 1673.3600000000001, "text": " around here moving towards zero would end up here so all the points that end up in this"}, {"start": 1673.36, "end": 1681.32, "text": " region probably moved towards zero during training and therefore are cut away so there's"}, {"start": 1681.32, "end": 1686.1999999999998, "text": " there's not just like for there to be points there would have been points that started"}, {"start": 1686.1999999999998, "end": 1690.52, "text": " even more in the middle and then moved out to here right and there's just not as many"}, {"start": 1690.52, "end": 1700.1399999999999, "text": " so that's why you have the V shape is very natural to expect right here so they they"}, {"start": 1700.14, "end": 1709.0400000000002, "text": " analyze this then in terms of the where the model cuts the weights out now they experiment"}, {"start": 1709.0400000000002, "end": 1714.8200000000002, "text": " on the BERT base thing that which is a transformer with 12 layers and if you don't know what"}, {"start": 1714.8200000000002, "end": 1723.68, "text": " BERT is you can go look at my video on BERT but you can see that the magnitude pruning"}, {"start": 1723.68, "end": 1730.4, "text": " will sort of cut all the weights on the layers equally so it will sort of go through the"}, {"start": 1730.4, "end": 1737.6000000000001, "text": " layers and take away let's say 90% of each here you can see 10% of weights remaining"}, {"start": 1737.6000000000001, "end": 1742.8400000000001, "text": " whereas the movement pruning especially the soft movement pruning will actually make a"}, {"start": 1742.8400000000001, "end": 1749.4, "text": " large difference it will remove much much more of the later layers weights and keep"}, {"start": 1749.4, "end": 1755.3600000000001, "text": " the lower layer weights which I think if you do transfer learning from these language models"}, {"start": 1755.3600000000001, "end": 1761.1200000000001, "text": " it tends to be that the lower layers maybe pick up if you if you think of a CNN the lower"}, {"start": 1761.1200000000001, "end": 1766.16, "text": " layers might pick up you know on these essential image features like corners and so on and"}, {"start": 1766.16, "end": 1771.24, "text": " the higher layers will pick up on the task specific things now if you do like a big pre-training"}, {"start": 1771.24, "end": 1774.98, "text": " tasks you might have a lot of information that you need there but then if you distill"}, {"start": 1774.98, "end": 1781.52, "text": " it and transfer it down to like a small set small task where only a single thing is important"}, {"start": 1781.52, "end": 1785.96, "text": " like in squad it's only important what's the answer to the question then you can probably"}, {"start": 1785.96, "end": 1791.3600000000001, "text": " remove a lot of that superfluous information that was there like high-level features from"}, {"start": 1791.3600000000001, "end": 1798.8, "text": " the pre-training task I mean that's my my guess here but they also have explained that"}, {"start": 1798.8, "end": 1806.18, "text": " so yeah that was this paper if you're still here and you enjoyed it leave a like tell"}, {"start": 1806.18, "end": 1829.3200000000002, "text": " me in the comments what you think and I'll see you next time bye bye"}]
Yannic Kilchner
https://www.youtube.com/watch?v=hQEnzdLkPj4
Learning To Classify Images Without Labels (Paper Explained)
How do you learn labels without labels? How do you classify images when you don't know what to classify them into? This paper investigates a new combination of representation learning, clustering, and self-labeling in order to group visually similar images together - and achieves surprisingly high accuracy on benchmark datasets. OUTLINE: 0:00 - Intro & High-level Overview 2:15 - Problem Statement 4:50 - Why naive Clustering does not work 9:25 - Representation Learning 13:40 - Nearest-neighbor-based Clustering 28:00 - Self-Labeling 32:10 - Experiments 38:20 - ImageNet Experiments 41:00 - Overclustering Paper: https://arxiv.org/abs/2005.12320 Code: https://github.com/wvangansbeke/Unsupervised-Classification Abstract: Is it possible to automatically classify images without the use of ground-truth annotations? Or when even the classes themselves, are not a priori known? These remain important, and open questions in computer vision. Several approaches have tried to tackle this problem in an end-to-end fashion. In this paper, we deviate from recent works, and advocate a two-step approach where feature learning and clustering are decoupled. First, a self-supervised task from representation learning is employed to obtain semantically meaningful features. Second, we use the obtained features as a prior in a learnable clustering approach. In doing so, we remove the ability for cluster learning to depend on low-level features, which is present in current end-to-end learning approaches. Experimental evaluation shows that we outperform state-of-the-art methods by huge margins, in particular +26.9% on CIFAR10, +21.5% on CIFAR100-20 and +11.7% on STL10 in terms of classification accuracy. Furthermore, results on ImageNet show that our approach is the first to scale well up to 200 randomly selected classes, obtaining 69.3% top-1 and 85.5% top-5 accuracy, and marking a difference of less than 7.5% with fully-supervised methods. Finally, we applied our approach to all 1000 classes on ImageNet, and found the results to be very encouraging. The code will be made publicly available. Authors: Wouter Van Gansbeke, Simon Vandenhende, Stamatios Georgoulis, Marc Proesmans, Luc Van Gool 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, check out these clusters of images right here. And just have a look at how all of them are pretty much showing the same object. So here's balloons, here's birds, here's sharks or other fish. These are from images from the ImageNet data set. And you can see that these clusters are pretty much the object classes themselves. So there's all the frogs right here, all the people that have caught fish. So the astonishing thing about this is that these clusters have been obtained without any labels of the ImageNet data set. Of course, the data set has labels, but this method doesn't use the labels, it learns to classify images without labels. So today we're looking at this paper, Learning to Classify Images Without Labels by Wouter van Gansbeke, Simon van den Hende, Stamatios Georgoulis, Mark Prozemans and Luc van Gool. And on a high level overview, they have a three step procedure. Basically, first, they use self supervised learning in order to get good representations. Second, they do a clustering. So they do a sort of k-nearest neighbor clustering, but they do clustering on top of those things. But they do it in a kind of special way. And then third, they do a refinement through self labeling. So if you know what all of these are, you basically understand the paper already. But there's a bit of tricky steps in there. And it's pretty cool that at the end, it works out like you just saw. So before we dive in, as always, if you're here and not subscribed, then please do and if you like the video, share it out and leave a comment if you feel like commenting. Cool. So as we already stated, the problem, they ask, is it possible to automatically classify images without the use of ground truth annotations? Or even when the classes themselves are not known a priori? Now, you might seem like you might think that this is outrageous. How can you classify when you don't even know what the classes are and so on? So the way you have to imagine it going forward, and they don't explicitly explain it, but it's sort of assumed that if you have a data set, and you learn to classify it, what basically that means is you cluster it, right? You put some of the data points in the same clusters. And then, of course, the data set, I'm going to draw the same data set right here, the same data set would have an actual classification thing. So this would be class zero, this here may be class one, and this here might be class two. Now, you can't possibly know how the classes are like called or something, which one is the first, which one is the second. So at test time, basically, if you have a method like this, that doesn't use labels, what you're going to do is you're basically going to find, you're going to be as generous as possible. And in the assignment of these and say, Oh, look, if I assign this here, to cluster zero, and this here to cluster two, and this here to cluster one, and I just, you know, carry over the labels, what would my accuracy be under that labeling? So you're, you're as generous as possible with the assignments of the labels. So that's how it's going to work, right? That's what you have to keep in mind, we're basically developing an algorithm that gives us this kind of clustering of the data. And then if that clustering partitions the data in the same way as the actual labeling would, the actual labeling with the test labels, then we we think it's a good algorithm. Okay, so they claim they have a. Okay, in this paper, we deviate from recent works and advocate a two step approach. That's actually a three step approach, but we're feature learning and clustering are decoupled. Okay, why? Why is that? So they argue, what you could do, what people have done is, and I'm going to, well, this is just a wall of text. So what you could do is you could just basically cluster the data, like who says you can't use clustering algorithms, but then the question is, what, what do you cluster them by? Like you need a distance. So if I have points in 2d, it sort of makes sense to use the Euclidean distance here. But if I have images of cats and dogs and whatnot, then Euclidean distance between the pixels is really not a good, good thing. But also, so you might think we could actually, we could use a deep neural network, and then basically send the image, that's the image right here, send the image through the deep neural network, and then either take these last state right here, so it goes through and through and through. And we could get take either of the hidden states, or we could just take you know, the last state that is the sort of hidden representation right here, and to do the clustering with that. But then of course, the question is, what do you what which neural network do you take? How do you train that neural network? And there have been a few approaches such as a deep cluster, which try to formulate basically an objective for that neural network where you first you send all the images through, right, you send a bunch of images through to get you in embedding space, get you points and then in embedding space, you think, well, the features that are in the embedding space, they are somehow latent and they if basically the entire thing is, if this neural network was used to classify images, you would have a classification head on top. And a classification head, this is like a five class classification is nothing else than a linear classifier boundary that you put on top of this hidden representation. So if you were to use this neural network for classification, it must be possible to draw a linear boundary between the classes. And therefore, the either things like the inner product distance or the Euclidean distance must make sense in that space. They don't make sense in the picture space, but they must make sense in the hidden representation space because what you're going to do with them is exactly linear classification. The last classification head of a neural network is just a linear classifier. So the assumption is that and the conclusion is, well, in this space, you should be able to cluster by Euclidean distance. So what deep cluster does, like is first get the representations, you start off with a random neural network, then cluster these representations, then basically label, self label the images in a way. Now I'm way oversimplifying that technique right here. But you have this alternative steps of clustering and then kind of finding better representation and then clustering these representations. And what it basically says is that the CNN itself is such a is like a prior because it's the translation environment works very good for very well for natural images. The CNN itself will lead to good representations if we do it in this way. And there's some good results there, but this paper argues that if you do that, then the algorithm tends to focus a lot on very low level features. So if the pixel on the bottom right here is blue, right, then you can end the neural network by chance puts two of those images where the blue pixel on the bottom right, it puts them close together, then in the next step, it will because they're close together, it will cluster them together. And then it will basically feed back the new representations should put the two in the same class, right? It will feed back that it should focus even more on that blue pixel. So it's very, very dependent on initializations. And it can jump super easily onto these low level features that have nothing to do with the high level task you're ultimately trying to solve, which is to classify these images later. So what this paper does is it says, we can eliminate this, we can eliminate this, the fact that these methods will produce will produce neural networks that focus on low level features. And how do we do that? We do that by representation learning. So representation learning, you might know this as self supervised learning. And this is the task they solve in the first step of their objective. So let's go through this, this right here is an image. Now, the T is a transformation of that image. And in self supervised learning, there are several methods that you can transform an image. So for example, you can random crop an image, you can just cut out like a piece right here and scale that up to be as large as the original image. Or you can use for example, data augmentation, which means you take the image, and you basically so if there is, I don't know the cat right here, you you kind of convolve it with some things it's there's like a very squiggly cat. Okay, I'm terrible. You can, you can rotate it, for example. So it's like this. Okay, so these are all these are all sets, including the crop sets of this transformation T. So you transform it in some way. And you want after you've transformed it, you send your original image. So that should be read, you're sending your original image and the transformed image through a neural network, each one by themselves. Okay. And then after this, you say the hidden representation here should be close to each other. Okay, this is this is basically the self supervised training task is been shown to work very, very well. As a pre training method for classification neural networks. You have an image and its augmented version, and you minimize the inner product or the Euclidean distance between the two versions in the hidden space. And the rationale is exactly the same. The rationale is that this hidden space, of course, should be linearly classifiable. And so the distance between those should be close. And the rationale between having these tasks is that, well, if I flip the image, right, if I flip the image to the right, it cannot focus on the pixel on the bottom right anymore, because that's not going to be the pixel on the bottom right here. And I'm not always going to flip it into the same direction. And sometimes I'm going to crop it. So it also can't focus on the pixel on the bottom right, because in the crop, that pixel is like out here, it's not even in the crop. But basically, what you're looking to do with the self supervised methods is you are looking to destroy this low level information. That's that's all you're looking to build a pipeline of a neural network here that destroys deliberately low level information and you do that by coming up with tasks like this self supervision tasks that deliberately exclude this information from being used. I think that's what's going on generally in the self supervised learning thing. Okay, so this here, as you can see, is the neural network that you train, you send both images, the original and the augmented version through the same neural network, and then you minimize some distance, which is usually like the inner product or the Euclidean distance in this embedding space, okay. And what you train, you can see right here, you train the parameters of this neural network. So the transformations are fixed or sampled, and the distance is fixed, you train the neural networks such that your embeddings minimize this task. Now this is nothing new. This has been this has been used for a couple of years now to get better representation. Self supervised learning is a thing. But they basically say we can use this as an initialization step for this clustering procedure because if we don't do that, we we focus on these low level features. Okay, and notice you don't need any labels for this procedure. That's why it's called self supervised. Okay, so the second second part is the clustering. Now they cluster, but they don't just cluster these representations that would be that doesn't perform very well in their in their experiments. What they instead do is they minimize this entire objective right here, and we'll go through it step by step. So they train a new neural network. Okay, this thing right here, this is a new neural network. So first you have you already have the neural network, which was called, what was it even called the one that gives you the embedding with the theta, okay, it's called phi theta. It's the same architecture, and I think they initialize one with the other. So in step one, you get phi, theta, phi theta goes give from from x gives you a representation of x, okay, let's call it hidden x. So that's via self supervised learning. But in step two, you train an entirely new neural network, this phi, eta here, and you initialize it with this one. But now you train it to do the following. Again, you want to minimize, sorry, you want to maximize the inner product, right here. See that's the inner product, you want to maximize the inner product between two things. Now that's the same thing as before, we want to minimize the distance between two things, and the dot product distance in that case, you maximize the dot product between two things. And the two things are two images that go through the same neural network as before, right, this and this. Now what's different here is that here we input an one image of the data set. That's the same as before, okay, so we input one image, but here before in the self supervised learning, we input an augmented version of that. And now we input something else, we input this k right here. Now what's k, what k comes from this neighbor set of x, okay, this is the set of neighbors of x, and these neighbors are determined with respect to this neural network right here. So what you do after step one is you take your neural network with the good embeddings, and here is your data set x, your data set x, this should be another, your data set x is this list basically of all the images in your data set. And what we're going to do is you're going to take all of them using that neural network that you just trained and embed them into a latent space right here. Okay. This is the latent space where you have done this self supervised training. And now for each image, right here. So if this is x i, you're going to find its k nearest neighbors and they use I think they use five as a benchmark. So you're going to find its nearest neighbors, its five nearest neighbors. And you do this for each image. So this image has these five nearest neighbors, so on. So in step two, what you're trying to do is you're going to try to pull together each image and its nearest neighbors in that in this, this, not in this space directly, but you determine which ones are the nearest neighbor from this neural network and you keep it constant. That's how you determine what the nearest neighbors are in the first task. And that is your n x set for x i. And in the second step, you're trying to make the representations of any image and its nearest neighbors closer to each other. Okay, so with with this thing right here, you maximize the inner product between x in after this neural network and a nearest neighbor of x that was was a nearest neighbor after the first task. Now the way they cluster here is not just again by putting it into an embedding space, like we saw before, but this thing right here, this neural network, as you can see here, is is a C dimensional vector in zero one. Now C is the number of classes that you can either know that so you don't know which class is which you don't have labels, but you could know how many classes there are, or you could just guess how many classes there are. And as long as you as you over guess, you can still like build super clusters later. So this, they simply say, it's in zero one, but they also say it performs a soft assignment. So we're also going to assume that this is normalized. So for each for each data point x here, you're going to, you're going to have an image, you're going to put it through this new neural network, okay, this new neural network new, and it's going to tell you, it's going to give you basically a histogram, let's say class one, two, or three, we guess there are three class and it's going to give you an assignment of the three. And you also take a nearest neighbor, here is your data set, you also take a nearest neighbor of that. So you look for this set n of x, and you take a nearest neighbor, maybe that's, that's a maybe that's a dog, I can't, I really can't draw a dog. Yeah, that's the best I can do. I'm sorry. And you also put that through the same network. And you're saying, since they were nearest neighbor in task one, they must share some sort of interesting high level features, because that's what the first task was for. Therefore, I want to make them closer together in in the in the light of these of this neural network right here. So this is also going to give you an assignment like, maybe like this. Okay, and now you object you train this network right here to basically match these two distributions. Okay, so this is this is now a classifier into C classes, but we guess C, and we don't have labels, we simply our label is going to be my neighbors from the first task must have the same labels. That's our label. Now, they say they also have this term right here, which is the entropy over assignments. Okay, as you can see, so they minimize the following, they minimize this quantity, which has a negative in front of it. So that means they maximize this log inner product. And they also maximize the entropy, because, sorry, so they minimize this thing. And but the entropy is a negative quantity, right? So they maximize the entropy because here's a plus. And now they minimize the entropy. Let's see what they say. By minimizing the following objective. Now entropy is the sum of the negative sum of p log p. And this if this is p, yes, this is the probability that an image is going to be assigned to cluster C over the entire data set. So they're going to Yes, so it's negative, this quantity, negative minus p log p. And this is the entropy. So they're going to minimize the entropy. Let's see what they say. We include an entropy term, the second term in equation two, which spreads the predictions uniformly across clusters C. Okay, so what we want is a uniform assignment over cluster, which means we should maximize the entropy. Oh, yes, okay. They minimize this thing. And this here is the negative entropy, right? Okay, so they want basically what they want over the whole data set that not all of the images are going to be in the same cluster. This is cluster one, and then this is cluster two, and then this is cluster three. So that term counteracts that. Basically, the more evenly spread the entire data set distribution is the the the higher the entropy, the lower the negative entropy. And that's the goal right here. I'm sorry, this, this was, I was confused by the too many negative signs, and then you minimize the entire thing. All right. Now they say they say a different thing right here. They say here, this bracket denotes the dot product operator, as we saw, it's the dot product between these two distributions right here. The first term in equation two, imposes this neural network to make consistent predictions for a sample x i, and its neighboring samples, the neighbors of x i. And here is an interesting thing. Note that the dot product will be maximal when the predictions are one hot, that means confident and assigned to the same cluster consistent. So they basically say the objective encourages confidence, because it encourages predictions to be one hot. And it encourages consistency, because it, you know, the, because the distributions need to be the same, they should be in the same cluster, right? Now I agree with the consistency, like if you make the inner product high, then of the of two, two of these histograms, of course, they look the same, right? Because these are ultimately vectors, these are three dimensional vectors, let's call them two dimensional vectors, right? So here is class one, here's class two, if you, you know, make the inner product small or high, they will agree on their predictions. But I disagree that this encourages anything to be one hot, like in my mind, if you have two vectors, they're both zero one times zero one, the inner product is going to be one. And if you have two assignments that are point five and point five, then it is also going to result in an in an inner product of is it 0.5? Right, is also going to be no. So what's the inner product here? The inner product is point five times point five plus point five times point five, which is point five. Am I dumb? And embarrassingly long time later. Oh, it's because the L one norm. Okay, okay, we got it. We got it. Um, I am I am okay, I am too dumb. Yes, of course, I was thinking of these vectors being normalized in L two space where their inner products would always be one. But of course, if you have assignments between classes, and it's a probability distribution, a histogram, then all of the prob possible assignments lie on this on this thing right here. Now, the inner product with yourself, of course, is the length of the vector and the length of a vector that points to one class, or the other class is longer than a vector that points in between. So okay, I see that's where they get this. That's where they get this must be one hot from. So okay, I'll give that to them. It is actually encouraging one hot predictions, as long as these things are normalized in L one space, which they probably are because they're histograms, right? Yes, that was that was dumbness of me. I was trying to make a counter example. I'm like, wait a minute. This counter example is a counter example to my counter example. Okay, so yeah, that's that's that. So as you can see, they are of course, correct here. And they now make the first experiments. So they say basically, after the first step of the self supervised training, they can already retrieve sort of nearest neighbors. And the nearest neighbors, the nearest neighbors of these images right here are the ones that you see on the right. And after the self supervised one, these nearest neighbors are already pretty good at sharing the high level feature actually crazy, crazy good, right? This flute here is in different sizes. As you can see, the fishes aren't aren't all exactly the same. The birds. So you can see it really focuses on sort of higher level features. But I guess it's really dependent on this higher level task. And they were they also investigate this quantitatively. But I just want to focus on how good is this after only the self supervised thing. And now they do this clustering. And they can already sort of could already evaluated right here, because now they have a clustering, right? After this step, they've basically pulled together the neighbors, and they have this neural network that is not assigning classes. So they could already evaluate this and they are going to do that. But that's not good enough yet. Then they do a third step, which is fine tuning through self labeling. Now self labeling is pretty much exactly what it's what it says. It's you label your own data with your own classifier. Now that might be a bit outrageous. And you basically saying, wait a minute, if I label my own data and learn a classifier on these labels, isn't isn't it just going to come out the same? And the answer is no, right? If you have a data set, because your classifier doesn't give you just first of all, if your classifier is something like this, right, just happens to be and you label and you learn a new classifier, it is going to be more like this, right? Because it sort of maximizes a lot of classifiers maximize these distances between the classes. So even if it's like that, and then the second step they do is they say, okay, there are some points where we are actually more confident about such as this one, we're more confident about that one, also this one, and then this one here is pretty close, like we're not super neither this one, but we're very confident about these two. So we're only going to use the ones where we are, in fact, confident about to learn to learn the new classifier, or basically we, you can also weigh them, and so on. But they go by confidence right here, as you can see, in this final algorithm. So this is the entire algorithm and I got kicked away. Our algorithm, there we go. All right. So semantic clustering by adopting nearest neighbors, their scan algorithm. So in the first step, you do this pretext task, this is the self supervision, the representation learning, okay? Your entire data set, no, sorry, this is this year, optimize the neural network with task T. That's just self supervised representation learning. Okay, then the second thing, we're going to determine the nearest neighbor set for each X. Now, they also in that step, they also augment the data, they do heavy data augmentation and so on. Also in this, in the third step in the self labeling, they do data augmentation. There's a lot of tricks in here. But ultimately, the base algorithm goes like this. So you find your neighboring sets for each X. And then what you do while your clustering loss decreases, you update this clustering neural network by with this loss that we saw. So this is the loss where you make the nearest neighbors closer to each other while still keeping the entropy high. Okay. And then in the last after you've done this, you go through and you say while the length of Y increases, what's Y? Y is all the data points that are above a certain threshold. Now, you're going to filter the data set that is above a certain threshold. And that's your data set Y and you train this same neural network, you basically fine tune it with the cross entropy loss on your own labels. So now you only have labels Y. Okay, so it's not labels, you have the cross entropy loss between the assignments of this and the assignments of your data set. Okay, so you basically do the same task, but you filter by confidence. And they use a threshold, I think, of point seven or something like this. Now let's go into the experiments. The experiments are look as follows. So they do some ablations to find out where in their methods kind of the the gains come from and we'll just quickly go through them. If they just do these self supervision at the beginning and then just do k-means clustering on top of that, that will give them on CIFAR-10 a 35.9% accuracy. So not very good. So the clustering, you can't just cluster on top of these representations and then be done. If they do what they say, so this is sample and batch entropy loss, this basically means you do not care about the nearest neighbors, you do this entire thing, but you only make an image close to the prediction close to itself and its augmentations. So you don't use any nearest neighbor information also doesn't work. Like I wouldn't pay too much attention that the numbers are 10, 20 or 30. It just is like doesn't work. Now if you use the scan loss, you all of a sudden you get into a regime where there is actual signal. So this is now significantly above the, this is significantly above random guessing. And if you use strong data augmentation, as I said, a lot of this has these tricks in it of what kind of data augmentation you do and so on. So never forget that these papers besides their idea, they put in all the tricks they can. So you get 10% more and then if you do this self labeling step, you get another 10% more. And this is fairly respectable like 83.5 without ever seeing labels. It's fairly good. But of course there are only 10 classes right here. So keep that in mind, but they will do it on ImageNet later. And they investigate what kind of self supervision tasks at the beginning are important. And they investigate things like RotNet feature decoupling and noise contrast of estimation, which noise contrast of estimation is the best. And noise contrast of estimation I think is just where you, as we said, you input an image and then it's kind of noisy versions with augmented in various ways. And then you classify them together. This has been like this, these methods have been very successful in the last few years. Yeah, so this, they have various investigations into their algorithm. I want to point out this here. This is the accuracy versus confidence after the complete clustering step. So this is now the third step, the self labeling. And you can see right here, as this confidence of the network goes up, the actual accuracy goes up as well. So that means the network after the clustering is really more confident about the points that it can classify more accurately. There's like a correlation between where the network is confident and the actual label of the point, which is remarkable because it has never seen the label. But also see how sort of the range here is quite small. So with the standard augmentation that goes like from here to here. So where you set that threshold is fairly important and might be quite brittle here because you need to set the threshold, right, such that some points are below it and some are above it and you don't want to pull in points where you're not, because if you pull in points from here, you only have the correct label for 75% or something like them, of them. That means if you now self label and learn on them, you're going to learn the wrong signal. So this step seems fairly brittle, honestly, but I don't know, of course. They go on and investigate various things such as how many clusters do you need or how many nearest neighbors, sorry, do you need this number K here. And you can see that if you have zero neighbors, then you're doing a lot worse than if you have, let's say, five nearest neighbors. So the jump here, as you can see, is fairly high in all the data sets. But after that, it sort of doesn't really matter much. So it seems like five nearest neighbors should be enough for most things. And here they just show that when they remove the false positives, that their algorithm actually converges to the correct clustering, the correct accuracy, which is not surprising. Like if you remove the wrong samples that are wrong, then the rest of the samples are going to be right. I think that's just showing that it doesn't go into some kind of crazy downward spiral loop or something like this. But still, it's just kind of funny. Okay, so they do investigate how much they improve and they improve by quite a lot above the kind of previous methods. So they have a lot of previous methods. But this includes things like k-means and so on, GANs, deep cluster that we spoke about. And this method, it already gets, as you can see, fairly close to good accuracy. So you have like 88.6% accuracy. And that's, you know, fairly remarkable on C410 without seeing the labels. But we'll go on and now they go into ImageNet. Now ImageNet, of course, has way more classes. It has 1000 classes compared to C410's 10 classes. So if you think, you know, clustering 10 classes might end there fairly apart from each other, might work with various techniques ImageNet, 1000 classes, that's way more difficult. Now they do subsample this to 50, 100 and 200 classes and they get okay accuracy. As you can see, they get 81% in 450 classes where a supervised baseline would get 86%. In the 200 classes, they get 69% where a supervised baseline would get 76%. So it's there. And that's quite remarkable for these low number of classes. And they figure out that if they look for the samples that are kind of in the most of the middle of their cluster, they get these prototypes right here. And you can see all of these images, if you know ImageNet, some of the images, they really only have a part of the object and so on. So here with the prototypical things, you really get center clear shot of the object with clearly visible features and so on. So this sort of repeats the fact that this clustering really does go on that sort of semantic information. Of course, the labels here are from the test label set, the network can't figure that out. And then they go for 1000 classes and in 1000 classes, it doesn't really work because there might be just too many confusions right here. But they do have this confusion matrix of their method. And it shows that the confusion matrix is pretty much a long block diagonal along these super clusters right here. So you can see the dogs, the network confuses the dogs fairly often and the insects with each other, but not really across here, which is still quite remarkable. But I mean, you get the same thing for a lot of these methods. So I don't know how much different this would be in other methods. But certainly it's interesting to look at. Now they go into one last thing. And that is what if we don't know how many clusters there are, right? If we don't know anything. So say so far, we have assumed to have knowledge about the number of ground truth classes. The model predictions were evaluated using the Hungarian matching algorithm. We already saw this in the DETR by Facebook, if you remember. However, what happens if the number of clusters does not match the number of ground truth classes anymore? So they now say table three reports the results when we overestimate the number of ground truth classes by a factor of two. Okay, so now they they build just 20 classes for CIFAR-10 instead of 10 classes. And we'll look at table three real quick. Where's table three? This is table three. Okay. So when they over cluster, you get the thing here on the bottom. And you can see there is a drop in accuracy right here. Now what I don't actually, they don't actually say how they do the over cluster matching. So if you imagine if I now have, I don't know, six clusters, but I need to assign them to three clusters, you know, here. Do I still use this most optimistic thing? So do I still use, I think they still use this most optimistic matching right where you assign everything to its best fitted cluster, right? You compute all the permutations and then you give it the best benefit of the doubt. Now if you imagine the situation where I over cluster to the point that I have each image in its own cluster, and I run this algorithm to evaluate my clustering, I give it basically the most beneficial view, then I would get 100% accuracy. Okay, so like in one of these over cluster approach, I would sort of expect that you actually get a better score because you can, like there is more generosity of the matching algorithm involved. Now that's counteracted by the fact that you can't group together things that obviously have similar features because they are in the same class. So there's kind of two forces pulling here, but I was kind of astounded that it's going down and the evaluation method of this matching algorithm, it sort of breaks down when you have more classes, at least in my opinion. Yeah, but it's interesting to see that you can just overshoot, but then you need some sort of heuristic to reconcile that. In any case, I think this paper is pretty cool. It brings together a lot of things that were already present and introduces this kind of this step approach, but what you have to keep in mind, and by the way, there's lots of samples down here. What you have to keep in mind is there are a lot of hyperparameters in here. There are like this threshold and you know, first of all, yeah, the number of classes, the thresholds, the architectures and so on, and all of this has been tuned to get these numbers really high, right? All of these steps, all of the augmentations and so on, the chosen data augmentations, it has been chosen to get this number as high as possible. So you know, to interpret this as, oh, look, we can classify without knowing the labels is, you know, yes, in this case, but the hyperparameter choices of the algorithm are all informed by the labels. So it is still very, very unclear of how this method will actually work when you really don't have the labels, when you actually have to choose the hyperparameters in absence of anything. And yeah, I think the future might tell if they continue to work on this. All right, thanks for listening, looking, watching, and bearing with me through my wrestling with with various math, basic math in this video. I wish you a good day and bye bye.
[{"start": 0.0, "end": 5.16, "text": " Hi there, check out these clusters of images right here."}, {"start": 5.16, "end": 10.120000000000001, "text": " And just have a look at how all of them are pretty much showing the same object."}, {"start": 10.120000000000001, "end": 15.72, "text": " So here's balloons, here's birds, here's sharks or other fish."}, {"start": 15.72, "end": 19.400000000000002, "text": " These are from images from the ImageNet data set."}, {"start": 19.400000000000002, "end": 25.98, "text": " And you can see that these clusters are pretty much the object classes themselves."}, {"start": 25.98, "end": 33.16, "text": " So there's all the frogs right here, all the people that have caught fish."}, {"start": 33.16, "end": 38.52, "text": " So the astonishing thing about this is that these clusters have been obtained without"}, {"start": 38.52, "end": 41.8, "text": " any labels of the ImageNet data set."}, {"start": 41.8, "end": 46.96, "text": " Of course, the data set has labels, but this method doesn't use the labels, it learns to"}, {"start": 46.96, "end": 50.28, "text": " classify images without labels."}, {"start": 50.28, "end": 56.88, "text": " So today we're looking at this paper, Learning to Classify Images Without Labels by Wouter"}, {"start": 56.88, "end": 69.32, "text": " van Gansbeke, Simon van den Hende, Stamatios Georgoulis, Mark Prozemans and Luc van Gool."}, {"start": 69.32, "end": 74.0, "text": " And on a high level overview, they have a three step procedure."}, {"start": 74.0, "end": 83.4, "text": " Basically, first, they use self supervised learning in order to get good representations."}, {"start": 83.4, "end": 86.12, "text": " Second, they do a clustering."}, {"start": 86.12, "end": 95.92, "text": " So they do a sort of k-nearest neighbor clustering, but they do clustering on top of those things."}, {"start": 95.92, "end": 97.88, "text": " But they do it in a kind of special way."}, {"start": 97.88, "end": 105.24, "text": " And then third, they do a refinement through self labeling."}, {"start": 105.24, "end": 110.6, "text": " So if you know what all of these are, you basically understand the paper already."}, {"start": 110.6, "end": 113.56, "text": " But there's a bit of tricky steps in there."}, {"start": 113.56, "end": 118.78, "text": " And it's pretty cool that at the end, it works out like you just saw."}, {"start": 118.78, "end": 125.19999999999999, "text": " So before we dive in, as always, if you're here and not subscribed, then please do and"}, {"start": 125.2, "end": 132.64000000000001, "text": " if you like the video, share it out and leave a comment if you feel like commenting."}, {"start": 132.64000000000001, "end": 133.64000000000001, "text": " Cool."}, {"start": 133.64000000000001, "end": 141.06, "text": " So as we already stated, the problem, they ask, is it possible to automatically classify"}, {"start": 141.06, "end": 144.8, "text": " images without the use of ground truth annotations?"}, {"start": 144.8, "end": 149.24, "text": " Or even when the classes themselves are not known a priori?"}, {"start": 149.24, "end": 153.48000000000002, "text": " Now, you might seem like you might think that this is outrageous."}, {"start": 153.48, "end": 158.04, "text": " How can you classify when you don't even know what the classes are and so on?"}, {"start": 158.04, "end": 164.16, "text": " So the way you have to imagine it going forward, and they don't explicitly explain it, but"}, {"start": 164.16, "end": 174.64, "text": " it's sort of assumed that if you have a data set, and you learn to classify it, what basically"}, {"start": 174.64, "end": 176.72, "text": " that means is you cluster it, right?"}, {"start": 176.72, "end": 182.23999999999998, "text": " You put some of the data points in the same clusters."}, {"start": 182.24, "end": 188.8, "text": " And then, of course, the data set, I'm going to draw the same data set right here, the"}, {"start": 188.8, "end": 193.32000000000002, "text": " same data set would have an actual classification thing."}, {"start": 193.32000000000002, "end": 198.44, "text": " So this would be class zero, this here may be class one, and this here might be class"}, {"start": 198.44, "end": 199.44, "text": " two."}, {"start": 199.44, "end": 203.64000000000001, "text": " Now, you can't possibly know how the classes are like called or something, which one is"}, {"start": 203.64000000000001, "end": 205.42000000000002, "text": " the first, which one is the second."}, {"start": 205.42000000000002, "end": 210.64000000000001, "text": " So at test time, basically, if you have a method like this, that doesn't use labels,"}, {"start": 210.64, "end": 214.95999999999998, "text": " what you're going to do is you're basically going to find, you're going to be as generous"}, {"start": 214.95999999999998, "end": 216.32, "text": " as possible."}, {"start": 216.32, "end": 222.76, "text": " And in the assignment of these and say, Oh, look, if I assign this here, to cluster zero,"}, {"start": 222.76, "end": 227.23999999999998, "text": " and this here to cluster two, and this here to cluster one, and I just, you know, carry"}, {"start": 227.23999999999998, "end": 232.56, "text": " over the labels, what would my accuracy be under that labeling?"}, {"start": 232.56, "end": 238.94, "text": " So you're, you're as generous as possible with the assignments of the labels."}, {"start": 238.94, "end": 241.4, "text": " So that's how it's going to work, right?"}, {"start": 241.4, "end": 244.6, "text": " That's what you have to keep in mind, we're basically developing an algorithm that gives"}, {"start": 244.6, "end": 247.88, "text": " us this kind of clustering of the data."}, {"start": 247.88, "end": 253.84, "text": " And then if that clustering partitions the data in the same way as the actual labeling"}, {"start": 253.84, "end": 262.15999999999997, "text": " would, the actual labeling with the test labels, then we we think it's a good algorithm."}, {"start": 262.15999999999997, "end": 267.12, "text": " Okay, so they claim they have a."}, {"start": 267.12, "end": 272.24, "text": " Okay, in this paper, we deviate from recent works and advocate a two step approach."}, {"start": 272.24, "end": 277.24, "text": " That's actually a three step approach, but we're feature learning and clustering are"}, {"start": 277.24, "end": 278.24, "text": " decoupled."}, {"start": 278.24, "end": 279.24, "text": " Okay, why?"}, {"start": 279.24, "end": 280.78000000000003, "text": " Why is that?"}, {"start": 280.78000000000003, "end": 289.64, "text": " So they argue, what you could do, what people have done is, and I'm going to, well, this"}, {"start": 289.64, "end": 291.04, "text": " is just a wall of text."}, {"start": 291.04, "end": 296.04, "text": " So what you could do is you could just basically cluster the data, like who says you can't"}, {"start": 296.04, "end": 302.28000000000003, "text": " use clustering algorithms, but then the question is, what, what do you cluster them by?"}, {"start": 302.28000000000003, "end": 303.44, "text": " Like you need a distance."}, {"start": 303.44, "end": 309.36, "text": " So if I have points in 2d, it sort of makes sense to use the Euclidean distance here."}, {"start": 309.36, "end": 314.16, "text": " But if I have images of cats and dogs and whatnot, then Euclidean distance between the"}, {"start": 314.16, "end": 317.22, "text": " pixels is really not a good, good thing."}, {"start": 317.22, "end": 324.92, "text": " But also, so you might think we could actually, we could use a deep neural network, and then"}, {"start": 324.92, "end": 330.36, "text": " basically send the image, that's the image right here, send the image through the deep"}, {"start": 330.36, "end": 335.68, "text": " neural network, and then either take these last state right here, so it goes through"}, {"start": 335.68, "end": 337.24, "text": " and through and through."}, {"start": 337.24, "end": 341.6, "text": " And we could get take either of the hidden states, or we could just take you know, the"}, {"start": 341.6, "end": 347.04, "text": " last state that is the sort of hidden representation right here, and to do the clustering with"}, {"start": 347.04, "end": 348.04, "text": " that."}, {"start": 348.04, "end": 352.56, "text": " But then of course, the question is, what do you what which neural network do you take?"}, {"start": 352.56, "end": 356.1, "text": " How do you train that neural network?"}, {"start": 356.1, "end": 361.14, "text": " And there have been a few approaches such as a deep cluster, which try to formulate"}, {"start": 361.14, "end": 365.72, "text": " basically an objective for that neural network where you first you send all the images through,"}, {"start": 365.72, "end": 371.04, "text": " right, you send a bunch of images through to get you in embedding space, get you points"}, {"start": 371.04, "end": 376.58, "text": " and then in embedding space, you think, well, the features that are in the embedding space,"}, {"start": 376.58, "end": 383.47999999999996, "text": " they are somehow latent and they if basically the entire thing is, if this neural network"}, {"start": 383.47999999999996, "end": 388.71999999999997, "text": " was used to classify images, you would have a classification head on top."}, {"start": 388.71999999999997, "end": 393.84, "text": " And a classification head, this is like a five class classification is nothing else"}, {"start": 393.84, "end": 401.97999999999996, "text": " than a linear classifier boundary that you put on top of this hidden representation."}, {"start": 401.97999999999996, "end": 405.91999999999996, "text": " So if you were to use this neural network for classification, it must be possible to"}, {"start": 405.92, "end": 409.72, "text": " draw a linear boundary between the classes."}, {"start": 409.72, "end": 415.68, "text": " And therefore, the either things like the inner product distance or the Euclidean distance"}, {"start": 415.68, "end": 418.84000000000003, "text": " must make sense in that space."}, {"start": 418.84000000000003, "end": 423.56, "text": " They don't make sense in the picture space, but they must make sense in the hidden representation"}, {"start": 423.56, "end": 428.12, "text": " space because what you're going to do with them is exactly linear classification."}, {"start": 428.12, "end": 434.1, "text": " The last classification head of a neural network is just a linear classifier."}, {"start": 434.1, "end": 441.32000000000005, "text": " So the assumption is that and the conclusion is, well, in this space, you should be able"}, {"start": 441.32000000000005, "end": 443.94, "text": " to cluster by Euclidean distance."}, {"start": 443.94, "end": 449.66, "text": " So what deep cluster does, like is first get the representations, you start off with a"}, {"start": 449.66, "end": 456.04, "text": " random neural network, then cluster these representations, then basically label, self"}, {"start": 456.04, "end": 459.12, "text": " label the images in a way."}, {"start": 459.12, "end": 462.08000000000004, "text": " Now I'm way oversimplifying that technique right here."}, {"start": 462.08, "end": 467.44, "text": " But you have this alternative steps of clustering and then kind of finding better representation"}, {"start": 467.44, "end": 469.96, "text": " and then clustering these representations."}, {"start": 469.96, "end": 476.0, "text": " And what it basically says is that the CNN itself is such a is like a prior because it's"}, {"start": 476.0, "end": 481.03999999999996, "text": " the translation environment works very good for very well for natural images."}, {"start": 481.03999999999996, "end": 486.44, "text": " The CNN itself will lead to good representations if we do it in this way."}, {"start": 486.44, "end": 494.8, "text": " And there's some good results there, but this paper argues that if you do that, then the"}, {"start": 494.8, "end": 499.14, "text": " algorithm tends to focus a lot on very low level features."}, {"start": 499.14, "end": 506.4, "text": " So if the pixel on the bottom right here is blue, right, then you can end the neural network"}, {"start": 506.4, "end": 511.92, "text": " by chance puts two of those images where the blue pixel on the bottom right, it puts them"}, {"start": 511.92, "end": 515.74, "text": " close together, then in the next step, it will because they're close together, it will"}, {"start": 515.74, "end": 517.5600000000001, "text": " cluster them together."}, {"start": 517.5600000000001, "end": 521.88, "text": " And then it will basically feed back the new representations should put the two in the"}, {"start": 521.88, "end": 523.76, "text": " same class, right?"}, {"start": 523.76, "end": 529.16, "text": " It will feed back that it should focus even more on that blue pixel."}, {"start": 529.16, "end": 533.36, "text": " So it's very, very dependent on initializations."}, {"start": 533.36, "end": 540.4, "text": " And it can jump super easily onto these low level features that have nothing to do with"}, {"start": 540.4, "end": 546.9599999999999, "text": " the high level task you're ultimately trying to solve, which is to classify these images later."}, {"start": 546.9599999999999, "end": 555.68, "text": " So what this paper does is it says, we can eliminate this, we can eliminate this, the"}, {"start": 555.68, "end": 563.72, "text": " fact that these methods will produce will produce neural networks that focus on low"}, {"start": 563.72, "end": 564.78, "text": " level features."}, {"start": 564.78, "end": 565.78, "text": " And how do we do that?"}, {"start": 565.78, "end": 568.42, "text": " We do that by representation learning."}, {"start": 568.42, "end": 574.24, "text": " So representation learning, you might know this as self supervised learning."}, {"start": 574.24, "end": 580.3399999999999, "text": " And this is the task they solve in the first step of their objective."}, {"start": 580.3399999999999, "end": 586.12, "text": " So let's go through this, this right here is an image."}, {"start": 586.12, "end": 589.8399999999999, "text": " Now, the T is a transformation of that image."}, {"start": 589.8399999999999, "end": 595.98, "text": " And in self supervised learning, there are several methods that you can transform an"}, {"start": 595.98, "end": 596.98, "text": " image."}, {"start": 596.98, "end": 603.36, "text": " So for example, you can random crop an image, you can just cut out like a piece right here"}, {"start": 603.36, "end": 608.0, "text": " and scale that up to be as large as the original image."}, {"start": 608.0, "end": 614.1, "text": " Or you can use for example, data augmentation, which means you take the image, and you basically"}, {"start": 614.1, "end": 619.12, "text": " so if there is, I don't know the cat right here, you you kind of convolve it with some"}, {"start": 619.12, "end": 622.04, "text": " things it's there's like a very squiggly cat."}, {"start": 622.04, "end": 624.8000000000001, "text": " Okay, I'm terrible."}, {"start": 624.8, "end": 628.4399999999999, "text": " You can, you can rotate it, for example."}, {"start": 628.4399999999999, "end": 629.92, "text": " So it's like this."}, {"start": 629.92, "end": 635.1999999999999, "text": " Okay, so these are all these are all sets, including the crop sets of this transformation"}, {"start": 635.1999999999999, "end": 640.04, "text": " T. So you transform it in some way."}, {"start": 640.04, "end": 647.92, "text": " And you want after you've transformed it, you send your original image."}, {"start": 647.92, "end": 654.56, "text": " So that should be read, you're sending your original image and the transformed image through"}, {"start": 654.56, "end": 658.16, "text": " a neural network, each one by themselves."}, {"start": 658.16, "end": 659.52, "text": " Okay."}, {"start": 659.52, "end": 666.9599999999999, "text": " And then after this, you say the hidden representation here should be close to each other."}, {"start": 666.9599999999999, "end": 672.5999999999999, "text": " Okay, this is this is basically the self supervised training task is been shown to work very, very"}, {"start": 672.5999999999999, "end": 673.5999999999999, "text": " well."}, {"start": 673.5999999999999, "end": 678.3599999999999, "text": " As a pre training method for classification neural networks."}, {"start": 678.3599999999999, "end": 683.9599999999999, "text": " You have an image and its augmented version, and you minimize the inner product or the"}, {"start": 683.96, "end": 687.6800000000001, "text": " Euclidean distance between the two versions in the hidden space."}, {"start": 687.6800000000001, "end": 689.72, "text": " And the rationale is exactly the same."}, {"start": 689.72, "end": 695.7, "text": " The rationale is that this hidden space, of course, should be linearly classifiable."}, {"start": 695.7, "end": 699.38, "text": " And so the distance between those should be close."}, {"start": 699.38, "end": 705.7, "text": " And the rationale between having these tasks is that, well, if I flip the image, right,"}, {"start": 705.7, "end": 711.84, "text": " if I flip the image to the right, it cannot focus on the pixel on the bottom right anymore,"}, {"start": 711.84, "end": 714.6, "text": " because that's not going to be the pixel on the bottom right here."}, {"start": 714.6, "end": 717.32, "text": " And I'm not always going to flip it into the same direction."}, {"start": 717.32, "end": 718.96, "text": " And sometimes I'm going to crop it."}, {"start": 718.96, "end": 723.48, "text": " So it also can't focus on the pixel on the bottom right, because in the crop, that pixel"}, {"start": 723.48, "end": 726.2800000000001, "text": " is like out here, it's not even in the crop."}, {"start": 726.2800000000001, "end": 731.6800000000001, "text": " But basically, what you're looking to do with the self supervised methods is you are looking"}, {"start": 731.6800000000001, "end": 734.9200000000001, "text": " to destroy this low level information."}, {"start": 734.9200000000001, "end": 738.8000000000001, "text": " That's that's all you're looking to build a pipeline of a neural network here that destroys"}, {"start": 738.8, "end": 744.54, "text": " deliberately low level information and you do that by coming up with tasks like this"}, {"start": 744.54, "end": 754.0, "text": " self supervision tasks that deliberately exclude this information from being used."}, {"start": 754.0, "end": 758.28, "text": " I think that's what's going on generally in the self supervised learning thing."}, {"start": 758.28, "end": 765.3, "text": " Okay, so this here, as you can see, is the neural network that you train, you send both"}, {"start": 765.3, "end": 770.04, "text": " images, the original and the augmented version through the same neural network, and then"}, {"start": 770.04, "end": 776.3399999999999, "text": " you minimize some distance, which is usually like the inner product or the Euclidean distance"}, {"start": 776.3399999999999, "end": 779.0, "text": " in this embedding space, okay."}, {"start": 779.0, "end": 783.7199999999999, "text": " And what you train, you can see right here, you train the parameters of this neural network."}, {"start": 783.7199999999999, "end": 788.7199999999999, "text": " So the transformations are fixed or sampled, and the distance is fixed, you train the neural"}, {"start": 788.7199999999999, "end": 793.28, "text": " networks such that your embeddings minimize this task."}, {"start": 793.28, "end": 794.4399999999999, "text": " Now this is nothing new."}, {"start": 794.44, "end": 800.0, "text": " This has been this has been used for a couple of years now to get better representation."}, {"start": 800.0, "end": 801.9200000000001, "text": " Self supervised learning is a thing."}, {"start": 801.9200000000001, "end": 808.1, "text": " But they basically say we can use this as an initialization step for this clustering"}, {"start": 808.1, "end": 814.5200000000001, "text": " procedure because if we don't do that, we we focus on these low level features."}, {"start": 814.5200000000001, "end": 817.96, "text": " Okay, and notice you don't need any labels for this procedure."}, {"start": 817.96, "end": 820.5600000000001, "text": " That's why it's called self supervised."}, {"start": 820.56, "end": 827.0799999999999, "text": " Okay, so the second second part is the clustering."}, {"start": 827.0799999999999, "end": 832.3199999999999, "text": " Now they cluster, but they don't just cluster these representations that would be that doesn't"}, {"start": 832.3199999999999, "end": 835.7399999999999, "text": " perform very well in their in their experiments."}, {"start": 835.7399999999999, "end": 841.9599999999999, "text": " What they instead do is they minimize this entire objective right here, and we'll go"}, {"start": 841.9599999999999, "end": 845.64, "text": " through it step by step."}, {"start": 845.64, "end": 848.9599999999999, "text": " So they train a new neural network."}, {"start": 848.96, "end": 853.84, "text": " Okay, this thing right here, this is a new neural network."}, {"start": 853.84, "end": 861.0400000000001, "text": " So first you have you already have the neural network, which was called, what was it even"}, {"start": 861.0400000000001, "end": 868.72, "text": " called the one that gives you the embedding with the theta, okay, it's called phi theta."}, {"start": 868.72, "end": 871.6, "text": " It's the same architecture, and I think they initialize one with the other."}, {"start": 871.6, "end": 878.9200000000001, "text": " So in step one, you get phi, theta, phi theta goes give from from"}, {"start": 878.92, "end": 885.36, "text": " x gives you a representation of x, okay, let's call it hidden x."}, {"start": 885.36, "end": 888.4599999999999, "text": " So that's via self supervised learning."}, {"start": 888.4599999999999, "end": 896.88, "text": " But in step two, you train an entirely new neural network, this phi, eta here, and you"}, {"start": 896.88, "end": 898.88, "text": " initialize it with this one."}, {"start": 898.88, "end": 902.4, "text": " But now you train it to do the following."}, {"start": 902.4, "end": 910.6, "text": " Again, you want to minimize, sorry, you want to maximize the inner product, right here."}, {"start": 910.6, "end": 915.04, "text": " See that's the inner product, you want to maximize the inner product between two things."}, {"start": 915.04, "end": 919.64, "text": " Now that's the same thing as before, we want to minimize the distance between two things,"}, {"start": 919.64, "end": 924.9599999999999, "text": " and the dot product distance in that case, you maximize the dot product between two things."}, {"start": 924.9599999999999, "end": 929.96, "text": " And the two things are two images that go through the same neural network as before,"}, {"start": 929.96, "end": 931.88, "text": " right, this and this."}, {"start": 931.88, "end": 937.56, "text": " Now what's different here is that here we input an one image of the data set."}, {"start": 937.56, "end": 943.66, "text": " That's the same as before, okay, so we input one image, but here before in the self supervised"}, {"start": 943.66, "end": 947.52, "text": " learning, we input an augmented version of that."}, {"start": 947.52, "end": 951.92, "text": " And now we input something else, we input this k right here."}, {"start": 951.92, "end": 958.2, "text": " Now what's k, what k comes from this neighbor set of x, okay, this is the set of neighbors"}, {"start": 958.2, "end": 967.0, "text": " of x, and these neighbors are determined with respect to this neural network right here."}, {"start": 967.0, "end": 974.72, "text": " So what you do after step one is you take your neural network with the good embeddings,"}, {"start": 974.72, "end": 980.84, "text": " and here is your data set x, your data set x, this should be another, your data set x"}, {"start": 980.84, "end": 985.48, "text": " is this list basically of all the images in your data set."}, {"start": 985.48, "end": 989.52, "text": " And what we're going to do is you're going to take all of them using that neural network"}, {"start": 989.52, "end": 995.5600000000001, "text": " that you just trained and embed them into a latent space right here."}, {"start": 995.5600000000001, "end": 997.9200000000001, "text": " Okay."}, {"start": 997.9200000000001, "end": 1001.9200000000001, "text": " This is the latent space where you have done this self supervised training."}, {"start": 1001.9200000000001, "end": 1005.8000000000001, "text": " And now for each image, right here."}, {"start": 1005.8000000000001, "end": 1011.28, "text": " So if this is x i, you're going to find its k nearest neighbors and they use I think they"}, {"start": 1011.28, "end": 1013.5600000000001, "text": " use five as a benchmark."}, {"start": 1013.56, "end": 1020.56, "text": " So you're going to find its nearest neighbors, its five nearest neighbors."}, {"start": 1020.56, "end": 1021.76, "text": " And you do this for each image."}, {"start": 1021.76, "end": 1025.6, "text": " So this image has these five nearest neighbors, so on."}, {"start": 1025.6, "end": 1031.1599999999999, "text": " So in step two, what you're trying to do is you're going to try to pull together each"}, {"start": 1031.1599999999999, "end": 1038.76, "text": " image and its nearest neighbors in that in this, this, not in this space directly, but"}, {"start": 1038.76, "end": 1043.32, "text": " you determine which ones are the nearest neighbor from this neural network and you keep it"}, {"start": 1043.32, "end": 1044.56, "text": " constant."}, {"start": 1044.56, "end": 1048.2, "text": " That's how you determine what the nearest neighbors are in the first task."}, {"start": 1048.2, "end": 1052.9199999999998, "text": " And that is your n x set for x i."}, {"start": 1052.9199999999998, "end": 1059.36, "text": " And in the second step, you're trying to make the representations of any image and its nearest"}, {"start": 1059.36, "end": 1062.76, "text": " neighbors closer to each other."}, {"start": 1062.76, "end": 1073.24, "text": " Okay, so with with this thing right here, you maximize the inner product between x in"}, {"start": 1073.24, "end": 1079.92, "text": " after this neural network and a nearest neighbor of x that was was a nearest neighbor after"}, {"start": 1079.92, "end": 1082.44, "text": " the first task."}, {"start": 1082.44, "end": 1087.96, "text": " Now the way they cluster here is not just again by putting it into an embedding space,"}, {"start": 1087.96, "end": 1093.92, "text": " like we saw before, but this thing right here, this neural network, as you can see here,"}, {"start": 1093.92, "end": 1100.66, "text": " is is a C dimensional vector in zero one."}, {"start": 1100.66, "end": 1106.0, "text": " Now C is the number of classes that you can either know that so you don't know which class"}, {"start": 1106.0, "end": 1109.44, "text": " is which you don't have labels, but you could know how many classes there are, or you could"}, {"start": 1109.44, "end": 1113.2, "text": " just guess how many classes there are."}, {"start": 1113.2, "end": 1119.52, "text": " And as long as you as you over guess, you can still like build super clusters later."}, {"start": 1119.52, "end": 1125.5600000000002, "text": " So this, they simply say, it's in zero one, but they also say it performs a soft assignment."}, {"start": 1125.5600000000002, "end": 1129.0, "text": " So we're also going to assume that this is normalized."}, {"start": 1129.0, "end": 1136.52, "text": " So for each for each data point x here, you're going to, you're going to have an image, you're"}, {"start": 1136.52, "end": 1142.48, "text": " going to put it through this new neural network, okay, this new neural network new, and it's"}, {"start": 1142.48, "end": 1147.64, "text": " going to tell you, it's going to give you basically a histogram, let's say class one,"}, {"start": 1147.64, "end": 1152.72, "text": " two, or three, we guess there are three class and it's going to give you an assignment of"}, {"start": 1152.72, "end": 1154.22, "text": " the three."}, {"start": 1154.22, "end": 1160.68, "text": " And you also take a nearest neighbor, here is your data set, you also take a nearest"}, {"start": 1160.68, "end": 1162.1200000000001, "text": " neighbor of that."}, {"start": 1162.1200000000001, "end": 1170.56, "text": " So you look for this set n of x, and you take a nearest neighbor, maybe that's, that's a"}, {"start": 1170.56, "end": 1175.16, "text": " maybe that's a dog, I can't, I really can't draw a dog."}, {"start": 1175.16, "end": 1177.32, "text": " Yeah, that's the best I can do."}, {"start": 1177.32, "end": 1178.32, "text": " I'm sorry."}, {"start": 1178.32, "end": 1181.2, "text": " And you also put that through the same network."}, {"start": 1181.2, "end": 1186.16, "text": " And you're saying, since they were nearest neighbor in task one, they must share some"}, {"start": 1186.16, "end": 1191.24, "text": " sort of interesting high level features, because that's what the first task was for."}, {"start": 1191.24, "end": 1197.52, "text": " Therefore, I want to make them closer together in in the in the light of these of this neural"}, {"start": 1197.52, "end": 1199.1200000000001, "text": " network right here."}, {"start": 1199.1200000000001, "end": 1204.92, "text": " So this is also going to give you an assignment like, maybe like this."}, {"start": 1204.92, "end": 1214.72, "text": " Okay, and now you object you train this network right here to basically match these two distributions."}, {"start": 1214.72, "end": 1221.72, "text": " Okay, so this is this is now a classifier into C classes, but we guess C, and we don't"}, {"start": 1221.72, "end": 1227.0800000000002, "text": " have labels, we simply our label is going to be my neighbors from the first task must"}, {"start": 1227.0800000000002, "end": 1228.52, "text": " have the same labels."}, {"start": 1228.52, "end": 1230.48, "text": " That's our label."}, {"start": 1230.48, "end": 1237.28, "text": " Now, they say they also have this term right here, which is the entropy over assignments."}, {"start": 1237.28, "end": 1243.1200000000001, "text": " Okay, as you can see, so they minimize the following, they minimize this quantity, which"}, {"start": 1243.1200000000001, "end": 1244.94, "text": " has a negative in front of it."}, {"start": 1244.94, "end": 1248.52, "text": " So that means they maximize this log inner product."}, {"start": 1248.52, "end": 1257.56, "text": " And they also maximize the entropy, because, sorry, so they minimize this thing."}, {"start": 1257.56, "end": 1261.3999999999999, "text": " And but the entropy is a negative quantity, right?"}, {"start": 1261.3999999999999, "end": 1267.52, "text": " So they maximize the entropy because here's a plus."}, {"start": 1267.52, "end": 1271.46, "text": " And now they minimize the entropy."}, {"start": 1271.46, "end": 1273.94, "text": " Let's see what they say."}, {"start": 1273.94, "end": 1276.3999999999999, "text": " By minimizing the following objective."}, {"start": 1276.3999999999999, "end": 1281.48, "text": " Now entropy is the sum of the negative sum of p log p."}, {"start": 1281.48, "end": 1288.84, "text": " And this if this is p, yes, this is the probability that an image is going to be assigned to cluster"}, {"start": 1288.84, "end": 1291.26, "text": " C over the entire data set."}, {"start": 1291.26, "end": 1305.96, "text": " So they're going to Yes, so it's negative, this quantity, negative minus p log p."}, {"start": 1305.96, "end": 1308.58, "text": " And this is the entropy."}, {"start": 1308.58, "end": 1311.46, "text": " So they're going to minimize the entropy."}, {"start": 1311.46, "end": 1315.8400000000001, "text": " Let's see what they say."}, {"start": 1315.8400000000001, "end": 1323.26, "text": " We include an entropy term, the second term in equation two, which spreads the predictions"}, {"start": 1323.26, "end": 1334.6000000000001, "text": " uniformly across clusters C. Okay, so what we want is a uniform assignment over cluster,"}, {"start": 1334.6, "end": 1341.9199999999998, "text": " which means we should maximize the entropy."}, {"start": 1341.9199999999998, "end": 1343.4599999999998, "text": " Oh, yes, okay."}, {"start": 1343.4599999999998, "end": 1344.98, "text": " They minimize this thing."}, {"start": 1344.98, "end": 1347.56, "text": " And this here is the negative entropy, right?"}, {"start": 1347.56, "end": 1353.32, "text": " Okay, so they want basically what they want over the whole data set that not all of the"}, {"start": 1353.32, "end": 1356.8799999999999, "text": " images are going to be in the same cluster."}, {"start": 1356.8799999999999, "end": 1360.6399999999999, "text": " This is cluster one, and then this is cluster two, and then this is cluster three."}, {"start": 1360.6399999999999, "end": 1362.6799999999998, "text": " So that term counteracts that."}, {"start": 1362.68, "end": 1369.3600000000001, "text": " Basically, the more evenly spread the entire data set distribution is the the the higher"}, {"start": 1369.3600000000001, "end": 1372.16, "text": " the entropy, the lower the negative entropy."}, {"start": 1372.16, "end": 1373.64, "text": " And that's the goal right here."}, {"start": 1373.64, "end": 1379.04, "text": " I'm sorry, this, this was, I was confused by the too many negative signs, and then you"}, {"start": 1379.04, "end": 1380.76, "text": " minimize the entire thing."}, {"start": 1380.76, "end": 1381.8, "text": " All right."}, {"start": 1381.8, "end": 1384.4, "text": " Now they say they say a different thing right here."}, {"start": 1384.4, "end": 1389.88, "text": " They say here, this bracket denotes the dot product operator, as we saw, it's the dot"}, {"start": 1389.88, "end": 1394.96, "text": " product between these two distributions right here."}, {"start": 1394.96, "end": 1401.3600000000001, "text": " The first term in equation two, imposes this neural network to make consistent predictions"}, {"start": 1401.3600000000001, "end": 1408.24, "text": " for a sample x i, and its neighboring samples, the neighbors of x i."}, {"start": 1408.24, "end": 1409.7600000000002, "text": " And here is an interesting thing."}, {"start": 1409.7600000000002, "end": 1415.0800000000002, "text": " Note that the dot product will be maximal when the predictions are one hot, that means"}, {"start": 1415.0800000000002, "end": 1418.72, "text": " confident and assigned to the same cluster consistent."}, {"start": 1418.72, "end": 1424.1200000000001, "text": " So they basically say the objective encourages confidence, because it encourages predictions"}, {"start": 1424.1200000000001, "end": 1425.44, "text": " to be one hot."}, {"start": 1425.44, "end": 1430.9, "text": " And it encourages consistency, because it, you know, the, because the distributions need"}, {"start": 1430.9, "end": 1436.0, "text": " to be the same, they should be in the same cluster, right?"}, {"start": 1436.0, "end": 1441.46, "text": " Now I agree with the consistency, like if you make the inner product high, then of the"}, {"start": 1441.46, "end": 1446.2, "text": " of two, two of these histograms, of course, they look the same, right?"}, {"start": 1446.2, "end": 1449.32, "text": " Because these are ultimately vectors, these are three dimensional vectors, let's call"}, {"start": 1449.32, "end": 1451.32, "text": " them two dimensional vectors, right?"}, {"start": 1451.32, "end": 1459.1200000000001, "text": " So here is class one, here's class two, if you, you know, make the inner product small"}, {"start": 1459.1200000000001, "end": 1462.8400000000001, "text": " or high, they will agree on their predictions."}, {"start": 1462.8400000000001, "end": 1468.38, "text": " But I disagree that this encourages anything to be one hot, like in my mind, if you have"}, {"start": 1468.38, "end": 1474.3400000000001, "text": " two vectors, they're both zero one times zero one, the inner product is going to be one."}, {"start": 1474.34, "end": 1480.58, "text": " And if you have two assignments that are point five and point five, then it is also going"}, {"start": 1480.58, "end": 1486.9199999999998, "text": " to result in an in an inner product of is it 0.5?"}, {"start": 1486.9199999999998, "end": 1492.6399999999999, "text": " Right, is also going to be no."}, {"start": 1492.6399999999999, "end": 1494.48, "text": " So what's the inner product here?"}, {"start": 1494.48, "end": 1500.5, "text": " The inner product is point five times point five plus point five times point five, which"}, {"start": 1500.5, "end": 1503.28, "text": " is point five."}, {"start": 1503.28, "end": 1505.96, "text": " Am I dumb?"}, {"start": 1505.96, "end": 1509.04, "text": " And embarrassingly long time later."}, {"start": 1509.04, "end": 1511.8799999999999, "text": " Oh, it's because the L one norm."}, {"start": 1511.8799999999999, "end": 1513.52, "text": " Okay, okay, we got it."}, {"start": 1513.52, "end": 1514.52, "text": " We got it."}, {"start": 1514.52, "end": 1519.32, "text": " Um, I am I am okay, I am too dumb."}, {"start": 1519.32, "end": 1524.48, "text": " Yes, of course, I was thinking of these vectors being normalized in L two space where their"}, {"start": 1524.48, "end": 1526.6, "text": " inner products would always be one."}, {"start": 1526.6, "end": 1533.2, "text": " But of course, if you have assignments between classes, and it's a probability distribution,"}, {"start": 1533.2, "end": 1541.0, "text": " a histogram, then all of the prob possible assignments lie on this on this thing right"}, {"start": 1541.0, "end": 1542.0, "text": " here."}, {"start": 1542.0, "end": 1546.6000000000001, "text": " Now, the inner product with yourself, of course, is the length of the vector and the length"}, {"start": 1546.6000000000001, "end": 1553.9, "text": " of a vector that points to one class, or the other class is longer than a vector that points"}, {"start": 1553.9, "end": 1555.16, "text": " in between."}, {"start": 1555.16, "end": 1557.8, "text": " So okay, I see that's where they get this."}, {"start": 1557.8, "end": 1561.0, "text": " That's where they get this must be one hot from."}, {"start": 1561.0, "end": 1563.14, "text": " So okay, I'll give that to them."}, {"start": 1563.14, "end": 1570.24, "text": " It is actually encouraging one hot predictions, as long as these things are normalized in"}, {"start": 1570.24, "end": 1574.16, "text": " L one space, which they probably are because they're histograms, right?"}, {"start": 1574.16, "end": 1579.64, "text": " Yes, that was that was dumbness of me."}, {"start": 1579.64, "end": 1581.5200000000002, "text": " I was trying to make a counter example."}, {"start": 1581.5200000000002, "end": 1583.2, "text": " I'm like, wait a minute."}, {"start": 1583.2, "end": 1587.4, "text": " This counter example is a counter example to my counter example."}, {"start": 1587.4, "end": 1592.1200000000001, "text": " Okay, so yeah, that's that's that."}, {"start": 1592.12, "end": 1596.08, "text": " So as you can see, they are of course, correct here."}, {"start": 1596.08, "end": 1603.02, "text": " And they now make the first experiments."}, {"start": 1603.02, "end": 1607.52, "text": " So they say basically, after the first step of the self supervised training, they can"}, {"start": 1607.52, "end": 1610.4599999999998, "text": " already retrieve sort of nearest neighbors."}, {"start": 1610.4599999999998, "end": 1618.32, "text": " And the nearest neighbors, the nearest neighbors of these images right here are the ones that"}, {"start": 1618.32, "end": 1620.6, "text": " you see on the right."}, {"start": 1620.6, "end": 1626.1999999999998, "text": " And after the self supervised one, these nearest neighbors are already pretty good at sharing"}, {"start": 1626.1999999999998, "end": 1630.1399999999999, "text": " the high level feature actually crazy, crazy good, right?"}, {"start": 1630.1399999999999, "end": 1632.8, "text": " This flute here is in different sizes."}, {"start": 1632.8, "end": 1639.1599999999999, "text": " As you can see, the fishes aren't aren't all exactly the same."}, {"start": 1639.1599999999999, "end": 1640.32, "text": " The birds."}, {"start": 1640.32, "end": 1643.6, "text": " So you can see it really focuses on sort of higher level features."}, {"start": 1643.6, "end": 1648.6399999999999, "text": " But I guess it's really dependent on this higher level task."}, {"start": 1648.64, "end": 1653.92, "text": " And they were they also investigate this quantitatively."}, {"start": 1653.92, "end": 1660.5600000000002, "text": " But I just want to focus on how good is this after only the self supervised thing."}, {"start": 1660.5600000000002, "end": 1662.64, "text": " And now they do this clustering."}, {"start": 1662.64, "end": 1667.44, "text": " And they can already sort of could already evaluated right here, because now they have"}, {"start": 1667.44, "end": 1669.66, "text": " a clustering, right?"}, {"start": 1669.66, "end": 1673.76, "text": " After this step, they've basically pulled together the neighbors, and they have this"}, {"start": 1673.76, "end": 1676.46, "text": " neural network that is not assigning classes."}, {"start": 1676.46, "end": 1679.1200000000001, "text": " So they could already evaluate this and they are going to do that."}, {"start": 1679.1200000000001, "end": 1682.16, "text": " But that's not good enough yet."}, {"start": 1682.16, "end": 1688.02, "text": " Then they do a third step, which is fine tuning through self labeling."}, {"start": 1688.02, "end": 1693.44, "text": " Now self labeling is pretty much exactly what it's what it says."}, {"start": 1693.44, "end": 1697.08, "text": " It's you label your own data with your own classifier."}, {"start": 1697.08, "end": 1699.88, "text": " Now that might be a bit outrageous."}, {"start": 1699.88, "end": 1705.4, "text": " And you basically saying, wait a minute, if I label my own data and learn a classifier"}, {"start": 1705.4, "end": 1710.5600000000002, "text": " on these labels, isn't isn't it just going to come out the same?"}, {"start": 1710.5600000000002, "end": 1713.0400000000002, "text": " And the answer is no, right?"}, {"start": 1713.0400000000002, "end": 1722.72, "text": " If you have a data set, because your classifier doesn't give you just first of all, if your"}, {"start": 1722.72, "end": 1729.72, "text": " classifier is something like this, right, just happens to be and you label and you learn"}, {"start": 1729.72, "end": 1734.3400000000001, "text": " a new classifier, it is going to be more like this, right?"}, {"start": 1734.34, "end": 1741.8, "text": " Because it sort of maximizes a lot of classifiers maximize these distances between the classes."}, {"start": 1741.8, "end": 1746.9199999999998, "text": " So even if it's like that, and then the second step they do is they say, okay, there are"}, {"start": 1746.9199999999998, "end": 1752.78, "text": " some points where we are actually more confident about such as this one, we're more confident"}, {"start": 1752.78, "end": 1757.9199999999998, "text": " about that one, also this one, and then this one here is pretty close, like we're not super"}, {"start": 1757.9199999999998, "end": 1761.74, "text": " neither this one, but we're very confident about these two."}, {"start": 1761.74, "end": 1769.32, "text": " So we're only going to use the ones where we are, in fact, confident about to learn"}, {"start": 1769.32, "end": 1777.3, "text": " to learn the new classifier, or basically we, you can also weigh them, and so on."}, {"start": 1777.3, "end": 1783.82, "text": " But they go by confidence right here, as you can see, in this final algorithm."}, {"start": 1783.82, "end": 1792.56, "text": " So this is the entire algorithm and I got kicked away."}, {"start": 1792.56, "end": 1795.1599999999999, "text": " Our algorithm, there we go."}, {"start": 1795.1599999999999, "end": 1797.6, "text": " All right."}, {"start": 1797.6, "end": 1803.24, "text": " So semantic clustering by adopting nearest neighbors, their scan algorithm."}, {"start": 1803.24, "end": 1809.08, "text": " So in the first step, you do this pretext task, this is the self supervision, the representation"}, {"start": 1809.08, "end": 1811.62, "text": " learning, okay?"}, {"start": 1811.62, "end": 1818.6799999999998, "text": " Your entire data set, no, sorry, this is this year, optimize the neural network with task"}, {"start": 1818.6799999999998, "end": 1823.04, "text": " T. That's just self supervised representation learning."}, {"start": 1823.04, "end": 1828.8, "text": " Okay, then the second thing, we're going to determine the nearest neighbor set for each"}, {"start": 1828.8, "end": 1829.8, "text": " X."}, {"start": 1829.8, "end": 1835.9599999999998, "text": " Now, they also in that step, they also augment the data, they do heavy data augmentation"}, {"start": 1835.9599999999998, "end": 1836.9599999999998, "text": " and so on."}, {"start": 1836.9599999999998, "end": 1840.56, "text": " Also in this, in the third step in the self labeling, they do data augmentation."}, {"start": 1840.56, "end": 1842.6399999999999, "text": " There's a lot of tricks in here."}, {"start": 1842.6399999999999, "end": 1845.08, "text": " But ultimately, the base algorithm goes like this."}, {"start": 1845.08, "end": 1849.9199999999998, "text": " So you find your neighboring sets for each X."}, {"start": 1849.9199999999998, "end": 1856.28, "text": " And then what you do while your clustering loss decreases, you update this clustering"}, {"start": 1856.28, "end": 1860.24, "text": " neural network by with this loss that we saw."}, {"start": 1860.24, "end": 1864.2, "text": " So this is the loss where you make the nearest neighbors closer to each other while still"}, {"start": 1864.2, "end": 1866.84, "text": " keeping the entropy high."}, {"start": 1866.84, "end": 1868.12, "text": " Okay."}, {"start": 1868.12, "end": 1875.36, "text": " And then in the last after you've done this, you go through and you say while the length"}, {"start": 1875.36, "end": 1878.02, "text": " of Y increases, what's Y?"}, {"start": 1878.02, "end": 1883.1599999999999, "text": " Y is all the data points that are above a certain threshold."}, {"start": 1883.1599999999999, "end": 1888.8799999999999, "text": " Now, you're going to filter the data set that is above a certain threshold."}, {"start": 1888.8799999999999, "end": 1894.76, "text": " And that's your data set Y and you train this same neural network, you basically fine tune"}, {"start": 1894.76, "end": 1898.2, "text": " it with the cross entropy loss on your own labels."}, {"start": 1898.2, "end": 1901.84, "text": " So now you only have labels Y."}, {"start": 1901.84, "end": 1914.44, "text": " Okay, so it's not labels, you have the cross entropy loss between the assignments of this"}, {"start": 1914.44, "end": 1916.8, "text": " and the assignments of your data set."}, {"start": 1916.8, "end": 1922.52, "text": " Okay, so you basically do the same task, but you filter by confidence."}, {"start": 1922.52, "end": 1931.96, "text": " And they use a threshold, I think, of point seven or something like this."}, {"start": 1931.96, "end": 1934.56, "text": " Now let's go into the experiments."}, {"start": 1934.56, "end": 1940.6, "text": " The experiments are look as follows."}, {"start": 1940.6, "end": 1946.6399999999999, "text": " So they do some ablations to find out where in their methods kind of the the gains come"}, {"start": 1946.6399999999999, "end": 1949.6399999999999, "text": " from and we'll just quickly go through them."}, {"start": 1949.64, "end": 1955.2, "text": " If they just do these self supervision at the beginning and then just do k-means clustering"}, {"start": 1955.2, "end": 1961.72, "text": " on top of that, that will give them on CIFAR-10 a 35.9% accuracy."}, {"start": 1961.72, "end": 1963.16, "text": " So not very good."}, {"start": 1963.16, "end": 1968.16, "text": " So the clustering, you can't just cluster on top of these representations and then be"}, {"start": 1968.16, "end": 1970.64, "text": " done."}, {"start": 1970.64, "end": 1978.8400000000001, "text": " If they do what they say, so this is sample and batch entropy loss, this basically means"}, {"start": 1978.84, "end": 1984.02, "text": " you do not care about the nearest neighbors, you do this entire thing, but you only make"}, {"start": 1984.02, "end": 1989.0, "text": " an image close to the prediction close to itself and its augmentations."}, {"start": 1989.0, "end": 1992.9599999999998, "text": " So you don't use any nearest neighbor information also doesn't work."}, {"start": 1992.9599999999998, "end": 1997.72, "text": " Like I wouldn't pay too much attention that the numbers are 10, 20 or 30."}, {"start": 1997.72, "end": 2000.76, "text": " It just is like doesn't work."}, {"start": 2000.76, "end": 2008.1599999999999, "text": " Now if you use the scan loss, you all of a sudden you get into a regime where there is"}, {"start": 2008.16, "end": 2009.16, "text": " actual signal."}, {"start": 2009.16, "end": 2018.14, "text": " So this is now significantly above the, this is significantly above random guessing."}, {"start": 2018.14, "end": 2024.28, "text": " And if you use strong data augmentation, as I said, a lot of this has these tricks in"}, {"start": 2024.28, "end": 2027.5400000000002, "text": " it of what kind of data augmentation you do and so on."}, {"start": 2027.5400000000002, "end": 2033.76, "text": " So never forget that these papers besides their idea, they put in all the tricks they"}, {"start": 2033.76, "end": 2035.28, "text": " can."}, {"start": 2035.28, "end": 2043.86, "text": " So you get 10% more and then if you do this self labeling step, you get another 10% more."}, {"start": 2043.86, "end": 2049.48, "text": " And this is fairly respectable like 83.5 without ever seeing labels."}, {"start": 2049.48, "end": 2051.94, "text": " It's fairly good."}, {"start": 2051.94, "end": 2054.54, "text": " But of course there are only 10 classes right here."}, {"start": 2054.54, "end": 2059.4, "text": " So keep that in mind, but they will do it on ImageNet later."}, {"start": 2059.4, "end": 2065.84, "text": " And they investigate what kind of self supervision tasks at the beginning are important."}, {"start": 2065.84, "end": 2071.28, "text": " And they investigate things like RotNet feature decoupling and noise contrast of estimation,"}, {"start": 2071.28, "end": 2073.84, "text": " which noise contrast of estimation is the best."}, {"start": 2073.84, "end": 2078.88, "text": " And noise contrast of estimation I think is just where you, as we said, you input an image"}, {"start": 2078.88, "end": 2083.76, "text": " and then it's kind of noisy versions with augmented in various ways."}, {"start": 2083.76, "end": 2088.2400000000002, "text": " And then you classify them together."}, {"start": 2088.24, "end": 2095.3599999999997, "text": " This has been like this, these methods have been very successful in the last few years."}, {"start": 2095.3599999999997, "end": 2103.68, "text": " Yeah, so this, they have various investigations into their algorithm."}, {"start": 2103.68, "end": 2106.3599999999997, "text": " I want to point out this here."}, {"start": 2106.3599999999997, "end": 2113.04, "text": " This is the accuracy versus confidence after the complete clustering step."}, {"start": 2113.04, "end": 2116.6, "text": " So this is now the third step, the self labeling."}, {"start": 2116.6, "end": 2123.8399999999997, "text": " And you can see right here, as this confidence of the network goes up, the actual accuracy"}, {"start": 2123.8399999999997, "end": 2125.08, "text": " goes up as well."}, {"start": 2125.08, "end": 2130.2599999999998, "text": " So that means the network after the clustering is really more confident about the points"}, {"start": 2130.2599999999998, "end": 2132.72, "text": " that it can classify more accurately."}, {"start": 2132.72, "end": 2138.2, "text": " There's like a correlation between where the network is confident and the actual label"}, {"start": 2138.2, "end": 2142.56, "text": " of the point, which is remarkable because it has never seen the label."}, {"start": 2142.56, "end": 2147.48, "text": " But also see how sort of the range here is quite small."}, {"start": 2147.48, "end": 2151.22, "text": " So with the standard augmentation that goes like from here to here."}, {"start": 2151.22, "end": 2160.12, "text": " So where you set that threshold is fairly important and might be quite brittle here"}, {"start": 2160.12, "end": 2165.82, "text": " because you need to set the threshold, right, such that some points are below it and some"}, {"start": 2165.82, "end": 2173.0800000000004, "text": " are above it and you don't want to pull in points where you're not, because if you pull"}, {"start": 2173.0800000000004, "end": 2183.36, "text": " in points from here, you only have the correct label for 75% or something like them, of them."}, {"start": 2183.36, "end": 2189.1800000000003, "text": " That means if you now self label and learn on them, you're going to learn the wrong signal."}, {"start": 2189.18, "end": 2200.0, "text": " So this step seems fairly brittle, honestly, but I don't know, of course."}, {"start": 2200.0, "end": 2206.8999999999996, "text": " They go on and investigate various things such as how many clusters do you need or how"}, {"start": 2206.8999999999996, "end": 2210.68, "text": " many nearest neighbors, sorry, do you need this number K here."}, {"start": 2210.68, "end": 2217.44, "text": " And you can see that if you have zero neighbors, then you're doing a lot worse than if you"}, {"start": 2217.44, "end": 2220.18, "text": " have, let's say, five nearest neighbors."}, {"start": 2220.18, "end": 2225.04, "text": " So the jump here, as you can see, is fairly high in all the data sets."}, {"start": 2225.04, "end": 2228.76, "text": " But after that, it sort of doesn't really matter much."}, {"start": 2228.76, "end": 2234.2400000000002, "text": " So it seems like five nearest neighbors should be enough for most things."}, {"start": 2234.2400000000002, "end": 2238.32, "text": " And here they just show that when they remove the false positives, that their algorithm"}, {"start": 2238.32, "end": 2244.04, "text": " actually converges to the correct clustering, the correct accuracy, which is not surprising."}, {"start": 2244.04, "end": 2249.16, "text": " Like if you remove the wrong samples that are wrong, then the rest of the samples are"}, {"start": 2249.16, "end": 2250.64, "text": " going to be right."}, {"start": 2250.64, "end": 2254.44, "text": " I think that's just showing that it doesn't go into some kind of crazy downward spiral"}, {"start": 2254.44, "end": 2256.16, "text": " loop or something like this."}, {"start": 2256.16, "end": 2259.8, "text": " But still, it's just kind of funny."}, {"start": 2259.8, "end": 2266.88, "text": " Okay, so they do investigate how much they improve and they improve by quite a lot above"}, {"start": 2266.88, "end": 2268.88, "text": " the kind of previous methods."}, {"start": 2268.88, "end": 2270.56, "text": " So they have a lot of previous methods."}, {"start": 2270.56, "end": 2279.12, "text": " But this includes things like k-means and so on, GANs, deep cluster that we spoke about."}, {"start": 2279.12, "end": 2284.16, "text": " And this method, it already gets, as you can see, fairly close to good accuracy."}, {"start": 2284.16, "end": 2290.2, "text": " So you have like 88.6% accuracy."}, {"start": 2290.2, "end": 2299.36, "text": " And that's, you know, fairly remarkable on C410 without seeing the labels."}, {"start": 2299.36, "end": 2302.76, "text": " But we'll go on and now they go into ImageNet."}, {"start": 2302.76, "end": 2306.48, "text": " Now ImageNet, of course, has way more classes."}, {"start": 2306.48, "end": 2310.1600000000003, "text": " It has 1000 classes compared to C410's 10 classes."}, {"start": 2310.1600000000003, "end": 2315.7200000000003, "text": " So if you think, you know, clustering 10 classes might end there fairly apart from each other,"}, {"start": 2315.7200000000003, "end": 2320.08, "text": " might work with various techniques ImageNet, 1000 classes, that's way more difficult."}, {"start": 2320.08, "end": 2333.56, "text": " Now they do subsample this to 50, 100 and 200 classes and they get okay accuracy."}, {"start": 2333.56, "end": 2344.44, "text": " As you can see, they get 81% in 450 classes where a supervised baseline would get 86%."}, {"start": 2344.44, "end": 2350.84, "text": " In the 200 classes, they get 69% where a supervised baseline would get 76%."}, {"start": 2350.84, "end": 2356.64, "text": " So it's there."}, {"start": 2356.64, "end": 2361.26, "text": " And that's quite remarkable for these low number of classes."}, {"start": 2361.26, "end": 2366.16, "text": " And they figure out that if they look for the samples that are kind of in the most of"}, {"start": 2366.16, "end": 2371.16, "text": " the middle of their cluster, they get these prototypes right here."}, {"start": 2371.16, "end": 2375.04, "text": " And you can see all of these images, if you know ImageNet, some of the images, they really"}, {"start": 2375.04, "end": 2377.96, "text": " only have a part of the object and so on."}, {"start": 2377.96, "end": 2385.6, "text": " So here with the prototypical things, you really get center clear shot of the object"}, {"start": 2385.6, "end": 2388.3799999999997, "text": " with clearly visible features and so on."}, {"start": 2388.3799999999997, "end": 2398.3199999999997, "text": " So this sort of repeats the fact that this clustering really does go on that sort of"}, {"start": 2398.32, "end": 2401.44, "text": " semantic information."}, {"start": 2401.44, "end": 2410.96, "text": " Of course, the labels here are from the test label set, the network can't figure that out."}, {"start": 2410.96, "end": 2417.6600000000003, "text": " And then they go for 1000 classes and in 1000 classes, it doesn't really work because there"}, {"start": 2417.6600000000003, "end": 2420.82, "text": " might be just too many confusions right here."}, {"start": 2420.82, "end": 2426.38, "text": " But they do have this confusion matrix of their method."}, {"start": 2426.38, "end": 2432.7200000000003, "text": " And it shows that the confusion matrix is pretty much a long block diagonal along these"}, {"start": 2432.7200000000003, "end": 2433.96, "text": " super clusters right here."}, {"start": 2433.96, "end": 2439.94, "text": " So you can see the dogs, the network confuses the dogs fairly often and the insects with"}, {"start": 2439.94, "end": 2445.32, "text": " each other, but not really across here, which is still quite remarkable."}, {"start": 2445.32, "end": 2449.6600000000003, "text": " But I mean, you get the same thing for a lot of these methods."}, {"start": 2449.66, "end": 2456.7999999999997, "text": " So I don't know how much different this would be in other methods."}, {"start": 2456.7999999999997, "end": 2459.8399999999997, "text": " But certainly it's interesting to look at."}, {"start": 2459.8399999999997, "end": 2461.7, "text": " Now they go into one last thing."}, {"start": 2461.7, "end": 2466.7599999999998, "text": " And that is what if we don't know how many clusters there are, right?"}, {"start": 2466.7599999999998, "end": 2468.58, "text": " If we don't know anything."}, {"start": 2468.58, "end": 2473.7799999999997, "text": " So say so far, we have assumed to have knowledge about the number of ground truth classes."}, {"start": 2473.7799999999997, "end": 2477.56, "text": " The model predictions were evaluated using the Hungarian matching algorithm."}, {"start": 2477.56, "end": 2484.16, "text": " We already saw this in the DETR by Facebook, if you remember."}, {"start": 2484.16, "end": 2488.6, "text": " However, what happens if the number of clusters does not match the number of ground truth"}, {"start": 2488.6, "end": 2490.6, "text": " classes anymore?"}, {"start": 2490.6, "end": 2496.74, "text": " So they now say table three reports the results when we overestimate the number of ground"}, {"start": 2496.74, "end": 2498.6, "text": " truth classes by a factor of two."}, {"start": 2498.6, "end": 2505.86, "text": " Okay, so now they they build just 20 classes for CIFAR-10 instead of 10 classes."}, {"start": 2505.86, "end": 2509.2400000000002, "text": " And we'll look at table three real quick."}, {"start": 2509.2400000000002, "end": 2511.1600000000003, "text": " Where's table three?"}, {"start": 2511.1600000000003, "end": 2512.36, "text": " This is table three."}, {"start": 2512.36, "end": 2513.48, "text": " Okay."}, {"start": 2513.48, "end": 2519.6800000000003, "text": " So when they over cluster, you get the thing here on the bottom."}, {"start": 2519.6800000000003, "end": 2523.9, "text": " And you can see there is a drop in accuracy right here."}, {"start": 2523.9, "end": 2532.92, "text": " Now what I don't actually, they don't actually say how they do the over cluster matching."}, {"start": 2532.92, "end": 2540.08, "text": " So if you imagine if I now have, I don't know, six clusters, but I need to assign them to"}, {"start": 2540.08, "end": 2544.88, "text": " three clusters, you know, here."}, {"start": 2544.88, "end": 2547.8, "text": " Do I still use this most optimistic thing?"}, {"start": 2547.8, "end": 2552.04, "text": " So do I still use, I think they still use this most optimistic matching right where"}, {"start": 2552.04, "end": 2557.64, "text": " you assign everything to its best fitted cluster, right?"}, {"start": 2557.64, "end": 2562.32, "text": " You compute all the permutations and then you give it the best benefit of the doubt."}, {"start": 2562.32, "end": 2572.1800000000003, "text": " Now if you imagine the situation where I over cluster to the point that I have each image"}, {"start": 2572.1800000000003, "end": 2577.88, "text": " in its own cluster, and I run this algorithm to evaluate my clustering, I give it basically"}, {"start": 2577.88, "end": 2583.2400000000002, "text": " the most beneficial view, then I would get 100% accuracy."}, {"start": 2583.2400000000002, "end": 2592.2000000000003, "text": " Okay, so like in one of these over cluster approach, I would sort of expect that you"}, {"start": 2592.2, "end": 2600.96, "text": " actually get a better score because you can, like there is more generosity of the matching"}, {"start": 2600.96, "end": 2602.2, "text": " algorithm involved."}, {"start": 2602.2, "end": 2607.68, "text": " Now that's counteracted by the fact that you can't group together things that obviously"}, {"start": 2607.68, "end": 2611.02, "text": " have similar features because they are in the same class."}, {"start": 2611.02, "end": 2616.08, "text": " So there's kind of two forces pulling here, but I was kind of astounded that it's going"}, {"start": 2616.08, "end": 2621.7999999999997, "text": " down and the evaluation method of this matching algorithm, it sort of breaks down when you"}, {"start": 2621.8, "end": 2625.4, "text": " have more classes, at least in my opinion."}, {"start": 2625.4, "end": 2632.96, "text": " Yeah, but it's interesting to see that you can just overshoot, but then you need some"}, {"start": 2632.96, "end": 2636.96, "text": " sort of heuristic to reconcile that."}, {"start": 2636.96, "end": 2640.6400000000003, "text": " In any case, I think this paper is pretty cool."}, {"start": 2640.6400000000003, "end": 2646.2000000000003, "text": " It brings together a lot of things that were already present and introduces this kind of"}, {"start": 2646.2000000000003, "end": 2651.76, "text": " this step approach, but what you have to keep in mind, and by the way, there's lots"}, {"start": 2651.76, "end": 2652.96, "text": " of samples down here."}, {"start": 2652.96, "end": 2657.2400000000002, "text": " What you have to keep in mind is there are a lot of hyperparameters in here."}, {"start": 2657.2400000000002, "end": 2663.1600000000003, "text": " There are like this threshold and you know, first of all, yeah, the number of classes,"}, {"start": 2663.1600000000003, "end": 2671.28, "text": " the thresholds, the architectures and so on, and all of this has been tuned to get these"}, {"start": 2671.28, "end": 2673.4, "text": " numbers really high, right?"}, {"start": 2673.4, "end": 2678.8, "text": " All of these steps, all of the augmentations and so on, the chosen data augmentations,"}, {"start": 2678.8, "end": 2683.8, "text": " it has been chosen to get this number as high as possible."}, {"start": 2683.8, "end": 2690.48, "text": " So you know, to interpret this as, oh, look, we can classify without knowing the labels"}, {"start": 2690.48, "end": 2699.92, "text": " is, you know, yes, in this case, but the hyperparameter choices of the algorithm are all informed by"}, {"start": 2699.92, "end": 2700.92, "text": " the labels."}, {"start": 2700.92, "end": 2706.86, "text": " So it is still very, very unclear of how this method will actually work when you really"}, {"start": 2706.86, "end": 2712.8, "text": " don't have the labels, when you actually have to choose the hyperparameters in absence of"}, {"start": 2712.8, "end": 2713.8, "text": " anything."}, {"start": 2713.8, "end": 2719.6, "text": " And yeah, I think the future might tell if they continue to work on this."}, {"start": 2719.6, "end": 2726.1200000000003, "text": " All right, thanks for listening, looking, watching, and bearing with me through my wrestling"}, {"start": 2726.1200000000003, "end": 2731.2400000000002, "text": " with with various math, basic math in this video."}, {"start": 2731.24, "end": 2737.3199999999997, "text": " I wish you a good day and bye bye."}]
Yannic Kilchner
https://www.youtube.com/watch?v=3_qGrmD6iQY
On the Measure of Intelligence by François Chollet - Part 1: Foundations (Paper Explained)
How does one measure the Intelligence of an AI? Is AlphaGo intelligent? How about GPT-3? In this landmark paper, Chollet proposes a solid measure of intelligence for AI that revolves around generalization, rather than skill. OUTLINE: 0:00 - Intro 1:15 - The need for a measure of intelligence 3:35 - Intelligence as generalization ability 5:45 - Nature vs nurture 11:45 - Skill-based evaluation 18:30 - Generalization based evaluation 30:25 - Inspiration from psychometrics 36:30 - Conclusion https://arxiv.org/abs/1911.01547 Abstract: To make deliberate progress towards more intelligent and more human-like artificial systems, we need to be following an appropriate feedback signal: we need to be able to define and evaluate intelligence in a way that enables comparisons between two systems, as well as comparisons with humans. Over the past hundred years, there has been an abundance of attempts to define and measure intelligence, across both the fields of psychology and AI. We summarize and critically assess these definitions and evaluation approaches, while making apparent the two historical conceptions of intelligence that have implicitly guided them. We note that in practice, the contemporary AI community still gravitates towards benchmarking intelligence by comparing the skill exhibited by AIs and humans at specific tasks such as board games and video games. We argue that solely measuring skill at any given task falls short of measuring intelligence, because skill is heavily modulated by prior knowledge and experience: unlimited priors or unlimited training data allow experimenters to "buy" arbitrary levels of skills for a system, in a way that masks the system's own generalization power. We then articulate a new formal definition of intelligence based on Algorithmic Information Theory, describing intelligence as skill-acquisition efficiency and highlighting the concepts of scope, generalization difficulty, priors, and experience. Using this definition, we propose a set of guidelines for what a general AI benchmark should look like. Finally, we present a benchmark closely following these guidelines, the Abstraction and Reasoning Corpus (ARC), built upon an explicit set of priors designed to be as close as possible to innate human priors. We argue that ARC can be used to measure a human-like form of general fluid intelligence and that it enables fair general intelligence comparisons between AI systems and humans. Authors: François Chollet Thumbnail: Photo by mohamed hassan 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
Hello there, today we're going to look at On the Measure of Intelligence by Francois Chollet of Google. This is a bit of a special episode I would say because if you look at the paper it is first of all is very long and then second of all it is a wall of text basically. Now it's very interesting text but if I were to go through this with you we'd basically just be kind of scrolling and reading along. So what I've done is I've basically read this and taken notes and I will attempt to just tell you what happens at least for the first part. So I intend for this to be a multi-part series because it's so long. So the first part as you can see here is context and history which is a little less boring than it sounds. The second part is going to be a new perspective where Chollet proposes his measure of intelligence and the third part is going to be about the benchmark, the Arc benchmark that is currently I believe running on Kaggle. So as it sees, as it looks right now, three parts and today we're going to dive into that first part. So here we go. He basically says that we need to define what intelligence means. We need an explicit goal to measure where if we think about AI like artificial intelligence, what does intelligence mean? We need something where we can basically put a number or multiple numbers on it and says that's intelligence, that's not intelligent. What we have right now is just basically anecdotes. It's just we all kind of feel what seems intelligent but we are not like sure and sometimes it's very misleading. He brings up the Turing test for example which is that you have a computer or a human behind a wall and on the other end sits a human and the human needs to kind of communicate without seeing what he communi or what he or she communicates with and then determine whether or not on the other side of the wall is a human or a computer and if the computer could fool a human into kind of a 50-50 guess then the computer would be passing the Turing test and therefore intelligent. Now, Chollet doesn't go right now into why that's not sufficient but he's basically saying this is not sufficient it's distracting and second of all it's basically just outsourcing the problems of defining intelligence to human right to this human right here who is fallible and noisy and you know doesn't all doesn't really know all you all you tell the human is basically like is this thing intelligent does this thing seem human to you it's also not clearly defined so we need some something more and Chollet says the definitions that exist today of intelligence are basically they they have implicit they are implicit definitions that are loaded with biases and biases basically from a human perspective on what intelligence is and if we want to really make progress in terms of measuring intelligence we need to point out these biases that are in these measures okay they has a range of quotes namely one here intelligence measures an agent's ability to achieve goals in a wide range of environments that was I believe the conclusion of a an author that distilled lots of different definitions and try to distill them into one one sentence and that's it intelligence measures an agent's ability to achieve goals in a wide range of environments so the crucial parts here is to ability to achieve goals so it must the agent must be you know doing something useful doing it like in reinforcement learning we'd say it must be getting higher rewards and the second part is in a wide range of environments so the the notion right here that we're going to encounter time and time again is basically an addition of skill and adaptivity so if you have it's not enough to have high skill you also need to be kind of adaptive to very very different environments to a range of environments and that's this this is the main issue that show lay has with the current sort of definitions of intelligence and the current direction of the AI field because it mostly measures skill and not generalization or adaptivity now he he says in this thing in this sentence right here that you just saw there is an implicit sort of something is said implicitly namely that these these these skills this ability to achieve goals in this wide range of environments it must be acquired it must be learned these these new tasks these different environments the agent should basically learn to adapt to the different environments then and then the agent is intelligent it's not that intelligent when it is sort of pre-programmed to already handle these environments so he says that's that's sort of implicit in that statement and we're going to see how this is made explicit later he goes into basically there are two two different viewpoints on intelligence this old nature versus nurture debate and that refers to two things like crystallized intelligence versus skill acquisition intelligence so the evolutionary view would be that intelligence is sort of this set of static programs and here we simply kind of boil down these two views to their extremes right so don't I don't think any major evolutionary biologist is complete like is apps is that extreme right now but these were historical set of views that were held one of them was that intelligence is basically just it's all pre-programmed into you by evolution so you can you can solve this puzzle because during evolution you know your ancestors that could solve these puzzles were were survived you can plan your path through a tree jungle because you know that was beneficiary to you and so evolution put that into your brain and therefore what results is AI is the science of making machines capable of performing tasks that would require intelligence if done by humans that's basically what Minsky said the quote I believe by Minsky at least show they says it's by Minsky or I misread where if you have this this set of view that that AI is basically just this set of static programs that means that if a human applies that set of programs to a task right and the human achieves 200 points it means if the if an AI comes along and achieves 201 points then it is intelligent because it has simply the better set of the better it has outperformed the static set of programs intelligence is this static set of programs and the AI has a better set of static set of programs so it's basically Minsky says if we know of a task that would require intelligence if done by a human then if something that can solve that task is intelligent and this equates learning basically just to memorization if you if you ask a proponent of this viewpoint well what's what's learning like if everything is pre-programmed what we can still learn and they would say yeah but the learning is just you memorize situations and that particular ability is also pre-programmed into you the other extreme viewpoint is this table or also viewpoint where it basically says you come into this world and your brain is a blank slate and everything you all of your abilities you basically must acquire through learning throughout your life so this is another extreme viewpoint and in terms of intelligence where that leads is following AI is the science and engineering of making machines do tasks they have never seen and have not been prepared for beforehand and that's a quote by McCarthy and Friedberg if we're ever to make a machine that will speak understand translate human languages solve mathematical problems with imagination practice a profession or direct an organization either we must reduce these activities to a science so exact that we can tell a machine precisely how to go about doing them or we must develop a machine that can do things without being told precisely how so this leads to more of of these notions right here that you can see here how the machines have not been prepared for a particular situation so if we make a machine that can do a task that it has not been prepared for we we know it's basically intelligent and again so if we make a machine that can do all of these things all of the things right here then either Friedberg says we must reduce these activities to assign so basically we must program the solution in there already or we must develop a machine that can do things without being told precisely how and as you as you might realize this is much closer to the to the machine learning paradigm it's basically it's all about how much you say precisely because the extreme proponent of this thing would would basically recognize any sort of learning anything that you haven't seen before is an intelligent right if you if you can handle any new situation you're intelligent and surely is going to argue that that's also not really the case like we have to be a bit more graded about it but this is basically the machine learning approach it's it's we build machines that can do things without being told precisely how that they have not been prepared for beforehand like it can solve things that are not in the training data that's one interpretation and if you're a very strong proponent of this you would call that intelligent and so they're gonna argue that the truth of course is somewhere in the middle between these two viewpoints and therefore defining intelligence in either of these terms is going to lack in in expressivity and in usefulness so how do we evaluate AI and show they goes through different levels here of AI evaluation so first of all he contrasts these these two things right here skill based evaluation and generalization based evaluation so in skill based evaluation you basically go for one given task so you evaluate a system on one given task one example here is for example the Turing test and that's done by human review another example is where you have like a proof so you evaluate a system in by giving its optimality proof you can analyze it and you can say it is always correct at this particular task what you can also do is this peer competition so this is maybe what we see in sort of like chess so we let the bots play first humans and then we let them play other bots and we determine which one's the best and also the most familiar one benchmarks so this would be where your I don't know your image net net test set is right that's right here that's a skill based evaluation that's one given task how well can you solve the image net test set without looking at it that's one task so the problem show they says with these this skill based evaluation is sort of obvious it's like a single focus you can't like you are only good at this particular thing and that is one of the examples of this is the fact that the Kaggle models are usually the winning Kaggle models are usually useless outside of that particular data set because they're just so hyper optimized and hyper focused on winning that particular Kaggle competition so it's actually it's actually a pretty strong science on how to set up a Kaggle competition such that you can then use the model the winning model afterwards for doing something actually useful no there are no conditions on how to arrive at a solution and there surely lets a bit of that that's basically his point that's gonna come in to the the measurement later into the math where he says you simply have to arrive at a solution in this skill based evaluation it the skill based evaluation usually doesn't care how you arrive there so the image net test set score doesn't care how you got the neural network or what not that you got it simply cares how many images do you classify correctly and this leads to what is called the AI effect which I didn't know it was called like this until recently but it's fairly obvious where people say people say people come up with a task that's that is intelligence so people used to say oh checkers the game of checkers it requires intelligence and then you build a machine to solve checkers because you can just I don't know search do like a bit of a smart tree search and you solve it and you tell them here's like a tree search that does checkers and they'll say well but that's not that's not really intelligent it's just like a tree search but but chess chess you can't possibly do the treat the full tree search so chess is intelligent and the then you build like a smarter tree search they build the stock fish and they're like yeah but that's just you know that's just this machine thing and so the goalposts keep moving every time they come up with a task and you solve the tasks they'll just say wow that's not really intelligence this next task that's intelligence and it's easy to see that if you just do this skill based evaluation you will never get there because it's always going to be on the next task the next task the next task it's overly anthropocentric it's overly based on how humans view the world and what is not left in here and again this this acquisition what is not in this definition is the fact that why do we think that someone that plays chess very well like why do we think Magnus Carlsen is smart why do we think someone like a go master is very intelligent and that's because we know that this person is human at least we believe there are doubts about these some of these grandmasters but we believe that they are humans and therefore we know that they have only had whatever 20 30 years to learn this and they must eat regularly and they can only think so fast and it's it's hard to memorize things as a human so we know all of their constraints that went into learning this and we we basically know there is it's not like we are not aware of something like neo has in the matrix where you can just upload the solution to chess into your brain we know what's required to achieve that level of success and we know the only way it this can be done is through general intelligence we know that there is this correlation in humans that if you are good at chess you must have this or you're very very likely to have this general problem-solving ability right that's a human centric view and that does not count for machines machines can take forever to calculate they can distill years and years of experience like thousands of years and this would also this would be the same case with these open AI dot-to-five right dot-to-five is exactly here AlphaGo is exactly here we only think they might be intelligent if a human does it because we know what's required for humans to get there again focus skill acquisition now you might be bored a little bit okay it's about skill acquisition but think about it it's it's not that easy to actually define this skill acquisition thing it without falling back into the exact same trap so it goes into say okay as opposed to this skill based we can measure generalization so what's the generalization generalization is the broad ability to handle tasks that differ from previous tasks so they they you have a task and it's different from previous tasks you generalize now there are two ways you can view this there is system centric generalization and that's basically if you take the strict definition here so this would be a machine learning system trains on the training set and then is evaluated on the test set it has never seen the test set before so it's generalizing right that's called system centric generalization but that's not really enough here because we also need to take into account the developer of the system so developer aware generalization means that you generalize the situations that are new to the system and to the developer so a developer of an image net model knows that it is going to be evaluated on the image net test set and that is that is in this category system centric because the developer knows however a broader generalization this developer aware generalization also takes into account that fact and it would say developer aware generalization is only when the system generalizes to something that is not known to developer that is new to even to the developer themselves they don't they haven't foreseen that so this accounts for prior knowledge of the developer it surely defines different degrees of generalization largely along these lines so absence of generalization is when you have like an algorithm that you know you absolutely have built in that it works for every possible situation like like a certain assorting algorithm that you have proven mathematically proven to work for all sequences of numbers no generalization everything has been foreseen then there is local generalization and this in machine learning we call this something like robustness this would be your test set robustness your a small distribution shift so the test set here comes from a known distribution so this is the the notion of known unknowns you you have an idea of what can come at your system and you require basically you require a dense sampling of the input space usually machine learning training sets are very very densely sample that means there's a lot of data there that we can learn from so we have like lots and lots and lots and lots and lots of data and when the test point comes it is going to be like somewhere really in with in between all of these training data points so we can infer from the surrounding training data points what the test data point is going to be like if there's a classification boundary right here we can sort of nearest neighbor it and there are arguments that deep networks are basically large nearest neighbor classifiers but that's a topic for another day and we are here basically we are here in machine learning right now we do local generalization we know our unknowns we know our test set as the the opposition to this is broad generalization broad generalization is where you don't know what you don't know unknown unknowns you don't know what comes at test time and you can't pre-build sort of your expectations into the system this is more akin to something like level 5 autonomous driving where you build this car but you don't really know what kind of situations coming no known this is a this is a fuzzy definition right I mean you do sort of know what situations will come at the car you can certainly probabilistically make a statement about what so this is it's not a clear-cut definition and I think we're going to so in the math it seems clear-cut but when we get there I don't think it is that clear-cut honestly it's still kind of a intuition thing what you categorize as local and broad and so on also here the Wozniak coffee cup example where it basically was in excess you should be able to build a robot that goes into any kitchen and gets you a cup of coffee and here you have known a sorry unknown unknowns because you can't possibly foresee all possible kitchen arrangements there might be obstacles and so on do you know the coffee might there might be different coffee makers that you've never encountered before but I've long been saying that this is a bit of a trick right here because what what you can always do is you can construct a room a kitchen right and right here is the coffee machine so there's the how do we draw this there's the coffee machine right here one of these fancy Nespresso machines you put in a capsule here and here's the coffee machine okay but then you you build a wall around it and the wall has a door and the door the door will only open if you solve an IQ test right so or any sort of any surface so whatever you put whatever you put in that spot that's the level of generalization you you can achieve basically so you can always up the level of generalization to or you can put I don't know you can put the halting problem here right you can you can you can here you can say you only solve this door if you can whatever give me a proof of the ABC conjecture something like this so coffee cup example kind of kind of has some back doors in any case you sort of know what was the EC means you should be able to go into a standard kitchen but the standard kitchens are still diverse enough you can't foresee all of them like I don't if any of you has this sort of kitchen that I'm talking about like mad respect all we will all get this robot and you'll you'll just have to wait for the next iteration okay then there's extreme extreme generalization is where you have kind of open-ended you you don't know what's gonna come you don't even know the broad category of tasks that is going to come right broad here is still broad still refers to a broad category of related tasks so it is sort of a general ability and the extreme generalization just means you know whatever whatever comes you can solve it but it is different from universal universal generalization show they says is any conceivable task in the universe and that's pointless it's pointless because it's just too much there's this no free lunch theorem right plus what we actually want is we want human level intelligence and human level intelligence has this property of extreme generalization with extreme generalization we mean the scope see it's dependent on a scope we mean the scope of all human tasks of all tasks that humans could produce or could find useful could find themselves in or could pose of this system not all tasks that the universe could pose so that here you you don't even have the relation between tasks the relation between tasks are at most abstract so there maybe it's like the general ability of sorting things generally in in whatever fashion in and things whatever these things are with whatever properties are the general ability to communicate an idea or something like this and this in humans is called the g factor if you or it's related to but we're going to take a like Shirley really goes after psychometrics here and really models its its his framework after psychometrics for humans and the sort of achievement in psychometrics one of the achievements is this measure of the g factor and that's what we humans usually call intelligence he says note that humans have system centric and developer aware generalization though you know that one this this and count this contains the other one so why because we can handle situations that previous humans haven't experienced now I'm not I'm not sure he basically says humans have developer aware generalization because we can we can fare well in situations that no humans during evolution have experienced prior but okay let's let's have this abstractly let's say our developer is the evolution process you still have to ask can humans really solve things that and the evolutionary process has not built into them in some sort I guess that refers back to the nature versus nurture like humans humans cannot you know multiply long floating point numbers it doesn't matter how I get without a pen and paper it doesn't matter how how much you learn or something like this there are some things that they just can't do but would want to do and I guess the evolutionary path simply didn't provide us for doing that kind of stuff we have a finite working memory and so on so I think the the discussion here is still to be had if we really do have developer aware generalization if you consider our developer to be the evolutionary process but but we can forgive a little bit here so this is the general diagram that also emerges from kind of theories of intelligence from psychology where generally you have a general intelligence factor which is one factor this is quite remarkable in humans there is one general intelligence factor statistically all all these general intelligence tasks they broadly correlate and lead to one statistical factor it's not it's not obvious why that should be but turns out to be one factor and that distributes hierarchically into these things which are called broad abilities broad cognitive abilities and in shoaless framework that would correspond to broad generalization and then these are again hierarchically subdivided and sometimes as you can see your shared task specific skills ok and this in in shoaless framework would be local or no generalization so again he basically goes into psychometrics and specifically IQ tests for humans can they inform the measuring process the note and the thing to note here according to shaleh is in an IQ test you want to measure these broad abilities you want to measure ultimately want to measure G but if even if you measure different things in psychometrics you want to measure these broad abilities but these are like these are abstract concepts so what you're left with what you can only do is you can only measure really tasks ok and is this wrongly numbered or is this intentional I don't know you can only measure tasks but you somehow have to make an inference about the broad ability from measuring the tasks so that's the difficulty in psychometrics you you you want to measure the abilities but you can only measure tasks the abilities are abstract concepts in the skill or the measurable things where you can put a number on it now you you can so what these IQ tests do they usually usually employ these broad battery of tests so you don't give the human just one tasks you give you give the human a lot of tasks you play ok complete this series which number comes next draw like rotate this in your head and so on but there there are so very human centric things like reading comprehension and so on but you do these broad battery of tests and you might think oh oh ok this is sort of like the Atari you know sweet where the one reinforcement learning agent has to solve these whole bunch of Atari games or a superglue in NLP where one NLP system has to learn to do all these different NLP tasks you know there is entailment there is sentiment there is Boolean question answering and but this is according to chalet it's sort of not really it's not really the case that these are equivalent because it is a battery but it is known to the developer so the developer knows that the NLP system has to solve the superglue thing so the developer can first of all train the system until it reaches a good superglue score but then also it will have built in already the assumptions of the developer that you have to solve this so the second important thing about these battery of tests and IQ test is that they are unknown to the tested the tested cannot or ideally should not practice for them that's why people keep developing new and new IQ tests because we sort of know they all correlate first of all so they measure the same thing but also second because otherwise people if you just always do the same test people could practice it and then you would no longer measure the general ability you would only measure that one test by the way that's also why a lot of these you know brain brain exercise apps and so on they none of them really ups your intelligence you you you only get better at one app if you do that you don't you don't get smarter in general so if and and show they says there have been a number of attempts at making machines making AI solve human IQ tests right well the reasoning is the follows like oh okay humans developed by Q tests for humans and presumably those are known and so on but again the tasks broadly of IQ tests are known I guess really IQ tests work on humans because they only work on humans who don't really care like if someone really really really really cared they would you know research what kind of tests there are they would look at all the tests from history there's only so many tests you can come up with the new ones are going to be like variations on the old one so you could technically if you really wanted you could like prepare super hard and that's exactly what developers are going to do they're basically going to look at all these tasks are going to pre-solve the problem and then they're going to program their you know pre-solved solution into an AI system so we can't just let AI system solve human IQ tests what we need are tests that are reliable which means they're reproducible that are valid that means they really measure IQ or they really measure artificial intelligence and not you know just task specific skill or something else they're standardized across the spectrum so they're standardized so everyone can do them in the same way by the way the current benchmarks are standardized that's the good part about them and they should be they should be free from bias which means they should not measure anything orthogonal to what they claim to measure and the example he gives is they should not measure reaction time which is also a big component in human IQ tests you also measure how fast the human is at the test and the machine obviously if you simply put more electrons through the cable it's going to run faster you can or if you put more more GPUs there so in broad terms we what we should focus on is this new skill acquisition as I said from the beginning but it is not as easy as you might think right now and we're going to dive into the next episode and is going to be math heavy and that's going to be fun so I hope you enjoyed this kind of special episode maybe let me know if you like this style the paper doesn't have any pictures so you're just left with what I'm what I'm drawing yeah if you enjoyed this leave like leave comments share it out and I'll see you next time bye bye
[{"start": 0.0, "end": 5.4, "text": " Hello there, today we're going to look at On the Measure of Intelligence by"}, {"start": 5.4, "end": 11.48, "text": " Francois Chollet of Google. This is a bit of a special episode I would say"}, {"start": 11.48, "end": 18.12, "text": " because if you look at the paper it is first of all is very long and then"}, {"start": 18.12, "end": 23.400000000000002, "text": " second of all it is a wall of text basically. Now it's very interesting text"}, {"start": 23.400000000000002, "end": 28.52, "text": " but if I were to go through this with you we'd basically just be kind of"}, {"start": 28.52, "end": 34.519999999999996, "text": " scrolling and reading along. So what I've done is I've basically read this and"}, {"start": 34.519999999999996, "end": 40.08, "text": " taken notes and I will attempt to just tell you what happens at least for the"}, {"start": 40.08, "end": 44.6, "text": " first part. So I intend for this to be a multi-part series because it's so long."}, {"start": 44.6, "end": 51.2, "text": " So the first part as you can see here is context and history which is a little"}, {"start": 51.2, "end": 55.4, "text": " less boring than it sounds. The second part is going to be a new perspective"}, {"start": 55.4, "end": 61.199999999999996, "text": " where Chollet proposes his measure of intelligence and the third part is going"}, {"start": 61.199999999999996, "end": 64.75999999999999, "text": " to be about the benchmark, the Arc benchmark that is currently I believe"}, {"start": 64.75999999999999, "end": 72.8, "text": " running on Kaggle. So as it sees, as it looks right now, three parts and today"}, {"start": 72.8, "end": 77.08, "text": " we're going to dive into that first part. So here we go."}, {"start": 77.08, "end": 85.03999999999999, "text": " He basically says that we need to define what intelligence means. We need an"}, {"start": 85.04, "end": 90.48, "text": " explicit goal to measure where if we think about AI like artificial"}, {"start": 90.48, "end": 94.52000000000001, "text": " intelligence, what does intelligence mean? We need something where we can basically"}, {"start": 94.52000000000001, "end": 99.16000000000001, "text": " put a number or multiple numbers on it and says that's intelligence, that's not"}, {"start": 99.16000000000001, "end": 104.08000000000001, "text": " intelligent. What we have right now is just basically anecdotes. It's just we"}, {"start": 104.08000000000001, "end": 111.36000000000001, "text": " all kind of feel what seems intelligent but we are not like sure and sometimes"}, {"start": 111.36, "end": 116.48, "text": " it's very misleading. He brings up the Turing test for example which is that"}, {"start": 116.48, "end": 123.12, "text": " you have a computer or a human behind a wall and on the other end sits a human"}, {"start": 123.12, "end": 128.0, "text": " and the human needs to kind of communicate without seeing what he"}, {"start": 128.0, "end": 133.04, "text": " communi or what he or she communicates with and then determine whether or not"}, {"start": 133.04, "end": 137.92000000000002, "text": " on the other side of the wall is a human or a computer and if the computer could"}, {"start": 137.92, "end": 145.07999999999998, "text": " fool a human into kind of a 50-50 guess then the computer would be passing the"}, {"start": 145.07999999999998, "end": 151.27999999999997, "text": " Turing test and therefore intelligent. Now, Chollet doesn't go right now into"}, {"start": 151.27999999999997, "end": 155.07999999999998, "text": " why that's not sufficient but he's basically saying this is not sufficient"}, {"start": 155.07999999999998, "end": 160.27999999999997, "text": " it's distracting and second of all it's basically just outsourcing the problems"}, {"start": 160.27999999999997, "end": 165.92, "text": " of defining intelligence to human right to this human right here who is fallible"}, {"start": 165.92, "end": 173.07999999999998, "text": " and noisy and you know doesn't all doesn't really know all you all you tell"}, {"start": 173.07999999999998, "end": 176.64, "text": " the human is basically like is this thing intelligent does this thing seem"}, {"start": 176.64, "end": 183.2, "text": " human to you it's also not clearly defined so we need some something more"}, {"start": 183.2, "end": 190.07999999999998, "text": " and Chollet says the definitions that exist today of intelligence are"}, {"start": 190.07999999999998, "end": 195.16, "text": " basically they they have implicit they are implicit definitions that are loaded"}, {"start": 195.16, "end": 201.84, "text": " with biases and biases basically from a human perspective on what intelligence"}, {"start": 201.84, "end": 206.28, "text": " is and if we want to really make progress in terms of measuring"}, {"start": 206.28, "end": 214.4, "text": " intelligence we need to point out these biases that are in these measures okay"}, {"start": 214.4, "end": 222.35999999999999, "text": " they has a range of quotes namely one here intelligence measures an agent's"}, {"start": 222.36, "end": 226.48000000000002, "text": " ability to achieve goals in a wide range of environments that was I believe the"}, {"start": 226.48000000000002, "end": 233.20000000000002, "text": " conclusion of a an author that distilled lots of different definitions and try to"}, {"start": 233.20000000000002, "end": 238.92000000000002, "text": " distill them into one one sentence and that's it intelligence measures an"}, {"start": 238.92000000000002, "end": 244.68, "text": " agent's ability to achieve goals in a wide range of environments so the crucial"}, {"start": 244.68, "end": 250.4, "text": " parts here is to ability to achieve goals so it must the agent must be you"}, {"start": 250.4, "end": 255.52, "text": " know doing something useful doing it like in reinforcement learning we'd say"}, {"start": 255.52, "end": 261.08, "text": " it must be getting higher rewards and the second part is in a wide range of"}, {"start": 261.08, "end": 266.8, "text": " environments so the the notion right here that we're going to encounter time"}, {"start": 266.8, "end": 273.32, "text": " and time again is basically an addition of skill and adaptivity so if you have"}, {"start": 273.32, "end": 279.28000000000003, "text": " it's not enough to have high skill you also need to be kind of adaptive to very"}, {"start": 279.28, "end": 284.96, "text": " very different environments to a range of environments and that's this this is"}, {"start": 284.96, "end": 289.03999999999996, "text": " the main issue that show lay has with the current sort of definitions of"}, {"start": 289.03999999999996, "end": 293.76, "text": " intelligence and the current direction of the AI field because it mostly"}, {"start": 293.76, "end": 303.64, "text": " measures skill and not generalization or adaptivity now he he says in this thing"}, {"start": 303.64, "end": 308.4, "text": " in this sentence right here that you just saw there is an implicit sort of"}, {"start": 308.4, "end": 316.12, "text": " something is said implicitly namely that these these these skills this ability to"}, {"start": 316.12, "end": 320.52, "text": " achieve goals in this wide range of environments it must be acquired it must"}, {"start": 320.52, "end": 326.08, "text": " be learned these these new tasks these different environments the agent should"}, {"start": 326.08, "end": 331.23999999999995, "text": " basically learn to adapt to the different environments then and then the"}, {"start": 331.23999999999995, "end": 335.28, "text": " agent is intelligent it's not that intelligent when it is sort of"}, {"start": 335.28, "end": 340.28, "text": " pre-programmed to already handle these environments so he says that's that's"}, {"start": 340.28, "end": 343.91999999999996, "text": " sort of implicit in that statement and we're going to see how this is made"}, {"start": 343.91999999999996, "end": 350.28, "text": " explicit later he goes into basically there are two two different viewpoints"}, {"start": 350.28, "end": 355.76, "text": " on intelligence this old nature versus nurture debate and that refers to two"}, {"start": 355.76, "end": 362.03999999999996, "text": " things like crystallized intelligence versus skill acquisition intelligence so"}, {"start": 362.04, "end": 366.68, "text": " the evolutionary view would be that intelligence is sort of this set of"}, {"start": 366.68, "end": 372.0, "text": " static programs and here we simply kind of boil down these two views to their"}, {"start": 372.0, "end": 378.8, "text": " extremes right so don't I don't think any major evolutionary biologist is"}, {"start": 378.8, "end": 386.12, "text": " complete like is apps is that extreme right now but these were historical set"}, {"start": 386.12, "end": 391.16, "text": " of views that were held one of them was that intelligence is basically just it's"}, {"start": 391.16, "end": 396.96000000000004, "text": " all pre-programmed into you by evolution so you can you can solve this"}, {"start": 396.96000000000004, "end": 400.96000000000004, "text": " puzzle because during evolution you know your ancestors that could solve these"}, {"start": 400.96000000000004, "end": 408.36, "text": " puzzles were were survived you can plan your path through a tree jungle because"}, {"start": 408.36, "end": 414.92, "text": " you know that was beneficiary to you and so evolution put that into your brain"}, {"start": 414.92, "end": 422.12, "text": " and therefore what results is AI is the science of making machines capable of"}, {"start": 422.12, "end": 427.44, "text": " performing tasks that would require intelligence if done by humans that's"}, {"start": 427.44, "end": 433.12, "text": " basically what Minsky said the quote I believe by Minsky at least show they"}, {"start": 433.12, "end": 439.72, "text": " says it's by Minsky or I misread where if you have this this set of view that"}, {"start": 439.72, "end": 446.0, "text": " that AI is basically just this set of static programs that means that if a"}, {"start": 446.0, "end": 452.40000000000003, "text": " human applies that set of programs to a task right and the human achieves 200"}, {"start": 452.40000000000003, "end": 461.92, "text": " points it means if the if an AI comes along and achieves 201 points then it is"}, {"start": 461.92, "end": 466.96000000000004, "text": " intelligent because it has simply the better set of the better it has"}, {"start": 466.96, "end": 471.28, "text": " outperformed the static set of programs intelligence is this static set of"}, {"start": 471.28, "end": 477.12, "text": " programs and the AI has a better set of static set of programs so it's basically"}, {"start": 477.12, "end": 484.71999999999997, "text": " Minsky says if we know of a task that would require intelligence if done by a"}, {"start": 484.71999999999997, "end": 494.59999999999997, "text": " human then if something that can solve that task is intelligent and this"}, {"start": 494.6, "end": 499.48, "text": " equates learning basically just to memorization if you if you ask a"}, {"start": 499.48, "end": 503.76000000000005, "text": " proponent of this viewpoint well what's what's learning like if everything is"}, {"start": 503.76000000000005, "end": 507.36, "text": " pre-programmed what we can still learn and they would say yeah but the learning"}, {"start": 507.36, "end": 511.52000000000004, "text": " is just you memorize situations and that particular ability is also"}, {"start": 511.52000000000004, "end": 520.76, "text": " pre-programmed into you the other extreme viewpoint is this table or also"}, {"start": 520.76, "end": 526.76, "text": " viewpoint where it basically says you come into this world and your brain is a"}, {"start": 526.76, "end": 531.68, "text": " blank slate and everything you all of your abilities you basically must"}, {"start": 531.68, "end": 538.88, "text": " acquire through learning throughout your life so this is another extreme viewpoint"}, {"start": 538.88, "end": 546.28, "text": " and in terms of intelligence where that leads is following AI is the science and"}, {"start": 546.28, "end": 552.04, "text": " engineering of making machines do tasks they have never seen and have not been"}, {"start": 552.04, "end": 559.24, "text": " prepared for beforehand and that's a quote by McCarthy and Friedberg if we're"}, {"start": 559.24, "end": 563.24, "text": " ever to make a machine that will speak understand translate human languages"}, {"start": 563.24, "end": 567.28, "text": " solve mathematical problems with imagination practice a profession or"}, {"start": 567.28, "end": 572.4, "text": " direct an organization either we must reduce these activities to a science so"}, {"start": 572.4, "end": 577.56, "text": " exact that we can tell a machine precisely how to go about doing them or"}, {"start": 577.56, "end": 582.68, "text": " we must develop a machine that can do things without being told precisely how"}, {"start": 582.68, "end": 590.36, "text": " so this leads to more of of these notions right here that you can see here"}, {"start": 590.36, "end": 595.88, "text": " how the machines have not been prepared for a particular situation so if we make"}, {"start": 595.88, "end": 602.0, "text": " a machine that can do a task that it has not been prepared for we we know it's"}, {"start": 602.0, "end": 608.92, "text": " basically intelligent and again so if we make a machine that can do all of these"}, {"start": 608.92, "end": 615.92, "text": " things all of the things right here then either Friedberg says we must reduce"}, {"start": 615.92, "end": 621.2, "text": " these activities to assign so basically we must program the solution in there"}, {"start": 621.2, "end": 626.12, "text": " already or we must develop a machine that can do things without being told"}, {"start": 626.12, "end": 632.48, "text": " precisely how and as you as you might realize this is much closer to the to"}, {"start": 632.48, "end": 638.2, "text": " the machine learning paradigm it's basically it's all about how much you"}, {"start": 638.2, "end": 644.84, "text": " say precisely because the extreme proponent of this thing would would"}, {"start": 644.84, "end": 651.2, "text": " basically recognize any sort of learning anything that you haven't seen before is"}, {"start": 651.2, "end": 657.0400000000001, "text": " an intelligent right if you if you can handle any new situation you're"}, {"start": 657.0400000000001, "end": 662.88, "text": " intelligent and surely is going to argue that that's also not really the case"}, {"start": 662.88, "end": 667.6, "text": " like we have to be a bit more graded about it but this is basically the"}, {"start": 667.6, "end": 673.0400000000001, "text": " machine learning approach it's it's we build machines that can do things"}, {"start": 673.0400000000001, "end": 678.6800000000001, "text": " without being told precisely how that they have not been prepared for"}, {"start": 678.68, "end": 684.5999999999999, "text": " beforehand like it can solve things that are not in the training data that's one"}, {"start": 684.5999999999999, "end": 689.16, "text": " interpretation and if you're a very strong proponent of this you would call"}, {"start": 689.16, "end": 695.0, "text": " that intelligent and so they're gonna argue that the truth of course is"}, {"start": 695.0, "end": 698.92, "text": " somewhere in the middle between these two viewpoints and therefore defining"}, {"start": 698.92, "end": 704.92, "text": " intelligence in either of these terms is going to lack in in expressivity and in"}, {"start": 704.92, "end": 713.8399999999999, "text": " usefulness so how do we evaluate AI and show they goes through different levels"}, {"start": 713.8399999999999, "end": 721.4799999999999, "text": " here of AI evaluation so first of all he contrasts these these two things right"}, {"start": 721.4799999999999, "end": 728.8, "text": " here skill based evaluation and generalization based evaluation so in"}, {"start": 728.8, "end": 736.7199999999999, "text": " skill based evaluation you basically go for one given task so you evaluate a"}, {"start": 736.7199999999999, "end": 743.8, "text": " system on one given task one example here is for example the Turing test and"}, {"start": 743.8, "end": 749.1999999999999, "text": " that's done by human review another example is where you have like a proof"}, {"start": 749.1999999999999, "end": 757.12, "text": " so you evaluate a system in by giving its optimality proof you can analyze it"}, {"start": 757.12, "end": 762.6, "text": " and you can say it is always correct at this particular task what you can also"}, {"start": 762.6, "end": 768.32, "text": " do is this peer competition so this is maybe what we see in sort of like chess"}, {"start": 768.32, "end": 773.74, "text": " so we let the bots play first humans and then we let them play other bots and we"}, {"start": 773.74, "end": 780.5600000000001, "text": " determine which one's the best and also the most familiar one benchmarks so this"}, {"start": 780.56, "end": 788.28, "text": " would be where your I don't know your image net net test set is right that's"}, {"start": 788.28, "end": 793.0799999999999, "text": " right here that's a skill based evaluation that's one given task how"}, {"start": 793.0799999999999, "end": 799.28, "text": " well can you solve the image net test set without looking at it that's one"}, {"start": 799.28, "end": 805.5999999999999, "text": " task so the problem show they says with these this skill based evaluation is"}, {"start": 805.6, "end": 811.5600000000001, "text": " sort of obvious it's like a single focus you can't like you are only good at this"}, {"start": 811.5600000000001, "end": 817.58, "text": " particular thing and that is one of the examples of this is the fact that the"}, {"start": 817.58, "end": 822.48, "text": " Kaggle models are usually the winning Kaggle models are usually useless"}, {"start": 822.48, "end": 826.8000000000001, "text": " outside of that particular data set because they're just so hyper optimized"}, {"start": 826.8000000000001, "end": 832.6800000000001, "text": " and hyper focused on winning that particular Kaggle competition so it's"}, {"start": 832.68, "end": 836.76, "text": " actually it's actually a pretty strong science on how to set up a Kaggle"}, {"start": 836.76, "end": 840.88, "text": " competition such that you can then use the model the winning model afterwards"}, {"start": 840.88, "end": 849.9599999999999, "text": " for doing something actually useful no there are no conditions on how to arrive"}, {"start": 849.9599999999999, "end": 855.9599999999999, "text": " at a solution and there surely lets a bit of that that's basically his point"}, {"start": 855.9599999999999, "end": 861.24, "text": " that's gonna come in to the the measurement later into the math where he"}, {"start": 861.24, "end": 866.64, "text": " says you simply have to arrive at a solution in this skill based evaluation"}, {"start": 866.64, "end": 872.2, "text": " it the skill based evaluation usually doesn't care how you arrive there so the"}, {"start": 872.2, "end": 877.2, "text": " image net test set score doesn't care how you got the neural network or what"}, {"start": 877.2, "end": 882.32, "text": " not that you got it simply cares how many images do you classify correctly"}, {"start": 882.32, "end": 888.52, "text": " and this leads to what is called the AI effect which I didn't know it was called"}, {"start": 888.52, "end": 893.8, "text": " like this until recently but it's fairly obvious where people say people say"}, {"start": 893.8, "end": 897.72, "text": " people come up with a task that's that is intelligence so people used to say oh"}, {"start": 897.72, "end": 904.0, "text": " checkers the game of checkers it requires intelligence and then you build"}, {"start": 904.0, "end": 908.84, "text": " a machine to solve checkers because you can just I don't know search do like a"}, {"start": 908.84, "end": 913.76, "text": " bit of a smart tree search and you solve it and you tell them here's like a tree"}, {"start": 913.76, "end": 916.6, "text": " search that does checkers and they'll say well but that's not that's not"}, {"start": 916.6, "end": 922.0400000000001, "text": " really intelligent it's just like a tree search but but chess chess you can't"}, {"start": 922.0400000000001, "end": 929.76, "text": " possibly do the treat the full tree search so chess is intelligent and the"}, {"start": 929.76, "end": 934.28, "text": " then you build like a smarter tree search they build the stock fish and"}, {"start": 934.28, "end": 939.52, "text": " they're like yeah but that's just you know that's just this machine thing and"}, {"start": 939.52, "end": 944.84, "text": " so the goalposts keep moving every time they come up with a task and you solve"}, {"start": 944.84, "end": 950.12, "text": " the tasks they'll just say wow that's not really intelligence this next task"}, {"start": 950.12, "end": 955.76, "text": " that's intelligence and it's easy to see that if you just do this skill based"}, {"start": 955.76, "end": 960.36, "text": " evaluation you will never get there because it's always going to be on the"}, {"start": 960.36, "end": 967.58, "text": " next task the next task the next task it's overly anthropocentric it's overly"}, {"start": 967.58, "end": 972.9200000000001, "text": " based on how humans view the world and what is not left in here and again this"}, {"start": 972.92, "end": 977.9599999999999, "text": " this acquisition what is not in this definition is the fact that why do we"}, {"start": 977.9599999999999, "end": 983.76, "text": " think that someone that plays chess very well like why do we think Magnus Carlsen"}, {"start": 983.76, "end": 990.92, "text": " is smart why do we think someone like a go master is very intelligent and that's"}, {"start": 990.92, "end": 997.1999999999999, "text": " because we know that this person is human at least we believe there are"}, {"start": 997.1999999999999, "end": 1002.12, "text": " doubts about these some of these grandmasters but we believe that they"}, {"start": 1002.12, "end": 1008.6, "text": " are humans and therefore we know that they have only had whatever 20 30 years"}, {"start": 1008.6, "end": 1013.44, "text": " to learn this and they must eat regularly and they can only think so"}, {"start": 1013.44, "end": 1018.16, "text": " fast and it's it's hard to memorize things as a human so we know all of"}, {"start": 1018.16, "end": 1023.0, "text": " their constraints that went into learning this and we we basically know"}, {"start": 1023.0, "end": 1032.08, "text": " there is it's not like we are not aware of something like neo has in the matrix"}, {"start": 1032.08, "end": 1037.4399999999998, "text": " where you can just upload the solution to chess into your brain we know what's"}, {"start": 1037.4399999999998, "end": 1043.48, "text": " required to achieve that level of success and we know the only way it this"}, {"start": 1043.48, "end": 1047.12, "text": " can be done is through general intelligence we know that there is this"}, {"start": 1047.12, "end": 1053.24, "text": " correlation in humans that if you are good at chess you must have this or"}, {"start": 1053.24, "end": 1058.6, "text": " you're very very likely to have this general problem-solving ability right"}, {"start": 1058.6, "end": 1063.08, "text": " that's a human centric view and that does not count for machines machines"}, {"start": 1063.08, "end": 1069.4399999999998, "text": " can take forever to calculate they can distill years and years of experience"}, {"start": 1069.4399999999998, "end": 1073.56, "text": " like thousands of years and this would also this would be the same case with"}, {"start": 1073.56, "end": 1079.0, "text": " these open AI dot-to-five right dot-to-five is exactly here"}, {"start": 1079.0, "end": 1085.8, "text": " AlphaGo is exactly here we only think they might be intelligent if a human"}, {"start": 1085.8, "end": 1091.9199999999998, "text": " does it because we know what's required for humans to get there again focus skill"}, {"start": 1091.9199999999998, "end": 1097.44, "text": " acquisition now you might be bored a little bit okay it's about skill"}, {"start": 1097.44, "end": 1103.96, "text": " acquisition but think about it it's it's not that easy to actually define this"}, {"start": 1103.96, "end": 1110.1599999999999, "text": " skill acquisition thing it without falling back into the exact same trap so"}, {"start": 1110.16, "end": 1115.92, "text": " it goes into say okay as opposed to this skill based we can measure"}, {"start": 1115.92, "end": 1120.64, "text": " generalization so what's the generalization generalization is the"}, {"start": 1120.64, "end": 1127.0800000000002, "text": " broad ability to handle tasks that differ from previous tasks so they they"}, {"start": 1127.0800000000002, "end": 1132.52, "text": " you have a task and it's different from previous tasks you generalize now there"}, {"start": 1132.52, "end": 1137.88, "text": " are two ways you can view this there is system centric generalization and that's"}, {"start": 1137.88, "end": 1142.8000000000002, "text": " basically if you take the strict definition here so this would be a"}, {"start": 1142.8000000000002, "end": 1148.8000000000002, "text": " machine learning system trains on the training set and then is evaluated on"}, {"start": 1148.8000000000002, "end": 1153.68, "text": " the test set it has never seen the test set before so it's generalizing right"}, {"start": 1153.68, "end": 1157.7600000000002, "text": " that's called system centric generalization but that's not really"}, {"start": 1157.7600000000002, "end": 1163.4, "text": " enough here because we also need to take into account the developer of the system"}, {"start": 1163.4, "end": 1169.76, "text": " so developer aware generalization means that you generalize the situations that"}, {"start": 1169.76, "end": 1175.16, "text": " are new to the system and to the developer so a developer of an image net"}, {"start": 1175.16, "end": 1180.4, "text": " model knows that it is going to be evaluated on the image net test set and"}, {"start": 1180.4, "end": 1186.0, "text": " that is that is in this category system centric because the developer knows"}, {"start": 1186.0, "end": 1193.1200000000001, "text": " however a broader generalization this developer aware generalization also takes"}, {"start": 1193.12, "end": 1199.4799999999998, "text": " into account that fact and it would say developer aware generalization is only"}, {"start": 1199.4799999999998, "end": 1204.8, "text": " when the system generalizes to something that is not known to developer that is"}, {"start": 1204.8, "end": 1211.6, "text": " new to even to the developer themselves they don't they haven't foreseen that so"}, {"start": 1211.6, "end": 1218.2399999999998, "text": " this accounts for prior knowledge of the developer it surely defines different"}, {"start": 1218.24, "end": 1224.08, "text": " degrees of generalization largely along these lines so absence of generalization"}, {"start": 1224.08, "end": 1228.44, "text": " is when you have like an algorithm that you know you absolutely have built in"}, {"start": 1228.44, "end": 1232.92, "text": " that it works for every possible situation like like a certain assorting"}, {"start": 1232.92, "end": 1236.56, "text": " algorithm that you have proven mathematically proven to work for all"}, {"start": 1236.56, "end": 1242.48, "text": " sequences of numbers no generalization everything has been foreseen then there"}, {"start": 1242.48, "end": 1246.92, "text": " is local generalization and this in machine learning we call this something"}, {"start": 1246.92, "end": 1252.24, "text": " like robustness this would be your test set robustness your a small distribution"}, {"start": 1252.24, "end": 1258.8000000000002, "text": " shift so the test set here comes from a known distribution so this is the the"}, {"start": 1258.8000000000002, "end": 1264.72, "text": " notion of known unknowns you you have an idea of what can come at your system and"}, {"start": 1264.72, "end": 1268.6000000000001, "text": " you require basically you require a dense sampling of the input space"}, {"start": 1268.6000000000001, "end": 1273.64, "text": " usually machine learning training sets are very very densely sample that means"}, {"start": 1273.64, "end": 1278.68, "text": " there's a lot of data there that we can learn from so we have like lots and lots"}, {"start": 1278.68, "end": 1283.48, "text": " and lots and lots and lots of data and when the test point comes it is going to"}, {"start": 1283.48, "end": 1290.1200000000001, "text": " be like somewhere really in with in between all of these training data"}, {"start": 1290.1200000000001, "end": 1294.0400000000002, "text": " points so we can infer from the surrounding training data points what"}, {"start": 1294.0400000000002, "end": 1297.76, "text": " the test data point is going to be like if there's a classification boundary"}, {"start": 1297.76, "end": 1303.52, "text": " right here we can sort of nearest neighbor it and there are arguments that"}, {"start": 1303.52, "end": 1307.8799999999999, "text": " deep networks are basically large nearest neighbor classifiers but that's"}, {"start": 1307.8799999999999, "end": 1314.28, "text": " a topic for another day and we are here basically we are here in machine"}, {"start": 1314.28, "end": 1320.92, "text": " learning right now we do local generalization we know our unknowns we"}, {"start": 1320.92, "end": 1328.16, "text": " know our test set as the the opposition to this is broad generalization broad"}, {"start": 1328.16, "end": 1333.44, "text": " generalization is where you don't know what you don't know unknown unknowns you"}, {"start": 1333.44, "end": 1338.4, "text": " don't know what comes at test time and you can't pre-build sort of your"}, {"start": 1338.4, "end": 1345.52, "text": " expectations into the system this is more akin to something like level 5"}, {"start": 1345.52, "end": 1352.96, "text": " autonomous driving where you build this car but you don't really know what kind"}, {"start": 1352.96, "end": 1357.16, "text": " of situations coming no known this is a this is a fuzzy definition right I mean"}, {"start": 1357.16, "end": 1363.36, "text": " you do sort of know what situations will come at the car you can certainly"}, {"start": 1363.36, "end": 1368.56, "text": " probabilistically make a statement about what so this is it's not a clear-cut"}, {"start": 1368.56, "end": 1375.28, "text": " definition and I think we're going to so in the math it seems clear-cut but when"}, {"start": 1375.28, "end": 1380.3999999999999, "text": " we get there I don't think it is that clear-cut honestly it's still kind of a"}, {"start": 1380.3999999999999, "end": 1386.48, "text": " intuition thing what you categorize as local and broad and so on also here the"}, {"start": 1386.48, "end": 1391.2, "text": " Wozniak coffee cup example where it basically was in excess you should be"}, {"start": 1391.2, "end": 1396.96, "text": " able to build a robot that goes into any kitchen and gets you a cup of coffee and"}, {"start": 1396.96, "end": 1402.04, "text": " here you have known a sorry unknown unknowns because you can't possibly"}, {"start": 1402.04, "end": 1405.8799999999999, "text": " foresee all possible kitchen arrangements there might be obstacles"}, {"start": 1405.8799999999999, "end": 1410.24, "text": " and so on do you know the coffee might there might be different coffee makers"}, {"start": 1410.24, "end": 1415.6, "text": " that you've never encountered before but I've long been saying that this is a"}, {"start": 1415.6, "end": 1423.04, "text": " bit of a trick right here because what what you can always do is you can"}, {"start": 1423.04, "end": 1429.04, "text": " construct a room a kitchen right and right here is the coffee machine so"}, {"start": 1429.04, "end": 1433.52, "text": " there's the how do we draw this there's the coffee machine right here one of"}, {"start": 1433.52, "end": 1439.48, "text": " these fancy Nespresso machines you put in a capsule here and here's the coffee"}, {"start": 1439.48, "end": 1444.92, "text": " machine okay but then you you build a wall around it and the wall has a door"}, {"start": 1444.92, "end": 1455.68, "text": " and the door the door will only open if you solve an IQ test right so or any"}, {"start": 1455.68, "end": 1460.16, "text": " sort of any surface so whatever you put whatever you put in that spot that's the"}, {"start": 1460.16, "end": 1464.6000000000001, "text": " level of generalization you you can achieve basically so you can always up"}, {"start": 1464.6000000000001, "end": 1470.92, "text": " the level of generalization to or you can put I don't know you can put the"}, {"start": 1470.92, "end": 1476.5600000000002, "text": " halting problem here right you can you can you can here you can say you only"}, {"start": 1476.5600000000002, "end": 1481.8, "text": " solve this door if you can whatever give me a proof of the ABC conjecture"}, {"start": 1481.8, "end": 1490.24, "text": " something like this so coffee cup example kind of kind of has some back"}, {"start": 1490.24, "end": 1495.56, "text": " doors in any case you sort of know what was the EC means you should be able to"}, {"start": 1495.56, "end": 1501.36, "text": " go into a standard kitchen but the standard kitchens are still diverse"}, {"start": 1501.36, "end": 1508.04, "text": " enough you can't foresee all of them like I don't if any of you has this sort"}, {"start": 1508.04, "end": 1513.92, "text": " of kitchen that I'm talking about like mad respect all we will all get this"}, {"start": 1513.92, "end": 1520.8, "text": " robot and you'll you'll just have to wait for the next iteration okay then"}, {"start": 1520.8, "end": 1526.36, "text": " there's extreme extreme generalization is where you have kind of open-ended you"}, {"start": 1526.36, "end": 1530.52, "text": " you don't know what's gonna come you don't even know the broad category of"}, {"start": 1530.52, "end": 1534.92, "text": " tasks that is going to come right broad here is still broad still refers to a"}, {"start": 1534.92, "end": 1542.24, "text": " broad category of related tasks so it is sort of a general ability and the"}, {"start": 1542.24, "end": 1546.8000000000002, "text": " extreme generalization just means you know whatever whatever comes you can"}, {"start": 1546.8000000000002, "end": 1552.26, "text": " solve it but it is different from universal universal generalization"}, {"start": 1552.26, "end": 1558.52, "text": " show they says is any conceivable task in the universe and that's pointless"}, {"start": 1558.52, "end": 1563.16, "text": " it's pointless because it's just too much there's this no free lunch theorem"}, {"start": 1563.16, "end": 1570.48, "text": " right plus what we actually want is we want human level intelligence and human"}, {"start": 1570.48, "end": 1576.0400000000002, "text": " level intelligence has this property of extreme generalization with extreme"}, {"start": 1576.0400000000002, "end": 1580.8400000000001, "text": " generalization we mean the scope see it's dependent on a scope we mean the"}, {"start": 1580.8400000000001, "end": 1587.8400000000001, "text": " scope of all human tasks of all tasks that humans could produce or could find"}, {"start": 1587.84, "end": 1595.08, "text": " useful could find themselves in or could pose of this system not all tasks that"}, {"start": 1595.08, "end": 1602.24, "text": " the universe could pose so that here you you don't even have the relation between"}, {"start": 1602.24, "end": 1608.52, "text": " tasks the relation between tasks are at most abstract so there maybe it's like"}, {"start": 1608.52, "end": 1617.12, "text": " the general ability of sorting things generally in in whatever fashion in and"}, {"start": 1617.12, "end": 1621.6399999999999, "text": " things whatever these things are with whatever properties are the general"}, {"start": 1621.6399999999999, "end": 1629.32, "text": " ability to communicate an idea or something like this and this in humans"}, {"start": 1629.32, "end": 1637.12, "text": " is called the g factor if you or it's related to but we're going to take a"}, {"start": 1637.12, "end": 1642.8, "text": " like Shirley really goes after psychometrics here and really models its"}, {"start": 1642.8, "end": 1649.08, "text": " its his framework after psychometrics for humans and the sort of achievement"}, {"start": 1649.08, "end": 1653.6399999999999, "text": " in psychometrics one of the achievements is this measure of the g factor and"}, {"start": 1653.6399999999999, "end": 1660.8799999999999, "text": " that's what we humans usually call intelligence he says note that humans"}, {"start": 1660.8799999999999, "end": 1665.12, "text": " have system centric and developer aware generalization though you know that one"}, {"start": 1665.12, "end": 1674.36, "text": " this this and count this contains the other one so why because we can handle"}, {"start": 1674.36, "end": 1679.0, "text": " situations that previous humans haven't experienced now I'm not I'm not sure he"}, {"start": 1679.0, "end": 1684.8799999999999, "text": " basically says humans have developer aware generalization because we can we"}, {"start": 1684.8799999999999, "end": 1690.6399999999999, "text": " can fare well in situations that no humans during evolution have experienced"}, {"start": 1690.64, "end": 1696.4, "text": " prior but okay let's let's have this abstractly let's say our developer is"}, {"start": 1696.4, "end": 1704.76, "text": " the evolution process you still have to ask can humans really solve things that"}, {"start": 1704.76, "end": 1710.8000000000002, "text": " and the evolutionary process has not built into them in some sort I guess"}, {"start": 1710.8000000000002, "end": 1717.6000000000001, "text": " that refers back to the nature versus nurture like humans humans cannot you"}, {"start": 1717.6, "end": 1725.04, "text": " know multiply long floating point numbers it doesn't matter how I get"}, {"start": 1725.04, "end": 1730.76, "text": " without a pen and paper it doesn't matter how how much you learn or"}, {"start": 1730.76, "end": 1735.12, "text": " something like this there are some things that they just can't do but would"}, {"start": 1735.12, "end": 1742.36, "text": " want to do and I guess the evolutionary path simply didn't provide us for doing"}, {"start": 1742.36, "end": 1747.28, "text": " that kind of stuff we have a finite working memory and so on so I think the"}, {"start": 1747.28, "end": 1753.6, "text": " the discussion here is still to be had if we really do have developer aware"}, {"start": 1753.6, "end": 1760.3999999999999, "text": " generalization if you consider our developer to be the evolutionary process"}, {"start": 1760.3999999999999, "end": 1768.04, "text": " but but we can forgive a little bit here so this is the general diagram that also"}, {"start": 1768.04, "end": 1772.72, "text": " emerges from kind of theories of intelligence from psychology where"}, {"start": 1772.72, "end": 1778.48, "text": " generally you have a general intelligence factor which is one factor"}, {"start": 1778.48, "end": 1783.76, "text": " this is quite remarkable in humans there is one general intelligence factor"}, {"start": 1783.76, "end": 1788.72, "text": " statistically all all these general intelligence tasks they broadly"}, {"start": 1788.72, "end": 1793.48, "text": " correlate and lead to one statistical factor it's not it's not obvious why"}, {"start": 1793.48, "end": 1800.0, "text": " that should be but turns out to be one factor and that distributes hierarchically"}, {"start": 1800.0, "end": 1806.32, "text": " into these things which are called broad abilities broad cognitive abilities and"}, {"start": 1806.32, "end": 1810.68, "text": " in shoaless framework that would correspond to broad generalization and"}, {"start": 1810.68, "end": 1814.4, "text": " then these are again hierarchically subdivided and sometimes as you can see"}, {"start": 1814.4, "end": 1821.8, "text": " your shared task specific skills ok and this in in shoaless framework would be"}, {"start": 1821.8, "end": 1831.48, "text": " local or no generalization so again he basically goes into psychometrics and"}, {"start": 1831.48, "end": 1836.96, "text": " specifically IQ tests for humans can they inform the measuring process the"}, {"start": 1836.96, "end": 1844.0, "text": " note and the thing to note here according to shaleh is in an IQ test you"}, {"start": 1844.0, "end": 1848.96, "text": " want to measure these broad abilities you want to measure ultimately want to"}, {"start": 1848.96, "end": 1853.64, "text": " measure G but if even if you measure different things in psychometrics you"}, {"start": 1853.64, "end": 1857.52, "text": " want to measure these broad abilities but these are like these are abstract"}, {"start": 1857.52, "end": 1862.8400000000001, "text": " concepts so what you're left with what you can only do is you can only measure"}, {"start": 1862.8400000000001, "end": 1871.88, "text": " really tasks ok and is this wrongly numbered or is this intentional I don't"}, {"start": 1871.88, "end": 1877.72, "text": " know you can only measure tasks but you somehow have to make an inference about"}, {"start": 1877.72, "end": 1882.92, "text": " the broad ability from measuring the tasks so that's the difficulty in"}, {"start": 1882.92, "end": 1888.1200000000001, "text": " psychometrics you you you want to measure the abilities but you can only"}, {"start": 1888.1200000000001, "end": 1893.68, "text": " measure tasks the abilities are abstract concepts in the skill or the measurable"}, {"start": 1893.68, "end": 1900.6000000000001, "text": " things where you can put a number on it now you you can so what these IQ tests"}, {"start": 1900.6000000000001, "end": 1906.88, "text": " do they usually usually employ these broad battery of tests so you don't give"}, {"start": 1906.88, "end": 1911.88, "text": " the human just one tasks you give you give the human a lot of tasks you play"}, {"start": 1911.88, "end": 1918.48, "text": " ok complete this series which number comes next draw like rotate this in your"}, {"start": 1918.48, "end": 1923.0, "text": " head and so on but there there are so very human centric things like reading"}, {"start": 1923.0, "end": 1928.7600000000002, "text": " comprehension and so on but you do these broad battery of tests and you might"}, {"start": 1928.7600000000002, "end": 1936.0, "text": " think oh oh ok this is sort of like the Atari you know sweet where the one"}, {"start": 1936.0, "end": 1939.88, "text": " reinforcement learning agent has to solve these whole bunch of Atari games"}, {"start": 1939.88, "end": 1946.8, "text": " or a superglue in NLP where one NLP system has to learn to do all these"}, {"start": 1946.8, "end": 1951.16, "text": " different NLP tasks you know there is entailment there is sentiment there is"}, {"start": 1951.16, "end": 1958.44, "text": " Boolean question answering and but this is according to chalet it's sort of not"}, {"start": 1958.44, "end": 1966.44, "text": " really it's not really the case that these are equivalent because it is a"}, {"start": 1966.44, "end": 1970.68, "text": " battery but it is known to the developer so the developer knows that the NLP"}, {"start": 1970.68, "end": 1976.4, "text": " system has to solve the superglue thing so the developer can first of all train"}, {"start": 1976.4, "end": 1981.4, "text": " the system until it reaches a good superglue score but then also it will"}, {"start": 1981.4, "end": 1985.6000000000001, "text": " have built in already the assumptions of the developer that you have to solve"}, {"start": 1985.6, "end": 1990.56, "text": " this so the second important thing about these battery of tests and IQ test is"}, {"start": 1990.56, "end": 1996.6399999999999, "text": " that they are unknown to the tested the tested cannot or ideally should not"}, {"start": 1996.6399999999999, "end": 2002.08, "text": " practice for them that's why people keep developing new and new IQ tests because"}, {"start": 2002.08, "end": 2005.3999999999999, "text": " we sort of know they all correlate first of all so they measure the same thing"}, {"start": 2005.3999999999999, "end": 2012.9199999999998, "text": " but also second because otherwise people if you just always do the same test"}, {"start": 2012.92, "end": 2018.44, "text": " people could practice it and then you would no longer measure the general"}, {"start": 2018.44, "end": 2022.76, "text": " ability you would only measure that one test by the way that's also why a lot of"}, {"start": 2022.76, "end": 2031.28, "text": " these you know brain brain exercise apps and so on they none of them really ups"}, {"start": 2031.28, "end": 2038.0, "text": " your intelligence you you you only get better at one app if you do that you"}, {"start": 2038.0, "end": 2049.6, "text": " don't you don't get smarter in general so if and and show they says there have"}, {"start": 2049.6, "end": 2055.32, "text": " been a number of attempts at making machines making AI solve human IQ tests"}, {"start": 2055.32, "end": 2060.48, "text": " right well the reasoning is the follows like oh okay humans developed by Q tests"}, {"start": 2060.48, "end": 2069.44, "text": " for humans and presumably those are known and so on but again the tasks"}, {"start": 2069.44, "end": 2074.48, "text": " broadly of IQ tests are known I guess really IQ tests work on humans because"}, {"start": 2074.48, "end": 2079.32, "text": " they only work on humans who don't really care like if someone really"}, {"start": 2079.32, "end": 2084.56, "text": " really really really cared they would you know research what kind of tests"}, {"start": 2084.56, "end": 2087.36, "text": " there are they would look at all the tests from history there's only so many"}, {"start": 2087.36, "end": 2091.08, "text": " tests you can come up with the new ones are going to be like variations on the"}, {"start": 2091.08, "end": 2095.48, "text": " old one so you could technically if you really wanted you could like prepare"}, {"start": 2095.48, "end": 2100.88, "text": " super hard and that's exactly what developers are going to do they're"}, {"start": 2100.88, "end": 2104.28, "text": " basically going to look at all these tasks are going to pre-solve the problem"}, {"start": 2104.28, "end": 2109.32, "text": " and then they're going to program their you know pre-solved solution into an AI"}, {"start": 2109.32, "end": 2116.4, "text": " system so we can't just let AI system solve human IQ tests what we need are"}, {"start": 2116.4, "end": 2122.0, "text": " tests that are reliable which means they're reproducible that are valid that"}, {"start": 2122.0, "end": 2127.52, "text": " means they really measure IQ or they really measure artificial intelligence"}, {"start": 2127.52, "end": 2132.28, "text": " and not you know just task specific skill or something else they're"}, {"start": 2132.28, "end": 2138.48, "text": " standardized across the spectrum so they're standardized so everyone can do"}, {"start": 2138.48, "end": 2143.08, "text": " them in the same way by the way the current benchmarks are standardized"}, {"start": 2143.08, "end": 2148.6, "text": " that's the good part about them and they should be they should be free from bias"}, {"start": 2148.6, "end": 2153.72, "text": " which means they should not measure anything orthogonal to what they claim"}, {"start": 2153.72, "end": 2159.08, "text": " to measure and the example he gives is they should not measure reaction time"}, {"start": 2159.08, "end": 2163.92, "text": " which is also a big component in human IQ tests you also measure how fast the"}, {"start": 2163.92, "end": 2168.84, "text": " human is at the test and the machine obviously if you simply put more"}, {"start": 2168.84, "end": 2173.8, "text": " electrons through the cable it's going to run faster you can or if you put more"}, {"start": 2173.8, "end": 2182.36, "text": " more GPUs there so in broad terms we what we should focus on is this new"}, {"start": 2182.36, "end": 2189.1200000000003, "text": " skill acquisition as I said from the beginning but it is not as easy as you"}, {"start": 2189.1200000000003, "end": 2194.6400000000003, "text": " might think right now and we're going to dive into the next episode and is going"}, {"start": 2194.64, "end": 2202.2799999999997, "text": " to be math heavy and that's going to be fun so I hope you enjoyed this kind of"}, {"start": 2202.2799999999997, "end": 2207.08, "text": " special episode maybe let me know if you like this style the paper doesn't have"}, {"start": 2207.08, "end": 2213.04, "text": " any pictures so you're just left with what I'm what I'm drawing yeah if you"}, {"start": 2213.04, "end": 2217.8799999999997, "text": " enjoyed this leave like leave comments share it out and I'll see you next time"}, {"start": 2217.88, "end": 2226.96, "text": " bye bye"}]
Yannic Kilchner
https://www.youtube.com/watch?v=HYEzHX6-fIA
Dynamics-Aware Unsupervised Discovery of Skills (Paper Explained)
This RL framework can discover low-level skills all by itself without any reward. Even better, at test time it can compose its learned skills and reach a specified goal without any additional learning! Warning: Math-heavy! OUTLINE: 0:00 - Motivation 2:15 - High-Level Overview 3:20 - Model-Based vs Model-Free Reinforcement Learning 9:00 - Skills 12:10 - Mutual Information Objective 18:40 - Decomposition of the Objective 27:10 - Unsupervised Skill Discovery Algorithm 42:20 - Planning in Skill Space 48:10 - Conclusion Paper: https://arxiv.org/abs/1907.01657 Website: https://sites.google.com/view/dads-skill Code: https://github.com/google-research/dads Abstract: Conventionally, model-based reinforcement learning (MBRL) aims to learn a global model for the dynamics of the environment. A good model can potentially enable planning algorithms to generate a large variety of behaviors and solve diverse tasks. However, learning an accurate model for complex dynamical systems is difficult, and even then, the model might not generalize well outside the distribution of states on which it was trained. In this work, we combine model-based learning with model-free learning of primitives that make model-based planning easy. To that end, we aim to answer the question: how can we discover skills whose outcomes are easy to predict? We propose an unsupervised learning algorithm, Dynamics-Aware Discovery of Skills (DADS), which simultaneously discovers predictable behaviors and learns their dynamics. Our method can leverage continuous skill spaces, theoretically, allowing us to learn infinitely many behaviors even for high-dimensional state-spaces. We demonstrate that zero-shot planning in the learned latent space significantly outperforms standard MBRL and model-free goal-conditioned RL, can handle sparse-reward tasks, and substantially improves over prior hierarchical RL methods for unsupervised skill discovery. Authors: Archit Sharma, Shixiang Gu, Sergey Levine, Vikash Kumar, Karol Hausman 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, take a look at this humanoid right here. It walks from one checkpoint to another checkpoint, and then to the next checkpoint, and so on. And that is its task, it gets reward from walking from checkpoint to checkpoint. Take a look at this. And this is called the end. It also walks from checkpoint to checkpoint. Now we've seen a lot of reinforcement learning algorithms in this environment is called Muko Joe, where you basically teach these little things to walk around. So the what's the impressive part here, the impressive part is that at training time, this and has never ever seen what a checkpoint is, and has never gotten any reward from walking from checkpoint to another checkpoint. Actually, it has never gotten any reward for anything that that is given from the environment, it has discovered the skill of walking by itself. And then at test time, there is no additional learning when it goes from checkpoint to checkpoint, it simply composes the skills that it knows from its unsupervised discovery phase in order to go from checkpoint to checkpoint. So here you can see, this paper basically proposes to learn these skills in a completely unsupervised way at the beginning sort of so in the training phase, it learns these skills, you can see these skills that the humanoid has learned. And then all you have to do at test time is to compose these skills to reach a given goal. And these are the things that the end has learned. Watch out, this is trippy. You can see it has learned various walks various ways walking here. And if you know anything about this environment, it's actually not that easy to make the ant walk by itself. So the the discovery here that these skills that are discovered are various ways of walking is actually already pretty impressive. And the last thing here, this cheetah, of course, also has to has learned to walk back forward kind of jump around and so on. So we're going to dive into this paper. It's called dynamics aware unsupervised discovery of skills by Archie Sharma and other people of Google brain. So this was published at iClear 2020. And on a high level, I already said it's basically proposing to learn unsupervised skills, and then to compose these skills in a model based planning method at test time to reach a given goal without additional training without additional training on the reward that you give at test time. As always, if you like videos like this, you're very welcome to subscribe and share it to everyone you know. Yeah. Okay, let's dive in. So they say, conventionally model based reinforcement learning aims to learn a global model for the dynamics of the environment, which is not exactly true, right? So we have we dive into model based and model free reinforcement learning. Model based reinforcement learning basically means that you have a model of the environment. A example for this is, let's say, tic tac toe. So in tic tac toe, I know, I have nine actions at my disposal. And if I take action, let's say I take action zero, which is to make a let's say I'm the X player. So I take action zero. And if I you know, number my things correctly, then that will result in this state of the world. Okay, so I know exactly how the world will look when I take a given action. And what that allows me to do is that allows me to actually plan. So I cannot plan ahead, I can say what would happen if I took action zero, so I can do this in my mind. And then what would happen if I took action one, I can be like, okay, that's gonna happen. And I can do this with many things. And I can in my mind, continue this and basically roll out the entire games, or and then only do the given action that has led to the best result at the end, right. So this is model model based reinforcement learning means you have a model of the environment, you know what's going to happen when you perform given actions. And you can also combine this with machine learning, like, you know, alpha, alpha go alpha zero or so they have models of the games they're playing, they know what's going to happen. But it's very intractable to basically go down this entire tree and plan out everything. So they combine it with machine learning. It doesn't change that it's a model based. Now in, in opposition to that in model free in in reinforcement learning, what you do, you are these agent, the heirs of the environment, and you simply have to do an action, I do action zero, and the environment just gives you back a reward and the next observation. And it you have basically no clue how the environment will change. If you do something, you all these and all these, these agents do or the classic model free agents do is basically they're trying to have a neural network somewhere in them. And you put the observation in here and outcomes and action. And you can do this in various ways into Q learning or policy gradient or actor critic, and so on. But ultimately, it's simply mapping the optic current observation, and maybe the last few to the best action to take without explicitly modeling what happens in the environment. Now, when they say model based reinforcement learning, what they mean is technically, what you can do, if you're in if you are in the model free, if you're in this situation, what you could do is you could say, Well, since these model based RL techniques tend to work better, I could hear inside the agent, I could try to learn a model of the environment, E prime, and I could try to basically learn what happens in my environment when I do a certain action. And then I could use that model right here, in order to do this planning that I know from up here, okay. So in this case, they go for exactly this they go for, let's learn a model of the environment, this is not an exact model, it's a learned model. And then let's use that to plan. Now, this usually has a bunch of, you know, very, a bunch of things that go against it, namely, if this model right here is bad, then the planning in the model will often accumulate and even exaggerate the errors that are in this model. So it's sometimes very hard to learn a model of the world and then use that for planning. And I've recently done a paper where where curious AI takes denoising auto encoders to regularize exactly such a planning procedure to counter this. And this paper right here is a different approach of combining this learned model. This learned model. So, okay, that was about the first sentence. They say it aims to learn a global model for the dynamics of the environment. A good model can potentially enable planning algorithms to generate a large variety of behaviors and solve diverse tasks, which is true, right? If I have a model of the environment, then I could just use it to plan, I wouldn't even have to do anything fancy anymore, right? If I have a model of how my tic-tac-toe works, I can just plan, plan my way to success. And I can do this alpha zero style. Or if the, if this state tree is small enough, I can actually just use a planner. And I don't even have to, I don't have to do anything anymore. If I have a good model, they say however, learning an accurate model for complex dynamical systems is difficult. And even then the model might not generalize well outside the distribution of states on which it was trained. So this is another problem. If you learn a model, it's only going to be valid in a certain range. Okay. And say in this work, we combine model based learning with model free learning of and the model free learning is of primitives that make model based planning easy. So what they attempt to do is they attempt in an unsupervised fashion to learn so called set of skills. And the set of skills could be something like walk forward, walk backward, stay put, jump. So they attempt to learn things like this in a model free way, that the model is simply asked to come up with these things or the agent is simply asked task to come up with these things. And then in in stage two, a planner can use these skills and decompose a plan. Now this plan here, the special thing about this plan, this planner, it doesn't operate in the space of actions of like small scale actions, it actually operates in the space of these skills right here. So here would be walk forward, walk back. So and with if we have a good enough model of the environment, then will tell us if I walk forward in this situation, what will happen? Okay, so I can walk forward and then after that I could walk backward, what's going to happen? And if I have a good model of the environment over the and the actions now are these macro actions of these skills, then I can use planning to reach my goal. Okay, so the question is, how do we come up with useful skills that the planner can then use? So they need to be somewhat diverse, right? But also, and here is the crucial part and the the sort of contribution of this paper, they say, how can we discover skills, whose outcomes are easy to predict? And this is how they counteract this notion here, that if your environment model is crap, then you're you're, it can't basically can't be used for planning, you'll just make it worse. So what they say is that these things right here, these skills that we learn, we will learn them in a way that make them easy to predict. So it makes it easy to predict what will happen after I do them. So they must be at the same time diverse. So only, you know, if you stay put, it's pretty easy to predict what's going to happen like nothing. Okay, but we're going to see in the exact objective that they have to be sort of diverse. But also, so only one of them can be stay put, the other ones have to do something else. But also, they should be easily predictable by the environment model. And if you learn the skills such that they're easily predictable, your environment model will make less errors, and then you can use it for planning. Okay, let's dive in. They do actually open source code, and they have more of these videos, if you want to check it out, I'll link everything in the description. Okay, let's actually dive into the the meat right here. They say they do maximize the mutual information. And we're going to see between between what and what they want to maximize the mutual information. If you don't know what the mutual information is, the mutual information is a quantity. The mutual information between x and y is a quantity, that's the entropy of x minus the entropy of x conditioned on y, or you can also decompose it in the other way around entropy of y minus entropy of y conditioned on x. And we're going to they apply this, where is it equation two right here. Okay, so what they want is the following, they want to maximize the mutual information. And the mutual information basically means how much does one variable tell me about the other variable, okay. The mutual information between the skill and we're going to see what that is, and the next state. So what, what is a skill? A skill is one entry in our table right here. So these here are skills, skills, and they're in their index by z. Now z here, it seems like they're discrete, right? But in this case, they would be z would be a continuous vector. But it's easier if you imagine that. So each one of this is like z one, z two, and so on. They're going to be continuous, but in our case, we'll just think of a discrete set of skills to be learned. Okay, so they say we want to maximize the mutual information between the skill that's currently in action. So in every, every time, the agent has to like choose a skill and saying like, Okay, now I'm going to walk forward. And it's in a given state. And what you want to say is you have to maximize the mutual information between the skill and the next state, which means that it means two things, which you can see right here, you can decompose it in two different ways. One way is the following is to say, if I know which state I'm in, what's the entropy over my? Okay, that's a wrong bad way of formulating it. It's if I knew if I know these two things. So if I know the state I'm in, and the next state that I'm going to write, I can in hindsight, I look back, if I know both things, what can I say about this skill z right here, that I couldn't say just from the starting state. So the starting state, let's say is the person right here, and the end state is the person a little bit more over there. So let's let's call this forward, it's the person is looking to the right. Okay. Now, if I only show you if I only show you the state on the left, the starting state, what can you tell me which action is going to follow right here? Basically, you can't tell me much, it could be any action like walk forward, walk back, stay put. But if I also show you the next state, then you can pretty confidently say, Ah, I know what you did, you did walk forward. Okay, so this, in this situation, we would have a high mutual information between z and s prime in the formulation here, if you decompose it in the other way, it this is equivalent, but it's a different way of thinking about it, it means, when I show you these two things, how much more can you tell me about the next state than if I only show you this. So in this formulation, what we would do is, we would say, I tell you, the human is here looking to the right, what can you tell me about the next state? And you like what I, I couldn't tell you very much, right? It can be anything. But if I then tell you the action is walk forward, then you could say, Ah, now I now I get it, it's probably going to be something like this. Okay, this also would be a high mutual information. So you see that the the task of maximizing this mutual information is good, because what happens if I don't, if I have a low mutual information, if I have a low mutual information, it would mean that I could predict the next state, just as well from the current state, it doesn't make a difference whether you give me the skill or not, it would not make a difference. And that is only the case if my skills are basically either all the same or all pretty, pretty random and pretty useless. Right. So if, if all my skills are basically walking backwards, then I don't, you don't have to tell me which skill you do, I'm gonna know that the next state is like this. So you can see that the objective of maximizing the mutual information between the skill and the next state is going to result in a situation where these skills are going to be first of all, diverse, and second of all, easy to easy to predict. Okay. And to see this, yeah, we only have to imagine what would happen, what would happen in a in a situation where the skills weren't diverse or weren't easy to predict. And you'll get exactly the situation where the information of the skill doesn't help you in predicting the next state, because yeah, either it's obvious or it's random. Okay, so we agree that it makes sense to maximize the mutual information. And they decompose this into two objectives. So they say the mutual information is basically what you'll have to do is you'll have to it decomposes into two terms where you can into two terms in a lower bound in the mutual information. And this is kind of the this is sort of the standard variational approximation literature. If you're into that read up on variational auto encoders and things like this. Basically, the two steps here are you tighten the variational lower bound and you maximize the approximate lower bound. Okay, so you have the mutual information and you can lower bound it. Okay, you can you can lower bound it by this quantity. Now the if since this is a lower bound, you can prove that this is a lower bound. It means that the higher you make this term, then the the more basically, okay, if it's a lower, I don't know how to formulate, but it should be fairly obvious if this if this thing on the right is a lower bound to the mutual information, then maximizing the thing on the right will maximize the thing on the left. And it will do so. Very so imagine I is up here. And this E on the right side is down here. It's a lower bound, right? It's lower than I. So if I maximize E, well, I haven't really done anything to I but if I maximize it even more up to here, and since it's a lower bound, I know now my I must be at least higher than this. Okay, so maximizing a lower bound to a quantity will ultimately increase the quantity. But you can also the efficiency by which it does this depends on how tight the bound is. So if the bound is very tight, like this, you see I is not much above E. If the bound is very tight, then maximizing E will result in a faster maximization of I. Okay, so you can do two things. You can maximize the quantity that is the lower bound, or you can tighten the bound. And here we can see that the difference that the tightness of the bound depends on this quantity right here, which is the KL divergence between this and this. So yeah, let's watch this in the context of we can actually go go through it on the high level. If you've never done this variational approximation sort of math, then this might be a bit informative. Okay, so the thing right here is just pops out of the definition of the mutual information. It's the it's basically the differences of the entropies, which the entropies are log quantities, right. So if you have a log a minus log b, that you can also write this as the log of the fraction of a over b, that's just a property of the log. And so it's expectations over logs, these entropies. So you can write it as this thing right here. Okay. And this basically says, this is very high, if or very low, depending so you need to whether something is low or high always will depend on what you exactly you have to consider. But ultimately, what you'll want is the ratio between this quantity, which is the probability of the next state given the current state and the skill you're taking divided by just the probability over the next state, given the the current state in expectation over all the skills, current states and next states. Now what they're saying is this here, this is basically the environment, right? This is if you are in a state and you perform a skill, what's the next state? That's that's the true environment appear is the true environment, which we don't know, right? We don't know what the environment's going to do. But we would like to learn a model for the environment. And this model for the environment is now q, q theta, phi, theta, phi, Greek letter. So q phi here is going to be a neural network that will approximate the environment. And in this probabilistic framework, it is going to be a learned distribution that will approximate the distribution of p. So we approximate it by this, but now this is here it says equal equal, right? This is not equal, because this is just an approximation. So the equality must become must be basically compensated for by this term, right here, you can see, this here is expanded into these two, you can go through the exact definitions and see why this is an equality. But basically, you can say that the mutual information is this expectation, or it is this expectation. But now you have to correct for the fact that here, you only have an approximation. And you have to correct for the fact by exactly the amount by which the approximation is different than the quantity that you're approximating. And this is this key KL divergence right here. So the KL divergence basically measures how different two distributions are. It's, it's sort of a distance, not exactly distance, but sort of a distance between these two distributions right here. It says, here's the real world. And here is your estimate of the real world, how much do they disagree. And that quantity plus, then you can replace your world, the exact world distribution by your approximate distribution, and you still are equal to the mutual information. And now the basically the trick is you say, oh, the KL divergence is always positive. It's a quantity that it can only be a positive number. So if I leave it away, certainly, this is only this is going to be a lower bound to the quantity. Okay. All right. So two tasks right here. First of all, tighten the variational bound, which means make this quantity small, make your approximate world model as close as possible to the real world. How do we do this neural network, okay, you input trajectories. I was in this state, I performed this skill, and I ended up in this state. Sorry, that's this. And then you simply match your neural network simply matches what happens in the real world, it learns the transition function, basically. So that's, that's the tightening of the variational bound. And the second step is this right here to to maximize the approximate lower bound, right, the first step was tighten variational low bound, that basically means make your world model more accurate. And the second is tighten that maximize the approximate lower bound. Now, this is going to part the this is going to be the part that says, now, given that I already have a better world model right here, can I improve my, can I sort of improve my skills, such that they become easier to predict and more diverse? Can I improve my skills such that this mutual information right here gets to be high as high as possible? Okay. So this is sort of an alternating thing. And you can see this in this very, very, very, very confusing diagram, honestly. So what are you going to do in this algorithm? First of all, in each episode, you're going to select a skill at random. And as I said, these skills, they're not predefined. So no one tells the agent to walk for it simply says, Okay, you have like, in a discrete case, you would have like, you have five skill slots, right? And the only thing I require is that they're sort of, you know, consistent over time. So skill one is always going to be sort of the same thing and skill two, but agent, you can basically decide what skill one is, right? But make the skills such that it's predictable, and that the different skills are diverse. Okay, so you're going to sample one of the skills, like skill zero or whatnot. And then you're going to do two things. First of all, you're going to learn these skill dynamics, which is you're going to learn your approximate model of the world. Okay. And how do you do that? Basically, here, you're the agent, and the agent will. So what what does the agent have to do, the agent will take in the skill Z. And it will take in the current state of the world, and it will output an action. Now, this is the model free part, right? So the agent that somehow has to come up with saying, ah, skill zero, that's, that's, that's walking forward. And in this situation, walking forward means I have to lift my leg or something like this. So you're going to take your skill, you're going to with your agent perform an action based on that skill and the current state of the world, then the environment is going to give you the next state right here. And from those things, you can now learn your world model, you know, I was in state s, I, I performed action a, but I performed action a based on skill Z. And then I ended up in state s prime. And I can learn a model of the world, right? This is a triple, I can do supervised learning of a world model. Now here, they do probabilistic learning, but and we're going to see in a second how that works. But ultimately, they approximate the world with their model. Cool. So that's the this outer loop. And then what are they going to do next, they're going to use that world model to determine a reward for the agent, and the reward for the agent for taking the action. So the reward is going to be, oh, agent, you took action a. Now what's your reward for doing this? This is the model free reinforcement learning part, your reward is going to be very high, if if this was very predictable. And if it is also diverse, right, so now, the agent has to sort of map sort of the agent has to go and make this quantity very high this, we want the outcome of these actions to be predictable, and dive and the actions themselves to be diverse. It is, I'm sorry, it's very hard to keep all of this very straight, okay. But ultimately, two steps, learn world model from the experience that you've generated. And second thing, learn the agent such that it maximizes this this quantity that we've seen before. And you do this via giving the agent a reward that is proportional to the mutual information. And we've already seen that we can approximate the mutual information by by this quantity here. Okay. So learn world model, and make the agent go higher mutual information, two steps. Okay, learn world model is very, very classic, you can say, okay, I need to improve, I need to minimize this KL divergence. So I need the gradient with respect to the parameters of my world model, I can write down the KL divergence like this. And then since I can do this reverse, so log a over b is log a minus log b. And since the world doesn't depend on the parameters of my model, this will simply give me this thing right here, which is the gradient of the log probability basically of my neural network. And this can be just optimized straightforward. This is a neural network optimized with gradient descent. These are the inputs, this is the output. Now, okay, you this is all probability distributions, but ultimately, you can you can do it pretty straightforward. Okay, so corresponds to maximizing the likelihood of the samples from P under q. Now, the second step, maximize the approximate lower bound, okay. So after they say after fitting q after improving our world model, we can optimize pi pi is the agent that actually takes the actions based on the skill. So it's given a skill, and it needs to perform an action. And it needs to maximize this quantity, as we've seen, needs to maximize the mutual information between if I know the action and if I don't, or the mutual information between the skill and the next state. I say note, this is a reinforcement learning style optimization, with a reward function of this quantity. However, so you look at the quantity that they need right here, the quantity is going to be this thing. And this thing is just I feed the skill and the state into my world model. And I look what what comes out of the world model. So this I can compute, right. But this thing right here, I can't compute because this is this is what happens in the world when I'm in state s, and I just run my agent over in expectation over all the skills. So this I don't know, they have a log of this is intractable. And they so we approximate the reward function for pi as this thing right here. Now, first, let's look at what this thing is. So the reward of taking action a and action a is based on skill z, right? So skill z was fed into the agent, the agent comes up with action a. Oh, you want me to walk forward in this situation? Okay, I'm going to lift my leg. That's the action. Okay, so the reward for this action, given this skill, and given the current state is going to be what it's going to be very high, if this here is very high. So it's going to be very high, if the probability so this s prime is the state you ended up in, right? So after taking the action, you ended up in s prime. So if what does it mean, when this quantity is very high, it means that my world model q, that is approximating the world thinks that this state is very probable, if you were in this state, and are given the skill z. So this basically means that the neural network can predict with very high accuracy, what's going to happen if you are in this state and are given this skill to perform, right? This is one of the things that we want. Now, what is it divided by? It's divided by this. And you can see here, the zi are other skills. So it is, what does this mean? This is almost the same quantity, it means how well can the same neural network predict the next state, if you were given a different skill. So it means if I'm here, and I ended up here, how well can you predict it if I tell you that I walked forward? And here you ask, well, how well can you predict it if I also if I told you you walked backward, if I told you you jumped if I told you, and so on. So you basically aggregate over all the other over all the other skills you could perform. And each time you ask the neural network, well, how likely is it that you end up in the state that I ended up when? So what does it mean if this quantity is high, or sorry, if the entire sum here is high, that means that the skill doesn't really give you much information, the neural network is very good, no matter which skill you selected, right? It's very accurate in predicting the next state doesn't really matter. The skill doesn't really matter. And this is what we don't want, right? We want that the the skills are very diverse, right? So the top part is they're easy, it's easy to predict what will happen if you perform a given skill. And if we divide this by the bottom part, and this makes it such that these skills are very diverse, because if they're not diverse, then it doesn't really matter which one you perform. And then this quantity on the bottom will be very high, but we divide by it. So we want, we want it to be low. Okay, that the reward is going to be the log of this fraction here. And this makes sense, right intuitively, but they're going to try to motivate this mathematically. And for motivating this mathematically, of course, they need to approximate this quantity right here. This quantity is the denominator. So they this denominator is a proc is an approximation to this, it's an approximation. As you can see here, this is sort of sort of a sample based approximation to the transition from s to s prime under the distribution of z. But what you want is just is the transition from s to s prime, not in your approximation, but in the real world. And they formulate this, they say, okay, we can decompose it as such as a as an integral over this conditional right here. So they bring in the z variable. And then they say, well, this, this is approximately approximately, we can replace this here by this. And we can replace this here by this, they say, well, since the this is a an approximation, the two, this is the world model is an approximation to the real world, we can sort of replace that. And then this is the this is the part that doesn't convince me they say, well, this p z of s, we can just replace it by p z. Now this is it's very tricky to see what these quantities are. Ultimately, it ends up being that right here. But it's it's it's so tricky. So they say, we replace p z given s by p of z. And, okay, let's think about this for a second. What does the top the bottom quantity is simply the distribution over your skills. And depending on your sample them, this could be like a uniform distribution over your skills, like that's fine. But what's the top thing? The top thing, basically, we can use base formula to reformulate it. It's p of s given z times p of right times p of z divided by p of s. So this quantity depends on multiple things. Here's that prior again. And this means what's the general distribution of states? What's the general distribution of states if your agent acts in the world, right? This and this we don't know. We don't we don't know. And also this right here. What's the distribution in the true world? What's the probability of a state given a given given that you were acting under a skill z. And this is also something we don't know because we don't know the world. We don't have the world model. So you run into the same problem again and again, that you're trying to approximate this and they want to make this so mathematically rigorous, but ultimately, and they go in the appendix, they go through various ways that they could solve this. But ultimately, they're just to say, well, this is approximately the same. So this right here, it basically means what skills if you're if you're in a certain state, what skills brought you here, basically, what skills brought you here? What's the distribution of skills that brought you to this state? And they say, well, we're just going to approximate that by the prior distribution over our skills, we disregard the state here. And this seems overly shaky. Like, as I said, the entire paper makes sense. But I just feel it's trying to be overly mathematical, and then run into a point where you can't be and then they're just okay, we'll, we'll just replace it. And then sort of things break down, like, you can only be overly mathematical to some degree. It doesn't really fit. But okay, so this is how you discover the skills, you maximize these quantities, alternately, you learn the world model, and you improve your your skills by making them diverse and easily predictable. So how do you then plan using these skills? This is the second part of the paper. And this is just as complicated as the first part. So they say, given the learned skills, so the learned skills are policies over action given the DZ, right? So now you know how to like walk forward and walk back and so on. And now you're, you're placed in a world, and you're given this checkpoint, it says, well, walk there. And you want this to do this using planning, you don't want to learn anymore, you simply want to plan. Okay, what do you do? And as I said, this is even more. So what you want to do is you want to do something like model predictive control, but not over actions, but over your learned skills. So you have this planner in the NPC and the planner will in its head roll out a number of different a number of different plans, it will kind of explore a bunch of different different plans, Z, it will roll them out, I'll say, okay, if I do this, and this, and this, and this, what will happen using its world model that it has learned, it will observe what's going to be the reward in each of these cases. Now, they say here access the environment reward, but can also be estimated. And this is another sort of, I feel weak point of this in that they now assume they have the true reward function. But they don't have a world model, right? They don't have the world model, but they assume that they can sort of always ask for the true reward, which is probably not the case if you if you like if you had a true world, but it could be the case, the reward could be something like, well, if you're over there, you get higher reward, but you don't exactly know how to get over there. In any case, so they roll out a bunch of trajectories in their head, they kind of plan forward, see what's going to happen if they do this or that or this or that. And then they choose the best one of these forward thoughts. And they execute it in the real world, right? So they say, Well, I'm going to you choose the skill walk forward. So the agent is now going to be tasked with walking forward. And it's going to do that in the real world for a certain amount of steps, like 10 steps of walking forward. After 10 steps of walking forward, you go back, you say, I'm in this new situation right here, what should I do? And again, the planner is going to be like, if you first walk forward and then walk back, where are you going to be, and so on. So the planner will always plan, basically to go from where you are, to the checkpoint, using a composition of the skills that you have learned. So the planner may be fine, okay, if I first walk forward, walk back a bit, and so on, I'm going to get to the goal, I'm going to reach the goal. Now please, agent execute this first thing, walk forward, the agent executes it, and maybe it won't, you know, it won't do as well, it will maybe end up here. And then it says, Well, I'm here now, please plan again. So it plans again, it says, Okay, I can still kind of walk back, I'll be here here, but then I have to do something else. So now walk back. And, okay, so this is what's going to happen. But it is going to happen in a weird way. Namely, what we keep our normal, since everything is continuous, we'll keep normal distributions of all our future steps. So we don't say, Okay, I go here, and then I go here. What you'll say is I approximately go here. And after that, I'll approximately go here. And you will do it in such a way that the peak of this normal distribution is going to be the highest, where you think you will get the most reward. If you follow this trajectory, like if you follow this trajectory, you get a very high reward. And if I follow a trajectory that maybe goes here, I won't get a high reward. If it actually turns out in your imagination that you do get a high reward for this trajectory, you'll change this distribution, such that the peak is here. And, of course, the tighter the peak is, the more sure you are. So you sort of are looking, if you look out into the world, you want the closest steps to be very peaky. And then as you look out, they can be more more sort of broad. And that's how you plan ahead, you keep refining, you keep doing a step. So if you go from here to finally you choose, I want to go here where the tip is the highest over here, then you imagine forward again, you refine these distributions over the future. And then you take the next step that gets you to the where the highest peak is right here, basically, and so on. This is simply planning in a continuous domain, it is pretty analogous to how you would plan in like, alpha go, if you or tic tac toe if you had a planner, but since everything's continuous, it makes it just so much harder. So they Yeah, they always update these distributions, as you can see here, to the skill that gave you a high reward in your imagination compared to the rewards of the other plans that you had. Okay, well, this was a long, long way until we got here. But if you recap, so first, they in an unsupervised fashion, learn these low level skills such that they're easily predictable by their own world model, and diverse. And then in the second step, they can use that to to do basically planning. So they first learn these skills, and then the planner composes them to make the agent do something. And again, the agent will never have to learn how to do this go from checkpoint to checkpoint, because the planner can just compose these low level skills. So they have these experiments right here. And we won't go through the experiment because this video is already very, very long, but they basically show that they their learned things, actually, their learned skills do end up being very diverse do end up predictable, have a high variance, and so on, they have to give certain priors to it to make it actually work in a real setting. But the results you can actually see in these videos and in the graphs, I invite you to check out the paper if you're still here. Thanks for being here. I hope this this was one of the most more complicated and mathy papers we looked at. But I think I still think it's fun. And I still think the outcome is pretty impressive right here, how you can use math to derive basically these intuitive, very intuitive objectives to learn. It's also pretty cool. Alright, that was it for me. And bye bye.
[{"start": 0.0, "end": 8.52, "text": " Hi there, take a look at this humanoid right here. It walks from one checkpoint to another"}, {"start": 8.52, "end": 13.84, "text": " checkpoint, and then to the next checkpoint, and so on. And that is its task, it gets reward"}, {"start": 13.84, "end": 20.080000000000002, "text": " from walking from checkpoint to checkpoint. Take a look at this. And this is called the"}, {"start": 20.080000000000002, "end": 26.5, "text": " end. It also walks from checkpoint to checkpoint. Now we've seen a lot of reinforcement learning"}, {"start": 26.5, "end": 33.24, "text": " algorithms in this environment is called Muko Joe, where you basically teach these little"}, {"start": 33.24, "end": 39.56, "text": " things to walk around. So the what's the impressive part here, the impressive part is that at"}, {"start": 39.56, "end": 47.28, "text": " training time, this and has never ever seen what a checkpoint is, and has never gotten"}, {"start": 47.28, "end": 52.400000000000006, "text": " any reward from walking from checkpoint to another checkpoint. Actually, it has never"}, {"start": 52.4, "end": 58.48, "text": " gotten any reward for anything that that is given from the environment, it has discovered"}, {"start": 58.48, "end": 65.92, "text": " the skill of walking by itself. And then at test time, there is no additional learning"}, {"start": 65.92, "end": 70.92, "text": " when it goes from checkpoint to checkpoint, it simply composes the skills that it knows"}, {"start": 70.92, "end": 80.28, "text": " from its unsupervised discovery phase in order to go from checkpoint to checkpoint. So here"}, {"start": 80.28, "end": 86.52, "text": " you can see, this paper basically proposes to learn these skills in a completely unsupervised"}, {"start": 86.52, "end": 92.36, "text": " way at the beginning sort of so in the training phase, it learns these skills, you can see"}, {"start": 92.36, "end": 97.72, "text": " these skills that the humanoid has learned. And then all you have to do at test time is"}, {"start": 97.72, "end": 103.54, "text": " to compose these skills to reach a given goal. And these are the things that the end has"}, {"start": 103.54, "end": 110.80000000000001, "text": " learned. Watch out, this is trippy. You can see it has learned various walks various ways"}, {"start": 110.80000000000001, "end": 115.24000000000001, "text": " walking here. And if you know anything about this environment, it's actually not that easy"}, {"start": 115.24000000000001, "end": 122.96000000000001, "text": " to make the ant walk by itself. So the the discovery here that these skills that are"}, {"start": 122.96000000000001, "end": 128.8, "text": " discovered are various ways of walking is actually already pretty impressive. And the"}, {"start": 128.8, "end": 133.92000000000002, "text": " last thing here, this cheetah, of course, also has to has learned to walk back forward"}, {"start": 133.92000000000002, "end": 139.60000000000002, "text": " kind of jump around and so on. So we're going to dive into this paper. It's called dynamics"}, {"start": 139.60000000000002, "end": 147.84, "text": " aware unsupervised discovery of skills by Archie Sharma and other people of Google brain."}, {"start": 147.84, "end": 153.16000000000003, "text": " So this was published at iClear 2020. And on a high level, I already said it's basically"}, {"start": 153.16, "end": 161.32, "text": " proposing to learn unsupervised skills, and then to compose these skills in a model based"}, {"start": 161.32, "end": 168.96, "text": " planning method at test time to reach a given goal without additional training without additional"}, {"start": 168.96, "end": 176.92, "text": " training on the reward that you give at test time. As always, if you like videos like this,"}, {"start": 176.92, "end": 184.2, "text": " you're very welcome to subscribe and share it to everyone you know. Yeah. Okay, let's"}, {"start": 184.2, "end": 191.48, "text": " dive in. So they say, conventionally model based reinforcement learning aims to learn"}, {"start": 191.48, "end": 198.72, "text": " a global model for the dynamics of the environment, which is not exactly true, right? So we have"}, {"start": 198.72, "end": 205.39999999999998, "text": " we dive into model based and model free reinforcement learning. Model based reinforcement learning"}, {"start": 205.4, "end": 212.32, "text": " basically means that you have a model of the environment. A example for this is, let's"}, {"start": 212.32, "end": 220.84, "text": " say, tic tac toe. So in tic tac toe, I know, I have nine actions at my disposal. And if"}, {"start": 220.84, "end": 228.4, "text": " I take action, let's say I take action zero, which is to make a let's say I'm the X player."}, {"start": 228.4, "end": 233.84, "text": " So I take action zero. And if I you know, number my things correctly, then that will"}, {"start": 233.84, "end": 240.24, "text": " result in this state of the world. Okay, so I know exactly how the world will look when"}, {"start": 240.24, "end": 245.72, "text": " I take a given action. And what that allows me to do is that allows me to actually plan."}, {"start": 245.72, "end": 250.72, "text": " So I cannot plan ahead, I can say what would happen if I took action zero, so I can do"}, {"start": 250.72, "end": 257.4, "text": " this in my mind. And then what would happen if I took action one, I can be like, okay,"}, {"start": 257.4, "end": 262.26, "text": " that's gonna happen. And I can do this with many things. And I can in my mind, continue"}, {"start": 262.26, "end": 269.96, "text": " this and basically roll out the entire games, or and then only do the given action that"}, {"start": 269.96, "end": 274.8, "text": " has led to the best result at the end, right. So this is model model based reinforcement"}, {"start": 274.8, "end": 280.4, "text": " learning means you have a model of the environment, you know what's going to happen when you perform"}, {"start": 280.4, "end": 287.59999999999997, "text": " given actions. And you can also combine this with machine learning, like, you know, alpha,"}, {"start": 287.6, "end": 292.84000000000003, "text": " alpha go alpha zero or so they have models of the games they're playing, they know what's"}, {"start": 292.84000000000003, "end": 298.12, "text": " going to happen. But it's very intractable to basically go down this entire tree and"}, {"start": 298.12, "end": 304.6, "text": " plan out everything. So they combine it with machine learning. It doesn't change that it's"}, {"start": 304.6, "end": 312.06, "text": " a model based. Now in, in opposition to that in model free in in reinforcement learning,"}, {"start": 312.06, "end": 316.6, "text": " what you do, you are these agent, the heirs of the environment, and you simply have to"}, {"start": 316.6, "end": 322.0, "text": " do an action, I do action zero, and the environment just gives you back a reward and the next"}, {"start": 322.0, "end": 329.32000000000005, "text": " observation. And it you have basically no clue how the environment will change. If you"}, {"start": 329.32000000000005, "end": 336.08000000000004, "text": " do something, you all these and all these, these agents do or the classic model free"}, {"start": 336.08000000000004, "end": 343.92, "text": " agents do is basically they're trying to have a neural network somewhere in them. And you"}, {"start": 343.92, "end": 349.08000000000004, "text": " put the observation in here and outcomes and action. And you can do this in various ways"}, {"start": 349.08000000000004, "end": 354.08000000000004, "text": " into Q learning or policy gradient or actor critic, and so on. But ultimately, it's simply"}, {"start": 354.08000000000004, "end": 360.56, "text": " mapping the optic current observation, and maybe the last few to the best action to take"}, {"start": 360.56, "end": 366.82, "text": " without explicitly modeling what happens in the environment. Now, when they say model"}, {"start": 366.82, "end": 373.68, "text": " based reinforcement learning, what they mean is technically, what you can do, if you're"}, {"start": 373.68, "end": 379.2, "text": " in if you are in the model free, if you're in this situation, what you could do is you"}, {"start": 379.2, "end": 387.0, "text": " could say, Well, since these model based RL techniques tend to work better, I could hear"}, {"start": 387.0, "end": 393.52, "text": " inside the agent, I could try to learn a model of the environment, E prime, and I could try"}, {"start": 393.52, "end": 399.26, "text": " to basically learn what happens in my environment when I do a certain action. And then I could"}, {"start": 399.26, "end": 406.24, "text": " use that model right here, in order to do this planning that I know from up here, okay."}, {"start": 406.24, "end": 414.92, "text": " So in this case, they go for exactly this they go for, let's learn a model of the environment,"}, {"start": 414.92, "end": 420.56, "text": " this is not an exact model, it's a learned model. And then let's use that to plan. Now,"}, {"start": 420.56, "end": 427.88, "text": " this usually has a bunch of, you know, very, a bunch of things that go against it, namely,"}, {"start": 427.88, "end": 436.52, "text": " if this model right here is bad, then the planning in the model will often accumulate"}, {"start": 436.52, "end": 441.88, "text": " and even exaggerate the errors that are in this model. So it's sometimes very hard to"}, {"start": 441.88, "end": 447.9, "text": " learn a model of the world and then use that for planning. And I've recently done a paper"}, {"start": 447.9, "end": 457.0, "text": " where where curious AI takes denoising auto encoders to regularize exactly such a planning"}, {"start": 457.0, "end": 463.8, "text": " procedure to counter this. And this paper right here is a different approach of combining"}, {"start": 463.8, "end": 475.08, "text": " this learned model. This learned model. So, okay, that was about the first sentence. They"}, {"start": 475.08, "end": 479.88, "text": " say it aims to learn a global model for the dynamics of the environment. A good model"}, {"start": 479.88, "end": 485.76, "text": " can potentially enable planning algorithms to generate a large variety of behaviors and"}, {"start": 485.76, "end": 490.71999999999997, "text": " solve diverse tasks, which is true, right? If I have a model of the environment, then"}, {"start": 490.71999999999997, "end": 496.08, "text": " I could just use it to plan, I wouldn't even have to do anything fancy anymore, right?"}, {"start": 496.08, "end": 502.59999999999997, "text": " If I have a model of how my tic-tac-toe works, I can just plan, plan my way to success. And"}, {"start": 502.59999999999997, "end": 507.56, "text": " I can do this alpha zero style. Or if the, if this state tree is small enough, I can"}, {"start": 507.56, "end": 513.1, "text": " actually just use a planner. And I don't even have to, I don't have to do anything anymore."}, {"start": 513.1, "end": 517.96, "text": " If I have a good model, they say however, learning an accurate model for complex dynamical"}, {"start": 517.96, "end": 524.08, "text": " systems is difficult. And even then the model might not generalize well outside the distribution"}, {"start": 524.08, "end": 528.84, "text": " of states on which it was trained. So this is another problem. If you learn a model,"}, {"start": 528.84, "end": 535.84, "text": " it's only going to be valid in a certain range. Okay. And say in this work, we combine model"}, {"start": 535.84, "end": 543.1600000000001, "text": " based learning with model free learning of and the model free learning is of primitives"}, {"start": 543.1600000000001, "end": 552.36, "text": " that make model based planning easy. So what they attempt to do is they attempt in an unsupervised"}, {"start": 552.36, "end": 559.36, "text": " fashion to learn so called set of skills. And the set of skills could be something like"}, {"start": 559.36, "end": 573.8000000000001, "text": " walk forward, walk backward, stay put, jump. So they attempt to learn things like this"}, {"start": 573.8000000000001, "end": 581.2, "text": " in a model free way, that the model is simply asked to come up with these things or the"}, {"start": 581.2, "end": 587.08, "text": " agent is simply asked task to come up with these things. And then in in stage two, a"}, {"start": 587.08, "end": 594.5600000000001, "text": " planner can use these skills and decompose a plan. Now this plan here, the special thing"}, {"start": 594.5600000000001, "end": 600.7800000000001, "text": " about this plan, this planner, it doesn't operate in the space of actions of like small"}, {"start": 600.7800000000001, "end": 606.08, "text": " scale actions, it actually operates in the space of these skills right here. So here"}, {"start": 606.08, "end": 612.76, "text": " would be walk forward, walk back. So and with if we have a good enough model of the environment,"}, {"start": 612.76, "end": 618.4399999999999, "text": " then will tell us if I walk forward in this situation, what will happen? Okay, so I can"}, {"start": 618.4399999999999, "end": 623.76, "text": " walk forward and then after that I could walk backward, what's going to happen? And if I"}, {"start": 623.76, "end": 630.84, "text": " have a good model of the environment over the and the actions now are these macro actions"}, {"start": 630.84, "end": 637.98, "text": " of these skills, then I can use planning to reach my goal. Okay, so the question is, how"}, {"start": 637.98, "end": 644.4, "text": " do we come up with useful skills that the planner can then use? So they need to be somewhat"}, {"start": 644.4, "end": 650.64, "text": " diverse, right? But also, and here is the crucial part and the the sort of contribution"}, {"start": 650.64, "end": 660.88, "text": " of this paper, they say, how can we discover skills, whose outcomes are easy to predict?"}, {"start": 660.88, "end": 666.6, "text": " And this is how they counteract this notion here, that if your environment model is crap,"}, {"start": 666.6, "end": 671.16, "text": " then you're you're, it can't basically can't be used for planning, you'll just make it"}, {"start": 671.16, "end": 678.2, "text": " worse. So what they say is that these things right here, these skills that we learn, we"}, {"start": 678.2, "end": 685.32, "text": " will learn them in a way that make them easy to predict. So it makes it easy to predict"}, {"start": 685.32, "end": 689.98, "text": " what will happen after I do them. So they must be at the same time diverse. So only,"}, {"start": 689.98, "end": 694.36, "text": " you know, if you stay put, it's pretty easy to predict what's going to happen like nothing."}, {"start": 694.36, "end": 701.24, "text": " Okay, but we're going to see in the exact objective that they have to be sort of diverse."}, {"start": 701.24, "end": 706.92, "text": " But also, so only one of them can be stay put, the other ones have to do something else."}, {"start": 706.92, "end": 714.08, "text": " But also, they should be easily predictable by the environment model. And if you learn"}, {"start": 714.08, "end": 719.12, "text": " the skills such that they're easily predictable, your environment model will make less errors,"}, {"start": 719.12, "end": 728.32, "text": " and then you can use it for planning. Okay, let's dive in. They do actually open source"}, {"start": 728.32, "end": 733.48, "text": " code, and they have more of these videos, if you want to check it out, I'll link everything"}, {"start": 733.48, "end": 745.28, "text": " in the description. Okay, let's actually dive into the the meat right here. They say they"}, {"start": 745.28, "end": 754.8399999999999, "text": " do maximize the mutual information. And we're going to see between between what and what"}, {"start": 754.8399999999999, "end": 758.36, "text": " they want to maximize the mutual information. If you don't know what the mutual information"}, {"start": 758.36, "end": 763.6, "text": " is, the mutual information is a quantity. The mutual information between x and y is"}, {"start": 763.6, "end": 768.3199999999999, "text": " a quantity, that's the entropy of x minus the entropy of x conditioned on y, or you"}, {"start": 768.3199999999999, "end": 775.16, "text": " can also decompose it in the other way around entropy of y minus entropy of y conditioned"}, {"start": 775.16, "end": 785.3, "text": " on x. And we're going to they apply this, where is it equation two right here. Okay,"}, {"start": 785.3, "end": 792.04, "text": " so what they want is the following, they want to maximize the mutual information. And the"}, {"start": 792.04, "end": 797.7199999999999, "text": " mutual information basically means how much does one variable tell me about the other"}, {"start": 797.72, "end": 808.96, "text": " variable, okay. The mutual information between the skill and we're going to see what that"}, {"start": 808.96, "end": 818.76, "text": " is, and the next state. So what, what is a skill? A skill is one entry in our table right"}, {"start": 818.76, "end": 827.6, "text": " here. So these here are skills, skills, and they're in their index by z. Now z here, it"}, {"start": 827.6, "end": 832.8, "text": " seems like they're discrete, right? But in this case, they would be z would be a continuous"}, {"start": 832.8, "end": 839.4, "text": " vector. But it's easier if you imagine that. So each one of this is like z one, z two,"}, {"start": 839.4, "end": 846.12, "text": " and so on. They're going to be continuous, but in our case, we'll just think of a discrete"}, {"start": 846.12, "end": 853.12, "text": " set of skills to be learned. Okay, so they say we want to maximize the mutual information"}, {"start": 853.12, "end": 860.92, "text": " between the skill that's currently in action. So in every, every time, the agent has to"}, {"start": 860.92, "end": 867.24, "text": " like choose a skill and saying like, Okay, now I'm going to walk forward. And it's in"}, {"start": 867.24, "end": 872.04, "text": " a given state. And what you want to say is you have to maximize the mutual information"}, {"start": 872.04, "end": 879.8399999999999, "text": " between the skill and the next state, which means that it means two things, which you"}, {"start": 879.8399999999999, "end": 885.76, "text": " can see right here, you can decompose it in two different ways. One way is the following"}, {"start": 885.76, "end": 896.86, "text": " is to say, if I know which state I'm in, what's the entropy over my? Okay, that's a wrong"}, {"start": 896.86, "end": 907.7, "text": " bad way of formulating it. It's if I knew if I know these two things. So if I know the"}, {"start": 907.7, "end": 913.36, "text": " state I'm in, and the next state that I'm going to write, I can in hindsight, I look"}, {"start": 913.36, "end": 922.5, "text": " back, if I know both things, what can I say about this skill z right here, that I couldn't"}, {"start": 922.5, "end": 932.52, "text": " say just from the starting state. So the starting state, let's say is the person right here,"}, {"start": 932.52, "end": 942.68, "text": " and the end state is the person a little bit more over there. So let's let's call this"}, {"start": 942.68, "end": 949.16, "text": " forward, it's the person is looking to the right. Okay. Now, if I only show you if I"}, {"start": 949.16, "end": 954.28, "text": " only show you the state on the left, the starting state, what can you tell me which action is"}, {"start": 954.28, "end": 959.3, "text": " going to follow right here? Basically, you can't tell me much, it could be any action"}, {"start": 959.3, "end": 965.8399999999999, "text": " like walk forward, walk back, stay put. But if I also show you the next state, then you"}, {"start": 965.8399999999999, "end": 973.4599999999999, "text": " can pretty confidently say, Ah, I know what you did, you did walk forward. Okay, so this,"}, {"start": 973.46, "end": 980.96, "text": " in this situation, we would have a high mutual information between z and s prime in the formulation"}, {"start": 980.96, "end": 985.1600000000001, "text": " here, if you decompose it in the other way, it this is equivalent, but it's a different"}, {"start": 985.1600000000001, "end": 991.8000000000001, "text": " way of thinking about it, it means, when I show you these two things, how much more can"}, {"start": 991.8000000000001, "end": 998.0, "text": " you tell me about the next state than if I only show you this. So in this formulation,"}, {"start": 998.0, "end": 1004.64, "text": " what we would do is, we would say, I tell you, the human is here looking to the right,"}, {"start": 1004.64, "end": 1010.84, "text": " what can you tell me about the next state? And you like what I, I couldn't tell you very"}, {"start": 1010.84, "end": 1018.24, "text": " much, right? It can be anything. But if I then tell you the action is walk forward,"}, {"start": 1018.24, "end": 1023.68, "text": " then you could say, Ah, now I now I get it, it's probably going to be something like this."}, {"start": 1023.68, "end": 1031.36, "text": " Okay, this also would be a high mutual information. So you see that the the task of maximizing"}, {"start": 1031.36, "end": 1036.8, "text": " this mutual information is good, because what happens if I don't, if I have a low mutual"}, {"start": 1036.8, "end": 1044.12, "text": " information, if I have a low mutual information, it would mean that I could predict the next"}, {"start": 1044.12, "end": 1050.56, "text": " state, just as well from the current state, it doesn't make a difference whether you give"}, {"start": 1050.56, "end": 1057.76, "text": " me the skill or not, it would not make a difference. And that is only the case if my skills are"}, {"start": 1057.76, "end": 1064.0, "text": " basically either all the same or all pretty, pretty random and pretty useless. Right. So"}, {"start": 1064.0, "end": 1069.56, "text": " if, if all my skills are basically walking backwards, then I don't, you don't have to"}, {"start": 1069.56, "end": 1074.6399999999999, "text": " tell me which skill you do, I'm gonna know that the next state is like this. So you can"}, {"start": 1074.64, "end": 1081.76, "text": " see that the objective of maximizing the mutual information between the skill and the next"}, {"start": 1081.76, "end": 1089.92, "text": " state is going to result in a situation where these skills are going to be first of all,"}, {"start": 1089.92, "end": 1099.4, "text": " diverse, and second of all, easy to easy to predict. Okay. And to see this, yeah, we only"}, {"start": 1099.4, "end": 1105.48, "text": " have to imagine what would happen, what would happen in a in a situation where the skills"}, {"start": 1105.48, "end": 1111.0400000000002, "text": " weren't diverse or weren't easy to predict. And you'll get exactly the situation where"}, {"start": 1111.0400000000002, "end": 1115.52, "text": " the information of the skill doesn't help you in predicting the next state, because"}, {"start": 1115.52, "end": 1122.8000000000002, "text": " yeah, either it's obvious or it's random. Okay, so we agree that it makes sense to maximize"}, {"start": 1122.8, "end": 1130.32, "text": " the mutual information. And they decompose this into two objectives. So they say the"}, {"start": 1130.32, "end": 1139.12, "text": " mutual information is basically what you'll have to do is you'll have to it decomposes"}, {"start": 1139.12, "end": 1148.84, "text": " into two terms where you can into two terms in a lower bound in the mutual information."}, {"start": 1148.84, "end": 1154.1599999999999, "text": " And this is kind of the this is sort of the standard variational approximation literature."}, {"start": 1154.1599999999999, "end": 1160.1999999999998, "text": " If you're into that read up on variational auto encoders and things like this. Basically,"}, {"start": 1160.1999999999998, "end": 1167.9399999999998, "text": " the two steps here are you tighten the variational lower bound and you maximize the approximate"}, {"start": 1167.9399999999998, "end": 1176.62, "text": " lower bound. Okay, so you have the mutual information and you can lower bound it. Okay,"}, {"start": 1176.62, "end": 1184.6, "text": " you can you can lower bound it by this quantity. Now the if since this is a lower bound, you"}, {"start": 1184.6, "end": 1191.8, "text": " can prove that this is a lower bound. It means that the higher you make this term, then the"}, {"start": 1191.8, "end": 1197.56, "text": " the more basically, okay, if it's a lower, I don't know how to formulate, but it should"}, {"start": 1197.56, "end": 1202.6599999999999, "text": " be fairly obvious if this if this thing on the right is a lower bound to the mutual information,"}, {"start": 1202.66, "end": 1208.44, "text": " then maximizing the thing on the right will maximize the thing on the left. And it will"}, {"start": 1208.44, "end": 1216.92, "text": " do so. Very so imagine I is up here. And this E on the right side is down here. It's a lower"}, {"start": 1216.92, "end": 1223.8400000000001, "text": " bound, right? It's lower than I. So if I maximize E, well, I haven't really done anything to"}, {"start": 1223.8400000000001, "end": 1229.48, "text": " I but if I maximize it even more up to here, and since it's a lower bound, I know now my"}, {"start": 1229.48, "end": 1235.08, "text": " I must be at least higher than this. Okay, so maximizing a lower bound to a quantity"}, {"start": 1235.08, "end": 1241.52, "text": " will ultimately increase the quantity. But you can also the efficiency by which it does"}, {"start": 1241.52, "end": 1249.0, "text": " this depends on how tight the bound is. So if the bound is very tight, like this, you"}, {"start": 1249.0, "end": 1257.68, "text": " see I is not much above E. If the bound is very tight, then maximizing E will result"}, {"start": 1257.68, "end": 1264.68, "text": " in a faster maximization of I. Okay, so you can do two things. You can maximize the quantity"}, {"start": 1264.68, "end": 1270.3, "text": " that is the lower bound, or you can tighten the bound. And here we can see that the difference"}, {"start": 1270.3, "end": 1274.92, "text": " that the tightness of the bound depends on this quantity right here, which is the KL"}, {"start": 1274.92, "end": 1286.04, "text": " divergence between this and this. So yeah, let's watch this in the context of we can"}, {"start": 1286.04, "end": 1293.12, "text": " actually go go through it on the high level. If you've never done this variational approximation"}, {"start": 1293.12, "end": 1300.84, "text": " sort of math, then this might be a bit informative. Okay, so the thing right here is just pops"}, {"start": 1300.84, "end": 1307.36, "text": " out of the definition of the mutual information. It's the it's basically the differences of"}, {"start": 1307.36, "end": 1313.36, "text": " the entropies, which the entropies are log quantities, right. So if you have a log a"}, {"start": 1313.36, "end": 1319.6399999999999, "text": " minus log b, that you can also write this as the log of the fraction of a over b, that's"}, {"start": 1319.6399999999999, "end": 1327.4799999999998, "text": " just a property of the log. And so it's expectations over logs, these entropies. So you can write"}, {"start": 1327.4799999999998, "end": 1337.3799999999999, "text": " it as this thing right here. Okay. And this basically says, this is very high, if or very"}, {"start": 1337.38, "end": 1345.2, "text": " low, depending so you need to whether something is low or high always will depend on what"}, {"start": 1345.2, "end": 1353.96, "text": " you exactly you have to consider. But ultimately, what you'll want is the ratio between this"}, {"start": 1353.96, "end": 1360.6000000000001, "text": " quantity, which is the probability of the next state given the current state and the"}, {"start": 1360.6, "end": 1368.1999999999998, "text": " skill you're taking divided by just the probability over the next state, given the the current"}, {"start": 1368.1999999999998, "end": 1375.6799999999998, "text": " state in expectation over all the skills, current states and next states. Now what they're"}, {"start": 1375.6799999999998, "end": 1383.12, "text": " saying is this here, this is basically the environment, right? This is if you are in"}, {"start": 1383.12, "end": 1388.48, "text": " a state and you perform a skill, what's the next state? That's that's the true environment"}, {"start": 1388.48, "end": 1393.24, "text": " appear is the true environment, which we don't know, right? We don't know what the environment's"}, {"start": 1393.24, "end": 1399.44, "text": " going to do. But we would like to learn a model for the environment. And this model"}, {"start": 1399.44, "end": 1413.4, "text": " for the environment is now q, q theta, phi, theta, phi, Greek letter. So q phi here is"}, {"start": 1413.4, "end": 1420.1200000000001, "text": " going to be a neural network that will approximate the environment. And in this probabilistic"}, {"start": 1420.1200000000001, "end": 1425.98, "text": " framework, it is going to be a learned distribution that will approximate the distribution of"}, {"start": 1425.98, "end": 1435.2, "text": " p. So we approximate it by this, but now this is here it says equal equal, right? This is"}, {"start": 1435.2, "end": 1443.0, "text": " not equal, because this is just an approximation. So the equality must become must be basically"}, {"start": 1443.0, "end": 1451.28, "text": " compensated for by this term, right here, you can see, this here is expanded into these"}, {"start": 1451.28, "end": 1456.14, "text": " two, you can go through the exact definitions and see why this is an equality. But basically,"}, {"start": 1456.14, "end": 1463.32, "text": " you can say that the mutual information is this expectation, or it is this expectation."}, {"start": 1463.32, "end": 1467.28, "text": " But now you have to correct for the fact that here, you only have an approximation. And"}, {"start": 1467.28, "end": 1474.28, "text": " you have to correct for the fact by exactly the amount by which the approximation is different"}, {"start": 1474.28, "end": 1480.76, "text": " than the quantity that you're approximating. And this is this key KL divergence right here."}, {"start": 1480.76, "end": 1488.68, "text": " So the KL divergence basically measures how different two distributions are. It's, it's"}, {"start": 1488.68, "end": 1493.76, "text": " sort of a distance, not exactly distance, but sort of a distance between these two distributions"}, {"start": 1493.76, "end": 1497.64, "text": " right here. It says, here's the real world. And here is your estimate of the real world,"}, {"start": 1497.64, "end": 1506.28, "text": " how much do they disagree. And that quantity plus, then you can replace your world, the"}, {"start": 1506.28, "end": 1512.8, "text": " exact world distribution by your approximate distribution, and you still are equal to the"}, {"start": 1512.8, "end": 1518.84, "text": " mutual information. And now the basically the trick is you say, oh, the KL divergence"}, {"start": 1518.84, "end": 1525.52, "text": " is always positive. It's a quantity that it can only be a positive number. So if I leave"}, {"start": 1525.52, "end": 1532.04, "text": " it away, certainly, this is only this is going to be a lower bound to the quantity. Okay."}, {"start": 1532.04, "end": 1537.32, "text": " All right. So two tasks right here. First of all, tighten the variational bound, which"}, {"start": 1537.32, "end": 1542.8, "text": " means make this quantity small, make your approximate world model as close as possible"}, {"start": 1542.8, "end": 1550.52, "text": " to the real world. How do we do this neural network, okay, you input trajectories. I was"}, {"start": 1550.52, "end": 1557.0, "text": " in this state, I performed this skill, and I ended up in this state. Sorry, that's this."}, {"start": 1557.0, "end": 1561.62, "text": " And then you simply match your neural network simply matches what happens in the real world,"}, {"start": 1561.62, "end": 1568.56, "text": " it learns the transition function, basically. So that's, that's the tightening of the variational"}, {"start": 1568.56, "end": 1579.1599999999999, "text": " bound. And the second step is this right here to"}, {"start": 1579.1599999999999, "end": 1583.32, "text": " to maximize the approximate lower bound, right, the first step was tighten variational low"}, {"start": 1583.32, "end": 1588.56, "text": " bound, that basically means make your world model more accurate. And the second is tighten"}, {"start": 1588.56, "end": 1595.12, "text": " that maximize the approximate lower bound. Now, this is going to part the this is going"}, {"start": 1595.12, "end": 1600.6, "text": " to be the part that says, now, given that I already have a better world model right"}, {"start": 1600.6, "end": 1610.12, "text": " here, can I improve my, can I sort of improve my skills, such that they become easier to"}, {"start": 1610.12, "end": 1616.6, "text": " predict and more diverse? Can I improve my skills such that this mutual information right"}, {"start": 1616.6, "end": 1626.28, "text": " here gets to be high as high as possible? Okay. So this is sort of an alternating thing."}, {"start": 1626.28, "end": 1633.1999999999998, "text": " And you can see this in this very, very, very, very confusing diagram, honestly. So what"}, {"start": 1633.1999999999998, "end": 1637.8799999999999, "text": " are you going to do in this algorithm? First of all, in each episode, you're going to select"}, {"start": 1637.8799999999999, "end": 1644.08, "text": " a skill at random. And as I said, these skills, they're not predefined. So no one tells the"}, {"start": 1644.08, "end": 1649.52, "text": " agent to walk for it simply says, Okay, you have like, in a discrete case, you would have"}, {"start": 1649.52, "end": 1655.5, "text": " like, you have five skill slots, right? And the only thing I require is that they're sort"}, {"start": 1655.5, "end": 1659.52, "text": " of, you know, consistent over time. So skill one is always going to be sort of the same"}, {"start": 1659.52, "end": 1665.6, "text": " thing and skill two, but agent, you can basically decide what skill one is, right? But make"}, {"start": 1665.6, "end": 1672.1799999999998, "text": " the skills such that it's predictable, and that the different skills are diverse. Okay,"}, {"start": 1672.18, "end": 1677.76, "text": " so you're going to sample one of the skills, like skill zero or whatnot. And then you're"}, {"start": 1677.76, "end": 1687.8200000000002, "text": " going to do two things. First of all, you're going to learn these skill dynamics, which"}, {"start": 1687.8200000000002, "end": 1694.3200000000002, "text": " is you're going to learn your approximate model of the world. Okay. And how do you do"}, {"start": 1694.32, "end": 1702.6, "text": " that? Basically, here, you're the agent, and the agent will. So what what does the agent"}, {"start": 1702.6, "end": 1710.0, "text": " have to do, the agent will take in the skill Z. And it will take in the current state of"}, {"start": 1710.0, "end": 1715.3999999999999, "text": " the world, and it will output an action. Now, this is the model free part, right? So the"}, {"start": 1715.3999999999999, "end": 1721.6399999999999, "text": " agent that somehow has to come up with saying, ah, skill zero, that's, that's, that's walking"}, {"start": 1721.64, "end": 1728.8000000000002, "text": " forward. And in this situation, walking forward means I have to lift my leg or something like"}, {"start": 1728.8000000000002, "end": 1733.76, "text": " this. So you're going to take your skill, you're going to with your agent perform an"}, {"start": 1733.76, "end": 1738.2, "text": " action based on that skill and the current state of the world, then the environment is"}, {"start": 1738.2, "end": 1744.5400000000002, "text": " going to give you the next state right here. And from those things, you can now learn your"}, {"start": 1744.5400000000002, "end": 1751.5400000000002, "text": " world model, you know, I was in state s, I, I performed action a, but I performed action"}, {"start": 1751.54, "end": 1761.28, "text": " a based on skill Z. And then I ended up in state s prime. And I can learn a model of"}, {"start": 1761.28, "end": 1765.44, "text": " the world, right? This is a triple, I can do supervised learning of a world model. Now"}, {"start": 1765.44, "end": 1770.6, "text": " here, they do probabilistic learning, but and we're going to see in a second how that"}, {"start": 1770.6, "end": 1777.8799999999999, "text": " works. But ultimately, they approximate the world with their model. Cool. So that's the"}, {"start": 1777.88, "end": 1783.74, "text": " this outer loop. And then what are they going to do next, they're going to use that world"}, {"start": 1783.74, "end": 1791.16, "text": " model to determine a reward for the agent, and the reward for the agent for taking the"}, {"start": 1791.16, "end": 1797.7600000000002, "text": " action. So the reward is going to be, oh, agent, you took action a. Now what's your"}, {"start": 1797.7600000000002, "end": 1803.24, "text": " reward for doing this? This is the model free reinforcement learning part, your reward is"}, {"start": 1803.24, "end": 1815.36, "text": " going to be very high, if if this was very predictable. And if it is also diverse, right,"}, {"start": 1815.36, "end": 1824.1200000000001, "text": " so now, the agent has to sort of map sort of the agent has to go and make this quantity"}, {"start": 1824.1200000000001, "end": 1831.74, "text": " very high this, we want the outcome of these actions to be predictable, and dive and the"}, {"start": 1831.74, "end": 1838.66, "text": " actions themselves to be diverse. It is, I'm sorry, it's very hard to keep all of this"}, {"start": 1838.66, "end": 1845.44, "text": " very straight, okay. But ultimately, two steps, learn world model from the experience that"}, {"start": 1845.44, "end": 1852.64, "text": " you've generated. And second thing, learn the agent such that it maximizes this this"}, {"start": 1852.64, "end": 1859.4, "text": " quantity that we've seen before. And you do this via giving the agent a reward that is"}, {"start": 1859.4, "end": 1866.0, "text": " proportional to the mutual information. And we've already seen that we can approximate"}, {"start": 1866.0, "end": 1879.92, "text": " the mutual information by by this quantity here. Okay. So learn world model, and make"}, {"start": 1879.92, "end": 1887.64, "text": " the agent go higher mutual information, two steps. Okay, learn world model is very, very"}, {"start": 1887.64, "end": 1893.76, "text": " classic, you can say, okay, I need to improve, I need to minimize this KL divergence. So"}, {"start": 1893.76, "end": 1901.6000000000001, "text": " I need the gradient with respect to the parameters of my world model, I can write down the KL"}, {"start": 1901.6000000000001, "end": 1908.1200000000001, "text": " divergence like this. And then since I can do this reverse, so log a over b is log a"}, {"start": 1908.1200000000001, "end": 1915.2800000000002, "text": " minus log b. And since the world doesn't depend on the parameters of my model, this will simply"}, {"start": 1915.28, "end": 1922.12, "text": " give me this thing right here, which is the gradient of the log probability basically"}, {"start": 1922.12, "end": 1927.28, "text": " of my neural network. And this can be just optimized straightforward. This is a neural"}, {"start": 1927.28, "end": 1933.92, "text": " network optimized with gradient descent. These are the inputs, this is the output. Now, okay,"}, {"start": 1933.92, "end": 1939.24, "text": " you this is all probability distributions, but ultimately, you can you can do it pretty"}, {"start": 1939.24, "end": 1944.72, "text": " straightforward. Okay, so corresponds to maximizing the likelihood of the samples from P under"}, {"start": 1944.72, "end": 1956.64, "text": " q. Now, the second step, maximize the approximate lower bound, okay. So after they say after"}, {"start": 1956.64, "end": 1964.08, "text": " fitting q after improving our world model, we can optimize pi pi is the agent that actually"}, {"start": 1964.08, "end": 1969.1200000000001, "text": " takes the actions based on the skill. So it's given a skill, and it needs to perform an"}, {"start": 1969.12, "end": 1977.0, "text": " action. And it needs to maximize this quantity, as we've seen, needs to maximize the mutual"}, {"start": 1977.0, "end": 1984.52, "text": " information between if I know the action and if I don't, or the mutual information between"}, {"start": 1984.52, "end": 1993.2399999999998, "text": " the skill and the next state. I say note, this is a reinforcement learning style optimization,"}, {"start": 1993.24, "end": 2000.2, "text": " with a reward function of this quantity. However, so you look at the quantity that they need"}, {"start": 2000.2, "end": 2007.36, "text": " right here, the quantity is going to be this thing. And this thing is just I feed the skill"}, {"start": 2007.36, "end": 2012.92, "text": " and the state into my world model. And I look what what comes out of the world model. So"}, {"start": 2012.92, "end": 2019.72, "text": " this I can compute, right. But this thing right here, I can't compute because this is"}, {"start": 2019.72, "end": 2028.3600000000001, "text": " this is what happens in the world when I'm in state s, and I just run my agent over in"}, {"start": 2028.3600000000001, "end": 2036.72, "text": " expectation over all the skills. So this I don't know, they have a log of this is intractable."}, {"start": 2036.72, "end": 2043.6200000000001, "text": " And they so we approximate the reward function for pi as this thing right here. Now, first,"}, {"start": 2043.62, "end": 2054.04, "text": " let's look at what this thing is. So the reward of taking action a and action a is based on"}, {"start": 2054.04, "end": 2060.72, "text": " skill z, right? So skill z was fed into the agent, the agent comes up with action a. Oh,"}, {"start": 2060.72, "end": 2065.16, "text": " you want me to walk forward in this situation? Okay, I'm going to lift my leg. That's the"}, {"start": 2065.16, "end": 2070.88, "text": " action. Okay, so the reward for this action, given this skill, and given the current state"}, {"start": 2070.88, "end": 2078.46, "text": " is going to be what it's going to be very high, if this here is very high. So it's going"}, {"start": 2078.46, "end": 2087.8, "text": " to be very high, if the probability so this s prime is the state you ended up in, right?"}, {"start": 2087.8, "end": 2094.1800000000003, "text": " So after taking the action, you ended up in s prime. So if what does it mean, when this"}, {"start": 2094.18, "end": 2103.62, "text": " quantity is very high, it means that my world model q, that is approximating the world thinks"}, {"start": 2103.62, "end": 2111.0, "text": " that this state is very probable, if you were in this state, and are given the skill z."}, {"start": 2111.0, "end": 2117.3799999999997, "text": " So this basically means that the neural network can predict with very high accuracy, what's"}, {"start": 2117.38, "end": 2125.12, "text": " going to happen if you are in this state and are given this skill to perform, right? This"}, {"start": 2125.12, "end": 2132.76, "text": " is one of the things that we want. Now, what is it divided by? It's divided by this. And"}, {"start": 2132.76, "end": 2141.6, "text": " you can see here, the zi are other skills. So it is, what does this mean? This is almost"}, {"start": 2141.6, "end": 2149.94, "text": " the same quantity, it means how well can the same neural network predict the next state,"}, {"start": 2149.94, "end": 2158.66, "text": " if you were given a different skill. So it means if I'm here, and I ended up here, how"}, {"start": 2158.66, "end": 2165.04, "text": " well can you predict it if I tell you that I walked forward? And here you ask, well,"}, {"start": 2165.04, "end": 2168.98, "text": " how well can you predict it if I also if I told you you walked backward, if I told you"}, {"start": 2168.98, "end": 2176.08, "text": " you jumped if I told you, and so on. So you basically aggregate over all the other over"}, {"start": 2176.08, "end": 2182.48, "text": " all the other skills you could perform. And each time you ask the neural network, well,"}, {"start": 2182.48, "end": 2188.18, "text": " how likely is it that you end up in the state that I ended up when? So what does it mean"}, {"start": 2188.18, "end": 2196.16, "text": " if this quantity is high, or sorry, if the entire sum here is high, that means that the"}, {"start": 2196.16, "end": 2201.58, "text": " skill doesn't really give you much information, the neural network is very good, no matter"}, {"start": 2201.58, "end": 2205.58, "text": " which skill you selected, right? It's very accurate in predicting the next state doesn't"}, {"start": 2205.58, "end": 2211.2599999999998, "text": " really matter. The skill doesn't really matter. And this is what we don't want, right? We"}, {"start": 2211.2599999999998, "end": 2219.02, "text": " want that the the skills are very diverse, right? So the top part is they're easy, it's"}, {"start": 2219.02, "end": 2226.12, "text": " easy to predict what will happen if you perform a given skill. And if we divide this by the"}, {"start": 2226.12, "end": 2231.9, "text": " bottom part, and this makes it such that these skills are very diverse, because if they're"}, {"start": 2231.9, "end": 2236.8599999999997, "text": " not diverse, then it doesn't really matter which one you perform. And then this quantity"}, {"start": 2236.8599999999997, "end": 2245.1, "text": " on the bottom will be very high, but we divide by it. So we want, we want it to be low. Okay,"}, {"start": 2245.1, "end": 2251.7799999999997, "text": " that the reward is going to be the log of this fraction here. And this makes sense,"}, {"start": 2251.78, "end": 2257.5, "text": " right intuitively, but they're going to try to motivate this mathematically. And for motivating"}, {"start": 2257.5, "end": 2262.34, "text": " this mathematically, of course, they need to approximate this quantity right here. This"}, {"start": 2262.34, "end": 2269.26, "text": " quantity is the denominator. So they this denominator is a proc is an approximation"}, {"start": 2269.26, "end": 2277.42, "text": " to this, it's an approximation. As you can see here, this is sort of sort of a sample"}, {"start": 2277.42, "end": 2284.5, "text": " based approximation to the transition from s to s prime under the distribution of z."}, {"start": 2284.5, "end": 2293.5, "text": " But what you want is just is the transition from s to s prime, not in your approximation,"}, {"start": 2293.5, "end": 2301.96, "text": " but in the real world. And they formulate this, they say, okay, we can decompose it"}, {"start": 2301.96, "end": 2313.42, "text": " as such as a as an integral over this conditional right here. So they bring in the z variable."}, {"start": 2313.42, "end": 2325.2200000000003, "text": " And then they say, well, this, this is approximately approximately, we can replace this here by"}, {"start": 2325.22, "end": 2333.7, "text": " this. And we can replace this here by this, they say, well, since the this is a an approximation,"}, {"start": 2333.7, "end": 2338.8199999999997, "text": " the two, this is the world model is an approximation to the real world, we can sort of replace"}, {"start": 2338.8199999999997, "end": 2346.74, "text": " that. And then this is the this is the part that doesn't convince me they say, well, this"}, {"start": 2346.74, "end": 2355.58, "text": " p z of s, we can just replace it by p z. Now this is it's very tricky to see what these"}, {"start": 2355.58, "end": 2362.54, "text": " quantities are. Ultimately, it ends up being that right here. But it's it's it's so tricky."}, {"start": 2362.54, "end": 2376.1, "text": " So they say, we replace p z given s by p of z. And, okay, let's think about this for a"}, {"start": 2376.1, "end": 2381.7, "text": " second. What does the top the bottom quantity is simply the distribution over your skills."}, {"start": 2381.7, "end": 2386.5, "text": " And depending on your sample them, this could be like a uniform distribution over your skills,"}, {"start": 2386.5, "end": 2392.52, "text": " like that's fine. But what's the top thing? The top thing, basically, we can use base"}, {"start": 2392.52, "end": 2408.06, "text": " formula to reformulate it. It's p of s given z times p of right times p of z divided by"}, {"start": 2408.06, "end": 2418.06, "text": " p of s. So this quantity depends on multiple things. Here's that prior again. And this"}, {"start": 2418.06, "end": 2424.7, "text": " means what's the general distribution of states? What's the general distribution of states"}, {"start": 2424.7, "end": 2431.58, "text": " if your agent acts in the world, right? This and this we don't know. We don't we don't"}, {"start": 2431.58, "end": 2439.24, "text": " know. And also this right here. What's the distribution in the true world? What's the"}, {"start": 2439.24, "end": 2449.3799999999997, "text": " probability of a state given a given given that you were acting under a skill z. And"}, {"start": 2449.3799999999997, "end": 2454.54, "text": " this is also something we don't know because we don't know the world. We don't have the"}, {"start": 2454.54, "end": 2459.66, "text": " world model. So you run into the same problem again and again, that you're trying to approximate"}, {"start": 2459.66, "end": 2464.9799999999996, "text": " this and they want to make this so mathematically rigorous, but ultimately, and they go in the"}, {"start": 2464.9799999999996, "end": 2468.9399999999996, "text": " appendix, they go through various ways that they could solve this. But ultimately, they're"}, {"start": 2468.94, "end": 2477.02, "text": " just to say, well, this is approximately the same. So this right here, it basically means"}, {"start": 2477.02, "end": 2485.86, "text": " what skills if you're if you're in a certain state, what skills brought you here, basically,"}, {"start": 2485.86, "end": 2490.9, "text": " what skills brought you here? What's the distribution of skills that brought you to this state?"}, {"start": 2490.9, "end": 2495.78, "text": " And they say, well, we're just going to approximate that by the prior distribution over our skills,"}, {"start": 2495.78, "end": 2503.2200000000003, "text": " we disregard the state here. And this seems overly shaky. Like, as I said, the entire"}, {"start": 2503.2200000000003, "end": 2512.1200000000003, "text": " paper makes sense. But I just feel it's trying to be overly mathematical, and then run into"}, {"start": 2512.1200000000003, "end": 2517.6200000000003, "text": " a point where you can't be and then they're just okay, we'll, we'll just replace it. And"}, {"start": 2517.6200000000003, "end": 2525.38, "text": " then sort of things break down, like, you can only be overly mathematical to some degree."}, {"start": 2525.38, "end": 2532.3, "text": " It doesn't really fit. But okay, so this is how you discover the skills, you maximize"}, {"start": 2532.3, "end": 2538.46, "text": " these quantities, alternately, you learn the world model, and you improve your your skills"}, {"start": 2538.46, "end": 2545.02, "text": " by making them diverse and easily predictable. So how do you then plan using these skills?"}, {"start": 2545.02, "end": 2551.36, "text": " This is the second part of the paper. And this is just as complicated as the first part."}, {"start": 2551.36, "end": 2555.5, "text": " So they say, given the learned skills, so the learned skills are policies over action"}, {"start": 2555.5, "end": 2562.5, "text": " given the DZ, right? So now you know how to like walk forward and walk back and so on."}, {"start": 2562.5, "end": 2568.26, "text": " And now you're, you're placed in a world, and you're given this checkpoint, it says,"}, {"start": 2568.26, "end": 2574.78, "text": " well, walk there. And you want this to do this using planning, you don't want to learn"}, {"start": 2574.78, "end": 2583.6200000000003, "text": " anymore, you simply want to plan. Okay, what do you do? And as I said, this is even more."}, {"start": 2583.6200000000003, "end": 2589.1400000000003, "text": " So what you want to do is you want to do something like model predictive control, but not over"}, {"start": 2589.1400000000003, "end": 2598.0600000000004, "text": " actions, but over your learned skills. So you have this planner in the NPC and the planner"}, {"start": 2598.06, "end": 2607.1, "text": " will in its head roll out a number of different a number of different plans, it will kind"}, {"start": 2607.1, "end": 2613.7799999999997, "text": " of explore a bunch of different different plans, Z, it will roll them out, I'll say,"}, {"start": 2613.7799999999997, "end": 2618.98, "text": " okay, if I do this, and this, and this, and this, what will happen using its world model"}, {"start": 2618.98, "end": 2625.86, "text": " that it has learned, it will observe what's going to be the reward in each of these cases."}, {"start": 2625.86, "end": 2631.38, "text": " Now, they say here access the environment reward, but can also be estimated. And this"}, {"start": 2631.38, "end": 2639.1, "text": " is another sort of, I feel weak point of this in that they now assume they have the true"}, {"start": 2639.1, "end": 2645.28, "text": " reward function. But they don't have a world model, right? They don't have the world model,"}, {"start": 2645.28, "end": 2652.4, "text": " but they assume that they can sort of always ask for the true reward, which is probably"}, {"start": 2652.4, "end": 2658.34, "text": " not the case if you if you like if you had a true world, but it could be the case, the"}, {"start": 2658.34, "end": 2662.94, "text": " reward could be something like, well, if you're over there, you get higher reward, but you"}, {"start": 2662.94, "end": 2670.54, "text": " don't exactly know how to get over there. In any case, so they roll out a bunch of trajectories"}, {"start": 2670.54, "end": 2675.42, "text": " in their head, they kind of plan forward, see what's going to happen if they do this"}, {"start": 2675.42, "end": 2684.34, "text": " or that or this or that. And then they choose the best one of these forward thoughts. And"}, {"start": 2684.34, "end": 2689.14, "text": " they execute it in the real world, right? So they say, Well, I'm going to you choose"}, {"start": 2689.14, "end": 2694.5, "text": " the skill walk forward. So the agent is now going to be tasked with walking forward. And"}, {"start": 2694.5, "end": 2699.36, "text": " it's going to do that in the real world for a certain amount of steps, like 10 steps of"}, {"start": 2699.36, "end": 2703.86, "text": " walking forward. After 10 steps of walking forward, you go back, you say, I'm in this"}, {"start": 2703.86, "end": 2708.86, "text": " new situation right here, what should I do? And again, the planner is going to be like,"}, {"start": 2708.86, "end": 2714.6600000000003, "text": " if you first walk forward and then walk back, where are you going to be, and so on. So the"}, {"start": 2714.6600000000003, "end": 2721.3, "text": " planner will always plan, basically to go from where you are, to the checkpoint, using"}, {"start": 2721.3, "end": 2727.34, "text": " a composition of the skills that you have learned. So the planner may be fine, okay,"}, {"start": 2727.34, "end": 2734.2200000000003, "text": " if I first walk forward, walk back a bit, and so on, I'm going to get to the goal, I'm going to reach"}, {"start": 2734.2200000000003, "end": 2740.7000000000003, "text": " the goal. Now please, agent execute this first thing, walk forward, the agent executes it,"}, {"start": 2740.7000000000003, "end": 2745.38, "text": " and maybe it won't, you know, it won't do as well, it will maybe end up here. And then"}, {"start": 2745.38, "end": 2750.6600000000003, "text": " it says, Well, I'm here now, please plan again. So it plans again, it says, Okay, I can still"}, {"start": 2750.6600000000003, "end": 2754.98, "text": " kind of walk back, I'll be here here, but then I have to do something else. So now walk"}, {"start": 2754.98, "end": 2763.3, "text": " back. And, okay, so this is what's going to happen. But it is going to happen in a weird"}, {"start": 2763.3, "end": 2772.22, "text": " way. Namely, what we keep our normal, since everything is continuous, we'll keep normal"}, {"start": 2772.22, "end": 2778.6, "text": " distributions of all our future steps. So we don't say, Okay, I go here, and then I"}, {"start": 2778.6, "end": 2785.06, "text": " go here. What you'll say is I approximately go here. And after that, I'll approximately"}, {"start": 2785.06, "end": 2790.7799999999997, "text": " go here. And you will do it in such a way that the peak of this normal distribution"}, {"start": 2790.7799999999997, "end": 2796.18, "text": " is going to be the highest, where you think you will get the most reward. If you follow"}, {"start": 2796.18, "end": 2800.86, "text": " this trajectory, like if you follow this trajectory, you get a very high reward. And if I follow"}, {"start": 2800.86, "end": 2806.9, "text": " a trajectory that maybe goes here, I won't get a high reward. If it actually turns out"}, {"start": 2806.9, "end": 2810.98, "text": " in your imagination that you do get a high reward for this trajectory, you'll change"}, {"start": 2810.98, "end": 2817.38, "text": " this distribution, such that the peak is here. And, of course, the tighter the peak is, the"}, {"start": 2817.38, "end": 2823.3, "text": " more sure you are. So you sort of are looking, if you look out into the world, you want the"}, {"start": 2823.3, "end": 2829.9, "text": " closest steps to be very peaky. And then as you look out, they can be more more sort of"}, {"start": 2829.9, "end": 2835.86, "text": " broad. And that's how you plan ahead, you keep refining, you keep doing a step. So if"}, {"start": 2835.86, "end": 2840.82, "text": " you go from here to finally you choose, I want to go here where the tip is the highest"}, {"start": 2840.82, "end": 2848.58, "text": " over here, then you imagine forward again, you refine these distributions over the future."}, {"start": 2848.58, "end": 2853.92, "text": " And then you take the next step that gets you to the where the highest peak is right"}, {"start": 2853.92, "end": 2862.38, "text": " here, basically, and so on. This is simply planning in a continuous domain, it is pretty"}, {"start": 2862.38, "end": 2869.9, "text": " analogous to how you would plan in like, alpha go, if you or tic tac toe if you had a planner,"}, {"start": 2869.9, "end": 2876.34, "text": " but since everything's continuous, it makes it just so much harder. So they Yeah, they"}, {"start": 2876.34, "end": 2881.44, "text": " always update these distributions, as you can see here, to the skill that gave you a"}, {"start": 2881.44, "end": 2890.06, "text": " high reward in your imagination compared to the rewards of the other plans that you had."}, {"start": 2890.06, "end": 2899.2599999999998, "text": " Okay, well, this was a long, long way until we got here. But if you recap, so first, they"}, {"start": 2899.2599999999998, "end": 2905.18, "text": " in an unsupervised fashion, learn these low level skills such that they're easily predictable"}, {"start": 2905.18, "end": 2911.02, "text": " by their own world model, and diverse. And then in the second step, they can use that"}, {"start": 2911.02, "end": 2920.44, "text": " to to do basically planning. So they first learn these skills, and then the planner composes"}, {"start": 2920.44, "end": 2927.7, "text": " them to make the agent do something. And again, the agent will never have to learn how to"}, {"start": 2927.7, "end": 2932.56, "text": " do this go from checkpoint to checkpoint, because the planner can just compose these"}, {"start": 2932.56, "end": 2940.22, "text": " low level skills. So they have these experiments right here. And we won't go through the experiment"}, {"start": 2940.22, "end": 2947.8599999999997, "text": " because this video is already very, very long, but they basically show that they their learned"}, {"start": 2947.8599999999997, "end": 2955.66, "text": " things, actually, their learned skills do end up being very diverse do end up predictable,"}, {"start": 2955.66, "end": 2961.9399999999996, "text": " have a high variance, and so on, they have to give certain priors to it to make it actually"}, {"start": 2961.9399999999996, "end": 2969.4199999999996, "text": " work in a real setting. But the results you can actually see in these videos and in the"}, {"start": 2969.42, "end": 2974.26, "text": " graphs, I invite you to check out the paper if you're still here. Thanks for being here."}, {"start": 2974.26, "end": 2980.26, "text": " I hope this this was one of the most more complicated and mathy papers we looked at."}, {"start": 2980.26, "end": 2986.62, "text": " But I think I still think it's fun. And I still think the outcome is pretty impressive"}, {"start": 2986.62, "end": 2993.34, "text": " right here, how you can use math to derive basically these intuitive, very intuitive"}, {"start": 2993.34, "end": 3000.78, "text": " objectives to learn. It's also pretty cool. Alright, that was it for me. And bye bye."}]